diff --git a/lawnchair/res/color/widgets_picker_scrim.xml b/lawnchair/res/color/widgets_picker_scrim.xml deleted file mode 100644 index fd868fb888..0000000000 --- a/lawnchair/res/color/widgets_picker_scrim.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - diff --git a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java index ba2c411096..42d561df5f 100644 --- a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java +++ b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java @@ -309,9 +309,9 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener boolean fromRecents = isLaunchingFromRecents(v, null /* targets */); RunnableList onEndCallback = new RunnableList(); - // Handle the case where an already visible task is launched which results in no - // transition - TaskRestartedDuringLaunchListener restartedListener = new TaskRestartedDuringLaunchListener(); + // Handle the case where an already visible task is launched which results in no transition + TaskRestartedDuringLaunchListener restartedListener = + new TaskRestartedDuringLaunchListener(); restartedListener.register(onEndCallback::executeAllAndDestroy); onEndCallback.add(restartedListener::unregister); @@ -1250,7 +1250,8 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener for (RemoteAnimationTarget target : targets) { if (target.mode == MODE_CLOSING) { numTargets++; - if (numTargets > 1 || target.windowConfiguration.getWindowingMode() == WINDOWING_MODE_MULTI_WINDOW) { + if (numTargets > 1 || target.windowConfiguration.getWindowingMode() + == WINDOWING_MODE_MULTI_WINDOW) { return true; } } @@ -1635,11 +1636,11 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener final boolean launcherIsForceInvisibleOrOpening = mLauncher.isForceInvisible() || launcherIsATargetWithMode(appTargets, MODE_OPENING); - View launcherView = findLauncherView(appTargets); - boolean playFallBackAnimation = (launcherView == null - && launcherIsForceInvisibleOrOpening) - || mLauncher.getWorkspace().isOverlayShown() - || shouldPlayFallbackClosingAnimation(appTargets); + View launcherView = findLauncherView(appTargets); + boolean playFallBackAnimation = (launcherView == null + && launcherIsForceInvisibleOrOpening) + || mLauncher.getWorkspace().isOverlayShown() + || shouldPlayFallbackClosingAnimation(appTargets); boolean playWorkspaceReveal = true; boolean skipAllAppsScale = false; @@ -2094,7 +2095,6 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener setCrossWindowBlursEnabled( CrossWindowBlurListeners.getInstance().isCrossWindowBlurEnabled()); } - // Make sure that the starting value matches the current depth set by the main // controller. stateDepth.setValue(launcher.getDepthController().stateDepth.getValue()); diff --git a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java index 600eaebf2e..fc9bd23e5e 100644 --- a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java @@ -940,8 +940,7 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT } /** - * Called whenever a new ui controller is set, and should update anything that - * depends on the + * Called whenever a new ui controller is set, and should update anything that depends on the * ui controller. */ public void onUiControllerChanged() { diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java index b267bdf972..2b888c6572 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java @@ -209,22 +209,22 @@ public class TaskbarLauncherStateController { } } - @Override - public void onStateTransitionComplete(LauncherState finalState) { - mLauncherState = finalState; - updateStateForFlag(FLAG_LAUNCHER_IN_STATE_TRANSITION, false); - // TODO(b/279514548) Cleans up bad state that can occur when user interacts with - // taskbar on top of transparent activity. - if (finalState == LauncherState.NORMAL && mLauncher.hasBeenResumed()) { - updateStateForFlag(FLAG_RESUMED, true); - } - applyState(); - boolean disallowLongClick = finalState == LauncherState.OVERVIEW_SPLIT_SELECT; - com.android.launcher3.taskbar.Utilities.setOverviewDragState( - mControllers, finalState.disallowTaskbarGlobalDrag(), - disallowLongClick, finalState.allowTaskbarInitialSplitSelection()); - } - }; + @Override + public void onStateTransitionComplete(LauncherState finalState) { + mLauncherState = finalState; + updateStateForFlag(FLAG_LAUNCHER_IN_STATE_TRANSITION, false); + // TODO(b/279514548) Cleans up bad state that can occur when user interacts with + // taskbar on top of transparent activity. + if (finalState == LauncherState.NORMAL && mLauncher.isResumed()) { + updateStateForFlag(FLAG_RESUMED, true); + } + applyState(); + boolean disallowLongClick = finalState == LauncherState.OVERVIEW_SPLIT_SELECT; + com.android.launcher3.taskbar.Utilities.setOverviewDragState( + mControllers, finalState.disallowTaskbarGlobalDrag(), + disallowLongClick, finalState.allowTaskbarInitialSplitSelection()); + } + }; /** * Initializes the controller instance, and applies the initial state diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java index 2a33485899..7d5b68581e 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java +++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java @@ -330,12 +330,13 @@ public class QuickstepLauncher extends Launcher { @Override public RunnableList startActivitySafely(View v, Intent intent, ItemInfo item) { - // Only pause is taskbar controller is not present until the transition (if it - // exists) ends + // Only pause is taskbar controller is not present until the transition (if it exists) ends mHotseatPredictionController.setPauseUIUpdate(getTaskbarUIController() == null); RunnableList result = super.startActivitySafely(v, intent, item); if (result == null) { - mHotseatPredictionController.setPauseUIUpdate(false); + if (getTaskbarUIController() == null) { + mHotseatPredictionController.setPauseUIUpdate(false); + } } else { result.add(() -> mHotseatPredictionController.setPauseUIUpdate(false)); } @@ -450,7 +451,10 @@ public class QuickstepLauncher extends Launcher { public void onDestroy() { mAppTransitionManager.onActivityDestroyed(); if (mUnfoldTransitionProgressProvider != null) { - SystemUiProxy.INSTANCE.get(this).setUnfoldAnimationListener(null); + if (FeatureFlags.RECEIVE_UNFOLD_EVENTS_FROM_SYSUI.get()) { + SystemUiProxy.INSTANCE.get(this).setUnfoldAnimationListener(null); + } + mUnfoldTransitionProgressProvider.destroy(); } mTISBindHelper.onDestroy(); @@ -1326,4 +1330,4 @@ public class QuickstepLauncher extends Launcher { } return super.onCreateView(parent, name, context, attrs); } -} \ No newline at end of file +} diff --git a/quickstep/src/com/android/quickstep/TaskAnimationManager.java b/quickstep/src/com/android/quickstep/TaskAnimationManager.java index c5bed9d74b..6c74e1716d 100644 --- a/quickstep/src/com/android/quickstep/TaskAnimationManager.java +++ b/quickstep/src/com/android/quickstep/TaskAnimationManager.java @@ -182,11 +182,9 @@ public class TaskAnimationManager implements RecentsAnimationCallbacks.RecentsAn // The only time we get onTasksAppeared() in button navigation with a // 3p launcher is if the user goes to overview first, and in this case we // can immediately finish the transition - RecentsView recentsView = activityInterface.getCreatedActivity().getOverviewPanel(); + RecentsView recentsView = + activityInterface.getCreatedActivity().getOverviewPanel(); if (recentsView != null) { - Log.d(TestProtocol.INCORRECT_HOME_STATE, - "finish recents animation on " - + compat.taskInfo.description); recentsView.finishRecentsAnimation(true, null); } return; diff --git a/quickstep/src/com/android/quickstep/TaskViewUtils.java b/quickstep/src/com/android/quickstep/TaskViewUtils.java index 289801c1a0..b8c9f1e9d6 100644 --- a/quickstep/src/com/android/quickstep/TaskViewUtils.java +++ b/quickstep/src/com/android/quickstep/TaskViewUtils.java @@ -494,11 +494,13 @@ public final class TaskViewUtils { } } if (taskId == initialTaskId) { - splitRoot1 = change.getParent() == null ? change : transitionInfo.getChange(change.getParent()); + splitRoot1 = change.getParent() == null ? change : + transitionInfo.getChange(change.getParent()); openingTargets.add(splitRoot1.getLeash()); } if (taskId == secondTaskId) { - splitRoot2 = change.getParent() == null ? change : transitionInfo.getChange(change.getParent()); + splitRoot2 = change.getParent() == null ? change : + transitionInfo.getChange(change.getParent()); openingTargets.add(splitRoot2.getLeash()); } } diff --git a/quickstep/src/com/android/quickstep/interaction/AllSetActivity.java b/quickstep/src/com/android/quickstep/interaction/AllSetActivity.java index 1a820a5c14..b4738a027c 100644 --- a/quickstep/src/com/android/quickstep/interaction/AllSetActivity.java +++ b/quickstep/src/com/android/quickstep/interaction/AllSetActivity.java @@ -270,9 +270,9 @@ public class AllSetActivity extends Activity { private void onTISConnected(TISBinder binder) { setSetupUIVisible(isResumed()); - binder.setSwipeUpProxy(isResumed() ? this::createSwipeUpProxy : null); - binder.setOverviewTargetChangeListener(binder::preloadOverviewForSUWAllSet); - binder.preloadOverviewForSUWAllSet(); + mBinder.setSwipeUpProxy(isResumed() ? this::createSwipeUpProxy : null); + mBinder.setOverviewTargetChangeListener(mBinder::preloadOverviewForSUWAllSet); + mBinder.preloadOverviewForSUWAllSet(); TaskbarManager taskbarManager = binder.getTaskbarManager(); if (taskbarManager != null) { mLauncherStartAnim = taskbarManager.createLauncherStartFromSuwAnim(MAX_SWIPE_DURATION); diff --git a/quickstep/src/com/android/quickstep/util/LauncherUnfoldAnimationController.java b/quickstep/src/com/android/quickstep/util/LauncherUnfoldAnimationController.java index 700e46f7c0..c3f1bdf4b8 100644 --- a/quickstep/src/com/android/quickstep/util/LauncherUnfoldAnimationController.java +++ b/quickstep/src/com/android/quickstep/util/LauncherUnfoldAnimationController.java @@ -293,4 +293,48 @@ public class LauncherUnfoldAnimationController implements OnDeviceProfileChangeL mHasRun = true; } } + + /** + * Class to track the current status of the external transition provider (the events are coming + * from the SystemUI side through IPC), it allows to check if the transition has already + * finished or currently running on the SystemUI side since last unfold. + */ + private static class TransitionStatusProvider implements TransitionProgressListener { + + private boolean mHasRun = false; + + @Override + public void onTransitionStarted() { + markAsRun(); + } + + @Override + public void onTransitionProgress(float progress) { + markAsRun(); + } + + @Override + public void onTransitionFinished() { + markAsRun(); + } + + /** + * Called when the device is folded, so we can reset the status of the animation + */ + public void onFolded() { + mHasRun = false; + } + + /** + * Returns true if there was an animation already (or it is currently running) after + * unfolding the device + */ + public boolean hasRun() { + return mHasRun; + } + + private void markAsRun() { + mHasRun = true; + } + } } diff --git a/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java b/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java index 5f42938b15..b4aa84922a 100644 --- a/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java @@ -47,7 +47,6 @@ import android.util.AttributeSet; import android.util.FloatProperty; import android.util.Log; import android.util.SparseArray; -import android.util.TypedValue; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.MotionEvent; @@ -302,9 +301,8 @@ public class ActivityAllAppsContainerView 0, 0 // Bottom left }; - final TypedValue value = new TypedValue(); - getContext().getTheme().resolveAttribute(android.R.attr.colorBackground, value, true); - mBottomSheetBackgroundColor = value.data; + mBottomSheetBackgroundColor = + Themes.getAttrColor(getContext(), R.attr.materialColorSurfaceDim); updateBackgroundVisibility(mActivityContext.getDeviceProfile()); mSearchUiManager.initializeSearch(this); } diff --git a/src/com/android/launcher3/config/FeatureFlags.java b/src/com/android/launcher3/config/FeatureFlags.java index 8993636c1a..cac3763fa7 100644 --- a/src/com/android/launcher3/config/FeatureFlags.java +++ b/src/com/android/launcher3/config/FeatureFlags.java @@ -46,219 +46,273 @@ import app.lawnchair.preferences2.PreferenceManager2; *

