xref: /aosp_15_r20/prebuilts/android-emulator/linux-x86_64/lib/adb_service.proto (revision d870e0501505f2fc9999364ffe386a6b6151adc1)
1// Copyright (C) 2020 The Android Open Source Project
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
15// Note that if you add/remove methods in this file you must update
16// the metrics sql as well ./android/scripts/gen-grpc-sql.py
17//
18// Please group deleted methods in a block including the date (MM/DD/YY)
19// it was removed. This enables us to easily keep metrics around after removal
20//
21// List of deleted methods
22// rpc iWasDeleted (03/12/12)
23// ...
24syntax = "proto3";
25
26option java_multiple_files = true;
27option java_package = "com.android.emulator.control";
28option objc_class_prefix = "AEC";
29
30package android.emulation.control;
31import "google/protobuf/empty.proto";
32
33// The ADB service enables you to interact with the running Adb service inside
34// the emulator. This service is usually not available as it has the ability to
35// retrieve the private adb key from the running image and make adb accessible
36// if and only if:
37//
38// 1. The private key is available to the running emulator.
39// 2. The public key corresponding the private key is embedded in the encrypted
40//    partition.
41//
42// This service is usually *ONLY* available to containerized emulators that are
43// running with mutual authentication on the gRPC endpoint (that is SSL is
44// enabled and a valid client certificate is required.).
45service Adb {
46    // Pulls the private key that the emulator uses to communicate with the
47    // emulator. This private key should be made accessible to adb when you wish
48    // to establish a connection to this emulator.
49    //
50    // The following gRPC error codes can be returned:
51    // -  unimplemented (code 14) if the AdbService is not availab.e
52    // -  aborted (code 10) if:
53    //     - The private key file cannot be found.
54    //     - The private key file cannot be read.
55    rpc pullAdbKey(google.protobuf.Empty) returns(AdbKey);
56
57
58    // Forwards the incoming bytes to the running adb deamon.
59    rpc forwardAdb(AdbPacket) returns(AdbPacket);
60}
61
62message AdbKey {
63    // The private key used to derive the public key that is embedded in the
64    // emulator. This private key must be made available to ADB in order to
65    // establish a connection to the emulator *without* requiring interaction.
66    //
67    // The private key must be made available to adb. This can be done
68    // by:
69    //
70    // - Saving it as a file and adding it to the $ADB_VENDOR_KEYS enviroment
71    // variable and restarting adb.
72    //
73    // or
74    //
75    // - Saving it the existing $ADB_VENDOR_KEYS search path used by adb.
76    string private_key = 1;
77};
78
79message AdbPacket {
80    // Payload that needs to be forwarded.
81    bytes payload = 1;
82
83    // status fields.
84    bool success = 2;
85    string err = 3;
86};
87