Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 84f92354 authored by Yasin Kilicdere's avatar Yasin Kilicdere Committed by Android (Google) Code Review
Browse files

Merge "Add trace logs to UserSwitchObserver callbacks."

parents 3136c27e 27421aca
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -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