Update orientation state while gesture animation start.
While quickswitch in landscape mode, the orientation handler would be
update to LandscapePagedViewHandler when receive onLauncherStart,
however, it might be too late because the VelocityTracker can already
tracking with PortraitPagedViewHandler at
AbsSwipeUpHandler#setupRecentsViewUi, which leads the wrong
judgement while PagedView#onTouchEvent handling the ACTION_UP that
the velocity can nearly 0 from mOrientationHandler.getPrimaryVelocity.
By update the orientation handler earlier at onGestureAnimationStart,
the velocity tracking result should stay consistent from ACTION_DOWN
till ACTION_UP.
Bug: 213867585
Bug: 209936664
Bug: 221805258
Test: run below tests w/o shell transition.
atest FlickerTests:QuickSwitchBetweenTwoAppsForwardTest
atest FlickerTests:QuickSwitchBetweenTwoAppsBackTest
Change-Id: If73fa8d88cc372b6f783fb6cdda4148d11a2ee19
diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
index 43be051..254f7b0 100644
--- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
+++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
@@ -583,7 +583,7 @@
} else {
runningTasks = new ActivityManager.RunningTaskInfo[]{mGestureState.getRunningTask()};
}
- mRecentsView.onGestureAnimationStart(runningTasks);
+ mRecentsView.onGestureAnimationStart(runningTasks, mDeviceState.getRotationTouchHelper());
}
private void launcherFrameDrawn() {
diff --git a/quickstep/src/com/android/quickstep/FallbackSwipeHandler.java b/quickstep/src/com/android/quickstep/FallbackSwipeHandler.java
index a62e9d1..1ed61ee 100644
--- a/quickstep/src/com/android/quickstep/FallbackSwipeHandler.java
+++ b/quickstep/src/com/android/quickstep/FallbackSwipeHandler.java
@@ -206,7 +206,8 @@
if (mRunningOverHome) {
if (DisplayController.getNavigationMode(mContext).hasGestures) {
mRecentsView.onGestureAnimationStartOnHome(
- new ActivityManager.RunningTaskInfo[]{mGestureState.getRunningTask()});
+ new ActivityManager.RunningTaskInfo[]{mGestureState.getRunningTask()},
+ mDeviceState.getRotationTouchHelper());
}
} else {
super.notifyGestureAnimationStartToRecents();
diff --git a/quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java b/quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java
index e6f73dc..eda2c5a 100644
--- a/quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java
+++ b/quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java
@@ -42,6 +42,7 @@
import com.android.quickstep.FallbackActivityInterface;
import com.android.quickstep.GestureState;
import com.android.quickstep.RecentsActivity;
+import com.android.quickstep.RotationTouchHelper;
import com.android.quickstep.util.GroupTask;
import com.android.quickstep.util.SplitSelectStateController;
import com.android.quickstep.util.TaskViewSimulator;
@@ -86,11 +87,12 @@
* to the home task. This allows us to handle quick-switch similarly to a quick-switching
* from a foreground task.
*/
- public void onGestureAnimationStartOnHome(RunningTaskInfo[] homeTaskInfo) {
+ public void onGestureAnimationStartOnHome(RunningTaskInfo[] homeTaskInfo,
+ RotationTouchHelper rotationTouchHelper) {
// TODO(b/195607777) General fallback love, but this might be correct
// Home task should be defined as the front-most task info I think?
mHomeTaskInfo = homeTaskInfo[0];
- onGestureAnimationStart(homeTaskInfo);
+ onGestureAnimationStart(homeTaskInfo, rotationTouchHelper);
}
/**
diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java
index 22491bc..0a3b311 100644
--- a/quickstep/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/RecentsView.java
@@ -154,6 +154,7 @@
import com.android.quickstep.RemoteAnimationTargets;
import com.android.quickstep.RemoteTargetGluer;
import com.android.quickstep.RemoteTargetGluer.RemoteTargetHandle;
+import com.android.quickstep.RotationTouchHelper;
import com.android.quickstep.SystemUiProxy;
import com.android.quickstep.TaskOverlayFactory;
import com.android.quickstep.TaskThumbnailCache;
@@ -2064,11 +2065,13 @@
/**
* Called when a gesture from an app is starting.
*/
- public void onGestureAnimationStart(RunningTaskInfo[] runningTaskInfo) {
+ public void onGestureAnimationStart(RunningTaskInfo[] runningTaskInfo,
+ RotationTouchHelper rotationTouchHelper) {
mGestureActive = true;
// This needs to be called before the other states are set since it can create the task view
if (mOrientationState.setGestureActive(true)) {
- updateOrientationHandler();
+ setLayoutRotation(rotationTouchHelper.getCurrentActiveRotation(),
+ rotationTouchHelper.getDisplayRotation());
}
showCurrentTask(runningTaskInfo);