Revert "Revert "[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.""
This reverts commitf470e292d8. Reason for revert: Fixed warning from presubmit Change-Id: I3e1ea17a2e149b548885666d9e8418647b96439e (cherry picked from commitb93d2ce0d3) Bug: 278891267 Test: make
This commit is contained in:
@@ -60,6 +60,7 @@ 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.
|
||||
@@ -595,7 +596,7 @@ public class AmbientContextManagerService extends
|
||||
|
||||
synchronized (mLock) {
|
||||
for (ClientRequest cr : mExistingClientRequests) {
|
||||
if (cr.getPackageName().equals(callingPackage)) {
|
||||
if ((cr != null) && cr.getPackageName().equals(callingPackage)) {
|
||||
AmbientContextManagerPerUserService service =
|
||||
getAmbientContextManagerPerUserServiceForEventTypes(
|
||||
UserHandle.getCallingUserId(),
|
||||
|
||||
Reference in New Issue
Block a user