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
This commit is contained in:
Yasin Kilicdere
2023-03-29 21:08:05 +01:00
parent 342bac9df9
commit c9b7df9763

View File

@@ -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");
}
};