From 3815a095f18fc626745b9526a69b0bc1c92e7e5a Mon Sep 17 00:00:00 2001 From: Vinit Nayak Date: Mon, 13 Jan 2025 18:14:47 -0500 Subject: [PATCH] Remove and cleanup splitContextual flag Bug: 276361926 Flag: EXEMPT removing flag Change-Id: I6f567a8aae5b962f36ec2bc96b7fb05906b4ff2f --- .../TaskbarLauncherStateController.java | 5 +- .../uioverrides/QuickstepLauncher.java | 25 ++++------ .../uioverrides/RecentsViewStateController.kt | 23 +-------- .../uioverrides/states/OverviewState.java | 5 +- .../NavBarToHomeTouchController.java | 5 +- .../fallback/FallbackRecentsView.java | 6 +-- .../util/SplitAnimationController.kt | 6 +-- .../util/SplitSelectStateController.java | 5 +- .../util/SplitToWorkspaceController.java | 2 +- .../SplitWithKeyboardShortcutController.java | 6 +-- .../quickstep/views/LauncherRecentsView.java | 6 +-- .../android/quickstep/views/RecentsView.java | 47 +++++-------------- .../views/SplitInstructionsView.java | 46 +++++++++--------- .../quickstep/TaplTestsSplitscreen.java | 18 ++----- src/com/android/launcher3/Launcher.java | 4 +- .../launcher3/config/FeatureFlags.java | 9 ---- .../testing/TestInformationHandler.java | 5 +- .../touch/ItemLongClickListener.java | 2 +- .../touch/WorkspaceTouchListener.java | 2 +- 19 files changed, 65 insertions(+), 162 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java index 1905561225..9a9575debc 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java @@ -393,10 +393,7 @@ public class TaskbarLauncherStateController { * @param launcherState The current state launcher is in */ private void updateOverviewDragState(LauncherState launcherState) { - boolean disallowLongClick = - FeatureFlags.enableSplitContextually() - ? mLauncher.isSplitSelectionActive() || mIsAnimatingToLauncher - : launcherState == LauncherState.OVERVIEW_SPLIT_SELECT; + boolean disallowLongClick = mLauncher.isSplitSelectionActive() || mIsAnimatingToLauncher; com.android.launcher3.taskbar.Utilities.setOverviewDragState( mControllers, launcherState.disallowTaskbarGlobalDrag(), disallowLongClick, launcherState.allowTaskbarInitialSplitSelection()); diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java index d3ac4110f1..810325c437 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java +++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java @@ -39,7 +39,6 @@ import static com.android.launcher3.LauncherState.OVERVIEW_MODAL_TASK; import static com.android.launcher3.LauncherState.OVERVIEW_SPLIT_SELECT; import static com.android.launcher3.Utilities.isRtl; import static com.android.launcher3.compat.AccessibilityManagerCompat.sendCustomAccessibilityEvent; -import static com.android.launcher3.config.FeatureFlags.enableSplitContextually; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_APP_LAUNCH_TAP; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_SPLIT_SELECTION_EXIT_HOME; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_SPLIT_SELECTION_EXIT_INTERRUPTED; @@ -723,11 +722,7 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer, splitSelectSource.alreadyRunningTaskId = taskWasFound ? foundTask.key.id : INVALID_TASK_ID; - if (enableSplitContextually()) { - startSplitToHome(splitSelectSource); - } else { - recentsView.initiateSplitSelect(splitSelectSource); - } + startSplitToHome(splitSelectSource); } ); } @@ -817,15 +812,13 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer, super.onPause(); - if (enableSplitContextually()) { - // If Launcher pauses before both split apps are selected, exit split screen. - if (!mSplitSelectStateController.isBothSplitAppsConfirmed() && - !mSplitSelectStateController.isLaunchingFirstAppFullscreen()) { - mSplitSelectStateController - .logExitReason(LAUNCHER_SPLIT_SELECTION_EXIT_INTERRUPTED); - mSplitSelectStateController.getSplitAnimationController() - .playPlaceholderDismissAnim(this, LAUNCHER_SPLIT_SELECTION_EXIT_INTERRUPTED); - } + // If Launcher pauses before both split apps are selected, exit split screen. + if (!mSplitSelectStateController.isBothSplitAppsConfirmed() && + !mSplitSelectStateController.isLaunchingFirstAppFullscreen()) { + mSplitSelectStateController + .logExitReason(LAUNCHER_SPLIT_SELECTION_EXIT_INTERRUPTED); + mSplitSelectStateController.getSplitAnimationController() + .playPlaceholderDismissAnim(this, LAUNCHER_SPLIT_SELECTION_EXIT_INTERRUPTED); } if (mTaskbarUIController != null && FeatureFlags.enableHomeTransitionListener()) { @@ -1424,7 +1417,7 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer, @Override public boolean handleIncorrectSplitTargetSelection() { - if (!enableSplitContextually() || !mSplitSelectStateController.isSplitSelectActive()) { + if (!mSplitSelectStateController.isSplitSelectActive()) { return false; } mSplitSelectStateController.getSplitInstructionsView().goBoing(); diff --git a/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.kt b/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.kt index f1965481a1..c8f46a9dd7 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.kt +++ b/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.kt @@ -26,7 +26,6 @@ import com.android.launcher3.anim.AnimatedFloat import com.android.launcher3.anim.AnimatorListeners.forSuccessCallback import com.android.launcher3.anim.PendingAnimation import com.android.launcher3.anim.PropertySetter -import com.android.launcher3.config.FeatureFlags.enableSplitContextually import com.android.launcher3.logging.StatsLogManager.LauncherEvent import com.android.launcher3.statemanager.StateManager.StateHandler import com.android.launcher3.states.StateAnimationConfig @@ -53,7 +52,6 @@ import com.android.quickstep.views.RecentsView.TASK_SECONDARY_SPLIT_TRANSLATION import com.android.quickstep.views.RecentsView.TASK_SECONDARY_TRANSLATION import com.android.quickstep.views.RecentsView.TASK_THUMBNAIL_SPLASH_ALPHA import com.android.quickstep.views.TaskView.Companion.FLAG_UPDATE_ALL -import com.android.wm.shell.Flags.enableSplitContextual /** * State handler for handling UI changes for [com.android.quickstep.views.LauncherRecentsView]. In @@ -129,23 +127,6 @@ class RecentsViewStateController(private val launcher: QuickstepLauncher) : config.getInterpolator(ANIM_OVERVIEW_TRANSLATE_Y, LINEAR), ) - val exitingOverview = !enableSplitContextually() && !toState.isRecentsViewVisible - if (recentsView.isSplitSelectionActive && exitingOverview) { - builder.add( - recentsView.splitSelectController.splitAnimationController - .createPlaceholderDismissAnim( - launcher, - LauncherEvent.LAUNCHER_SPLIT_SELECTION_EXIT_HOME, - builder.duration, - ) - ) - builder.setViewAlpha( - recentsView.splitInstructionsView, - 0f, - config.getInterpolator(ANIM_OVERVIEW_SPLIT_SELECT_INSTRUCTIONS_FADE, LINEAR), - ) - } - builder.setFloat( recentsView, CONTENT_ALPHA, @@ -227,9 +208,7 @@ class RecentsViewStateController(private val launcher: QuickstepLauncher) : builder: PendingAnimation, animate: Boolean, ) { - val goingToOverviewFromWorkspaceContextual = - enableSplitContextual() && - toState == LauncherState.OVERVIEW && + val goingToOverviewFromWorkspaceContextual = toState == LauncherState.OVERVIEW && launcher.isSplitSelectionActive if ( toState != LauncherState.OVERVIEW_SPLIT_SELECT && diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java index c48ba4f11b..5c16a6227f 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java +++ b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java @@ -18,7 +18,6 @@ package com.android.launcher3.uioverrides.states; import static com.android.app.animation.Interpolators.DECELERATE_2; import static com.android.launcher3.Flags.enableScalingRevealHomeAnimation; import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_OVERVIEW; -import static com.android.wm.shell.Flags.enableSplitContextual; import android.content.Context; import android.graphics.Rect; @@ -123,7 +122,7 @@ public class OverviewState extends LauncherState { if (showFloatingSearch) { elements |= FLOATING_SEARCH_BAR; } - if (enableSplitContextual() && launcher.isSplitSelectionActive()) { + if (launcher.isSplitSelectionActive()) { elements &= ~CLEAR_ALL_BUTTON; } return elements; @@ -131,7 +130,7 @@ public class OverviewState extends LauncherState { @Override public float getSplitSelectTranslation(Launcher launcher) { - if (!enableSplitContextual() || !launcher.isSplitSelectionActive()) { + if (!launcher.isSplitSelectionActive()) { return 0f; } RecentsView recentsView = launcher.getOverviewPanel(); diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java index 1d9e49201d..d203f282e3 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java @@ -210,10 +210,7 @@ public class NavBarToHomeTouchController implements TouchController, mLauncher.getStateManager().addStateListener(listener); onSwipeInteractionCompleted(mEndState); }; - new OverviewToHomeAnim(mLauncher, onReachedHome, - FeatureFlags.enableSplitContextually() - ? mCancelSplitRunnable - : null) + new OverviewToHomeAnim(mLauncher, onReachedHome, mCancelSplitRunnable) .animateWithVelocity(velocity); } else { mLauncher.getStateManager().goToState(mEndState, true, diff --git a/quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java b/quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java index 76da4af5be..d9209bf8af 100644 --- a/quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java +++ b/quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java @@ -284,11 +284,7 @@ public class FallbackRecentsView remoteTargetHandle.getTaskViewSimulator().setDrawsBelowRecents(false)); - if (!FeatureFlags.enableSplitContextually()) { - resetFromSplitSelectionState(); - } // These are relatively expensive and don't need to be done this frame (RecentsView isn't // visible anyway), so defer by a frame to get off the critical path, e.g. app to home. @@ -3640,11 +3633,7 @@ public abstract class RecentsView< InteractionJankMonitorWrapper.end(Cuj.CUJ_SPLIT_SCREEN_ENTER); } else { // If transition to split select was interrupted, clean up to prevent glitches - if (FeatureFlags.enableSplitContextually()) { - mSplitSelectStateController.resetState(); - } else { - resetFromSplitSelectionState(); - } + mSplitSelectStateController.resetState(); InteractionJankMonitorWrapper.cancel(Cuj.CUJ_SPLIT_SCREEN_ENTER); } @@ -5368,11 +5357,7 @@ public abstract class RecentsView< mSplitSelectStateController.launchSplitTasks( aBoolean1 -> { InteractionJankMonitorWrapper.end(Cuj.CUJ_SPLIT_SCREEN_ENTER); - if (FeatureFlags.enableSplitContextually()) { - mSplitSelectStateController.resetState(); - } else { - resetFromSplitSelectionState(); - } + mSplitSelectStateController.resetState(); }); }); @@ -5394,17 +5379,14 @@ public abstract class RecentsView< @SuppressLint("WrongCall") protected void resetFromSplitSelectionState() { - if (mSplitSelectSource != null || mSplitHiddenTaskViewIndex != -1 || - FeatureFlags.enableSplitContextually()) { - safeRemoveDragLayerView(mSplitSelectStateController.getFirstFloatingTaskView()); - safeRemoveDragLayerView(mSecondFloatingTaskView); - safeRemoveDragLayerView(mSplitSelectStateController.getSplitInstructionsView()); - safeRemoveDragLayerView(mSplitScrim); - mSecondFloatingTaskView = null; - mSplitSelectSource = null; - mSplitSelectStateController.getSplitAnimationController() - .removeSplitInstructionsView(mContainer); - } + safeRemoveDragLayerView(mSplitSelectStateController.getFirstFloatingTaskView()); + safeRemoveDragLayerView(mSecondFloatingTaskView); + safeRemoveDragLayerView(mSplitSelectStateController.getSplitInstructionsView()); + safeRemoveDragLayerView(mSplitScrim); + mSecondFloatingTaskView = null; + mSplitSelectSource = null; + mSplitSelectStateController.getSplitAnimationController() + .removeSplitInstructionsView(mContainer); if (mSecondSplitHiddenView != null) { mSecondSplitHiddenView.setThumbnailVisibility(VISIBLE, INVALID_TASK_ID); @@ -5416,11 +5398,6 @@ public abstract class RecentsView< setTaskViewsPrimarySplitTranslation(0); setTaskViewsSecondarySplitTranslation(0); - if (!FeatureFlags.enableSplitContextually()) { - // When flag is on, this method gets called from resetState() call below, let's avoid - // infinite recursion today - mSplitSelectStateController.resetState(); - } if (mSplitHiddenTaskViewIndex == -1) { return; } diff --git a/quickstep/src/com/android/quickstep/views/SplitInstructionsView.java b/quickstep/src/com/android/quickstep/views/SplitInstructionsView.java index f6393e4717..0d80f6ad76 100644 --- a/quickstep/src/com/android/quickstep/views/SplitInstructionsView.java +++ b/quickstep/src/com/android/quickstep/views/SplitInstructionsView.java @@ -126,33 +126,31 @@ public class SplitInstructionsView extends LinearLayout { TextView cancelTextView = findViewById(R.id.split_instructions_text_cancel); TextView instructionTextView = findViewById(R.id.split_instructions_text); - if (FeatureFlags.enableSplitContextually()) { - cancelTextView.setVisibility(VISIBLE); - cancelTextView.setOnClickListener((v) -> exitSplitSelection()); - instructionTextView.setText(R.string.toast_contextual_split_select_app); + cancelTextView.setVisibility(VISIBLE); + cancelTextView.setOnClickListener((v) -> exitSplitSelection()); + instructionTextView.setText(R.string.toast_contextual_split_select_app); - // After layout, expand touch target of cancel button to meet minimum a11y measurements. - post(() -> { - int minTouchSize = getResources() - .getDimensionPixelSize(settingslib_preferred_minimum_touch_target); - Rect r = new Rect(); - cancelTextView.getHitRect(r); + // After layout, expand touch target of cancel button to meet minimum a11y measurements. + post(() -> { + int minTouchSize = getResources() + .getDimensionPixelSize(settingslib_preferred_minimum_touch_target); + Rect r = new Rect(); + cancelTextView.getHitRect(r); - if (r.width() < minTouchSize) { - // add 1 to ensure ceiling on int division - int expandAmount = (minTouchSize + 1 - r.width()) / 2; - r.left -= expandAmount; - r.right += expandAmount; - } - if (r.height() < minTouchSize) { - int expandAmount = (minTouchSize + 1 - r.height()) / 2; - r.top -= expandAmount; - r.bottom += expandAmount; - } + if (r.width() < minTouchSize) { + // add 1 to ensure ceiling on int division + int expandAmount = (minTouchSize + 1 - r.width()) / 2; + r.left -= expandAmount; + r.right += expandAmount; + } + if (r.height() < minTouchSize) { + int expandAmount = (minTouchSize + 1 - r.height()) / 2; + r.top -= expandAmount; + r.bottom += expandAmount; + } - setTouchDelegate(new TouchDelegate(r, cancelTextView)); - }); - } + setTouchDelegate(new TouchDelegate(r, cancelTextView)); + }); // Set accessibility title, will be announced by a11y tools. instructionTextView.setAccessibilityPaneTitle(instructionTextView.getText()); diff --git a/quickstep/tests/src/com/android/quickstep/TaplTestsSplitscreen.java b/quickstep/tests/src/com/android/quickstep/TaplTestsSplitscreen.java index daa4ec327a..afe636808f 100644 --- a/quickstep/tests/src/com/android/quickstep/TaplTestsSplitscreen.java +++ b/quickstep/tests/src/com/android/quickstep/TaplTestsSplitscreen.java @@ -16,8 +16,6 @@ package com.android.quickstep; -import static com.android.launcher3.config.FeatureFlags.enableSplitContextually; - import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.junit.Assume.assumeTrue; @@ -89,18 +87,10 @@ public class TaplTestsSplitscreen extends AbstractQuickStepTest { .getSplitScreenMenuItem() .click(); - if (enableSplitContextually()) { - // We're staying in all apps, use same instance - mLauncher.getAllApps() - .getAppIcon(CALCULATOR_APP_NAME) - .launchIntoSplitScreen(); - } else { - // We're in overview, use taskbar instance - mLauncher.getLaunchedAppState() - .getTaskbar() - .getAppIcon(CALCULATOR_APP_NAME) - .launchIntoSplitScreen(); - } + // We're staying in all apps, use same instance + mLauncher.getAllApps() + .getAppIcon(CALCULATOR_APP_NAME) + .launchIntoSplitScreen(); } @Test diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index f68c8e0d59..7df4014fc0 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -1657,9 +1657,7 @@ public class Launcher extends StatefulActivity } } - if (FeatureFlags.enableSplitContextually()) { - handleSplitAnimationGoingToHome(LAUNCHER_SPLIT_SELECTION_EXIT_HOME); - } + handleSplitAnimationGoingToHome(LAUNCHER_SPLIT_SELECTION_EXIT_HOME); mOverlayManager.hideOverlay(isStarted()); handleGestureContract(intent); } else if (Intent.ACTION_ALL_APPS.equals(intent.getAction())) { diff --git a/src/com/android/launcher3/config/FeatureFlags.java b/src/com/android/launcher3/config/FeatureFlags.java index 9e38824158..1fe42f75a6 100644 --- a/src/com/android/launcher3/config/FeatureFlags.java +++ b/src/com/android/launcher3/config/FeatureFlags.java @@ -201,15 +201,6 @@ public final class FeatureFlags { "USE_LOCAL_ICON_OVERRIDES", ENABLED, "Use inbuilt monochrome icons if app doesn't provide one"); - // Aconfig migration complete for ENABLE_SPLIT_FROM_WORKSPACE_TO_WORKSPACE. - public static final BooleanFlag ENABLE_SPLIT_FROM_WORKSPACE_TO_WORKSPACE = getDebugFlag( - 270393453, "ENABLE_SPLIT_FROM_WORKSPACE_TO_WORKSPACE", DISABLED, - "Enable initiating split screen from workspace to workspace."); - public static boolean enableSplitContextually() { - return ENABLE_SPLIT_FROM_WORKSPACE_TO_WORKSPACE.get() || - com.android.wm.shell.Flags.enableSplitContextual(); - } - // TODO(Block 29): Clean up flags // Aconfig migration complete for ENABLE_ALL_APPS_BUTTON_IN_HOTSEAT. public static final BooleanFlag ENABLE_ALL_APPS_BUTTON_IN_HOTSEAT = getDebugFlag(270393897, diff --git a/src/com/android/launcher3/testing/TestInformationHandler.java b/src/com/android/launcher3/testing/TestInformationHandler.java index cde72c104c..daa6e67a17 100644 --- a/src/com/android/launcher3/testing/TestInformationHandler.java +++ b/src/com/android/launcher3/testing/TestInformationHandler.java @@ -22,7 +22,6 @@ import static com.android.launcher3.allapps.AllAppsStore.DEFER_UPDATES_TEST; import static com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_NAVBAR_UNIFICATION; import static com.android.launcher3.config.FeatureFlags.FOLDABLE_SINGLE_PAGE; import static com.android.launcher3.config.FeatureFlags.enableAppPairs; -import static com.android.launcher3.config.FeatureFlags.enableSplitContextually; import static com.android.launcher3.testing.shared.TestProtocol.TEST_INFO_RESPONSE_FIELD; import static com.android.launcher3.util.Executors.MAIN_EXECUTOR; import static com.android.launcher3.util.Executors.MODEL_EXECUTOR; @@ -245,8 +244,8 @@ public class TestInformationHandler implements ResourceBasedOverride { } case TestProtocol.REQUEST_GET_SPLIT_SELECTION_ACTIVE: - response.putBoolean(TEST_INFO_RESPONSE_FIELD, enableSplitContextually() - && Launcher.ACTIVITY_TRACKER.getCreatedContext().isSplitSelectionActive()); + response.putBoolean(TEST_INFO_RESPONSE_FIELD, + Launcher.ACTIVITY_TRACKER.getCreatedContext().isSplitSelectionActive()); return response; case TestProtocol.REQUEST_ENABLE_ROTATION: diff --git a/src/com/android/launcher3/touch/ItemLongClickListener.java b/src/com/android/launcher3/touch/ItemLongClickListener.java index 89057a21fd..98ba8c7e99 100644 --- a/src/com/android/launcher3/touch/ItemLongClickListener.java +++ b/src/com/android/launcher3/touch/ItemLongClickListener.java @@ -188,7 +188,7 @@ public class ItemLongClickListener { // Return early if an item is already being dragged (e.g. when long-pressing two shortcuts) if (launcher.getDragController().isDragging()) return false; // Return early if user is in the middle of selecting split-screen apps - if (FeatureFlags.enableSplitContextually() && launcher.isSplitSelectionActive()) { + if (launcher.isSplitSelectionActive()) { return false; } diff --git a/src/com/android/launcher3/touch/WorkspaceTouchListener.java b/src/com/android/launcher3/touch/WorkspaceTouchListener.java index 0ff10c26a5..b69bc17824 100644 --- a/src/com/android/launcher3/touch/WorkspaceTouchListener.java +++ b/src/com/android/launcher3/touch/WorkspaceTouchListener.java @@ -207,7 +207,7 @@ public class WorkspaceTouchListener extends GestureDetector.SimpleOnGestureListe HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING); mLauncher.getStatsLogManager().logger().log(LAUNCHER_WORKSPACE_LONGPRESS); mLauncher.showDefaultOptions(mTouchDownPoint.x, mTouchDownPoint.y); - if (FeatureFlags.enableSplitContextually() && mLauncher.isSplitSelectionActive()) { + if (mLauncher.isSplitSelectionActive()) { mLauncher.dismissSplitSelection(LAUNCHER_SPLIT_SELECTION_EXIT_INTERRUPTED); } } else {