1// Copyright 2023 Google LLC 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15syntax = "proto3"; 16 17package google.devtools.testing.v1; 18 19option go_package = "google.golang.org/genproto/googleapis/devtools/testing/v1;testing"; 20option java_multiple_files = true; 21option java_outer_classname = "AdbServiceProto"; 22option java_package = "com.google.devtools.testing.v1"; 23 24// API-facing proto equivalent to the internal ADB Service proto. In general, 25// this proto should be equivalent of the messages defined in the internal 26// ADB Device Forwarder, with the caveat that these support a self-sufficient 27// API, which is the best practice at the time of writing. 28 29// A message returned from a device. 30message DeviceMessage { 31 oneof contents { 32 // Information about the device's state. 33 StatusUpdate status_update = 1; 34 35 // The result of a device stream from ADB. 36 StreamStatus stream_status = 2; 37 38 // Data from an open stream. 39 StreamData stream_data = 3; 40 } 41} 42 43// A message to an ADB server. 44message AdbMessage { 45 oneof contents { 46 // Open a new stream. 47 Open open = 1; 48 49 // Send data to a stream. 50 StreamData stream_data = 2; 51 } 52} 53 54// A StatusUpdate message given over the ADB protocol for the device state. 55message StatusUpdate { 56 // The state displayed with the ADB Device when running "adb devices" 57 enum DeviceState { 58 // The device state is unknown. 59 DEVICE_STATE_UNSPECIFIED = 0; 60 61 // The ADB device is in the "device" status. 62 DEVICE = 1; 63 64 // The ADB device is in the "recovery" status. 65 RECOVERY = 2; 66 67 // The ADB device is in the "rescue" status. 68 RESCUE = 3; 69 70 // The ADB device is in the "sideload" status. 71 SIDELOAD = 4; 72 73 // The ADB device is in the "missing" status. 74 MISSING = 10; 75 76 // The ADB device is in the "offline" status. 77 OFFLINE = 11; 78 79 // The ADB device is in the "unauthorized" status. 80 UNAUTHORIZED = 12; 81 82 // The ADB device is in the "authorizing" status. 83 AUTHORIZING = 13; 84 85 // The ADB device is in the "connecting" status. 86 CONNECTING = 14; 87 } 88 89 // The device's state 90 DeviceState state = 1; 91 92 // A map of properties with information about this device. 93 map<string, string> properties = 2; 94 95 // A comma-separated list of "features" that this device supports. 96 string features = 3; 97} 98 99// The result of a stream. 100message StreamStatus { 101 // The unique ID of this stream, assigned by the client. 102 int32 stream_id = 1; 103 104 // The result of the stream. Either "Okay" for success or "Fail" for failure. 105 oneof status { 106 // Okay for success. 107 Okay okay = 2; 108 109 // Fail for failure. 110 Fail fail = 3; 111 } 112} 113 114// Message for opening a new stream. 115message Open { 116 // The unique ID that will be used to talk to this stream. This should 117 // probably just be a number that increments for each new Open request. 118 int32 stream_id = 1; 119 120 // An ADB service to use in the new stream. 121 string service = 2; 122} 123 124// Data for a stream. 125message StreamData { 126 // The unique ID of this stream, assigned by the client. 127 int32 stream_id = 1; 128 129 // The data of the stream, either bytes or "Close", indicating that the stream 130 // is done. 131 oneof contents { 132 // Data in the stream. 133 bytes data = 2; 134 135 // The stream is closing. EOF. 136 Close close = 3; 137 } 138} 139 140// Message signifying that the stream is open 141message Okay {} 142 143// Message signifying that the stream failed to open 144message Fail { 145 // A user-displayable failure reason. 146 string reason = 1; 147} 148 149// Message signifying that the stream closed. 150message Close {} 151