From 73705bf07a108d9a1a514974e1d4338fb77dd58e Mon Sep 17 00:00:00 2001 From: Tracy Zhou Date: Tue, 18 May 2021 16:38:39 -0700 Subject: [PATCH] Notify when quickstep gesture starts Also rename notifyQuickSwitchToNewTask Fixes: 188568083 Test: manual Change-Id: Ic42825c60f69bcf1b13b92a096d182e82759d72a --- .../shared/recents/ISystemUiProxy.aidl | 7 ++-- .../systemui/navigationbar/NavigationBar.java | 4 +-- .../gestural/EdgeBackGestureHandler.java | 2 +- .../recents/OverviewProxyService.java | 32 +++++++++++++------ 4 files changed, 30 insertions(+), 15 deletions(-) diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/recents/ISystemUiProxy.aidl b/packages/SystemUI/shared/src/com/android/systemui/shared/recents/ISystemUiProxy.aidl index f61cadb73a67b..f72245b9b252e 100644 --- a/packages/SystemUI/shared/src/com/android/systemui/shared/recents/ISystemUiProxy.aidl +++ b/packages/SystemUI/shared/src/com/android/systemui/shared/recents/ISystemUiProxy.aidl @@ -116,7 +116,7 @@ interface ISystemUiProxy { * Notifies that quickstep will switch to a new task * @param rotation indicates which Surface.Rotation the gesture was started in */ - void onQuickSwitchToNewTask(int rotation) = 25; + void notifyPrioritizedRotation(int rotation) = 25; /** * Handle the provided image as if it was a screenshot. @@ -137,5 +137,8 @@ interface ISystemUiProxy { /** Sets home rotation enabled. */ void setHomeRotationEnabled(boolean enabled) = 45; - // Next id = 46 + /** Notifies that a swipe-up gesture has started */ + oneway void notifySwipeUpGestureStarted() = 46; + + // Next id = 47 } diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java index 04f519958d567..9e77b60036a2c 100644 --- a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java +++ b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java @@ -246,7 +246,7 @@ public class NavigationBar implements View.OnAttachStateChangeListener, * gesture to indicate to them that they can continue in that orientation without having to * rotate the phone * The secondary handle will show when we get - * {@link OverviewProxyListener#onQuickSwitchToNewTask(int)} callback with the + * {@link OverviewProxyListener#notifyPrioritizedRotation(int)} callback with the * original handle hidden and we'll flip the visibilities once the * {@link #mTasksFrozenListener} fires */ @@ -319,7 +319,7 @@ public class NavigationBar implements View.OnAttachStateChangeListener, } @Override - public void onQuickSwitchToNewTask(@Surface.Rotation int rotation) { + public void onPrioritizedRotation(@Surface.Rotation int rotation) { mStartingQuickSwitchRotation = rotation; if (rotation == -1) { mShowOrientedHandleForImmersiveMode = false; diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/gestural/EdgeBackGestureHandler.java b/packages/SystemUI/src/com/android/systemui/navigationbar/gestural/EdgeBackGestureHandler.java index fc615deb1db61..dfcd1814cef14 100644 --- a/packages/SystemUI/src/com/android/systemui/navigationbar/gestural/EdgeBackGestureHandler.java +++ b/packages/SystemUI/src/com/android/systemui/navigationbar/gestural/EdgeBackGestureHandler.java @@ -128,7 +128,7 @@ public class EdgeBackGestureHandler extends CurrentUserTracker private OverviewProxyService.OverviewProxyListener mQuickSwitchListener = new OverviewProxyService.OverviewProxyListener() { @Override - public void onQuickSwitchToNewTask(@Surface.Rotation int rotation) { + public void onPrioritizedRotation(@Surface.Rotation int rotation) { mStartingQuickstepRotation = rotation; updateDisabledForQuickstep(mContext.getResources().getConfiguration()); } diff --git a/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java b/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java index 20c3e818e0976..89cb5af58928b 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java +++ b/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java @@ -425,20 +425,32 @@ public class OverviewProxyService extends CurrentUserTracker implements mPipOptional.ifPresent( pip -> pip.setPinnedStackAnimationType( PipAnimationController.ANIM_TYPE_ALPHA)); - mHandler.post(() -> notifySwipeToHomeFinishedInternal()); } finally { Binder.restoreCallingIdentity(token); } } @Override - public void onQuickSwitchToNewTask(@Surface.Rotation int rotation) { - if (!verifyCaller("onQuickSwitchToNewTask")) { + public void notifySwipeUpGestureStarted() { + if (!verifyCaller("notifySwipeUpGestureStarted")) { return; } final long token = Binder.clearCallingIdentity(); try { - mHandler.post(() -> notifyQuickSwitchToNewTask(rotation)); + mHandler.post(() -> notifySwipeUpGestureStartedInternal()); + } finally { + Binder.restoreCallingIdentity(token); + } + } + + @Override + public void notifyPrioritizedRotation(@Surface.Rotation int rotation) { + if (!verifyCaller("notifyPrioritizedRotation")) { + return; + } + final long token = Binder.clearCallingIdentity(); + try { + mHandler.post(() -> notifyPrioritizedRotationInternal(rotation)); } finally { Binder.restoreCallingIdentity(token); } @@ -880,9 +892,9 @@ public class OverviewProxyService extends CurrentUserTracker implements } } - private void notifyQuickSwitchToNewTask(@Surface.Rotation int rotation) { + private void notifyPrioritizedRotationInternal(@Surface.Rotation int rotation) { for (int i = mConnectionCallbacks.size() - 1; i >= 0; --i) { - mConnectionCallbacks.get(i).onQuickSwitchToNewTask(rotation); + mConnectionCallbacks.get(i).onPrioritizedRotation(rotation); } } @@ -910,9 +922,9 @@ public class OverviewProxyService extends CurrentUserTracker implements } } - public void notifySwipeToHomeFinishedInternal() { + private void notifySwipeUpGestureStartedInternal() { for (int i = mConnectionCallbacks.size() - 1; i >= 0; --i) { - mConnectionCallbacks.get(i).onSwipeToHomeFinished(); + mConnectionCallbacks.get(i).onSwipeUpGestureStarted(); } } @@ -1007,8 +1019,8 @@ public class OverviewProxyService extends CurrentUserTracker implements public interface OverviewProxyListener { default void onConnectionChanged(boolean isConnected) {} default void onQuickStepStarted() {} - default void onSwipeToHomeFinished() {} - default void onQuickSwitchToNewTask(@Surface.Rotation int rotation) {} + default void onSwipeUpGestureStarted() {} + default void onPrioritizedRotation(@Surface.Rotation int rotation) {} default void onOverviewShown(boolean fromHome) {} default void onQuickScrubStarted() {} /** Notify the recents app (overview) is started by 3-button navigation. */