Loading quickstep/src/com/android/launcher3/taskbar/FallbackTaskbarUIController.java +4 −4 Original line number Diff line number Diff line Loading @@ -73,12 +73,12 @@ public class FallbackTaskbarUIController extends TaskbarUIController { boolean useStashedLauncherState = toState.hasOverviewActions(); boolean stashedLauncherState = useStashedLauncherState && !FeatureFlags.ENABLE_TASKBAR_IN_OVERVIEW.get(); TaskbarStashController controller = mControllers.taskbarStashController; TaskbarStashController stashController = mControllers.taskbarStashController; // Set both FLAG_IN_STASHED_LAUNCHER_STATE and FLAG_IN_APP to ensure the state is respected. // For all other states, just use the current stashed-in-app setting (e.g. if long clicked). controller.updateStateForFlag(FLAG_IN_STASHED_LAUNCHER_STATE, stashedLauncherState); controller.updateStateForFlag(FLAG_IN_APP, !useStashedLauncherState); return controller.applyStateWithoutStart(duration); stashController.updateStateForFlag(FLAG_IN_STASHED_LAUNCHER_STATE, stashedLauncherState); stashController.updateStateForFlag(FLAG_IN_APP, !useStashedLauncherState); return stashController.createApplyStateAnimator(duration); } private void animateToRecentsState(RecentsState toState) { Loading quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java +2 −2 Original line number Diff line number Diff line Loading @@ -183,7 +183,7 @@ import java.util.StringJoiner; stashController.updateStateForFlag(FLAG_IN_APP, false); updateStateForFlag(FLAG_RECENTS_ANIMATION_RUNNING, true); animatorSet.play(stashController.applyStateWithoutStart(duration)); animatorSet.play(stashController.createApplyStateAnimator(duration)); animatorSet.play(applyState(duration, false)); if (mTaskBarRecentsAnimationListener != null) { Loading Loading @@ -397,7 +397,7 @@ import java.util.StringJoiner; boolean isInStashedState = mLauncherState.isTaskbarStashed(mLauncher); TaskbarStashController stashController = mControllers.taskbarStashController; stashController.updateStateForFlag(FLAG_IN_STASHED_LAUNCHER_STATE, isInStashedState); Animator stashAnimator = stashController.applyStateWithoutStart(duration); Animator stashAnimator = stashController.createApplyStateAnimator(duration); if (stashAnimator != null) { stashAnimator.addListener(new AnimatorListenerAdapter() { @Override Loading quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java +22 −47 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_S import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; import android.animation.ValueAnimator; import android.annotation.Nullable; import android.content.SharedPreferences; import android.content.res.Resources; Loading Loading @@ -69,8 +70,6 @@ import java.util.function.IntPredicate; */ public class TaskbarStashController implements TaskbarControllers.LoggableTaskbarController { private static final String TAG = "TaskbarStashController"; public static final int FLAG_IN_APP = 1 << 0; public static final int FLAG_STASHED_IN_APP_MANUAL = 1 << 1; // long press, persisted public static final int FLAG_STASHED_IN_SYSUI_STATE = 1 << 2; // app pinning, keyguard, etc. Loading Loading @@ -374,8 +373,8 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba /** * Returns the height that taskbar will inset when inside apps. * @see WindowInsets.Type#navigationBars() * @see WindowInsets.Type#systemBars() * @see android.view.WindowInsets.Type#navigationBars() * @see android.view.WindowInsets.Type#systemBars() */ public int getContentHeightToReportToApps() { if ((isPhoneMode() && !mActivity.isThreeButtonNav()) Loading Loading @@ -408,7 +407,7 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba /** * Returns the height that taskbar will inset when inside apps. * @see WindowInsets.Type#tappableElement() * @see android.view.WindowInsets.Type#tappableElement() */ public int getTappableHeightToReportToApps() { int contentHeight = getContentHeightToReportToApps(); Loading Loading @@ -494,7 +493,6 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba createAnimToIsStashed( /* isStashed= */ false, placeholderDuration, /* startDelay= */ 0, /* animateBg= */ false, /* changedFlags=*/ 0); animation.play(mAnimator); Loading @@ -504,11 +502,10 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba * Create a stash animation and save to {@link #mAnimator}. * @param isStashed whether it's a stash animation or an unstash animation * @param duration duration of the animation * @param startDelay how many milliseconds to delay the animation after starting it. * @param animateBg whether the taskbar's background should be animated */ private void createAnimToIsStashed(boolean isStashed, long duration, long startDelay, boolean animateBg, int changedFlags) { private void createAnimToIsStashed(boolean isStashed, long duration, boolean animateBg, int changedFlags) { if (mAnimator != null) { mAnimator.cancel(); } Loading @@ -528,13 +525,7 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba .setDuration(duration)); mAnimator.play(mTaskbarImeBgAlpha.animateToValue( hasAnyFlag(FLAG_STASHED_IN_APP_IME) ? 0 : 1).setDuration(duration)); mAnimator.setStartDelay(startDelay); mAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { mAnimator = null; } }); mAnimator.addListener(AnimatorListeners.forEndCallback(() -> mAnimator = null)); return; } Loading Loading @@ -615,7 +606,6 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba mAnimator.playTogether(fullLengthAnimatorSet, firstHalfAnimatorSet, secondHalfAnimatorSet); mAnimator.setStartDelay(startDelay); mAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { Loading Loading @@ -701,19 +691,17 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba } public void applyState(long duration) { mStatePropertyHolder.setState(mState, duration, true); createApplyStateAnimator(duration).start(); } public void applyState(long duration, long startDelay) { mStatePropertyHolder.setState(mState, duration, startDelay, true); Animator animator = createApplyStateAnimator(duration); animator.setStartDelay(startDelay); animator.start(); } public Animator applyStateWithoutStart() { return applyStateWithoutStart(TASKBAR_STASH_DURATION); } public Animator applyStateWithoutStart(long duration) { return mStatePropertyHolder.setState(mState, duration, false); public Animator createApplyStateAnimator(long duration) { return mStatePropertyHolder.createSetStateAnimator(mState, duration); } /** Loading Loading @@ -948,22 +936,14 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba } /** * @see #setState(int, long, long, boolean) with a default startDelay = 0. */ public Animator setState(int flags, long duration, boolean start) { return setState(flags, duration, 0 /* startDelay */, start); } /** * Applies the latest state, potentially calling onStateChangeApplied() and creating a new * animation (stored in mAnimator) which is started if {@param start} is true. * Creates an animator (stored in mAnimator) which applies the latest state, potentially * creating a new animation (stored in mAnimator). * @param flags The latest flags to apply (see the top of this file). * @param duration The length of the animation. * @param startDelay How long to delay the animation after calling start(). * @param start Whether to start mAnimator immediately. * @return mAnimator if mIsStashed changed, else null. * @return mAnimator if mIsStashed changed or an empty animator. */ public Animator setState(int flags, long duration, long startDelay, boolean start) { @NonNull public Animator createSetStateAnimator(int flags, long duration) { int changedFlags = mPrevFlags ^ flags; if (mPrevFlags != flags) { onStateChangeApplied(changedFlags); Loading @@ -979,24 +959,19 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba && mAnimator != null && mAnimator.isStarted())) { if (TestProtocol.sDebugTracing) { Log.d(TestProtocol.TASKBAR_IN_APP_STATE, String.format( "setState: mIsStashed=%b, isStashed=%b, duration=%d, start=:%b", "setState: mIsStashed=%b, isStashed=%b, duration=%d", mIsStashed, isStashed, duration, start)); duration)); } mIsStashed = isStashed; mIsHotseatIconOnTopWhenAligned = isHotseatIconOnTopWhenAligned; // This sets mAnimator. createAnimToIsStashed( mIsStashed, duration, startDelay, /* animateBg= */ true, changedFlags); if (start) { mAnimator.start(); } createAnimToIsStashed(mIsStashed, duration, /* animateBg= */ true, changedFlags); return mAnimator; } return null; return ValueAnimator.ofFloat(0, 1).setDuration(duration); } } } Loading
quickstep/src/com/android/launcher3/taskbar/FallbackTaskbarUIController.java +4 −4 Original line number Diff line number Diff line Loading @@ -73,12 +73,12 @@ public class FallbackTaskbarUIController extends TaskbarUIController { boolean useStashedLauncherState = toState.hasOverviewActions(); boolean stashedLauncherState = useStashedLauncherState && !FeatureFlags.ENABLE_TASKBAR_IN_OVERVIEW.get(); TaskbarStashController controller = mControllers.taskbarStashController; TaskbarStashController stashController = mControllers.taskbarStashController; // Set both FLAG_IN_STASHED_LAUNCHER_STATE and FLAG_IN_APP to ensure the state is respected. // For all other states, just use the current stashed-in-app setting (e.g. if long clicked). controller.updateStateForFlag(FLAG_IN_STASHED_LAUNCHER_STATE, stashedLauncherState); controller.updateStateForFlag(FLAG_IN_APP, !useStashedLauncherState); return controller.applyStateWithoutStart(duration); stashController.updateStateForFlag(FLAG_IN_STASHED_LAUNCHER_STATE, stashedLauncherState); stashController.updateStateForFlag(FLAG_IN_APP, !useStashedLauncherState); return stashController.createApplyStateAnimator(duration); } private void animateToRecentsState(RecentsState toState) { Loading
quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java +2 −2 Original line number Diff line number Diff line Loading @@ -183,7 +183,7 @@ import java.util.StringJoiner; stashController.updateStateForFlag(FLAG_IN_APP, false); updateStateForFlag(FLAG_RECENTS_ANIMATION_RUNNING, true); animatorSet.play(stashController.applyStateWithoutStart(duration)); animatorSet.play(stashController.createApplyStateAnimator(duration)); animatorSet.play(applyState(duration, false)); if (mTaskBarRecentsAnimationListener != null) { Loading Loading @@ -397,7 +397,7 @@ import java.util.StringJoiner; boolean isInStashedState = mLauncherState.isTaskbarStashed(mLauncher); TaskbarStashController stashController = mControllers.taskbarStashController; stashController.updateStateForFlag(FLAG_IN_STASHED_LAUNCHER_STATE, isInStashedState); Animator stashAnimator = stashController.applyStateWithoutStart(duration); Animator stashAnimator = stashController.createApplyStateAnimator(duration); if (stashAnimator != null) { stashAnimator.addListener(new AnimatorListenerAdapter() { @Override Loading
quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java +22 −47 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_S import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; import android.animation.ValueAnimator; import android.annotation.Nullable; import android.content.SharedPreferences; import android.content.res.Resources; Loading Loading @@ -69,8 +70,6 @@ import java.util.function.IntPredicate; */ public class TaskbarStashController implements TaskbarControllers.LoggableTaskbarController { private static final String TAG = "TaskbarStashController"; public static final int FLAG_IN_APP = 1 << 0; public static final int FLAG_STASHED_IN_APP_MANUAL = 1 << 1; // long press, persisted public static final int FLAG_STASHED_IN_SYSUI_STATE = 1 << 2; // app pinning, keyguard, etc. Loading Loading @@ -374,8 +373,8 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba /** * Returns the height that taskbar will inset when inside apps. * @see WindowInsets.Type#navigationBars() * @see WindowInsets.Type#systemBars() * @see android.view.WindowInsets.Type#navigationBars() * @see android.view.WindowInsets.Type#systemBars() */ public int getContentHeightToReportToApps() { if ((isPhoneMode() && !mActivity.isThreeButtonNav()) Loading Loading @@ -408,7 +407,7 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba /** * Returns the height that taskbar will inset when inside apps. * @see WindowInsets.Type#tappableElement() * @see android.view.WindowInsets.Type#tappableElement() */ public int getTappableHeightToReportToApps() { int contentHeight = getContentHeightToReportToApps(); Loading Loading @@ -494,7 +493,6 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba createAnimToIsStashed( /* isStashed= */ false, placeholderDuration, /* startDelay= */ 0, /* animateBg= */ false, /* changedFlags=*/ 0); animation.play(mAnimator); Loading @@ -504,11 +502,10 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba * Create a stash animation and save to {@link #mAnimator}. * @param isStashed whether it's a stash animation or an unstash animation * @param duration duration of the animation * @param startDelay how many milliseconds to delay the animation after starting it. * @param animateBg whether the taskbar's background should be animated */ private void createAnimToIsStashed(boolean isStashed, long duration, long startDelay, boolean animateBg, int changedFlags) { private void createAnimToIsStashed(boolean isStashed, long duration, boolean animateBg, int changedFlags) { if (mAnimator != null) { mAnimator.cancel(); } Loading @@ -528,13 +525,7 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba .setDuration(duration)); mAnimator.play(mTaskbarImeBgAlpha.animateToValue( hasAnyFlag(FLAG_STASHED_IN_APP_IME) ? 0 : 1).setDuration(duration)); mAnimator.setStartDelay(startDelay); mAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { mAnimator = null; } }); mAnimator.addListener(AnimatorListeners.forEndCallback(() -> mAnimator = null)); return; } Loading Loading @@ -615,7 +606,6 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba mAnimator.playTogether(fullLengthAnimatorSet, firstHalfAnimatorSet, secondHalfAnimatorSet); mAnimator.setStartDelay(startDelay); mAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { Loading Loading @@ -701,19 +691,17 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba } public void applyState(long duration) { mStatePropertyHolder.setState(mState, duration, true); createApplyStateAnimator(duration).start(); } public void applyState(long duration, long startDelay) { mStatePropertyHolder.setState(mState, duration, startDelay, true); Animator animator = createApplyStateAnimator(duration); animator.setStartDelay(startDelay); animator.start(); } public Animator applyStateWithoutStart() { return applyStateWithoutStart(TASKBAR_STASH_DURATION); } public Animator applyStateWithoutStart(long duration) { return mStatePropertyHolder.setState(mState, duration, false); public Animator createApplyStateAnimator(long duration) { return mStatePropertyHolder.createSetStateAnimator(mState, duration); } /** Loading Loading @@ -948,22 +936,14 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba } /** * @see #setState(int, long, long, boolean) with a default startDelay = 0. */ public Animator setState(int flags, long duration, boolean start) { return setState(flags, duration, 0 /* startDelay */, start); } /** * Applies the latest state, potentially calling onStateChangeApplied() and creating a new * animation (stored in mAnimator) which is started if {@param start} is true. * Creates an animator (stored in mAnimator) which applies the latest state, potentially * creating a new animation (stored in mAnimator). * @param flags The latest flags to apply (see the top of this file). * @param duration The length of the animation. * @param startDelay How long to delay the animation after calling start(). * @param start Whether to start mAnimator immediately. * @return mAnimator if mIsStashed changed, else null. * @return mAnimator if mIsStashed changed or an empty animator. */ public Animator setState(int flags, long duration, long startDelay, boolean start) { @NonNull public Animator createSetStateAnimator(int flags, long duration) { int changedFlags = mPrevFlags ^ flags; if (mPrevFlags != flags) { onStateChangeApplied(changedFlags); Loading @@ -979,24 +959,19 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba && mAnimator != null && mAnimator.isStarted())) { if (TestProtocol.sDebugTracing) { Log.d(TestProtocol.TASKBAR_IN_APP_STATE, String.format( "setState: mIsStashed=%b, isStashed=%b, duration=%d, start=:%b", "setState: mIsStashed=%b, isStashed=%b, duration=%d", mIsStashed, isStashed, duration, start)); duration)); } mIsStashed = isStashed; mIsHotseatIconOnTopWhenAligned = isHotseatIconOnTopWhenAligned; // This sets mAnimator. createAnimToIsStashed( mIsStashed, duration, startDelay, /* animateBg= */ true, changedFlags); if (start) { mAnimator.start(); } createAnimToIsStashed(mIsStashed, duration, /* animateBg= */ true, changedFlags); return mAnimator; } return null; return ValueAnimator.ofFloat(0, 1).setDuration(duration); } } }