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

Commit ae2a2419 authored by Charlie Wang's avatar Charlie Wang
Browse files

Fix NPE in AmbientContextManagerService.

Bug: 266371615
Test: None
Change-Id: I3d9a6628f98427536aa14ed37e09b9823b928aae
parent bf22f1aa
Loading
Loading
Loading
Loading
+13 −10
Original line number Diff line number Diff line
@@ -593,11 +593,13 @@ public class AmbientContextManagerService extends
                    Manifest.permission.ACCESS_AMBIENT_CONTEXT_EVENT, TAG);
            assertCalledByPackageOwner(callingPackage);

            synchronized (mLock) {
                for (ClientRequest cr : mExistingClientRequests) {
                    if (cr.getPackageName().equals(callingPackage)) {
                        AmbientContextManagerPerUserService service =
                                getAmbientContextManagerPerUserServiceForEventTypes(
                            UserHandle.getCallingUserId(), cr.getRequest().getEventTypes());
                                        UserHandle.getCallingUserId(),
                                        cr.getRequest().getEventTypes());
                        if (service != null) {
                            service.onUnregisterObserver(callingPackage);
                        } else {
@@ -607,6 +609,7 @@ public class AmbientContextManagerService extends
                    }
                }
            }
        }

        @Override
        public void queryServiceStatus(int[] eventTypes, String callingPackage,