Merge "Fix getting stuck in BackgroundAppState for 2-button mode" into ub-launcher3-qt-dev

am: 72c6e7b736

Change-Id: I6ab2194d50a6d7dfb7bd7c13bab776331c426c23
This commit is contained in:
Tony Wickham authored and android-build-merger committed 2019-05-31 16:26:39 -07:00
commit dcff2f1875
5 files changed
+20 -18

No files matched your search

@@ -29,7 +29,7 @@ public abstract class GoActivityControlHelper<T extends BaseDraggingActivity> im
} }
@Override @Override
public void onSwipeUpComplete(T activity) { public void onSwipeUpToRecentsComplete(T activity) {
// Go does not support swipe up gesture. // Go does not support swipe up gesture.
} }
@@ -70,7 +70,7 @@ public final class FallbackActivityControllerHelper implements
} }
@Override @Override
public void onSwipeUpComplete(RecentsActivity activity) { public void onSwipeUpToRecentsComplete(RecentsActivity activity) {
RecentsView recentsView = activity.getOverviewPanel(); RecentsView recentsView = activity.getOverviewPanel();
recentsView.getClearAllButton().setVisibilityAlpha(1); recentsView.getClearAllButton().setVisibilityAlpha(1);
recentsView.setDisallowScrollToClearAll(false); recentsView.setDisallowScrollToClearAll(false);
@@ -91,7 +91,7 @@ public final class LauncherActivityControllerHelper implements ActivityControlHe
} }
@Override @Override
public void onSwipeUpComplete(Launcher activity) { public void onSwipeUpToRecentsComplete(Launcher activity) {
// Re apply state in case we did something funky during the transition. // Re apply state in case we did something funky during the transition.
activity.getStateManager().reapplyState(); activity.getStateManager().reapplyState();
DiscoveryBounce.showForOverviewIfNeeded(activity); DiscoveryBounce.showForOverviewIfNeeded(activity);
@@ -353,7 +353,7 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity>
| STATE_LAUNCHER_DRAWN | STATE_SCALED_CONTROLLER_RECENTS | STATE_LAUNCHER_DRAWN | STATE_SCALED_CONTROLLER_RECENTS
| STATE_CURRENT_TASK_FINISHED | STATE_GESTURE_COMPLETED | STATE_CURRENT_TASK_FINISHED | STATE_GESTURE_COMPLETED
| STATE_GESTURE_STARTED, | STATE_GESTURE_STARTED,
this::setupLauncherUiAfterSwipeUpAnimation); this::setupLauncherUiAfterSwipeUpToRecentsAnimation);
mStateCallback.addCallback(STATE_HANDLER_INVALIDATED, this::invalidateHandler); mStateCallback.addCallback(STATE_HANDLER_INVALIDATED, this::invalidateHandler);
mStateCallback.addCallback(STATE_LAUNCHER_PRESENT | STATE_HANDLER_INVALIDATED, mStateCallback.addCallback(STATE_LAUNCHER_PRESENT | STATE_HANDLER_INVALIDATED,
@@ -647,7 +647,10 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity>
} }
private void buildAnimationController() { private void buildAnimationController() {
if (mStateCallback.hasStates(STATE_GESTURE_COMPLETED)) { if (mGestureEndTarget == HOME || (mLauncherTransitionController != null
&& mLauncherTransitionController.getAnimationPlayer().isStarted())) {
// We don't want a new mLauncherTransitionController if mGestureEndTarget == HOME (it
// has its own animation) or if we're already animating the current controller.
return; return;
} }
initTransitionEndpoints(mActivity.getDeviceProfile()); initTransitionEndpoints(mActivity.getDeviceProfile());
@@ -1276,12 +1279,7 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity>
} }
private void invalidateHandlerWithLauncher() { private void invalidateHandlerWithLauncher() {
if (mLauncherTransitionController != null) { endLauncherTransitionController();
if (mLauncherTransitionController.getAnimationPlayer().isStarted()) {
mLauncherTransitionController.getAnimationPlayer().cancel();
}
mLauncherTransitionController = null;
}
mRecentsView.onGestureAnimationEnd(); mRecentsView.onGestureAnimationEnd();
@@ -1289,6 +1287,13 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity>
mActivity.getRootView().getOverlay().remove(mLiveTileOverlay); mActivity.getRootView().getOverlay().remove(mLiveTileOverlay);
} }
private void endLauncherTransitionController() {
if (mLauncherTransitionController != null) {
mLauncherTransitionController.getAnimationPlayer().end();
mLauncherTransitionController = null;
}
}
private void notifyTransitionCancelled() { private void notifyTransitionCancelled() {
mAnimationFactory.onTransitionCancelled(); mAnimationFactory.onTransitionCancelled();
} }
@@ -1390,12 +1395,9 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity>
doLogGesture(HOME); doLogGesture(HOME);
} }
private void setupLauncherUiAfterSwipeUpAnimation() { private void setupLauncherUiAfterSwipeUpToRecentsAnimation() {
if (mLauncherTransitionController != null) { endLauncherTransitionController();
mLauncherTransitionController.getAnimationPlayer().end(); mActivityControlHelper.onSwipeUpToRecentsComplete(mActivity);
mLauncherTransitionController = null;
}
mActivityControlHelper.onSwipeUpComplete(mActivity);
mRecentsAnimationWrapper.setCancelWithDeferredScreenshot(true); mRecentsAnimationWrapper.setCancelWithDeferredScreenshot(true);
mRecentsView.onSwipeUpAnimationSuccess(); mRecentsView.onSwipeUpAnimationSuccess();
@@ -51,7 +51,7 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> {
int getSwipeUpDestinationAndLength(DeviceProfile dp, Context context, Rect outRect); int getSwipeUpDestinationAndLength(DeviceProfile dp, Context context, Rect outRect);
void onSwipeUpComplete(T activity); void onSwipeUpToRecentsComplete(T activity);
void onAssistantVisibilityChanged(float visibility); void onAssistantVisibilityChanged(float visibility);