diff options
Diffstat (limited to 'quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java')
-rw-r--r-- | quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java | 58 |
1 files changed, 39 insertions, 19 deletions
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java index 90f7beaf9c..057b71b74f 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java @@ -17,7 +17,9 @@ package com.android.launcher3.taskbar; import static com.android.app.animation.Interpolators.EMPHASIZED; import static com.android.launcher3.taskbar.TaskbarKeyguardController.MASK_ANY_SYSUI_LOCKED; +import static com.android.launcher3.taskbar.TaskbarManager.isPhoneMode; import static com.android.launcher3.taskbar.TaskbarStashController.FLAG_IN_APP; +import static com.android.launcher3.taskbar.TaskbarStashController.FLAG_IN_OVERVIEW; import static com.android.launcher3.taskbar.TaskbarStashController.FLAG_IN_STASHED_LAUNCHER_STATE; import static com.android.launcher3.taskbar.TaskbarViewController.ALPHA_INDEX_HOME; import static com.android.launcher3.util.FlagDebugUtils.appendFlag; @@ -44,6 +46,7 @@ import com.android.launcher3.QuickstepTransitionManager; import com.android.launcher3.Utilities; import com.android.launcher3.anim.AnimatedFloat; import com.android.launcher3.anim.AnimatorListeners; +import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.statemanager.StateManager; import com.android.launcher3.uioverrides.QuickstepLauncher; import com.android.launcher3.util.MultiPropertyFactory.MultiProperty; @@ -66,13 +69,13 @@ public class TaskbarLauncherStateController { private static final String TAG = TaskbarLauncherStateController.class.getSimpleName(); private static final boolean DEBUG = false; - /** Launcher activity is resumed and focused. */ - public static final int FLAG_RESUMED = 1 << 0; + /** Launcher activity is visible and focused. */ + public static final int FLAG_VISIBLE = 1 << 0; /** - * A external transition / animation is running that will result in FLAG_RESUMED being set. + * A external transition / animation is running that will result in FLAG_VISIBLE being set. **/ - public static final int FLAG_TRANSITION_TO_RESUMED = 1 << 1; + public static final int FLAG_TRANSITION_TO_VISIBLE = 1 << 1; /** * Set while the launcher state machine is performing a state transition, see {@link @@ -116,7 +119,7 @@ public class TaskbarLauncherStateController { */ private static final int FLAG_TASKBAR_HIDDEN = 1 << 6; - private static final int FLAGS_LAUNCHER_ACTIVE = FLAG_RESUMED | FLAG_TRANSITION_TO_RESUMED; + private static final int FLAGS_LAUNCHER_ACTIVE = FLAG_VISIBLE | FLAG_TRANSITION_TO_VISIBLE; /** Equivalent to an int with all 1s for binary operation purposes */ private static final int FLAGS_ALL = ~0; @@ -202,19 +205,32 @@ public class TaskbarLauncherStateController { 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; + boolean disallowLongClick = + FeatureFlags.enableSplitContextually() + ? mLauncher.isSplitSelectionEnabled() + : finalState == LauncherState.OVERVIEW_SPLIT_SELECT; com.android.launcher3.taskbar.Utilities.setOverviewDragState( mControllers, finalState.disallowTaskbarGlobalDrag(), disallowLongClick, finalState.allowTaskbarInitialSplitSelection()); } }; + /** + * Callback for when launcher state transition completes after user swipes to home. + * @param finalState The final state of the transition. + */ + public void onStateTransitionCompletedAfterSwipeToHome(LauncherState finalState) { + // TODO(b/279514548) Cleans up bad state that can occur when user interacts with + // taskbar on top of transparent activity. + if (!FeatureFlags.enableHomeTransitionListener() + && (finalState == LauncherState.NORMAL) + && mLauncher.hasBeenResumed()) { + updateStateForFlag(FLAG_VISIBLE, true); + applyState(); + } + } + /** Initializes the controller instance, and applies the initial state immediately. */ public void init(TaskbarControllers controllers, QuickstepLauncher launcher, int sysuiStateFlags) { @@ -277,7 +293,7 @@ public class TaskbarLauncherStateController { } stashController.updateStateForFlag(FLAG_IN_APP, false); - updateStateForFlag(FLAG_TRANSITION_TO_RESUMED, true); + updateStateForFlag(FLAG_TRANSITION_TO_VISIBLE, true); animatorSet.play(stashController.createApplyStateAnimator(duration)); animatorSet.play(applyState(duration, false)); @@ -416,6 +432,9 @@ public class TaskbarLauncherStateController { controllers.bubbleStashController.setBubblesShowingOnOverview(onOverview); }); + mControllers.taskbarStashController.updateStateForFlag(FLAG_IN_OVERVIEW, + mLauncherState == LauncherState.OVERVIEW); + AnimatorSet animatorSet = new AnimatorSet(); if (hasAnyFlag(changedFlags, FLAG_LAUNCHER_IN_STATE_TRANSITION)) { @@ -425,7 +444,7 @@ public class TaskbarLauncherStateController { if (launcherTransitionCompleted && mLauncherState == LauncherState.QUICK_SWITCH_FROM_HOME) { // We're about to be paused, set immediately to ensure seamless handoff. - updateStateForFlag(FLAG_RESUMED, false); + updateStateForFlag(FLAG_VISIBLE, false); applyState(0 /* duration */); } if (mLauncherState == LauncherState.NORMAL) { @@ -715,6 +734,7 @@ public class TaskbarLauncherStateController { } mIconAlphaForHome.setValue(alpha); boolean hotseatVisible = alpha == 0 + || isPhoneMode(mLauncher.getDeviceProfile()) || (!mControllers.uiController.isHotseatIconOnTopWhenAligned() && mIconAlignment.value > 0); /* @@ -751,10 +771,10 @@ public class TaskbarLauncherStateController { mTaskBarRecentsAnimationListener = null; ((RecentsView) mLauncher.getOverviewPanel()).setTaskLaunchListener(null); - // Update the resumed state immediately to ensure a seamless handoff - boolean launcherResumed = !finishedToApp; - updateStateForFlag(FLAG_TRANSITION_TO_RESUMED, false); - updateStateForFlag(FLAG_RESUMED, launcherResumed); + // Update the visible state immediately to ensure a seamless handoff + boolean launcherVisible = !finishedToApp; + updateStateForFlag(FLAG_TRANSITION_TO_VISIBLE, false); + updateStateForFlag(FLAG_VISIBLE, launcherVisible); applyState(); TaskbarStashController controller = mControllers.taskbarStashController; @@ -768,8 +788,8 @@ public class TaskbarLauncherStateController { private static String getStateString(int flags) { StringJoiner result = new StringJoiner("|"); - appendFlag(result, flags, FLAG_RESUMED, "resumed"); - appendFlag(result, flags, FLAG_TRANSITION_TO_RESUMED, "transition_to_resumed"); + appendFlag(result, flags, FLAG_VISIBLE, "flag_visible"); + appendFlag(result, flags, FLAG_TRANSITION_TO_VISIBLE, "transition_to_visible"); appendFlag(result, flags, FLAG_LAUNCHER_IN_STATE_TRANSITION, "launcher_in_state_transition"); appendFlag(result, flags, FLAG_AWAKE, "awake"); |