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
This commit is contained in:
Fyodor Kupolov
2016-06-24 13:46:18 -07:00
parent 0b77ef9f51
commit 599d43b4fe

View File

@@ -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 {