diff options
author | Paul Murphy <paulmur@google.com> | 2020-02-28 08:35:05 -0800 |
---|---|---|
committer | Paul Murphy <paulmur@google.com> | 2020-02-28 09:20:15 -0800 |
commit | d3133ebf7628042908fd4306a06a04a01d858a06 (patch) | |
tree | 102e5282e8db3349386b2ae1a693b92714f02116 | |
parent | d506a78e94594be701b2a061cb48b5e2f5cf3908 (diff) |
CDM isDeviceAssociatedForWifiConnection returns false if no devices associated
The expectation is that when a caller holds COMPANION_APPROVE_WIFI_CONNECTIONS permisison,
isDeviceAssociatedForWifiConnection should always return true. In the
previous case, at least one device had to exist for this to be the case.
Bug: b/150459257
Test: A CTS test is what discovered the bug, and will be checked in
alongside this change.
Change-Id: If0a4dd427ebd437d7cd29810a26301b581ee3c75
-rw-r--r-- | services/companion/java/com/android/server/companion/CompanionDeviceManagerService.java | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/services/companion/java/com/android/server/companion/CompanionDeviceManagerService.java b/services/companion/java/com/android/server/companion/CompanionDeviceManagerService.java index 434a97ee0bc5..6ccdf245b271 100644 --- a/services/companion/java/com/android/server/companion/CompanionDeviceManagerService.java +++ b/services/companion/java/com/android/server/companion/CompanionDeviceManagerService.java @@ -369,10 +369,13 @@ public class CompanionDeviceManagerService extends SystemService implements Bind boolean bypassMacPermission = getContext().getPackageManager().checkPermission( android.Manifest.permission.COMPANION_APPROVE_WIFI_CONNECTIONS, packageName) == PackageManager.PERMISSION_GRANTED; + if (bypassMacPermission) { + return true; + } return CollectionUtils.any( readAllAssociations(userId, packageName), - a -> bypassMacPermission || Objects.equals(a.deviceAddress, macAddress)); + a -> Objects.equals(a.deviceAddress, macAddress)); } private void checkCanCallNotificationApi(String callingPackage) throws RemoteException { |