[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
This commit is contained in:
@@ -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 =
|
||||
|
||||
Reference in New Issue
Block a user