Merge "Fix system crash when unpair app" into sc-dev am: 891f3034ea

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14903799

Change-Id: I69ffa963d01b7a0a89cab29ed08d0d2f24f1dff8
This commit is contained in:
Evan Chen
2021-06-21 19:58:07 +00:00
committed by Automerger Merge Worker

View File

@@ -753,9 +753,19 @@ public class CompanionDeviceManagerService extends SystemService implements Bind
} }
return notMatch; return notMatch;
})); }));
restartBleScan();
} }
void onAssociationPreRemove(Association association) { 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(); String deviceProfile = association.getDeviceProfile();
if (deviceProfile != null) { if (deviceProfile != null) {
Association otherAssociationWithDeviceProfile = find( Association otherAssociationWithDeviceProfile = find(
@@ -787,16 +797,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) { private void updateSpecialAccessPermissionForAssociatedPackage(Association association) {