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

Commit 21b89197 authored by Kathy Chen's avatar Kathy Chen
Browse files

[AC] Fix NPE. If the client sends multiple unregister requests at the same...

[AC] Fix NPE. If the client sends multiple unregister requests at the same time, the client request could be null before the next request is processed.

Bug: 278891267
Test: make
Change-Id: I7ff41338ab638ce40ef618bc306cc25f0939f023
parent 96964919
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -56,11 +56,11 @@ import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.concurrent.ConcurrentHashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;

/**
 * System service for managing {@link AmbientContextEvent}s.
@@ -600,7 +600,7 @@ public class AmbientContextManagerService extends
            unregisterObserver_enforcePermission();
            assertCalledByPackageOwner(callingPackage);

            synchronized (mLock) {
            synchronized (mExistingClientRequests) {
                for (ClientRequest cr : mExistingClientRequests) {
                    if (cr.getPackageName().equals(callingPackage)) {
                        AmbientContextManagerPerUserService service =