From 35dc8758fb74b33d76f51f1f502355aeb9f5dd85 Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Fri, 30 Aug 2024 12:23:16 -0700 Subject: [PATCH] Removing obsolete flags Flag: EXEMPT legacy ENABLE_ALL_APPS_FROM_OVERVIEW and ENABLE_MULTI_DISPLAY_PARTIAL_DEPTH Test: Verified manually Bug: 270395073 Bug: 275132633 Change-Id: Ifa1db64dc037183faaef9e014d7c56275d61ed60 --- .../uioverrides/states/AllAppsState.java | 12 ---- .../PortraitStatesTouchController.java | 5 +- .../android/quickstep/AbsSwipeUpHandler.java | 62 ++----------------- .../quickstep/BaseContainerInterface.java | 3 - .../android/quickstep/DeviceConfigWrapper.kt | 8 --- .../quickstep/FallbackActivityInterface.java | 5 -- .../quickstep/LauncherActivityInterface.java | 9 --- .../quickstep/TaskAnimationManager.java | 5 +- .../AnimatorControllerWithResistance.java | 60 ++---------------- src/com/android/launcher3/DeviceProfile.java | 3 +- .../launcher3/config/FeatureFlags.java | 9 --- .../touch/AllAppsSwipeController.java | 37 ----------- 12 files changed, 11 insertions(+), 207 deletions(-) diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java b/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java index fa80dc2776..030a7acb48 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java +++ b/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java @@ -26,7 +26,6 @@ import com.android.launcher3.DeviceProfile; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherState; import com.android.launcher3.R; -import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.util.Themes; import com.android.launcher3.views.ActivityContext; import com.android.quickstep.util.BaseDepthController; @@ -201,17 +200,6 @@ public class AllAppsState extends LauncherState { : previousState == OVERVIEW ? OVERVIEW : NORMAL; } - @Override - public float[] getOverviewScaleAndOffset(Launcher launcher) { - if (!FeatureFlags.ENABLE_ALL_APPS_FROM_OVERVIEW.get()) { - return super.getOverviewScaleAndOffset(launcher); - } - // This handles the case of returning to the previous app from Overview -> All Apps gesture. - // This is the start scale/offset of overview that will be used for that transition. - // TODO (b/283336332): Translate in Y direction (ideally with overview resistance). - return new float[] {0.5f /* scale */, NO_OFFSET}; - } - @Override public int getWorkspaceScrimColor(Launcher launcher) { return launcher.getDeviceProfile().isTablet diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java index b5914a1880..b6a0ab30fe 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java @@ -29,7 +29,6 @@ import com.android.launcher3.DeviceProfile; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherState; import com.android.launcher3.allapps.AllAppsTransitionController; -import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.states.StateAnimationConfig; import com.android.launcher3.touch.AbstractStateChangeTouchController; import com.android.launcher3.touch.AllAppsSwipeController; @@ -93,9 +92,7 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr @Override protected LauncherState getTargetState(LauncherState fromState, boolean isDragTowardPositive) { if (fromState == ALL_APPS && !isDragTowardPositive) { - return FeatureFlags.ENABLE_ALL_APPS_FROM_OVERVIEW.get() - ? mLauncher.getStateManager().getLastState() - : NORMAL; + return NORMAL; } else if (fromState == NORMAL && shouldOpenAllApps(isDragTowardPositive)) { return ALL_APPS; } diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java index 05627be4d6..6b49f32dae 100644 --- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java @@ -45,7 +45,6 @@ import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR; import static com.android.launcher3.util.SystemUiController.UI_STATE_FULLSCREEN_TASK; import static com.android.launcher3.util.VibratorWrapper.OVERVIEW_HAPTIC; import static com.android.launcher3.util.window.RefreshRateTracker.getSingleFrameMs; -import static com.android.quickstep.GestureState.GestureEndTarget.ALL_APPS; import static com.android.quickstep.GestureState.GestureEndTarget.HOME; import static com.android.quickstep.GestureState.GestureEndTarget.LAST_TASK; import static com.android.quickstep.GestureState.GestureEndTarget.NEW_TASK; @@ -262,8 +261,6 @@ public abstract class AbsSwipeUpHandler - remoteTargetHandle.getTaskViewSimulator().setDrawsBelowRecents(isInAllAppsRegion)); - } - - private void buildAnimationController() { if (!canCreateNewOrUpdateExistingLauncherTransitionController()) { return; @@ -914,8 +878,6 @@ public abstract class AbsSwipeUpHandler= threshold); updateSysUiFlags(mCurrentShift.value); applyScrollAndTransform(); @@ -1198,9 +1160,6 @@ public abstract class AbsSwipeUpHandler Math.abs(endVelocity); final boolean isSwipeUp = endVelocity < 0; - if (mIsInAllAppsRegion) { - return isSwipeUp ? ALL_APPS : LAST_TASK; - } if (!isSwipeUp) { final boolean isCenteredOnNewTask = mRecentsView != null && mRecentsView.getDestinationPage() != mRecentsView.getRunningTaskIndex(); @@ -1337,9 +1293,7 @@ public abstract class AbsSwipeUpHandler mContext.getResources() .getDimension(R.dimen.quickstep_fling_threshold_speed); - if (mIsInAllAppsRegion) { - return ALL_APPS; - } else if (isScrollingToNewTask && isFlingX) { + if (isScrollingToNewTask && isFlingX) { // Flinging towards new task takes precedence over mIsMotionPaused (which only // checks y-velocity). return NEW_TASK; @@ -1394,8 +1348,7 @@ public abstract class AbsSwipeUpHandler> stateManager = - recentsView.getStateManager(); - if (stateManager.isInStableState(LauncherState.BACKGROUND_APP) - && stateManager.isInTransition()) { - - // Calculate the resistance progress threshold where All Apps will trigger. - float threshold = getAllAppsThreshold(context, recentsOrientedState, dp); - - StateAnimationConfig config = new StateAnimationConfig(); - AllAppsSwipeController.applyOverviewToAllAppsAnimConfig(dp, config, threshold); - AnimatorSet allAppsAnimator = stateManager.createAnimationToNewWorkspace( - LauncherState.ALL_APPS, config).getTarget(); - resistAnim.add(allAppsAnimator); - } - } - } - AnimatorPlaybackController resistanceController = resistAnim.createPlaybackController(); return new AnimatorControllerWithResistance(normalController, resistanceController); } - private static float getAllAppsThreshold(Context context, - RecentsOrientedState recentsOrientedState, DeviceProfile dp) { - int transitionDragLength = - recentsOrientedState.getContainerInterface().getSwipeUpDestinationAndLength( - dp, context, TEMP_RECT, - recentsOrientedState.getOrientationHandler()); - float dragLengthFactor = (float) dp.heightPx / transitionDragLength; - // -1s are because 0-1 is reserved for the normal transition. - float threshold = DeviceConfigWrapper.get().getAllAppsOverviewThreshold() / 100f; - return (threshold - 1) / (dragLengthFactor - 1); - } - /** * Creates the resistance animation for {@link #createForRecents}, or can be used separately * when starting from recents, i.e. {@link #createRecentsResistanceFromOverviewAnim}. @@ -305,17 +259,11 @@ public class AnimatorControllerWithResistance { this.translationTarget = translationTarget; this.translationProperty = translationProperty; if (dp.isTablet) { - resistanceParams = - recentsOrientedState.getContainerInterface().allowAllAppsFromOverview() - ? RecentsResistanceParams.FROM_APP_TO_ALL_APPS_TABLET - : enableGridOnlyOverview() - ? RecentsResistanceParams.FROM_APP_TABLET_GRID_ONLY - : RecentsResistanceParams.FROM_APP_TABLET; + resistanceParams = enableGridOnlyOverview() + ? RecentsResistanceParams.FROM_APP_TABLET_GRID_ONLY + : RecentsResistanceParams.FROM_APP_TABLET; } else { - resistanceParams = - recentsOrientedState.getContainerInterface().allowAllAppsFromOverview() - ? RecentsResistanceParams.FROM_APP_TO_ALL_APPS - : RecentsResistanceParams.FROM_APP; + resistanceParams = RecentsResistanceParams.FROM_APP; } } diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java index 5cbf6fba94..e8b5240b96 100644 --- a/src/com/android/launcher3/DeviceProfile.java +++ b/src/com/android/launcher3/DeviceProfile.java @@ -25,7 +25,6 @@ import static com.android.launcher3.InvariantDeviceProfile.INDEX_TWO_PANEL_LANDS import static com.android.launcher3.InvariantDeviceProfile.INDEX_TWO_PANEL_PORTRAIT; import static com.android.launcher3.Utilities.dpiFromPx; import static com.android.launcher3.Utilities.pxFromSp; -import static com.android.launcher3.config.FeatureFlags.ENABLE_MULTI_DISPLAY_PARTIAL_DEPTH; import static com.android.launcher3.folder.ClippedFolderIconLayoutRule.ICON_OVERLAP_FACTOR; import static com.android.launcher3.icons.GraphicsUtils.getShapePath; import static com.android.launcher3.icons.IconNormalizer.ICON_VISIBLE_AREA_FACTOR; @@ -435,7 +434,7 @@ public class DeviceProfile { bottomSheetCloseDuration = res.getInteger(R.integer.config_bottomSheetCloseDuration); if (isTablet) { bottomSheetWorkspaceScale = workspaceContentScale; - if (isMultiDisplay && !ENABLE_MULTI_DISPLAY_PARTIAL_DEPTH.get()) { + if (isMultiDisplay) { // TODO(b/259893832): Revert to use maxWallpaperScale to calculate bottomSheetDepth // when screen recorder bug is fixed. if (enableScalingRevealHomeAnimation()) { diff --git a/src/com/android/launcher3/config/FeatureFlags.java b/src/com/android/launcher3/config/FeatureFlags.java index d0596fac9e..ac3bfedec5 100644 --- a/src/com/android/launcher3/config/FeatureFlags.java +++ b/src/com/android/launcher3/config/FeatureFlags.java @@ -62,11 +62,6 @@ public final class FeatureFlags { * and set a default value for the flag. This will be the default value on Debug builds. *

*/ - // 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, @@ -85,10 +80,6 @@ public final class FeatureFlags { + "data preparation for loading the home screen"); // TODO(Block 4): Cleanup flags - 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"); diff --git a/src/com/android/launcher3/touch/AllAppsSwipeController.java b/src/com/android/launcher3/touch/AllAppsSwipeController.java index fe4a83b8d0..9dcdf22852 100644 --- a/src/com/android/launcher3/touch/AllAppsSwipeController.java +++ b/src/com/android/launcher3/touch/AllAppsSwipeController.java @@ -22,13 +22,9 @@ import static com.android.app.animation.Interpolators.EMPHASIZED_DECELERATE; import static com.android.app.animation.Interpolators.FINAL_FRAME; import static com.android.app.animation.Interpolators.INSTANT; import static com.android.app.animation.Interpolators.LINEAR; -import static com.android.app.animation.Interpolators.clampToProgress; -import static com.android.app.animation.Interpolators.mapToProgress; import static com.android.launcher3.LauncherState.ALL_APPS; import static com.android.launcher3.LauncherState.NORMAL; -import static com.android.launcher3.states.StateAnimationConfig.ANIM_ALL_APPS_BOTTOM_SHEET_FADE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_ALL_APPS_FADE; -import static com.android.launcher3.states.StateAnimationConfig.ANIM_ALL_APPS_KEYBOARD_FADE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_DEPTH; import static com.android.launcher3.states.StateAnimationConfig.ANIM_HOTSEAT_FADE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_HOTSEAT_SCALE; @@ -37,15 +33,12 @@ import static com.android.launcher3.states.StateAnimationConfig.ANIM_SCRIM_FADE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_VERTICAL_PROGRESS; import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_FADE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_SCALE; -import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_TRANSLATE; -import static com.android.launcher3.states.StateAnimationConfig.SKIP_OVERVIEW; import android.view.MotionEvent; import android.view.animation.Interpolator; import com.android.app.animation.Interpolators; import com.android.launcher3.AbstractFloatingView; -import com.android.launcher3.DeviceProfile; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherState; import com.android.launcher3.states.StateAnimationConfig; @@ -281,36 +274,6 @@ public class AllAppsSwipeController extends AbstractStateChangeTouchController { } } - /** - * Applies Animation config values for transition from overview to all apps. - * - * @param threshold progress at which all apps will open upon release - */ - public static void applyOverviewToAllAppsAnimConfig( - DeviceProfile deviceProfile, StateAnimationConfig config, float threshold) { - config.animProps |= StateAnimationConfig.USER_CONTROLLED; - config.animFlags = SKIP_OVERVIEW; - if (deviceProfile.isTablet) { - config.setInterpolator(ANIM_ALL_APPS_FADE, INSTANT); - config.setInterpolator(ANIM_SCRIM_FADE, ALL_APPS_SCRIM_RESPONDER); - // The fact that we end on Workspace is not very ideal, but since we do, fade it in at - // the end of the transition. Don't scale/translate it. - config.setInterpolator(ANIM_WORKSPACE_FADE, clampToProgress(LINEAR, 0.8f, 1)); - config.setInterpolator(ANIM_WORKSPACE_SCALE, INSTANT); - config.setInterpolator(ANIM_WORKSPACE_TRANSLATE, INSTANT); - } else { - // Pop the background panel, keyboard, and content in at full opacity at the threshold. - config.setInterpolator(ANIM_ALL_APPS_BOTTOM_SHEET_FADE, - thresholdInterpolator(threshold, INSTANT)); - config.setInterpolator(ANIM_ALL_APPS_KEYBOARD_FADE, - thresholdInterpolator(threshold, INSTANT)); - config.setInterpolator(ANIM_ALL_APPS_FADE, thresholdInterpolator(threshold, INSTANT)); - - config.setInterpolator(ANIM_VERTICAL_PROGRESS, - thresholdInterpolator(threshold, mapToProgress(LINEAR, threshold, 1f))); - } - } - /** Creates an interpolator that is 0 until the threshold, then follows given interpolator. */ private static Interpolator thresholdInterpolator(float threshold, Interpolator interpolator) { return progress -> progress <= threshold ? 0 : interpolator.getInterpolation(progress);