Loading services/core/java/com/android/server/am/UserController.java +12 −0 Original line number Diff line number Diff line Loading @@ -2084,6 +2084,8 @@ class UserController implements Handler.Callback { } private void timeoutUserSwitch(UserState uss, int oldUserId, int newUserId) { TimingsTraceAndSlog t = new TimingsTraceAndSlog(TAG); t.traceBegin("timeoutUserSwitch-" + oldUserId + "-to-" + newUserId); synchronized (mLock) { Slogf.e(TAG, "User switch timeout: from " + oldUserId + " to " + newUserId); mTimeoutUserSwitchCallbacks = mCurWaitingUserSwitchCallbacks; Loading @@ -2093,6 +2095,7 @@ class UserController implements Handler.Callback { mHandler.sendMessageDelayed(mHandler.obtainMessage(USER_SWITCH_CALLBACKS_TIMEOUT_MSG, oldUserId, newUserId), USER_SWITCH_CALLBACKS_TIMEOUT_MS); } t.traceEnd(); } private void timeoutUserSwitchCallbacks(int oldUserId, int newUserId) { Loading Loading @@ -2150,6 +2153,8 @@ class UserController implements Handler.Callback { + " ms after dispatchUserSwitch."); } TimingsTraceAndSlog t2 = new TimingsTraceAndSlog(TAG); t2.traceBegin("onUserSwitchingReply-" + name); curWaitingUserSwitchCallbacks.remove(name); // Continue switching if all callbacks have been notified and // user switching session is still valid Loading @@ -2158,11 +2163,15 @@ class UserController implements Handler.Callback { == mCurWaitingUserSwitchCallbacks)) { sendContinueUserSwitchLU(uss, oldUserId, newUserId); } t2.traceEnd(); } } }; t.traceBegin("onUserSwitching-" + name); mUserSwitchObservers.getBroadcastItem(i).onUserSwitching(newUserId, callback); t.traceEnd(); } catch (RemoteException e) { // Ignore } } } else { Loading @@ -2176,10 +2185,13 @@ class UserController implements Handler.Callback { @GuardedBy("mLock") private void sendContinueUserSwitchLU(UserState uss, int oldUserId, int newUserId) { TimingsTraceAndSlog t = new TimingsTraceAndSlog(TAG); t.traceBegin("sendContinueUserSwitchLU-" + oldUserId + "-to-" + newUserId); mCurWaitingUserSwitchCallbacks = null; mHandler.removeMessages(USER_SWITCH_TIMEOUT_MSG); mHandler.sendMessage(mHandler.obtainMessage(CONTINUE_USER_SWITCH_MSG, oldUserId, newUserId, uss)); t.traceEnd(); } @VisibleForTesting Loading Loading
services/core/java/com/android/server/am/UserController.java +12 −0 Original line number Diff line number Diff line Loading @@ -2084,6 +2084,8 @@ class UserController implements Handler.Callback { } private void timeoutUserSwitch(UserState uss, int oldUserId, int newUserId) { TimingsTraceAndSlog t = new TimingsTraceAndSlog(TAG); t.traceBegin("timeoutUserSwitch-" + oldUserId + "-to-" + newUserId); synchronized (mLock) { Slogf.e(TAG, "User switch timeout: from " + oldUserId + " to " + newUserId); mTimeoutUserSwitchCallbacks = mCurWaitingUserSwitchCallbacks; Loading @@ -2093,6 +2095,7 @@ class UserController implements Handler.Callback { mHandler.sendMessageDelayed(mHandler.obtainMessage(USER_SWITCH_CALLBACKS_TIMEOUT_MSG, oldUserId, newUserId), USER_SWITCH_CALLBACKS_TIMEOUT_MS); } t.traceEnd(); } private void timeoutUserSwitchCallbacks(int oldUserId, int newUserId) { Loading Loading @@ -2150,6 +2153,8 @@ class UserController implements Handler.Callback { + " ms after dispatchUserSwitch."); } TimingsTraceAndSlog t2 = new TimingsTraceAndSlog(TAG); t2.traceBegin("onUserSwitchingReply-" + name); curWaitingUserSwitchCallbacks.remove(name); // Continue switching if all callbacks have been notified and // user switching session is still valid Loading @@ -2158,11 +2163,15 @@ class UserController implements Handler.Callback { == mCurWaitingUserSwitchCallbacks)) { sendContinueUserSwitchLU(uss, oldUserId, newUserId); } t2.traceEnd(); } } }; t.traceBegin("onUserSwitching-" + name); mUserSwitchObservers.getBroadcastItem(i).onUserSwitching(newUserId, callback); t.traceEnd(); } catch (RemoteException e) { // Ignore } } } else { Loading @@ -2176,10 +2185,13 @@ class UserController implements Handler.Callback { @GuardedBy("mLock") private void sendContinueUserSwitchLU(UserState uss, int oldUserId, int newUserId) { TimingsTraceAndSlog t = new TimingsTraceAndSlog(TAG); t.traceBegin("sendContinueUserSwitchLU-" + oldUserId + "-to-" + newUserId); mCurWaitingUserSwitchCallbacks = null; mHandler.removeMessages(USER_SWITCH_TIMEOUT_MSG); mHandler.sendMessage(mHandler.obtainMessage(CONTINUE_USER_SWITCH_MSG, oldUserId, newUserId, uss)); t.traceEnd(); } @VisibleForTesting Loading