diff options
author | Sunny Goyal <sunnygoyal@google.com> | 2018-09-07 13:45:26 -0700 |
---|---|---|
committer | Sunny Goyal <sunnygoyal@google.com> | 2018-09-07 13:46:47 -0700 |
commit | c6043e456832e99914b62b399ea0ca15a3db1f56 (patch) | |
tree | 2ef2f67e4557bd8654e0d02d5d50bf8ea93a8eda /quickstep | |
parent | 0c98d0c05fb56a53b88a9d62361b3914eb95a75a (diff) | |
download | android_packages_apps_Trebuchet-c6043e456832e99914b62b399ea0ca15a3db1f56.tar.gz android_packages_apps_Trebuchet-c6043e456832e99914b62b399ea0ca15a3db1f56.tar.bz2 android_packages_apps_Trebuchet-c6043e456832e99914b62b399ea0ca15a3db1f56.zip |
Fixing Launcher stuck in BACKGROUND_APP state when using overview button
When using overview button, we skip the activtiy animation, which leads
to wrong state. Instead always running the animation and changing the endpoints
accordingly.
Change-Id: Id071b4e74da42c78760519aa29644621afc822e2
Diffstat (limited to 'quickstep')
3 files changed, 11 insertions, 10 deletions
diff --git a/quickstep/src/com/android/quickstep/ActivityControlHelper.java b/quickstep/src/com/android/quickstep/ActivityControlHelper.java index 63fc6cdb3..4b918102c 100644 --- a/quickstep/src/com/android/quickstep/ActivityControlHelper.java +++ b/quickstep/src/com/android/quickstep/ActivityControlHelper.java @@ -106,7 +106,7 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> { void onSwipeUpComplete(T activity); AnimationFactory prepareRecentsUI(T activity, boolean activityVisible, - Consumer<AnimatorPlaybackController> callback); + boolean animateActivity, Consumer<AnimatorPlaybackController> callback); ActivityInitListener createActivityInitListener(BiPredicate<T, Boolean> onInitListener); @@ -214,7 +214,7 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> { @Override public AnimationFactory prepareRecentsUI(Launcher activity, boolean activityVisible, - Consumer<AnimatorPlaybackController> callback) { + boolean animateActivity, Consumer<AnimatorPlaybackController> callback) { final LauncherState startState = activity.getStateManager().getState(); LauncherState resetState = startState; @@ -228,8 +228,8 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> { // Since the launcher is not visible, we can safely reset the scroll position. // This ensures then the next swipe up to all-apps starts from scroll 0. activity.getAppsView().reset(false /* animate */); - fromState = BACKGROUND_APP; - activity.getStateManager().goToState(BACKGROUND_APP, false); + fromState = animateActivity ? BACKGROUND_APP : OVERVIEW; + activity.getStateManager().goToState(fromState, false); // Optimization, hide the all apps view to prevent layout while initializing activity.getAppsView().getContentView().setVisibility(View.GONE); @@ -268,6 +268,9 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> { .createAnimationToNewWorkspace(fromState, endState, accuracy)); return; } + if (fromState == endState) { + return; + } AnimatorSet anim = new AnimatorSet(); if (!activity.getDeviceProfile().isVerticalBarLayout()) { @@ -470,7 +473,7 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> { @Override public AnimationFactory prepareRecentsUI(RecentsActivity activity, boolean activityVisible, - Consumer<AnimatorPlaybackController> callback) { + boolean animateActivity, Consumer<AnimatorPlaybackController> callback) { if (activityVisible) { return (transitionLength, interactionType) -> { }; } diff --git a/quickstep/src/com/android/quickstep/OverviewCommandHelper.java b/quickstep/src/com/android/quickstep/OverviewCommandHelper.java index 3d54b82d1..1a9915c41 100644 --- a/quickstep/src/com/android/quickstep/OverviewCommandHelper.java +++ b/quickstep/src/com/android/quickstep/OverviewCommandHelper.java @@ -269,7 +269,7 @@ public class OverviewCommandHelper { activity.<RecentsView>getOverviewPanel().setCurrentTask(mRunningTaskId); AbstractFloatingView.closeAllOpenViews(activity, wasVisible); AnimationFactory factory = mHelper.prepareRecentsUI(activity, wasVisible, - (controller) -> { + false /* animate activity */, (controller) -> { controller.dispatchOnStart(); ValueAnimator anim = controller.getAnimationPlayer() .setDuration(RECENTS_LAUNCH_DURATION); @@ -277,9 +277,7 @@ public class OverviewCommandHelper { anim.start(); }); factory.onRemoteAnimationReceived(null); - if (wasVisible) { - factory.createActivityController(RECENTS_LAUNCH_DURATION, INTERACTION_NORMAL); - } + factory.createActivityController(RECENTS_LAUNCH_DURATION, INTERACTION_NORMAL); mActivity = activity; mRecentsView = mActivity.getOverviewPanel(); mRecentsView.setRunningTaskIconScaledDown(true); diff --git a/quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java b/quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java index fa36f6b7b..a2e9af841 100644 --- a/quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java +++ b/quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java @@ -418,7 +418,7 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> { } mAnimationFactory = mActivityControlHelper.prepareRecentsUI(mActivity, - mWasLauncherAlreadyVisible, this::onAnimatorPlaybackControllerCreated); + mWasLauncherAlreadyVisible, true, this::onAnimatorPlaybackControllerCreated); AbstractFloatingView.closeAllOpenViews(activity, mWasLauncherAlreadyVisible); if (mWasLauncherAlreadyVisible) { |