diff options
author | Evan Chen <evanxinchen@google.com> | 2021-06-08 17:17:19 +0000 |
---|---|---|
committer | Evan Chen <evanxinchen@google.com> | 2021-06-18 16:58:10 +0000 |
commit | 5f9987a5c0b0e04daeb5cb590655308c0b0b31e1 (patch) | |
tree | 26b2ef7fd81d1e334b4d78471c84a7f6c7cf3df2 | |
parent | e6fb6087aa433228cf0fb1a0d52d1a8721df38e3 (diff) |
Fix system crash when unpair app
No need to restartBleScan after each unbind serviceSelector
restart ble scan after update the associations
Also, move unbind serviceSelector before the permission revoke since
permission revoking caused app crashed.
Fix: 190506983
Test: Manual test
Change-Id: Icc2a19f56295be4000155a4ccd6650a30e7c9b66
-rw-r--r-- | services/companion/java/com/android/server/companion/CompanionDeviceManagerService.java | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/services/companion/java/com/android/server/companion/CompanionDeviceManagerService.java b/services/companion/java/com/android/server/companion/CompanionDeviceManagerService.java index 83dfe8ed2576..685beabc1aef 100644 --- a/services/companion/java/com/android/server/companion/CompanionDeviceManagerService.java +++ b/services/companion/java/com/android/server/companion/CompanionDeviceManagerService.java @@ -759,9 +759,19 @@ public class CompanionDeviceManagerService extends SystemService implements Bind } return notMatch; })); + restartBleScan(); } void onAssociationPreRemove(Association association) { + if (association.isNotifyOnDeviceNearby()) { + ServiceConnector<ICompanionDeviceService> serviceConnector = + mDeviceListenerServiceConnectors.forUser(association.getUserId()) + .get(association.getPackageName()); + if (serviceConnector != null) { + serviceConnector.unbind(); + } + } + String deviceProfile = association.getDeviceProfile(); if (deviceProfile != null) { Association otherAssociationWithDeviceProfile = find( @@ -793,16 +803,6 @@ public class CompanionDeviceManagerService extends SystemService implements Bind } } } - - if (association.isNotifyOnDeviceNearby()) { - ServiceConnector<ICompanionDeviceService> serviceConnector = - mDeviceListenerServiceConnectors.forUser(association.getUserId()) - .get(association.getPackageName()); - if (serviceConnector != null) { - serviceConnector.unbind(); - restartBleScan(); - } - } } private void updateSpecialAccessPermissionForAssociatedPackage(Association association) { |