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 commit 21b89197a9.
Reason for revert: Need to address WARNING reported by Error Prone: [SynchronizeOnNonFinalField] Synchronizing on non-final fields is not safe: if the field is ever updated, different threads may end up locking on different objects.
Change-Id: I97acc0c933795e90e9e7fa0e72798259acf862dc
This commit is contained in:
committed by
Android (Google) Code Review
parent
21b89197a9
commit
f470e292d8
@@ -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 (mExistingClientRequests) {
|
||||
synchronized (mLock) {
|
||||
for (ClientRequest cr : mExistingClientRequests) {
|
||||
if (cr.getPackageName().equals(callingPackage)) {
|
||||
AmbientContextManagerPerUserService service =
|
||||
|
||||
Reference in New Issue
Block a user