All the flags should be defined here with appropriate default values. */ public final class FeatureFlags { - @VisibleForTesting - public static Predicate sBooleanReader = f -> f.mCurrentValue; - @VisibleForTesting - public static ToIntFunction sIntReader = f -> f.mCurrentValue; - private FeatureFlags() { } - public static boolean showFlagTogglerUi(Context context) { - return Utilities.isDevelopersOptionsEnabled(context); - } - /** - * True when the build has come from Android Studio and is being used for local debugging. - * @deprecated Use {@link BuildConfig#IS_STUDIO_BUILD} directly - */ - @Deprecated - public static final boolean IS_STUDIO_BUILD = false; - /** - * Enable moving the QSB on the 0th screen of the workspace. This is not a configuration feature - * and should be modified at a project level. - * @deprecated Use {@link BuildConfig#QSB_ON_FIRST_SCREEN} directly - */ - @Deprecated - public static boolean topQsbOnFirstScreenEnabled(Context context) { - PreferenceManager2 preferenceManager2 = PreferenceManager2.getInstance(context); - return PreferenceExtensionsKt.firstBlocking(preferenceManager2.getEnableSmartspace()); - } - public static boolean showDotPagination(Context context) { - PreferenceManager2 preferenceManager2 = PreferenceManager2.getInstance(context); - return PreferenceExtensionsKt.firstBlocking(preferenceManager2.getEnableDotPagination()); - } - public static boolean showMaterialUPopup(Context context) { - PreferenceManager2 preferenceManager2 = PreferenceManager2.getInstance(context); - return PreferenceExtensionsKt.firstBlocking(preferenceManager2.getEnableMaterialUPopUp()); - } - /** - * Feature flag to handle define config changes dynamically instead of killing the process. - *

- * - * To add a new flag that can be toggled through the flags UI: - *

- * Declare a new ToggleableFlag below. Give it a unique key (e.g. "QSB_ON_FIRST_SCREEN"), - * and set a default value for the flag. This will be the default value on Debug builds. - *

- */ - // TODO(Block 1): Clean up flags - public static final BooleanFlag ENABLE_SEARCH_RESULT_BACKGROUND_DRAWABLES = getReleaseFlag( - 270394041, "ENABLE_SEARCH_RESULT_BACKGROUND_DRAWABLES", ENABLED, - "Enable option to replace decorator-based search result backgrounds with drawables"); - public static final BooleanFlag ENABLE_SEARCH_RESULT_LAUNCH_TRANSITION = getReleaseFlag( - 270394392, "ENABLE_SEARCH_RESULT_LAUNCH_TRANSITION", ENABLED, - "Enable option to launch search results using the new view container transitions"); - // TODO(Block 2): Clean up flags - public static final BooleanFlag ENABLE_MULTI_DISPLAY_PARTIAL_DEPTH = getDebugFlag(270395073, - "ENABLE_MULTI_DISPLAY_PARTIAL_DEPTH", DISABLED, - "Allow bottom sheet depth to be smaller than 1 for multi-display devices."); - // TODO(Block 3): Clean up flags - public static final BooleanFlag ENABLE_DISMISS_PREDICTION_UNDO = getDebugFlag(270394476, - "ENABLE_DISMISS_PREDICTION_UNDO", DISABLED, - "Show an 'Undo' snackbar when users dismiss a predicted hotseat item"); - public static final BooleanFlag CONTINUOUS_VIEW_TREE_CAPTURE = getDebugFlag(270395171, - "CONTINUOUS_VIEW_TREE_CAPTURE", DISABLED, "Capture View tree every frame"); - public static final BooleanFlag ENABLE_WORKSPACE_LOADING_OPTIMIZATION = getDebugFlag(251502424, - "ENABLE_WORKSPACE_LOADING_OPTIMIZATION", DISABLED, - "load the current workspace screen visible to the user before the rest rather than " - + "loading all of them at once."); - public static final BooleanFlag CHANGE_MODEL_DELEGATE_LOADING_ORDER = getDebugFlag(251502424, - "CHANGE_MODEL_DELEGATE_LOADING_ORDER", DISABLED, - "changes the timing of the loading and binding of delegate items during " - + "data preparation for loading the home screen"); - // TODO(Block 4): Cleanup flags - public static final BooleanFlag ENABLE_FLOATING_SEARCH_BAR = - getReleaseFlag(268388460, "ENABLE_FLOATING_SEARCH_BAR", DISABLED, - "Allow search bar to persist and animate across states, and attach to" - + " the keyboard from the bottom of the screen"); - public static final BooleanFlag ENABLE_ALL_APPS_FROM_OVERVIEW = - getDebugFlag(275132633, "ENABLE_ALL_APPS_FROM_OVERVIEW", DISABLED, - "Allow entering All Apps from Overview (e.g. long swipe up from app)"); - public static final BooleanFlag ENABLE_SHOW_KEYBOARD_OPTION_IN_ALL_APPS = getReleaseFlag( - 270394468, "ENABLE_SHOW_KEYBOARD_OPTION_IN_ALL_APPS", ENABLED, - "Enable option to show keyboard when going to all-apps"); - // TODO(Block 5): Clean up flags - public static final BooleanFlag ENABLE_TWOLINE_DEVICESEARCH = getDebugFlag(201388851, - "ENABLE_TWOLINE_DEVICESEARCH", ENABLED, - "Enable two line label for icons with labels on device search."); - public static final BooleanFlag ENABLE_ICON_IN_TEXT_HEADER = getDebugFlag(270395143, - "ENABLE_ICON_IN_TEXT_HEADER", DISABLED, "Show icon in textheader"); - public static final BooleanFlag ENABLE_PREMIUM_HAPTICS_ALL_APPS = getDebugFlag(270396358, - "ENABLE_PREMIUM_HAPTICS_ALL_APPS", DISABLED, - "Enables haptics opening/closing All apps"); - // TODO(Block 6): Clean up flags - public static final BooleanFlag ENABLE_ALL_APPS_SEARCH_IN_TASKBAR = getDebugFlag(270393900, - "ENABLE_ALL_APPS_SEARCH_IN_TASKBAR", DISABLED, - "Enables Search box in Taskbar All Apps."); - public static final BooleanFlag SECONDARY_DRAG_N_DROP_TO_PIN = getDebugFlag(270395140, - "SECONDARY_DRAG_N_DROP_TO_PIN", DISABLED, - "Enable dragging and dropping to pin apps within secondary display"); - // TODO(Block 7): Clean up flags - public static final BooleanFlag ENABLE_FORCED_MONO_ICON = getDebugFlag(270396209, - "ENABLE_FORCED_MONO_ICON", DISABLED, - "Enable the ability to generate monochromatic icons, if it is not provided by the app"); - // TODO(Block 8): Clean up flags - public static final BooleanFlag ENABLE_MATERIAL_U_POPUP = getDebugFlag(270395516, - "ENABLE_MATERIAL_U_POPUP", ENABLED, "Switch popup UX to use material U"); - // TODO(Block 9): Clean up flags - public static final BooleanFlag ENABLE_DOWNLOAD_APP_UX_V2 = getReleaseFlag(270395134, - "ENABLE_DOWNLOAD_APP_UX_V2", ENABLED, "Updates the download app UX" - + " to have better visuals"); - public static final BooleanFlag ENABLE_DOWNLOAD_APP_UX_V3 = getDebugFlag(270395186, - "ENABLE_DOWNLOAD_APP_UX_V3", ENABLED, "Updates the download app UX" - + " to have better visuals, improve contrast, and color"); - public static final BooleanFlag SHOW_DOT_PAGINATION = getDebugFlag(270395278, - "SHOW_DOT_PAGINATION", ENABLED, "Enable showing dot pagination in workspace"); - public static final BooleanFlag LARGE_SCREEN_WIDGET_PICKER = getDebugFlag(270395809, - "LARGE_SCREEN_WIDGET_PICKER", ENABLED, "Enable new widget picker that takes " - + "advantage of large screen format"); - public static final BooleanFlag MULTI_SELECT_EDIT_MODE = getDebugFlag(270709220, - "MULTI_SELECT_EDIT_MODE", DISABLED, "Enable new multi-select edit mode " - + "for home screen"); - // TODO(Block 10): Clean up flags - public static final BooleanFlag ENABLE_BACK_SWIPE_LAUNCHER_ANIMATION = getDebugFlag(270614790, - "ENABLE_BACK_SWIPE_LAUNCHER_ANIMATION", DISABLED, - "Enables predictive back animation from all apps and widgets to home"); - // TODO(Block 11): Clean up flags - public static final BooleanFlag FOLDABLE_SINGLE_PAGE = getDebugFlag(270395274, - "FOLDABLE_SINGLE_PAGE", DISABLED, "Use a single page for the workspace"); - public static final BooleanFlag ENABLE_PARAMETRIZE_REORDER = getDebugFlag(289420844, - "ENABLE_PARAMETRIZE_REORDER", DISABLED, - "Enables generating the reorder using a set of parameters"); - // TODO(Block 12): Clean up flags - public static final BooleanFlag ENABLE_MULTI_INSTANCE = getDebugFlag(270396680, - "ENABLE_MULTI_INSTANCE", DISABLED, - "Enables creation and filtering of multiple task instances in overview"); - // TODO(Block 13): Clean up flags - public static final BooleanFlag ENABLE_DEVICE_SEARCH_PERFORMANCE_LOGGING = getReleaseFlag( - 270391397, "ENABLE_DEVICE_SEARCH_PERFORMANCE_LOGGING", DISABLED, - "Allows on device search in all apps logging"); - // TODO(Block 14): Cleanup flags - public static final BooleanFlag NOTIFY_CRASHES = getDebugFlag(270393108, "NOTIFY_CRASHES", - TEAMFOOD, "Sends a notification whenever launcher encounters an uncaught exception."); - public static final BooleanFlag ENABLE_TRANSIENT_TASKBAR = getDebugFlag(270395798, - "ENABLE_TRANSIENT_TASKBAR", ENABLED, "Enables transient taskbar."); - // TODO(Block 16): Clean up flags - // When enabled the promise icon is visible in all apps while installation an app. - public static final BooleanFlag PROMISE_APPS_IN_ALL_APPS = getDebugFlag(270390012, - "PROMISE_APPS_IN_ALL_APPS", DISABLED, "Add promise icon in all-apps"); - public static final BooleanFlag KEYGUARD_ANIMATION = getDebugFlag(270390904, - "KEYGUARD_ANIMATION", DISABLED, - "Enable animation for keyguard going away on wallpaper"); - public static final BooleanFlag ENABLE_DEVICE_SEARCH = getReleaseFlag(270390907, - "ENABLE_DEVICE_SEARCH", ENABLED, "Allows on device search in all apps"); - public static final BooleanFlag ENABLE_HIDE_HEADER = getReleaseFlag(270390930, - "ENABLE_HIDE_HEADER", ENABLED, "Hide header on keyboard before typing in all apps"); - public static final BooleanFlag ENABLE_EXPANDING_PAUSE_WORK_BUTTON = getDebugFlag(270390779, - "ENABLE_EXPANDING_PAUSE_WORK_BUTTON", DISABLED, - "Expand and collapse pause work button while scrolling"); - public static final BooleanFlag COLLECT_SEARCH_HISTORY = getReleaseFlag(270391455, - "COLLECT_SEARCH_HISTORY", DISABLED, "Allow launcher to collect search history for log"); - public static final BooleanFlag ENABLE_TWOLINE_ALLAPPS = getDebugFlag(270390937, - "ENABLE_TWOLINE_ALLAPPS", DISABLED, "Enables two line label inside all apps."); - public static final BooleanFlag IME_STICKY_SNACKBAR_EDU = getDebugFlag(270391693, - "IME_STICKY_SNACKBAR_EDU", ENABLED, "Show sticky IME edu in AllApps"); - public static final BooleanFlag ENABLE_PEOPLE_TILE_PREVIEW = getDebugFlag(270391653, - "ENABLE_PEOPLE_TILE_PREVIEW", DISABLED, - "Experimental: Shows conversation shortcuts on home screen as search results"); - public static final BooleanFlag FOLDER_NAME_MAJORITY_RANKING = getDebugFlag(270391638, - "FOLDER_NAME_MAJORITY_RANKING", ENABLED, - "Suggests folder names based on majority based ranking."); - public static final BooleanFlag INJECT_FALLBACK_APP_CORPUS_RESULTS = getReleaseFlag(270391706, - "INJECT_FALLBACK_APP_CORPUS_RESULTS", DISABLED, - "Inject fallback app corpus result when AiAi fails to return it."); - public static final BooleanFlag ENABLE_LONG_PRESS_NAV_HANDLE = - getReleaseFlag(282993230, "ENABLE_LONG_PRESS_NAV_HANDLE_MPR", TEAMFOOD, - "Enables long pressing on the bottom bar nav handle to trigger events."); - // TODO(Block 17): Clean up flags - public static final BooleanFlag ENABLE_TASKBAR_PINNING = getDebugFlag(270396583, - "ENABLE_TASKBAR_PINNING", DISABLED, - "Enables taskbar pinning to allow user to switch between transient and persistent " - + "taskbar flavors"); - // TODO(Block 18): Clean up flags - public static final BooleanFlag ENABLE_APP_PAIRS = getDebugFlag(274189428, - "ENABLE_APP_PAIRS", DISABLED, - "Enables the ability to create and save app pairs on the Home screen for easy" - + " split screen launching."); - // TODO(Block 19): Clean up flags - public static final BooleanFlag SCROLL_TOP_TO_RESET = getReleaseFlag(270395177, - "SCROLL_TOP_TO_RESET", ENABLED, - "Bring up IME and focus on input when scroll to top if 'Always show keyboard'" - + " is enabled or in prefix state"); - public static final BooleanFlag ENABLE_SEARCH_UNINSTALLED_APPS = getReleaseFlag(270395269, - "ENABLE_SEARCH_UNINSTALLED_APPS", ENABLED, "Search uninstalled app results."); - // TODO(Block 20): Clean up flags - public static final BooleanFlag ENABLE_SCRIM_FOR_APP_LAUNCH = getDebugFlag(270393276, - "ENABLE_SCRIM_FOR_APP_LAUNCH", DISABLED, "Enables scrim during app launch animation."); - public static final BooleanFlag ENABLE_BACK_SWIPE_HOME_ANIMATION = getDebugFlag(270393426, - "ENABLE_BACK_SWIPE_HOME_ANIMATION", ENABLED, - "Enables home animation to icon when user swipes back."); - public static final BooleanFlag ENABLE_DYNAMIC_TASKBAR_THRESHOLDS = getDebugFlag(294252473, - "ENABLE_DYNAMIC_TASKBAR_THRESHOLDS", ENABLED, - "Enables taskbar thresholds that scale based on screen size."); - // TODO(Block 21): Clean up flags - public static final BooleanFlag ENABLE_APP_ICON_FOR_INLINE_SHORTCUTS = getDebugFlag(270395087, - "ENABLE_APP_ICON_IN_INLINE_SHORTCUTS", DISABLED, "Show app icon for inline shortcut"); - // TODO(Block 22): Clean up flags - public static final BooleanFlag ENABLE_WIDGET_TRANSITION_FOR_RESIZING = getDebugFlag(268553314, - "ENABLE_WIDGET_TRANSITION_FOR_RESIZING", DISABLED, - "Enable widget transition animation when resizing the widgets"); - public static final BooleanFlag PREEMPTIVE_UNFOLD_ANIMATION_START = getDebugFlag(270397209, - "PREEMPTIVE_UNFOLD_ANIMATION_START", ENABLED, - "Enables starting the unfold animation preemptively when unfolding, without" - + "waiting for SystemUI and then merging the SystemUI progress whenever we " - + "start receiving the events"); - // TODO(Block 23): Clean up flags - public static final BooleanFlag ENABLE_GRID_ONLY_OVERVIEW = getDebugFlag(270397206, - "ENABLE_GRID_ONLY_OVERVIEW", TEAMFOOD, - "Enable a grid-only overview without a focused task."); + + @VisibleForTesting + public static Predicate sBooleanReader = f -> f.mCurrentValue; + @VisibleForTesting + public static ToIntFunction sIntReader = f -> f.mCurrentValue; + + private FeatureFlags() { } + + public static boolean showFlagTogglerUi(Context context) { + return BuildConfig.IS_DEBUG_DEVICE && Utilities.isDevelopersOptionsEnabled(context); + } + + /** + * True when the build has come from Android Studio and is being used for local debugging. + * @deprecated Use {@link BuildConfig#IS_STUDIO_BUILD} directly + */ + @Deprecated + public static final boolean IS_STUDIO_BUILD = BuildConfig.IS_STUDIO_BUILD; + + /** + * Enable moving the QSB on the 0th screen of the workspace. This is not a configuration feature + * and should be modified at a project level. + * @deprecated Use {@link BuildConfig#QSB_ON_FIRST_SCREEN} directly + */ + @Deprecated + public static final boolean QSB_ON_FIRST_SCREEN = BuildConfig.QSB_ON_FIRST_SCREEN; + + /** + * Feature flag to handle define config changes dynamically instead of killing the process. + *

+ * + * To add a new flag that can be toggled through the flags UI: + *

+ * Declare a new ToggleableFlag below. Give it a unique key (e.g. "QSB_ON_FIRST_SCREEN"), + * and set a default value for the flag. This will be the default value on Debug builds. + *

+ */ + // TODO(Block 1): Clean up flags + public static final BooleanFlag ENABLE_ONE_SEARCH_MOTION = getReleaseFlag(270394223, + "ENABLE_ONE_SEARCH_MOTION", ENABLED, "Enables animations in OneSearch."); + + public static final BooleanFlag ENABLE_SEARCH_RESULT_BACKGROUND_DRAWABLES = getReleaseFlag( + 270394041, "ENABLE_SEARCH_RESULT_BACKGROUND_DRAWABLES", DISABLED, + "Enable option to replace decorator-based search result backgrounds with drawables"); + + public static final BooleanFlag ENABLE_SEARCH_RESULT_LAUNCH_TRANSITION = getReleaseFlag( + 270394392, "ENABLE_SEARCH_RESULT_LAUNCH_TRANSITION", DISABLED, + "Enable option to launch search results using the new view container transitions"); + + // TODO(Block 2): Clean up flags + public static final BooleanFlag ENABLE_MULTI_DISPLAY_PARTIAL_DEPTH = getDebugFlag(270395073, + "ENABLE_MULTI_DISPLAY_PARTIAL_DEPTH", DISABLED, + "Allow bottom sheet depth to be smaller than 1 for multi-display devices."); + + // TODO(Block 3): Clean up flags + public static final BooleanFlag ENABLE_DISMISS_PREDICTION_UNDO = getDebugFlag(270394476, + "ENABLE_DISMISS_PREDICTION_UNDO", DISABLED, + "Show an 'Undo' snackbar when users dismiss a predicted hotseat item"); + + public static final BooleanFlag CONTINUOUS_VIEW_TREE_CAPTURE = getDebugFlag(270395171, + "CONTINUOUS_VIEW_TREE_CAPTURE", ENABLED, "Capture View tree every frame"); + + public static final BooleanFlag ENABLE_WORKSPACE_LOADING_OPTIMIZATION = getDebugFlag(251502424, + "ENABLE_WORKSPACE_LOADING_OPTIMIZATION", DISABLED, + "load the current workspace screen visible to the user before the rest rather than " + + "loading all of them at once."); + + public static final BooleanFlag CHANGE_MODEL_DELEGATE_LOADING_ORDER = getDebugFlag(251502424, + "CHANGE_MODEL_DELEGATE_LOADING_ORDER", DISABLED, + "changes the timing of the loading and binding of delegate items during " + + "data preparation for loading the home screen"); + + // TODO(Block 4): Cleanup flags + public static final BooleanFlag ENABLE_FLOATING_SEARCH_BAR = + getReleaseFlag(268388460, "ENABLE_FLOATING_SEARCH_BAR", DISABLED, + "Keep All Apps search bar at the bottom (but above keyboard if open)"); + + public static final BooleanFlag ENABLE_ALL_APPS_FROM_OVERVIEW = + getDebugFlag(275132633, "ENABLE_ALL_APPS_FROM_OVERVIEW", DISABLED, + "Allow entering All Apps from Overview (e.g. long swipe up from app)"); + + public static final BooleanFlag ENABLE_SHOW_KEYBOARD_OPTION_IN_ALL_APPS = getReleaseFlag( + 270394468, "ENABLE_SHOW_KEYBOARD_OPTION_IN_ALL_APPS", ENABLED, + "Enable option to show keyboard when going to all-apps"); + + // TODO(Block 5): Clean up flags + public static final BooleanFlag ENABLE_TWOLINE_DEVICESEARCH = getDebugFlag(201388851, + "ENABLE_TWOLINE_DEVICESEARCH", TEAMFOOD, + "Enable two line label for icons with labels on device search."); + + public static final BooleanFlag ENABLE_ICON_IN_TEXT_HEADER = getDebugFlag(270395143, + "ENABLE_ICON_IN_TEXT_HEADER", DISABLED, "Show icon in textheader"); + + public static final BooleanFlag ENABLE_PREMIUM_HAPTICS_ALL_APPS = getDebugFlag(270396358, + "ENABLE_PREMIUM_HAPTICS_ALL_APPS", DISABLED, + "Enables haptics opening/closing All apps"); + + // TODO(Block 6): Clean up flags + public static final BooleanFlag ENABLE_ALL_APPS_SEARCH_IN_TASKBAR = getDebugFlag(270393900, + "ENABLE_ALL_APPS_SEARCH_IN_TASKBAR", DISABLED, + "Enables Search box in Taskbar All Apps."); + + public static final BooleanFlag SECONDARY_DRAG_N_DROP_TO_PIN = getDebugFlag(270395140, + "SECONDARY_DRAG_N_DROP_TO_PIN", DISABLED, + "Enable dragging and dropping to pin apps within secondary display"); + + // TODO(Block 7): Clean up flags + public static final BooleanFlag ENABLE_FORCED_MONO_ICON = getDebugFlag(270396209, + "ENABLE_FORCED_MONO_ICON", DISABLED, + "Enable the ability to generate monochromatic icons, if it is not provided by the app"); + + // TODO(Block 8): Clean up flags + public static final BooleanFlag ENABLE_MATERIAL_U_POPUP = getDebugFlag(270395516, + "ENABLE_MATERIAL_U_POPUP", ENABLED, "Switch popup UX to use material U"); + + // TODO(Block 9): Clean up flags + public static final BooleanFlag ENABLE_DOWNLOAD_APP_UX_V2 = getReleaseFlag(270395134, + "ENABLE_DOWNLOAD_APP_UX_V2", ENABLED, "Updates the download app UX" + + " to have better visuals"); + + public static final BooleanFlag ENABLE_DOWNLOAD_APP_UX_V3 = getDebugFlag(270395186, + "ENABLE_DOWNLOAD_APP_UX_V3", ENABLED, "Updates the download app UX" + + " to have better visuals, improve contrast, and color"); + + public static final BooleanFlag SHOW_DOT_PAGINATION = getDebugFlag(270395278, + "SHOW_DOT_PAGINATION", ENABLED, "Enable showing dot pagination in workspace"); + + public static final BooleanFlag LARGE_SCREEN_WIDGET_PICKER = getDebugFlag(270395809, + "LARGE_SCREEN_WIDGET_PICKER", ENABLED, "Enable new widget picker that takes " + + "advantage of large screen format"); + + public static final BooleanFlag MULTI_SELECT_EDIT_MODE = getDebugFlag(270709220, + "MULTI_SELECT_EDIT_MODE", DISABLED, "Enable new multi-select edit mode " + + "for home screen"); + + // TODO(Block 10): Clean up flags + public static final BooleanFlag ENABLE_BACK_SWIPE_LAUNCHER_ANIMATION = getDebugFlag(270614790, + "ENABLE_BACK_SWIPE_LAUNCHER_ANIMATION", DISABLED, + "Enables predictive back animation from all apps and widgets to home"); + + // TODO(Block 11): Clean up flags + public static final BooleanFlag ENABLE_TWO_PANEL_HOME = getDebugFlag(270392643, + "ENABLE_TWO_PANEL_HOME", ENABLED, + "Uses two panel on home screen. Only applicable on large screen devices."); + + public static final BooleanFlag FOLDABLE_WORKSPACE_REORDER = getDebugFlag(270395070, + "FOLDABLE_WORKSPACE_REORDER", DISABLED, + "In foldables, when reordering the icons and widgets, is now going to use both sides"); + + public static final BooleanFlag FOLDABLE_SINGLE_PAGE = getDebugFlag(270395274, + "FOLDABLE_SINGLE_PAGE", DISABLED, "Use a single page for the workspace"); + + // TODO(Block 12): Clean up flags + public static final BooleanFlag ENABLE_MULTI_INSTANCE = getDebugFlag(270396680, + "ENABLE_MULTI_INSTANCE", DISABLED, + "Enables creation and filtering of multiple task instances in overview"); + + // TODO(Block 13): Clean up flags + public static final BooleanFlag ENABLE_DEVICE_SEARCH_PERFORMANCE_LOGGING = getReleaseFlag( + 270391397, "ENABLE_DEVICE_SEARCH_PERFORMANCE_LOGGING", DISABLED, + "Allows on device search in all apps logging"); + + // TODO(Block 14): Cleanup flags + public static final BooleanFlag NOTIFY_CRASHES = getDebugFlag(270393108, "NOTIFY_CRASHES", + TEAMFOOD, "Sends a notification whenever launcher encounters an uncaught exception."); + + public static final BooleanFlag ENABLE_TRANSIENT_TASKBAR = getDebugFlag(270395798, + "ENABLE_TRANSIENT_TASKBAR", ENABLED, "Enables transient taskbar."); + + // TODO(Block 16): Clean up flags + // When enabled the promise icon is visible in all apps while installation an app. + public static final BooleanFlag PROMISE_APPS_IN_ALL_APPS = getDebugFlag(270390012, + "PROMISE_APPS_IN_ALL_APPS", DISABLED, "Add promise icon in all-apps"); + + public static final BooleanFlag KEYGUARD_ANIMATION = getDebugFlag(270390904, + "KEYGUARD_ANIMATION", DISABLED, + "Enable animation for keyguard going away on wallpaper"); + + public static final BooleanFlag ENABLE_DEVICE_SEARCH = getReleaseFlag(270390907, + "ENABLE_DEVICE_SEARCH", ENABLED, "Allows on device search in all apps"); + + public static final BooleanFlag ENABLE_HIDE_HEADER = getReleaseFlag(270390930, + "ENABLE_HIDE_HEADER", ENABLED, "Hide header on keyboard before typing in all apps"); + + public static final BooleanFlag ENABLE_EXPANDING_PAUSE_WORK_BUTTON = getDebugFlag(270390779, + "ENABLE_EXPANDING_PAUSE_WORK_BUTTON", DISABLED, + "Expand and collapse pause work button while scrolling"); + + public static final BooleanFlag COLLECT_SEARCH_HISTORY = getReleaseFlag(270391455, + "COLLECT_SEARCH_HISTORY", DISABLED, "Allow launcher to collect search history for log"); + + public static final BooleanFlag ENABLE_TWOLINE_ALLAPPS = getDebugFlag(270390937, + "ENABLE_TWOLINE_ALLAPPS", TEAMFOOD, "Enables two line label inside all apps."); + + public static final BooleanFlag IME_STICKY_SNACKBAR_EDU = getDebugFlag(270391693, + "IME_STICKY_SNACKBAR_EDU", ENABLED, "Show sticky IME edu in AllApps"); + + public static final BooleanFlag ENABLE_PEOPLE_TILE_PREVIEW = getDebugFlag(270391653, + "ENABLE_PEOPLE_TILE_PREVIEW", DISABLED, + "Experimental: Shows conversation shortcuts on home screen as search results"); + + public static final BooleanFlag FOLDER_NAME_MAJORITY_RANKING = getDebugFlag(270391638, + "FOLDER_NAME_MAJORITY_RANKING", ENABLED, + "Suggests folder names based on majority based ranking."); + + public static final BooleanFlag INJECT_FALLBACK_APP_CORPUS_RESULTS = getReleaseFlag(270391706, + "INJECT_FALLBACK_APP_CORPUS_RESULTS", DISABLED, + "Inject fallback app corpus result when AiAi fails to return it."); + + // TODO(Block 17): Clean up flags + public static final BooleanFlag ENABLE_TASKBAR_PINNING = getDebugFlag(270396583, + "ENABLE_TASKBAR_PINNING", DISABLED, + "Enables taskbar pinning to allow user to switch between transient and persistent " + + "taskbar flavors"); + + // TODO(Block 18): Clean up flags + public static final BooleanFlag ENABLE_LAUNCH_FROM_STAGED_APP = getDebugFlag(270395567, + "ENABLE_LAUNCH_FROM_STAGED_APP", ENABLED, + "Enable the ability to tap a staged app during split select to launch it in full " + + "screen"); + + public static final BooleanFlag ENABLE_APP_PAIRS = getDebugFlag(274189428, + "ENABLE_APP_PAIRS", DISABLED, + "Enables the ability to create and save app pairs on the Home screen for easy" + + " split screen launching."); + + // TODO(Block 19): Clean up flags + public static final BooleanFlag SCROLL_TOP_TO_RESET = getReleaseFlag(270395177, + "SCROLL_TOP_TO_RESET", ENABLED, + "Bring up IME and focus on input when scroll to top if 'Always show keyboard'" + + " is enabled or in prefix state"); + + public static final BooleanFlag ENABLE_SEARCH_UNINSTALLED_APPS = getReleaseFlag(270395269, + "ENABLE_SEARCH_UNINSTALLED_APPS", DISABLED, "Search uninstalled app results."); + + // TODO(Block 20): Clean up flags + public static final BooleanFlag ENABLE_SCRIM_FOR_APP_LAUNCH = getDebugFlag(270393276, + "ENABLE_SCRIM_FOR_APP_LAUNCH", DISABLED, "Enables scrim during app launch animation."); + + public static final BooleanFlag ENABLE_BACK_SWIPE_HOME_ANIMATION = getDebugFlag(270393426, + "ENABLE_BACK_SWIPE_HOME_ANIMATION", ENABLED, + "Enables home animation to icon when user swipes back."); + + // TODO(Block 21): Clean up flags + public static final BooleanFlag ENABLE_APP_ICON_FOR_INLINE_SHORTCUTS = getDebugFlag(270395087, + "ENABLE_APP_ICON_IN_INLINE_SHORTCUTS", DISABLED, "Show app icon for inline shortcut"); + + // TODO(Block 22): Clean up flags + public static final BooleanFlag RECEIVE_UNFOLD_EVENTS_FROM_SYSUI = getDebugFlag(270397209, + "RECEIVE_UNFOLD_EVENTS_FROM_SYSUI", ENABLED, + "Enables receiving unfold animation events from sysui instead of calculating " + + "them in launcher process using hinge sensor values."); + + public static final BooleanFlag ENABLE_WIDGET_TRANSITION_FOR_RESIZING = getDebugFlag(268553314, + "ENABLE_WIDGET_TRANSITION_FOR_RESIZING", DISABLED, + "Enable widget transition animation when resizing the widgets"); + + public static final BooleanFlag PREEMPTIVE_UNFOLD_ANIMATION_START = getDebugFlag(270397209, + "PREEMPTIVE_UNFOLD_ANIMATION_START", ENABLED, + "Enables starting the unfold animation preemptively when unfolding, without" + + "waiting for SystemUI and then merging the SystemUI progress whenever we " + + "start receiving the events"); + + // TODO(Block 23): Clean up flags + public static final BooleanFlag ENABLE_GRID_ONLY_OVERVIEW = getDebugFlag(270397206, + "ENABLE_GRID_ONLY_OVERVIEW", DISABLED, + "Enable a grid-only overview without a focused task."); public static final BooleanFlag ENABLE_SPLIT_LAUNCH_DATA_REFACTOR = getDebugFlag(270397202, "ENABLE_SPLIT_LAUNCH_DATA_REFACTOR", DISABLED, diff --git a/src/com/android/launcher3/folder/LauncherDelegate.java b/src/com/android/launcher3/folder/LauncherDelegate.java index 283257ad49..51a3787384 100644 --- a/src/com/android/launcher3/folder/LauncherDelegate.java +++ b/src/com/android/launcher3/folder/LauncherDelegate.java @@ -94,6 +94,9 @@ public class LauncherDelegate { // folder CellLayout cellLayout = mLauncher.getCellLayout(info.container, mLauncher.getCellPosMapper().mapModelToPresenter(info).screenId); + if (cellLayout == null) { + return; + } finalItem = info.contents.remove(0); newIcon = mLauncher.createShortcut(cellLayout, finalItem); mLauncher.getModelWriter().addOrMoveItemInDatabase(finalItem,