Merge "IAdbManager.getPairDevices returns FingerprintAndPairDevice[]." am: e9e1f5afa7 am: da74454c03
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1780474 Change-Id: Ie2798465753d7a6fd7d7e157fb528db6d17dbd89
This commit is contained in:
28
core/java/android/debug/FingerprintAndPairDevice.aidl
Normal file
28
core/java/android/debug/FingerprintAndPairDevice.aidl
Normal file
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* 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;
|
||||
}
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package android.debug;
|
||||
|
||||
import android.debug.FingerprintAndPairDevice;
|
||||
|
||||
/**
|
||||
* Interface to communicate remotely with the {@code AdbService} in the system server.
|
||||
*
|
||||
@@ -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.
|
||||
|
||||
@@ -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;
|
||||
@@ -348,12 +349,21 @@ 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;
|
||||
}
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user