summaryrefslogtreecommitdiffstats
path: root/quickstep
diff options
context:
space:
mode:
authorTony Wickham <twickham@google.com>2019-10-01 10:03:14 -0700
committerandroid-build-team Robot <android-build-team-robot@google.com>2019-10-11 18:51:30 +0000
commitb8b9cfaf0d7565db83df94b1b026e2e746c628d8 (patch)
tree09a38720d0595815a201e05d852abc757277a21b /quickstep
parentdf4ce4d6c14cc0bfd26f20571e743fd2b1d6a363 (diff)
downloadandroid_packages_apps_Trebuchet-b8b9cfaf0d7565db83df94b1b026e2e746c628d8.tar.gz
android_packages_apps_Trebuchet-b8b9cfaf0d7565db83df94b1b026e2e746c628d8.tar.bz2
android_packages_apps_Trebuchet-b8b9cfaf0d7565db83df94b1b026e2e746c628d8.zip
Don't allow scrolling RecentsView outside navbar during quickswitch
Once the inputProxy (OverviewInputConsumer) was enabled, it was never disabled. And while it was enabled, touches above the nav bar would go through to launcher, allowing you to scroll RecentsView (for example) during quick switch transitions. This breaks some assumptions, since it doesn't go through our normal shared swipe state logic that cancels the animation, updates the new end target (e.g. NEW_TASK vs LAST_TASK), etc. Thus, if you tried returning to LAST_TASK via this route, we would end up starting it as a new activity instead of resuming the existing one, causing a flicker (I guess because that TaskView is hidden). Test: - Swipe up from task A to home (to enable input proxy) - Open A - Swipe to B, and during transition scroll back to A from the center of the screen Before, this caused a flicker, now the last scroll is ignored. TODO: we should increase the nav region during quick switch to make it easier to continue scrolling Bug: 136829198 Bug: 138620399 Change-Id: I5ffb53743b728e1909066c5dd18cc9308aff2c7e (cherry picked from commit c9654eb09158a9878d7ff8fc9e588ec2d4903318) (cherry picked from commit 2784315f7d62ceea51651e57eb0348f23fb57c59) (cherry picked from commit 80090d579fc10f4dcb985259b6b70efcc27bd062)
Diffstat (limited to 'quickstep')
-rw-r--r--quickstep/recents_ui_overrides/src/com/android/quickstep/RecentsAnimationWrapper.java27
1 files changed, 27 insertions, 0 deletions
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/RecentsAnimationWrapper.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/RecentsAnimationWrapper.java
index e51ba631b..c4d3fa03a 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/RecentsAnimationWrapper.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/RecentsAnimationWrapper.java
@@ -19,6 +19,8 @@ import static android.view.MotionEvent.ACTION_CANCEL;
import static android.view.MotionEvent.ACTION_DOWN;
import static android.view.MotionEvent.ACTION_UP;
+import android.os.SystemClock;
+import android.util.Log;
import android.view.InputEvent;
import android.view.KeyEvent;
import android.view.MotionEvent;
@@ -38,6 +40,8 @@ import java.util.function.Supplier;
*/
public class RecentsAnimationWrapper {
+ private static final String TAG = "RecentsAnimationWrapper";
+
// A list of callbacks to run when we receive the recents animation target. There are different
// than the state callbacks as these run on the current worker thread.
private final ArrayList<Runnable> mCallbacks = new ArrayList<>();
@@ -125,6 +129,7 @@ public class RecentsAnimationWrapper {
boolean sendUserLeaveHint) {
SwipeAnimationTargetSet controller = targetSet;
targetSet = null;
+ disableInputProxy();
if (controller != null) {
controller.finishController(toRecents, onFinishComplete, sendUserLeaveHint);
}
@@ -153,6 +158,16 @@ public class RecentsAnimationWrapper {
mInputConsumerController.setInputListener(this::onInputConsumerEvent);
}
+ private void disableInputProxy() {
+ if (mInputConsumer != null && mTouchInProgress) {
+ long now = SystemClock.uptimeMillis();
+ MotionEvent dummyCancel = MotionEvent.obtain(now, now, ACTION_CANCEL, 0, 0, 0);
+ mInputConsumer.onMotionEvent(dummyCancel);
+ dummyCancel.recycle();
+ }
+ mInputConsumerController.setInputListener(null);
+ }
+
private boolean onInputConsumerEvent(InputEvent ev) {
if (ev instanceof MotionEvent) {
onInputConsumerMotionEvent((MotionEvent) ev);
@@ -168,6 +183,18 @@ public class RecentsAnimationWrapper {
private boolean onInputConsumerMotionEvent(MotionEvent ev) {
int action = ev.getAction();
+
+ // Just to be safe, verify that ACTION_DOWN comes before any other action,
+ // and ignore any ACTION_DOWN after the first one (though that should not happen).
+ if (!mTouchInProgress && action != ACTION_DOWN) {
+ Log.w(TAG, "Received non-down motion before down motion: " + action);
+ return false;
+ }
+ if (mTouchInProgress && action == ACTION_DOWN) {
+ Log.w(TAG, "Received down motion while touch was already in progress");
+ return false;
+ }
+
if (action == ACTION_DOWN) {
mTouchInProgress = true;
if (mInputConsumer == null) {