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

Commit c9b7df97 authored by Yasin Kilicdere's avatar Yasin Kilicdere
Browse files

Prevent app icons blinking after a user switch.

This CL moves OverviewProxyService from onUserChanged to
onUserChanging, to allow the jank to happen earlier while the user
switch is happening (i.e. while the screen is frozen),

Bug: 275349347
Test: Visual (screen recordings attached to the bug)
Change-Id: I8a5c2f56ff5d94f8c3754acac410f99675a3e1a2
parent 342bac9d
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -112,6 +112,7 @@ import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executor;
import java.util.function.Supplier;

@@ -445,6 +446,10 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
            notifySystemUiStateFlags(mSysUiState.getFlags());

            notifyConnectionChanged();
            if (mLatchForOnUserChanging != null) {
                mLatchForOnUserChanging.countDown();
                mLatchForOnUserChanging = null;
            }
        }

        @Override
@@ -499,11 +504,14 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
        }
    };

    private CountDownLatch mLatchForOnUserChanging;
    private final UserTracker.Callback mUserChangedCallback =
            new UserTracker.Callback() {
                @Override
                public void onUserChanged(int newUser, @NonNull Context userContext) {
                public void onUserChanging(int newUser, @NonNull Context userContext,
                        CountDownLatch latch) {
                    mConnectionBackoffAttempts = 0;
                    mLatchForOnUserChanging = latch;
                    internalConnectToCurrentUser("User changed");
                }
            };