1//
2// Copyright (C) 2023 The Android Open Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8//      http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15//
16
17syntax = "proto3";
18
19package com.android.devicediagnostics;
20option java_outer_classname = "Protos";
21
22// When updating this file, update DeviceReportJsonFormatter.kt as well.
23
24message TestResults {
25    optional bool screen_test = 1;
26    optional bool touch_test = 2;
27}
28
29message BatteryInfo {
30    reserved 2, 3;
31    optional int32 cycle_count = 1;
32    optional int32 state_of_health = 4;
33    optional string serial = 5;
34    optional string part_status = 6;
35    int32 legacy_health = 7;
36    optional int64 manufacture_timestamp = 8;
37    optional int64 first_usage_timestamp = 9;
38}
39
40message LockInfo {
41    bool factory_reset_protection = 1;
42}
43
44message StorageInfo {
45    reserved 1, 2;
46    optional int32 useful_lifetime_remaining = 3;
47    int64 capacity_bytes = 4;
48}
49
50message TrustedDeviceInfo {
51    bytes challenge = 1;
52}
53
54message DeviceReport {
55    TestResults tests = 1;
56    bytes attestation = 2;
57    BatteryInfo battery = 3;
58    StorageInfo storage = 4;
59    optional int32 launch_level = 5;
60    LockInfo locks = 6;
61}
62
63enum PacketCommand {
64    COMMAND_ACK = 0;
65    COMMAND_CLOSE = 1;
66};
67
68message BluetoothPacket {
69    int32 version = 1;
70    oneof payload {
71        TrustedDeviceInfo trusted_device_info = 2;
72        DeviceReport device_report = 3;
73        PacketCommand command = 4;
74    }
75}