Merge "Add trace logs to UserSwitchObserver callbacks."

This commit is contained in:
Yasin Kilicdere
2022-11-10 14:42:34 +00:00
committed by Android (Google) Code Review

View File

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