Merge "Migrate ENABLE_TASKBAR_NO_RECREATION to launcher.aconfig" into main

This commit is contained in:
Tracy Zhou
2023-10-25 17:45:09 +00:00
committed by Android (Google) Code Review
4 changed files with 22 additions and 12 deletions

View File

@@ -41,3 +41,10 @@ flag {
description: "Enable updated overview icon and menu within task."
bug: "257950105"
}
flag {
name: "enable_taskbar_no_recreate"
namespace: "launcher"
description: "Enables taskbar with no recreation from lifecycle changes of TaskbarActivityContext."
bug: "299193589"
}

View File

@@ -29,8 +29,8 @@ import static com.android.launcher3.AbstractFloatingView.TYPE_TASKBAR_OVERLAY_PR
import static com.android.launcher3.Flags.enableCursorHoverStates;
import static com.android.launcher3.Utilities.calculateTextHeight;
import static com.android.launcher3.Utilities.isRunningInTestHarness;
import static com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_NO_RECREATION;
import static com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_PINNING;
import static com.android.launcher3.config.FeatureFlags.enableTaskbarNoRecreate;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_FOLDER_OPEN;
import static com.android.launcher3.taskbar.TaskbarAutohideSuspendController.FLAG_AUTOHIDE_SUSPEND_DRAGGING;
import static com.android.launcher3.taskbar.TaskbarAutohideSuspendController.FLAG_AUTOHIDE_SUSPEND_FULLSCREEN;
@@ -339,7 +339,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
mIsDestroyed = false;
}
if (!ENABLE_TASKBAR_NO_RECREATION.get() && !mAddedWindow) {
if (!enableTaskbarNoRecreate() && !mAddedWindow) {
mWindowManager.addView(mDragLayer, mWindowLayoutParams);
mAddedWindow = true;
} else {
@@ -695,7 +695,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
mIsDestroyed = true;
setUIController(TaskbarUIController.DEFAULT);
mControllers.onDestroy();
if (!ENABLE_TASKBAR_NO_RECREATION.get() && !FLAG_HIDE_NAVBAR_WINDOW) {
if (!enableTaskbarNoRecreate() && !FLAG_HIDE_NAVBAR_WINDOW) {
mWindowManager.removeViewImmediate(mDragLayer);
mAddedWindow = false;
}
@@ -1290,7 +1290,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
void notifyUpdateLayoutParams() {
if (mDragLayer.isAttachedToWindow()) {
if (ENABLE_TASKBAR_NO_RECREATION.get()) {
if (enableTaskbarNoRecreate()) {
mWindowManager.updateViewLayout(mDragLayer.getRootView(), mWindowLayoutParams);
} else {
mWindowManager.updateViewLayout(mDragLayer, mWindowLayoutParams);

View File

@@ -23,7 +23,7 @@ import static android.view.WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL;
import static com.android.launcher3.LauncherPrefs.TASKBAR_PINNING;
import static com.android.launcher3.LauncherPrefs.TASKBAR_PINNING_KEY;
import static com.android.launcher3.LauncherState.OVERVIEW;
import static com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_NO_RECREATION;
import static com.android.launcher3.config.FeatureFlags.enableTaskbarNoRecreate;
import static com.android.launcher3.util.DisplayController.TASKBAR_NOT_DESTROYED_TAG;
import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
import static com.android.launcher3.util.FlagDebugUtils.formatFlagChange;
@@ -210,7 +210,7 @@ public class TaskbarManager {
Display display =
service.getSystemService(DisplayManager.class).getDisplay(DEFAULT_DISPLAY);
mContext = service.createWindowContext(display, TYPE_NAVIGATION_BAR_PANEL, null);
if (ENABLE_TASKBAR_NO_RECREATION.get()) {
if (enableTaskbarNoRecreate()) {
mWindowManager = mContext.getSystemService(WindowManager.class);
mTaskbarRootLayout = new FrameLayout(mContext) {
@Override
@@ -308,7 +308,7 @@ public class TaskbarManager {
LauncherPrefs.get(mContext).removeListener(mTaskbarPinningPreferenceChangeListener,
TASKBAR_PINNING);
mTaskbarActivityContext.onDestroy();
if (!FLAG_HIDE_NAVBAR_WINDOW || ENABLE_TASKBAR_NO_RECREATION.get()) {
if (!FLAG_HIDE_NAVBAR_WINDOW || enableTaskbarNoRecreate()) {
mTaskbarActivityContext = null;
}
}
@@ -448,7 +448,7 @@ public class TaskbarManager {
return;
}
if (ENABLE_TASKBAR_NO_RECREATION.get() || mTaskbarActivityContext == null) {
if (enableTaskbarNoRecreate() || mTaskbarActivityContext == null) {
mTaskbarActivityContext = new TaskbarActivityContext(mContext, dp,
mNavButtonController, mUnfoldProgressProvider);
} else {
@@ -461,7 +461,7 @@ public class TaskbarManager {
createTaskbarUIControllerForActivity(mActivity));
}
if (ENABLE_TASKBAR_NO_RECREATION.get()) {
if (enableTaskbarNoRecreate()) {
addTaskbarRootViewToWindow();
mTaskbarRootLayout.removeAllViews();
mTaskbarRootLayout.addView(mTaskbarActivityContext.getDragLayer());
@@ -603,8 +603,7 @@ public class TaskbarManager {
}
private void addTaskbarRootViewToWindow() {
if (ENABLE_TASKBAR_NO_RECREATION.get() && !mAddedWindow
&& mTaskbarActivityContext != null) {
if (enableTaskbarNoRecreate() && !mAddedWindow && mTaskbarActivityContext != null) {
mWindowManager.addView(mTaskbarRootLayout,
mTaskbarActivityContext.getWindowLayoutParams());
mAddedWindow = true;
@@ -612,7 +611,7 @@ public class TaskbarManager {
}
private void removeTaskbarRootViewFromWindow() {
if (ENABLE_TASKBAR_NO_RECREATION.get() && mAddedWindow) {
if (enableTaskbarNoRecreate() && mAddedWindow) {
mWindowManager.removeViewImmediate(mTaskbarRootLayout);
mAddedWindow = false;
}

View File

@@ -202,9 +202,13 @@ public final class FeatureFlags {
public static final BooleanFlag ENABLE_TRANSIENT_TASKBAR = getDebugFlag(270395798,
"ENABLE_TRANSIENT_TASKBAR", ENABLED, "Enables transient taskbar.");
// Aconfig migration complete for ENABLE_TASKBAR_NO_RECREATION.
public static final BooleanFlag ENABLE_TASKBAR_NO_RECREATION = getDebugFlag(299193589,
"ENABLE_TASKBAR_NO_RECREATION", DISABLED,
"Enables taskbar with no recreation from lifecycle changes of TaskbarActivityContext.");
public static boolean enableTaskbarNoRecreate() {
return ENABLE_TASKBAR_NO_RECREATION.get() || Flags.enableTaskbarNoRecreate();
}
// TODO(Block 16): Clean up flags
// When enabled the promise icon is visible in all apps while installation an app.