Merge "Prevent app icons blinking after a user switch." into udc-dev

This commit is contained in:
Yasin Kilicdere
2023-04-06 12:10:50 +00:00
committed by Android (Google) Code Review

View File

@@ -114,6 +114,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;
@@ -448,6 +449,10 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
notifySystemUiStateFlags(mSysUiState.getFlags());
notifyConnectionChanged();
if (mLatchForOnUserChanging != null) {
mLatchForOnUserChanging.countDown();
mLatchForOnUserChanging = null;
}
}
@Override
@@ -502,11 +507,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");
}
};