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