summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Fyodor Kupolov <fkupolov@google.com> 2016-06-24 13:46:18 -0700
committer Fyodor Kupolov <fkupolov@google.com> 2016-06-24 13:46:18 -0700
commit599d43b4fe43f48f7398f7052b8b2d4e88cbcf14 (patch)
tree964c799a59d4b0e2da0557a578dea7c44fd55738
parent0b77ef9f5199b7cd0956f2bfe049cbd699ca03b4 (diff)
Prevent NPE in dispatchUserSwitch
Access to mCurWaitingUserSwitchCallbacks should be synchronized and it's safer to access the local variable curWaitingUserSwitchCallbacks Bug: 29039588 Change-Id: Id91699670ca16467d385f476ba06da2cb29a984b
-rw-r--r--services/core/java/com/android/server/am/UserController.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/am/UserController.java b/services/core/java/com/android/server/am/UserController.java
index 152d34d10525..6b44f14883e5 100644
--- a/services/core/java/com/android/server/am/UserController.java
+++ b/services/core/java/com/android/server/am/UserController.java
@@ -1061,7 +1061,9 @@ final class UserController {
try {
// Prepend with unique prefix to guarantee that keys are unique
final String name = "#" + i + " " + mUserSwitchObservers.getBroadcastCookie(i);
- mCurWaitingUserSwitchCallbacks.add(name);
+ synchronized (mService) {
+ curWaitingUserSwitchCallbacks.add(name);
+ }
final IRemoteCallback callback = new IRemoteCallback.Stub() {
@Override
public void sendResult(Bundle data) throws RemoteException {