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

Commit 20f950e7 authored by Yasin Kilicdere's avatar Yasin Kilicdere
Browse files

Add trace logs for UserController#dispatchUserSwitchComplete.

To track how long it takes for each mUserSwitchObservers to process
IUserSwitchObserver#onUserSwitchComplete call and when that happens.

Bug: 239497256
Test: atest MultiUserPerfTests:android.multiuser.UserLifecycleTests#switchUser_stopped --no-bazel-mode
Change-Id: I9c618b6bb2247d93f624a8f9b9351608d4579000
parent fd811417
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -1872,15 +1872,21 @@ class UserController implements Handler.Callback {
    /** Called on handler thread */
    @VisibleForTesting
    void dispatchUserSwitchComplete(@UserIdInt int userId) {
        final TimingsTraceAndSlog t = new TimingsTraceAndSlog();
        t.traceBegin("dispatchUserSwitchComplete-" + userId);
        mInjector.getWindowManager().setSwitchingUser(false);
        final int observerCount = mUserSwitchObservers.beginBroadcast();
        for (int i = 0; i < observerCount; i++) {
            try {
                t.traceBegin("onUserSwitchComplete-" + userId + " #" + i + " "
                        + mUserSwitchObservers.getBroadcastCookie(i));
                mUserSwitchObservers.getBroadcastItem(i).onUserSwitchComplete(userId);
                t.traceEnd();
            } catch (RemoteException e) {
            }
        }
        mUserSwitchObservers.finishBroadcast();
        t.traceEnd();
    }

    private void dispatchLockedBootComplete(@UserIdInt int userId) {