Revert ag/22195243 and solve the initialization issue it was supposed to fix differently

The fix caused a flicker tests to fail, but that is specific to the persistent taskbar used in tests only.

Bug: 277470898
Bug: 277003116
Fixed: 277470898
Fixed: 277003116

Test: Flicker tests passes
Test: Manual (http://shortn/_kiAZykhZsp)
Test: Tapl presubmit tests
Change-Id: Ib9daebf3b06af2f1a4a3b7461acf91f204ff281b
This commit is contained in:
Mike Schneider
2023-04-13 13:21:06 +02:00
parent 433d215c88
commit 593ff77267
5 changed files with 19 additions and 18 deletions

View File

@@ -210,7 +210,9 @@ public class TaskbarLauncherStateController {
}
};
public void init(TaskbarControllers controllers, QuickstepLauncher launcher) {
/** Initializes the controller instance, and applies the initial state immediately. */
public void init(TaskbarControllers controllers, QuickstepLauncher launcher,
int sysuiStateFlags) {
mCanSyncViews = false;
mControllers = controllers;
@@ -229,6 +231,8 @@ public class TaskbarLauncherStateController {
mLauncher.getStateManager().addStateListener(mStateListener);
mLauncherState = launcher.getStateManager().getState();
updateStateForSysuiFlags(sysuiStateFlags, /*applyState*/ false);
applyState(0);
mCanSyncViews = true;
@@ -298,7 +302,11 @@ public class TaskbarLauncherStateController {
}
/** SysUI flags updated, see QuickStepContract.SYSUI_STATE_* values. */
public void updateStateForSysuiFlags(int systemUiStateFlags, boolean skipAnim) {
public void updateStateForSysuiFlags(int systemUiStateFlags) {
updateStateForSysuiFlags(systemUiStateFlags, /* applyState */ true);
}
private void updateStateForSysuiFlags(int systemUiStateFlags, boolean applyState) {
final boolean prevIsAwake = hasAnyFlag(FLAG_AWAKE);
final boolean currIsAwake = hasAnyFlag(systemUiStateFlags, SYSUI_STATE_AWAKE);
@@ -322,9 +330,7 @@ public class TaskbarLauncherStateController {
|| (systemUiStateFlags & SYSUI_STATE_WAKEFULNESS_MASK) != WAKEFULNESS_AWAKE;
updateStateForFlag(FLAG_TASKBAR_HIDDEN, isTaskbarHidden);
if (skipAnim) {
applyState(0);
} else {
if (applyState) {
applyState();
}
}
@@ -361,10 +367,6 @@ public class TaskbarLauncherStateController {
applyState(duration, true);
}
public Animator applyState(boolean start) {
return applyState(mControllers.taskbarStashController.getStashDuration(), start);
}
public Animator applyState(long duration, boolean start) {
if (mControllers.taskbarActivityContext.isDestroyed()) {
return null;
@@ -420,7 +422,7 @@ public class TaskbarLauncherStateController {
}
}
if (hasAnyFlag(changedFlags, FLAGS_LAUNCHER_ACTIVE | FLAG_AWAKE)) {
if (hasAnyFlag(changedFlags, FLAGS_LAUNCHER_ACTIVE)) {
animatorSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {