1 /*
2  * Copyright (C) 2018 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 
17 package android.debug;
18 
19 /**
20  * Interface to communicate remotely with the {@code AdbService} in the system server.
21  *
22  * @hide
23  */
24 interface IAdbManager {
25     /**
26      * Allow ADB debugging from the attached host. If {@code alwaysAllow} is
27      * {@code true}, add {@code publicKey} to list of host keys that the
28      * user has approved.
29      *
30      * @param alwaysAllow if true, add permanently to list of allowed keys
31      * @param publicKey RSA key in mincrypt format and Base64-encoded
32      */
allowDebugging(boolean alwaysAllow, String publicKey)33     void allowDebugging(boolean alwaysAllow, String publicKey);
34 
35     /**
36      * Deny ADB debugging from the attached host.
37      */
denyDebugging()38     void denyDebugging();
39 
40     /**
41      * Clear all public keys installed for secure ADB debugging.
42      */
clearDebuggingKeys()43     void clearDebuggingKeys();
44 
45     /**
46      * Allow ADB wireless debugging on the connected network. If {@code alwaysAllow}
47      * is {@code true}, add {@code bssid} to list of networks that the user has
48      * approved.
49      *
50      * @param alwaysAllow if true, add permanently to list of allowed networks
51      * @param bssid BSSID of the network
52      */
allowWirelessDebugging(boolean alwaysAllow, String bssid)53     void allowWirelessDebugging(boolean alwaysAllow, String bssid);
54 
55     /**
56      * Deny ADB wireless debugging on the connected network.
57      */
denyWirelessDebugging()58     void denyWirelessDebugging();
59 
60     /**
61      * Returns a Map<String, PairDevice> with the key fingerprint mapped to the device information.
62      */
getPairedDevices()63     Map getPairedDevices();
64 
65     /**
66      * Unpair the device identified by the key fingerprint it uses.
67      *
68      * @param fingerprint fingerprint of the key the device is using.
69      */
unpairDevice(String fingerprint)70     void unpairDevice(String fingerprint);
71 
72     /**
73      * Enables pairing by pairing code. The result of the enable will be sent via intent action
74      * {@link android.debug.AdbManager#WIRELESS_DEBUG_ENABLE_DISCOVER_ACTION}. Furthermore, the
75      * pairing code will also be sent in the intent as an extra
76      * @{link android.debug.AdbManager#WIRELESS_PAIRING_CODE_EXTRA}. Note that only one
77      * pairing method can be enabled at a time, either by pairing code, or by QR code.
78      */
enablePairingByPairingCode()79     void enablePairingByPairingCode();
80 
81     /**
82      * Enables pairing by QR code. The result of the enable will be sent via intent action
83      * {@link android.debug.AdbManager#WIRELESS_DEBUG_ENABLE_DISCOVER_ACTION}. Note that only one
84      * pairing method can be enabled at a time, either by pairing code, or by QR code.
85      *
86      * @param serviceName The MDNS service name parsed from the QR code.
87      * @param password The password parsed from the QR code.
88      */
enablePairingByQrCode(String serviceName, String password)89     void enablePairingByQrCode(String serviceName, String password);
90 
91     /**
92      * Returns the network port that adb wireless server is running on.
93      */
getAdbWirelessPort()94     int getAdbWirelessPort();
95 
96     /**
97      * Disables pairing.
98      */
disablePairing()99     void disablePairing();
100 
101     /**
102      * Returns true if device supports secure Adb over Wi-Fi.
103      */
isAdbWifiSupported()104     boolean isAdbWifiSupported();
105 
106     /**
107      * Returns true if device supports secure Adb over Wi-Fi and device pairing by
108      * QR code.
109      */
isAdbWifiQrSupported()110     boolean isAdbWifiQrSupported();
111 }
112