Loading core/java/android/debug/FingerprintAndPairDevice.aidl 0 → 100644 +28 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 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; import android.debug.PairDevice; /** * @see {@link android.debug.IAdbManager#getPairedDevices()} * @hide */ parcelable FingerprintAndPairDevice { String keyFingerprint; PairDevice device; } No newline at end of file core/java/android/debug/IAdbManager.aidl +5 −2 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package android.debug; import android.debug.FingerprintAndPairDevice; /** * Interface to communicate remotely with the {@code AdbService} in the system server. * Loading Loading @@ -58,9 +60,10 @@ interface IAdbManager { void denyWirelessDebugging(); /** * Returns a Map<String, PairDevice> with the key fingerprint mapped to the device information. * Returns an array of NamedPairDevice with the key fingerprint mapped to the device * information. */ Map getPairedDevices(); FingerprintAndPairDevice[] getPairedDevices(); /** * Unpair the device identified by the key fingerprint it uses. Loading services/core/java/com/android/server/adb/AdbService.java +15 −5 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import android.database.ContentObserver; import android.debug.AdbManager; import android.debug.AdbManagerInternal; import android.debug.AdbTransportType; import android.debug.FingerprintAndPairDevice; import android.debug.IAdbManager; import android.debug.IAdbTransport; import android.debug.PairDevice; Loading Loading @@ -348,13 +349,22 @@ public class AdbService extends IAdbManager.Stub { } @Override public Map<String, PairDevice> getPairedDevices() { public FingerprintAndPairDevice[] getPairedDevices() { mContext.enforceCallingOrSelfPermission(android.Manifest.permission.MANAGE_DEBUGGING, null); if (mDebuggingManager != null) { return mDebuggingManager.getPairedDevices(); } if (mDebuggingManager == null) { return null; } Map<String, PairDevice> map = mDebuggingManager.getPairedDevices(); FingerprintAndPairDevice[] ret = new FingerprintAndPairDevice[map.size()]; int i = 0; for (Map.Entry<String, PairDevice> entry : map.entrySet()) { ret[i] = new FingerprintAndPairDevice(); ret[i].keyFingerprint = entry.getKey(); ret[i].device = entry.getValue(); i++; } return ret; } @Override public void unpairDevice(@NonNull String fingerprint) { Loading Loading
core/java/android/debug/FingerprintAndPairDevice.aidl 0 → 100644 +28 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 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; import android.debug.PairDevice; /** * @see {@link android.debug.IAdbManager#getPairedDevices()} * @hide */ parcelable FingerprintAndPairDevice { String keyFingerprint; PairDevice device; } No newline at end of file
core/java/android/debug/IAdbManager.aidl +5 −2 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package android.debug; import android.debug.FingerprintAndPairDevice; /** * Interface to communicate remotely with the {@code AdbService} in the system server. * Loading Loading @@ -58,9 +60,10 @@ interface IAdbManager { void denyWirelessDebugging(); /** * Returns a Map<String, PairDevice> with the key fingerprint mapped to the device information. * Returns an array of NamedPairDevice with the key fingerprint mapped to the device * information. */ Map getPairedDevices(); FingerprintAndPairDevice[] getPairedDevices(); /** * Unpair the device identified by the key fingerprint it uses. Loading
services/core/java/com/android/server/adb/AdbService.java +15 −5 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import android.database.ContentObserver; import android.debug.AdbManager; import android.debug.AdbManagerInternal; import android.debug.AdbTransportType; import android.debug.FingerprintAndPairDevice; import android.debug.IAdbManager; import android.debug.IAdbTransport; import android.debug.PairDevice; Loading Loading @@ -348,13 +349,22 @@ public class AdbService extends IAdbManager.Stub { } @Override public Map<String, PairDevice> getPairedDevices() { public FingerprintAndPairDevice[] getPairedDevices() { mContext.enforceCallingOrSelfPermission(android.Manifest.permission.MANAGE_DEBUGGING, null); if (mDebuggingManager != null) { return mDebuggingManager.getPairedDevices(); } if (mDebuggingManager == null) { return null; } Map<String, PairDevice> map = mDebuggingManager.getPairedDevices(); FingerprintAndPairDevice[] ret = new FingerprintAndPairDevice[map.size()]; int i = 0; for (Map.Entry<String, PairDevice> entry : map.entrySet()) { ret[i] = new FingerprintAndPairDevice(); ret[i].keyFingerprint = entry.getKey(); ret[i].device = entry.getValue(); i++; } return ret; } @Override public void unpairDevice(@NonNull String fingerprint) { Loading