Fix Taskbar being visible over Hotseat when recreated in Overview

Debugging locally, it seems there were a couple of state changes
and the last one (which is correct) was getting clobbered by a
previously destroyed instance of TaskbarLauncherStateController.
Fixed this by updating the isDestroyed() call which previously
only checked TaskbarActivityContext to now check
TaskbarLauncherStateController's destroyed state directly. This
is needed because TaskbarLauncherStateController is part of
LauncherTaskbarUIController which can be destroyed independently
of the other Taskbar controllers when Launcher is destroyed.

Also fix a debug log that was not updated long ago in ag/21122190

Flag: EXEMPT bugfix
Test: Go to overview, change Font Scale or Dark Theme from Quick
settings, ensure Taskbar is not visible over Hotseat
Fixes: 302923055

Change-Id: I1299462955b51a2bf931f022177045b1cec039c5
This commit is contained in:
Tony Wickham
2024-08-12 23:36:11 +00:00
parent cafe06f63d
commit 5c32af7e5b
3 changed files with 4 additions and 6 deletions
@@ -146,6 +146,7 @@ public class TaskbarLauncherStateController {
private MultiProperty mIconAlphaForHome;
private QuickstepLauncher mLauncher;
private boolean mIsDestroyed = false;
private Integer mPrevState;
private int mState;
private LauncherState mLauncherState = LauncherState.NORMAL;
@@ -256,6 +257,7 @@ public class TaskbarLauncherStateController {
}
public void onDestroy() {
mIsDestroyed = true;
mCanSyncViews = false;
mIconAlignment.finishAnimation();
@@ -407,7 +409,7 @@ public class TaskbarLauncherStateController {
}
public Animator applyState(long duration, boolean start) {
if (mControllers.taskbarActivityContext.isDestroyed()) {
if (mIsDestroyed) {
return null;
}
Animator animator = null;
@@ -753,7 +755,7 @@ public class TaskbarLauncherStateController {
}
private void updateIconAlphaForHome(float alpha) {
if (mControllers.taskbarActivityContext.isDestroyed()) {
if (mIsDestroyed) {
return;
}
mIconAlphaForHome.setValue(alpha);
@@ -950,7 +950,6 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
"ALPHA_INDEX_RECENTS_DISABLED",
"ALPHA_INDEX_NOTIFICATION_EXPANDED",
"ALPHA_INDEX_ASSISTANT_INVOKED",
"ALPHA_INDEX_IME_BUTTON_NAV",
"ALPHA_INDEX_SMALL_SCREEN");
mModelCallbacks.dumpLogs(prefix + "\t", pw);
@@ -25,7 +25,6 @@ import static org.junit.Assume.assumeTrue;
import android.content.Intent;
import android.platform.test.annotations.PlatinumTest;
import androidx.test.filters.FlakyTest;
import androidx.test.platform.app.InstrumentationRegistry;
import com.android.launcher3.Launcher;
@@ -33,7 +32,6 @@ import com.android.launcher3.LauncherState;
import com.android.launcher3.tapl.AllApps;
import com.android.launcher3.ui.AbstractLauncherUiTest;
import com.android.launcher3.ui.PortraitLandscapeRunner.PortraitLandscape;
import com.android.launcher3.util.rule.ScreenRecordRule;
import org.junit.Test;
@@ -191,7 +189,6 @@ public class TaplOpenCloseAllAppsTest extends AbstractLauncherUiTest<Launcher> {
/**
* Makes sure that when pressing back when AllApps is open we go back to the Home screen.
*/
@FlakyTest(bugId = 256615483)
@Test
@PortraitLandscape
public void testPressBackFromAllAppsToHome() {