Add FLAG_DELAY_TASKBAR_BG_TAG to restrict when taskbar bg anim gets delayed.
We set it only when user swipes up to unstash. Fixes: 360778703 Test: swipe up to home, long click on taskbar icon before it settles Flag: com.android.launcher3.enable_scaling_reveal_home_animation Change-Id: I24ff466ee6730e3739d85307363567cfa1455cbf
This commit is contained in:
1 parent
b41def0366
commit
86a4b653b9
3 files changed
+64
-25
No files matched your search
@@ -82,6 +82,11 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
|
||||
private static final String TAG = "TaskbarStashController";
|
||||
private static final boolean DEBUG = false;
|
||||
|
||||
/**
|
||||
* Def. value for @param shouldBubblesFollow in
|
||||
* {@link #updateAndAnimateTransientTaskbar(boolean)} */
|
||||
public static boolean SHOULD_BUBBLES_FOLLOW_DEFAULT_VALUE = true;
|
||||
|
||||
public static final int FLAG_IN_APP = 1 << 0;
|
||||
public static final int FLAG_STASHED_IN_APP_SYSUI = 1 << 1; // shade open, ...
|
||||
public static final int FLAG_STASHED_IN_APP_SETUP = 1 << 2; // setup wizard and AllSetActivity
|
||||
@@ -94,6 +99,8 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
|
||||
public static final int FLAG_STASHED_SYSUI = 1 << 9; // app pinning,...
|
||||
public static final int FLAG_STASHED_DEVICE_LOCKED = 1 << 10; // device is locked: keyguard, ...
|
||||
public static final int FLAG_IN_OVERVIEW = 1 << 11; // launcher is in overview
|
||||
// An internal no-op flag to determine whether we should delay the taskbar background animation
|
||||
private static final int FLAG_DELAY_TASKBAR_BG_TAG = 1 << 12;
|
||||
|
||||
// If any of these flags are enabled, isInApp should return true.
|
||||
private static final int FLAGS_IN_APP = FLAG_IN_APP | FLAG_IN_SETUP;
|
||||
@@ -489,9 +496,17 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
|
||||
/**
|
||||
* Stash or unstashes the transient taskbar, using the default TASKBAR_STASH_DURATION.
|
||||
* If bubble bar exists, it will match taskbars stashing behavior.
|
||||
* Will not delay taskbar background by default.
|
||||
*/
|
||||
public void updateAndAnimateTransientTaskbar(boolean stash) {
|
||||
updateAndAnimateTransientTaskbar(stash, /* shouldBubblesFollow= */ true);
|
||||
updateAndAnimateTransientTaskbar(stash, SHOULD_BUBBLES_FOLLOW_DEFAULT_VALUE, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Stash or unstashes the transient taskbar, using the default TASKBAR_STASH_DURATION.
|
||||
*/
|
||||
public void updateAndAnimateTransientTaskbar(boolean stash, boolean shouldBubblesFollow) {
|
||||
updateAndAnimateTransientTaskbar(stash, shouldBubblesFollow, false);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -499,28 +514,47 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
|
||||
*
|
||||
* @param stash whether transient taskbar should be stashed.
|
||||
* @param shouldBubblesFollow whether bubbles should match taskbars behavior.
|
||||
* @param delayTaskbarBackground whether we will delay the taskbar background animation
|
||||
*/
|
||||
public void updateAndAnimateTransientTaskbar(boolean stash, boolean shouldBubblesFollow) {
|
||||
public void updateAndAnimateTransientTaskbar(boolean stash, boolean shouldBubblesFollow,
|
||||
boolean delayTaskbarBackground) {
|
||||
if (!DisplayController.isTransientTaskbar(mActivity)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (
|
||||
stash
|
||||
&& !mControllers.taskbarAutohideSuspendController
|
||||
.isSuspendedForTransientTaskbarInLauncher()
|
||||
&& mControllers.taskbarAutohideSuspendController
|
||||
.isTransientTaskbarStashingSuspended()) {
|
||||
if (stash
|
||||
&& !mControllers.taskbarAutohideSuspendController
|
||||
.isSuspendedForTransientTaskbarInLauncher()
|
||||
&& mControllers.taskbarAutohideSuspendController
|
||||
.isTransientTaskbarStashingSuspended()) {
|
||||
// Avoid stashing if autohide is currently suspended.
|
||||
return;
|
||||
}
|
||||
|
||||
boolean shouldApplyState = false;
|
||||
|
||||
if (delayTaskbarBackground) {
|
||||
mControllers.taskbarStashController.updateStateForFlag(FLAG_DELAY_TASKBAR_BG_TAG, true);
|
||||
shouldApplyState = true;
|
||||
}
|
||||
|
||||
if (hasAnyFlag(FLAG_STASHED_IN_APP_AUTO) != stash) {
|
||||
mTaskbarSharedState.taskbarWasStashedAuto = stash;
|
||||
updateStateForFlag(FLAG_STASHED_IN_APP_AUTO, stash);
|
||||
shouldApplyState = true;
|
||||
}
|
||||
|
||||
if (shouldApplyState) {
|
||||
applyState();
|
||||
}
|
||||
|
||||
// Effectively a no-opp to remove the tag.
|
||||
if (delayTaskbarBackground) {
|
||||
mControllers.taskbarStashController.updateStateForFlag(FLAG_DELAY_TASKBAR_BG_TAG,
|
||||
false);
|
||||
mControllers.taskbarStashController.applyState(0);
|
||||
}
|
||||
|
||||
mControllers.bubbleControllers.ifPresent(controllers -> {
|
||||
if (shouldBubblesFollow) {
|
||||
final boolean willStash = mIsStashedPredicate.test(mState);
|
||||
@@ -584,14 +618,14 @@ 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 animationType what transition type to play.
|
||||
* @param skipTaskbarBackgroundDelay Iff true, skips delaying the taskbar background.
|
||||
* @param jankTag tag to be used in jank monitor trace.
|
||||
* @param isStashed whether it's a stash animation or an unstash animation
|
||||
* @param duration duration of the animation
|
||||
* @param animationType what transition type to play.
|
||||
* @param shouldDelayBackground whether we should delay the taskbar bg animation
|
||||
* @param jankTag tag to be used in jank monitor trace.
|
||||
*/
|
||||
private void createAnimToIsStashed(boolean isStashed, long duration,
|
||||
@StashAnimation int animationType, boolean skipTaskbarBackgroundDelay, String jankTag) {
|
||||
@StashAnimation int animationType, boolean shouldDelayBackground, String jankTag) {
|
||||
if (animationType == TRANSITION_UNSTASH_SUW_MANUAL && isStashed) {
|
||||
// The STASH_ANIMATION_SUW_MANUAL must only be used during an unstash animation.
|
||||
Log.e(TAG, "Illegal arguments:Using TRANSITION_UNSTASH_SUW_MANUAL to stash taskbar");
|
||||
@@ -630,7 +664,7 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
|
||||
|
||||
if (isTransientTaskbar) {
|
||||
createTransientAnimToIsStashed(mAnimator, isStashed, duration,
|
||||
skipTaskbarBackgroundDelay, animationType);
|
||||
shouldDelayBackground, animationType);
|
||||
} else {
|
||||
createAnimToIsStashed(mAnimator, isStashed, duration, stashTranslation, animationType);
|
||||
}
|
||||
@@ -736,7 +770,7 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
|
||||
}
|
||||
|
||||
private void createTransientAnimToIsStashed(AnimatorSet as, boolean isStashed, long duration,
|
||||
boolean skipTaskbarBackgroundDelay, @StashAnimation int animationType) {
|
||||
boolean shouldDelayBackground, @StashAnimation int animationType) {
|
||||
// Target values of the properties this is going to set
|
||||
final float backgroundOffsetTarget = isStashed ? 1 : 0;
|
||||
final float iconAlphaTarget = isStashed ? 0 : 1;
|
||||
@@ -787,7 +821,10 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
|
||||
backgroundAndHandleAlphaStartDelay,
|
||||
backgroundAndHandleAlphaDuration, LINEAR);
|
||||
|
||||
if (enableScalingRevealHomeAnimation() && isStashed && !skipTaskbarBackgroundDelay) {
|
||||
|
||||
if (enableScalingRevealHomeAnimation()
|
||||
&& !isStashed
|
||||
&& shouldDelayBackground) {
|
||||
play(as, getTaskbarBackgroundAnimatorWhenNotGoingHome(duration),
|
||||
0, 0, LINEAR);
|
||||
as.addListener(AnimatorListeners.forEndCallback(
|
||||
@@ -1349,10 +1386,9 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
|
||||
mIsStashed = isStashed;
|
||||
mLastStartedTransitionType = animationType;
|
||||
|
||||
boolean skipTaskbarBgDelay = !hasAnyFlag(FLAG_STASHED_IN_TASKBAR_ALL_APPS)
|
||||
&& hasAnyFlag(FLAG_STASHED_IN_TASKBAR_ALL_APPS, changedFlags);
|
||||
boolean shouldDelayBackground = hasAnyFlag(FLAG_DELAY_TASKBAR_BG_TAG);
|
||||
// This sets mAnimator.
|
||||
createAnimToIsStashed(mIsStashed, duration, animationType, skipTaskbarBgDelay,
|
||||
createAnimToIsStashed(mIsStashed, duration, animationType, shouldDelayBackground,
|
||||
computeTaskbarJankMonitorTag(changedFlags));
|
||||
return mAnimator;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user