Notify when quickstep gesture starts

Also rename notifyQuickSwitchToNewTask

Fixes: 188568083
Test: manual

Change-Id: Ic42825c60f69bcf1b13b92a096d182e82759d72a
This commit is contained in:
Tracy Zhou
2021-05-18 16:38:39 -07:00
parent 330f8f000d
commit 73705bf07a
4 changed files with 30 additions and 15 deletions

View File

@@ -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
}

View File

@@ -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;

View File

@@ -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());
}

View File

@@ -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. */