From c609421f2ad43ec9cf0396fb37f8a27bc8c2a618 Mon Sep 17 00:00:00 2001 From: Vinit Nayak Date: Mon, 18 May 2020 19:18:45 -0700 Subject: [PATCH] Maintain fake nav bar position in overview for landscape NavBar defaults to display when quickswitch ends, which is always portrait since home is now always in portrait. We keep the same nav region that the user used to swipe up to enter recents and reset once they swipe to home. Fixes: 156053957 Test: Swipe up from landscape app, then swipe up from the same nav bar region to go home. Change-Id: Ia4cf8172850b991aa5e145897622be3b2afa3779 --- .../quickstep/BaseSwipeUpHandlerV2.java | 8 ++----- .../quickstep/FallbackActivityInterface.java | 5 +++++ .../quickstep/LauncherActivityInterface.java | 22 +++++++++++++++++++ .../quickstep/TouchInteractionService.java | 1 - .../quickstep/BaseActivityInterface.java | 3 +++ .../RecentsAnimationDeviceState.java | 21 ++++++++++++++++-- 6 files changed, 51 insertions(+), 9 deletions(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandlerV2.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandlerV2.java index 343f28ac3d..5194940bb0 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandlerV2.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandlerV2.java @@ -779,12 +779,6 @@ public abstract class BaseSwipeUpHandlerV2, Q exte } } - if (endTarget == RECENTS || endTarget == HOME) { - // Since we're now done quickStepping, we want to only listen for touch events - // for the main orientation's nav bar, instead of multiple - mDeviceState.enableMultipleRegions(false); - } - if (mDeviceState.isOverviewDisabled() && (endTarget == RECENTS || endTarget == LAST_TASK)) { return LAST_TASK; } @@ -1242,6 +1236,7 @@ public abstract class BaseSwipeUpHandlerV2, Q exte } ActiveGestureLog.INSTANCE.addLog("finishRecentsAnimation", true); doLogGesture(HOME); + mDeviceState.enableMultipleRegions(false); } protected abstract void finishRecentsControllerToHome(Runnable callback); @@ -1257,6 +1252,7 @@ public abstract class BaseSwipeUpHandlerV2, Q exte SystemUiProxy.INSTANCE.get(mContext).onOverviewShown(false, TAG); doLogGesture(RECENTS); + mDeviceState.onSwipeUpToOverview(mActivityInterface); reset(); } diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityInterface.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityInterface.java index 7d08fac363..c9ff88409a 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityInterface.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityInterface.java @@ -139,6 +139,11 @@ public final class FallbackActivityInterface extends || super.deferStartingActivity(deviceState, ev); } + @Override + public void onExitOverview(RecentsAnimationDeviceState deviceState, Runnable exitRunnable) { + // no-op, fake landscape not supported for 3P + } + @Override public int getContainerType() { RecentsActivity activity = getCreatedActivity(); diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityInterface.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityInterface.java index dae2f41b28..13b84e036e 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityInterface.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityInterface.java @@ -44,6 +44,7 @@ import com.android.launcher3.anim.PendingAnimation; import com.android.launcher3.appprediction.PredictionUiStateManager; import com.android.launcher3.statehandlers.DepthController; import com.android.launcher3.statehandlers.DepthController.ClampedDepthProperty; +import com.android.launcher3.statemanager.StateManager; import com.android.launcher3.testing.TestProtocol; import com.android.launcher3.touch.PagedOrientationHandler; import com.android.launcher3.userevent.nano.LauncherLogProto; @@ -224,6 +225,27 @@ public final class LauncherActivityInterface extends } + @Override + public void onExitOverview(RecentsAnimationDeviceState deviceState, Runnable exitRunnable) { + final StateManager stateManager = getCreatedActivity().getStateManager(); + stateManager.addStateListener( + new StateManager.StateListener() { + @Override + public void onStateTransitionComplete(LauncherState toState) { + // Are we going from Recents to Workspace? + if (toState == LauncherState.NORMAL) { + exitRunnable.run(); + + // reset layout on swipe to home + RecentsView recentsView = getCreatedActivity().getOverviewPanel(); + recentsView.setLayoutRotation(deviceState.getCurrentActiveRotation(), + deviceState.getDisplayRotation()); + stateManager.removeStateListener(this); + } + } + }); + } + @Override public Rect getOverviewWindowBounds(Rect homeBounds, RemoteAnimationTargetCompat target) { return homeBounds; diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java index a0bb631f78..ef3d174ed3 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java @@ -554,7 +554,6 @@ public class TouchInteractionService extends Service implements PluginListener mGestureBlockedActivities; private Runnable mOnDestroyFrozenTaskRunnable; + /** + * Set to true when user swipes to recents. In recents, we ignore the state of the recents + * task list being frozen or not to allow the user to keep interacting with nav bar rotation + * they went into recents with as opposed to defaulting to the default display rotation. + * TODO: (b/156984037) For when user rotates after entering overview + */ + private boolean mInOverview; public RecentsAnimationDeviceState(Context context) { mContext = context; @@ -508,7 +514,18 @@ public class RecentsAnimationDeviceState implements mOrientationTouchTransformer.transform(event); } + void onSwipeUpToOverview(BaseActivityInterface activityInterface) { + mInOverview = true; + activityInterface.onExitOverview(this, () -> { + mInOverview = false; + enableMultipleRegions(false); + }); + } + void enableMultipleRegions(boolean enable) { + if (mInOverview) { + return; + } mOrientationTouchTransformer.enableMultipleRegions(enable, mDefaultDisplay.getInfo()); UI_HELPER_EXECUTOR.execute(() -> { int quickStepStartingRotation =