Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5f9987a5 authored by Evan Chen's avatar Evan Chen
Browse files

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
parent e6fb6087
Loading
Loading
Loading
Loading
+10 −10
Original line number Diff line number Diff line
@@ -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) {