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

Commit 5c85be46 authored by Charlie Wang's avatar Charlie Wang Committed by Android (Google) Code Review
Browse files

Merge "Fix NPE in AmbientContextManagerService."

parents 90c5577f ae2a2419
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,