Merge "Need to check isManagedByCompanionApp before calling getMacAddress()"

This commit is contained in:
Evan Chen
2021-11-05 05:31:30 +00:00
committed by Android (Google) Code Review

View File

@@ -775,12 +775,14 @@ public class CompanionDeviceManagerService extends SystemService {
exemptFromAutoRevoke(packageInfo.packageName, packageInfo.applicationInfo.uid);
if (mCurrentlyConnectedDevices.contains(association.getDeviceMacAddress())) {
grantDeviceProfile(association);
}
if (!association.isManagedByCompanionApp()) {
if (mCurrentlyConnectedDevices.contains(association.getDeviceMacAddress())) {
grantDeviceProfile(association);
}
if (association.isNotifyOnDeviceNearby()) {
restartBleScan();
if (association.isNotifyOnDeviceNearby()) {
restartBleScan();
}
}
}
@@ -1217,6 +1219,9 @@ public class CompanionDeviceManagerService extends SystemService {
ArrayList<ScanFilter> result = new ArrayList<>();
ArraySet<String> addressesSeen = new ArraySet<>();
for (AssociationInfo association : getAllAssociations()) {
if (association.isManagedByCompanionApp()) {
continue;
}
String address = association.getDeviceMacAddress();
if (addressesSeen.contains(address)) {
continue;