Loading core/java/android/debug/AdbManager.java +108 −0 Original line number Original line Diff line number Diff line Loading @@ -31,6 +31,114 @@ import android.os.RemoteException; public class AdbManager { public class AdbManager { private static final String TAG = "AdbManager"; private static final String TAG = "AdbManager"; /** * Action indicating the state change of wireless debugging. Can be either * STATUS_CONNECTED * STATUS_DISCONNECTED * * @hide */ public static final String WIRELESS_DEBUG_STATE_CHANGED_ACTION = "com.android.server.adb.WIRELESS_DEBUG_STATUS"; /** * Contains the list of paired devices. * * @hide */ public static final String WIRELESS_DEBUG_PAIRED_DEVICES_ACTION = "com.android.server.adb.WIRELESS_DEBUG_PAIRED_DEVICES"; /** * Action indicating the status of a pairing. Can be either * WIRELESS_STATUS_FAIL * WIRELESS_STATUS_SUCCESS * WIRELESS_STATUS_CANCELLED * WIRELESS_STATUS_PAIRING_CODE * WIRELESS_STATUS_CONNECTED * * @hide */ public static final String WIRELESS_DEBUG_PAIRING_RESULT_ACTION = "com.android.server.adb.WIRELESS_DEBUG_PAIRING_RESULT"; /** * Extra containing the PairDevice map of paired/pairing devices. * * @hide */ public static final String WIRELESS_DEVICES_EXTRA = "devices_map"; /** * The status of the pairing/unpairing. * * @hide */ public static final String WIRELESS_STATUS_EXTRA = "status"; /** * The PairDevice. * * @hide */ public static final String WIRELESS_PAIR_DEVICE_EXTRA = "pair_device"; /** * The six-digit pairing code. * * @hide */ public static final String WIRELESS_PAIRING_CODE_EXTRA = "pairing_code"; /** * The adb connection/pairing port that was opened. * * @hide */ public static final String WIRELESS_DEBUG_PORT_EXTRA = "adb_port"; /** * Status indicating the pairing/unpairing failed. * * @hide */ public static final int WIRELESS_STATUS_FAIL = 0; /** * Status indicating the pairing/unpairing succeeded. * * @hide */ public static final int WIRELESS_STATUS_SUCCESS = 1; /** * Status indicating the pairing/unpairing was cancelled. * * @hide */ public static final int WIRELESS_STATUS_CANCELLED = 2; /** * Status indicating the pairing code for pairing. * * @hide */ public static final int WIRELESS_STATUS_PAIRING_CODE = 3; /** * Status indicating wireless debugging is connected. * * @hide */ public static final int WIRELESS_STATUS_CONNECTED = 4; /** * Status indicating wireless debugging is disconnected. * * @hide */ public static final int WIRELESS_STATUS_DISCONNECTED = 5; private final Context mContext; private final Context mContext; private final IAdbManager mService; private final IAdbManager mService; Loading core/java/android/debug/AdbManagerInternal.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -42,7 +42,7 @@ public abstract class AdbManagerInternal { /** /** * Returns {@code true} if ADB debugging is enabled. * Returns {@code true} if ADB debugging is enabled. */ */ public abstract boolean isAdbEnabled(); public abstract boolean isAdbEnabled(byte transportType); /** /** * Returns the file that contains all of the ADB keys used by the device. * Returns the file that contains all of the ADB keys used by the device. Loading core/java/android/debug/AdbTransportType.aidl 0 → 100644 +25 −0 Original line number Original line Diff line number Diff line /* * Copyright (C) 2019 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.debug; /** @hide */ @Backing(type="byte") enum AdbTransportType { USB, WIFI, } core/java/android/debug/IAdbManager.aidl +56 −0 Original line number Original line Diff line number Diff line Loading @@ -42,6 +42,62 @@ interface IAdbManager { */ */ void clearDebuggingKeys(); void clearDebuggingKeys(); /** * Allow ADB wireless debugging on the connected network. If {@code alwaysAllow} * is {@code true}, add {@code bssid} to list of networks that the user has * approved. * * @param alwaysAllow if true, add permanently to list of allowed networks * @param bssid BSSID of the network */ void allowWirelessDebugging(boolean alwaysAllow, String bssid); /** * Deny ADB wireless debugging on the connected network. */ void denyWirelessDebugging(); /** * Returns a Map<String, PairDevice> with the key fingerprint mapped to the device information. */ Map getPairedDevices(); /** * Unpair the device identified by the key fingerprint it uses. * * @param fingerprint fingerprint of the key the device is using. */ void unpairDevice(String fingerprint); /** * Enables pairing by pairing code. The result of the enable will be sent via intent action * {@link android.debug.AdbManager#WIRELESS_DEBUG_ENABLE_DISCOVER_ACTION}. Furthermore, the * pairing code will also be sent in the intent as an extra * @{link android.debug.AdbManager#WIRELESS_PAIRING_CODE_EXTRA}. Note that only one * pairing method can be enabled at a time, either by pairing code, or by QR code. */ void enablePairingByPairingCode(); /** * Enables pairing by QR code. The result of the enable will be sent via intent action * {@link android.debug.AdbManager#WIRELESS_DEBUG_ENABLE_DISCOVER_ACTION}. Note that only one * pairing method can be enabled at a time, either by pairing code, or by QR code. * * @param serviceName The MDNS service name parsed from the QR code. * @param password The password parsed from the QR code. */ void enablePairingByQrCode(String serviceName, String password); /** * Returns the network port that adb wireless server is running on. */ int getAdbWirelessPort(); /** * Disables pairing. */ void disablePairing(); /** /** * Returns true if device supports secure Adb over Wi-Fi. * Returns true if device supports secure Adb over Wi-Fi. */ */ Loading core/java/android/debug/IAdbTransport.aidl +3 −1 Original line number Original line Diff line number Diff line Loading @@ -16,7 +16,9 @@ package android.debug; package android.debug; import android.debug.AdbTransportType; /** @hide */ /** @hide */ interface IAdbTransport { interface IAdbTransport { void onAdbEnabled(boolean enabled); void onAdbEnabled(boolean enabled, in AdbTransportType type); } } Loading
core/java/android/debug/AdbManager.java +108 −0 Original line number Original line Diff line number Diff line Loading @@ -31,6 +31,114 @@ import android.os.RemoteException; public class AdbManager { public class AdbManager { private static final String TAG = "AdbManager"; private static final String TAG = "AdbManager"; /** * Action indicating the state change of wireless debugging. Can be either * STATUS_CONNECTED * STATUS_DISCONNECTED * * @hide */ public static final String WIRELESS_DEBUG_STATE_CHANGED_ACTION = "com.android.server.adb.WIRELESS_DEBUG_STATUS"; /** * Contains the list of paired devices. * * @hide */ public static final String WIRELESS_DEBUG_PAIRED_DEVICES_ACTION = "com.android.server.adb.WIRELESS_DEBUG_PAIRED_DEVICES"; /** * Action indicating the status of a pairing. Can be either * WIRELESS_STATUS_FAIL * WIRELESS_STATUS_SUCCESS * WIRELESS_STATUS_CANCELLED * WIRELESS_STATUS_PAIRING_CODE * WIRELESS_STATUS_CONNECTED * * @hide */ public static final String WIRELESS_DEBUG_PAIRING_RESULT_ACTION = "com.android.server.adb.WIRELESS_DEBUG_PAIRING_RESULT"; /** * Extra containing the PairDevice map of paired/pairing devices. * * @hide */ public static final String WIRELESS_DEVICES_EXTRA = "devices_map"; /** * The status of the pairing/unpairing. * * @hide */ public static final String WIRELESS_STATUS_EXTRA = "status"; /** * The PairDevice. * * @hide */ public static final String WIRELESS_PAIR_DEVICE_EXTRA = "pair_device"; /** * The six-digit pairing code. * * @hide */ public static final String WIRELESS_PAIRING_CODE_EXTRA = "pairing_code"; /** * The adb connection/pairing port that was opened. * * @hide */ public static final String WIRELESS_DEBUG_PORT_EXTRA = "adb_port"; /** * Status indicating the pairing/unpairing failed. * * @hide */ public static final int WIRELESS_STATUS_FAIL = 0; /** * Status indicating the pairing/unpairing succeeded. * * @hide */ public static final int WIRELESS_STATUS_SUCCESS = 1; /** * Status indicating the pairing/unpairing was cancelled. * * @hide */ public static final int WIRELESS_STATUS_CANCELLED = 2; /** * Status indicating the pairing code for pairing. * * @hide */ public static final int WIRELESS_STATUS_PAIRING_CODE = 3; /** * Status indicating wireless debugging is connected. * * @hide */ public static final int WIRELESS_STATUS_CONNECTED = 4; /** * Status indicating wireless debugging is disconnected. * * @hide */ public static final int WIRELESS_STATUS_DISCONNECTED = 5; private final Context mContext; private final Context mContext; private final IAdbManager mService; private final IAdbManager mService; Loading
core/java/android/debug/AdbManagerInternal.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -42,7 +42,7 @@ public abstract class AdbManagerInternal { /** /** * Returns {@code true} if ADB debugging is enabled. * Returns {@code true} if ADB debugging is enabled. */ */ public abstract boolean isAdbEnabled(); public abstract boolean isAdbEnabled(byte transportType); /** /** * Returns the file that contains all of the ADB keys used by the device. * Returns the file that contains all of the ADB keys used by the device. Loading
core/java/android/debug/AdbTransportType.aidl 0 → 100644 +25 −0 Original line number Original line Diff line number Diff line /* * Copyright (C) 2019 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.debug; /** @hide */ @Backing(type="byte") enum AdbTransportType { USB, WIFI, }
core/java/android/debug/IAdbManager.aidl +56 −0 Original line number Original line Diff line number Diff line Loading @@ -42,6 +42,62 @@ interface IAdbManager { */ */ void clearDebuggingKeys(); void clearDebuggingKeys(); /** * Allow ADB wireless debugging on the connected network. If {@code alwaysAllow} * is {@code true}, add {@code bssid} to list of networks that the user has * approved. * * @param alwaysAllow if true, add permanently to list of allowed networks * @param bssid BSSID of the network */ void allowWirelessDebugging(boolean alwaysAllow, String bssid); /** * Deny ADB wireless debugging on the connected network. */ void denyWirelessDebugging(); /** * Returns a Map<String, PairDevice> with the key fingerprint mapped to the device information. */ Map getPairedDevices(); /** * Unpair the device identified by the key fingerprint it uses. * * @param fingerprint fingerprint of the key the device is using. */ void unpairDevice(String fingerprint); /** * Enables pairing by pairing code. The result of the enable will be sent via intent action * {@link android.debug.AdbManager#WIRELESS_DEBUG_ENABLE_DISCOVER_ACTION}. Furthermore, the * pairing code will also be sent in the intent as an extra * @{link android.debug.AdbManager#WIRELESS_PAIRING_CODE_EXTRA}. Note that only one * pairing method can be enabled at a time, either by pairing code, or by QR code. */ void enablePairingByPairingCode(); /** * Enables pairing by QR code. The result of the enable will be sent via intent action * {@link android.debug.AdbManager#WIRELESS_DEBUG_ENABLE_DISCOVER_ACTION}. Note that only one * pairing method can be enabled at a time, either by pairing code, or by QR code. * * @param serviceName The MDNS service name parsed from the QR code. * @param password The password parsed from the QR code. */ void enablePairingByQrCode(String serviceName, String password); /** * Returns the network port that adb wireless server is running on. */ int getAdbWirelessPort(); /** * Disables pairing. */ void disablePairing(); /** /** * Returns true if device supports secure Adb over Wi-Fi. * Returns true if device supports secure Adb over Wi-Fi. */ */ Loading
core/java/android/debug/IAdbTransport.aidl +3 −1 Original line number Original line Diff line number Diff line Loading @@ -16,7 +16,9 @@ package android.debug; package android.debug; import android.debug.AdbTransportType; /** @hide */ /** @hide */ interface IAdbTransport { interface IAdbTransport { void onAdbEnabled(boolean enabled); void onAdbEnabled(boolean enabled, in AdbTransportType type); } }