summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2019-10-11 18:54:16 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2019-10-11 18:54:16 +0000
commit23c20a9d2b17e83c2daa0bb11f521d6aef245d2f (patch)
tree22c56c00bb0175f63d1dafee59dcd19389fe42f2
parentdf4ce4d6c14cc0bfd26f20571e743fd2b1d6a363 (diff)
parent7409190c86352c24e6ac6a023f0e610e02bc93ce (diff)
downloadandroid_packages_apps_Trebuchet-23c20a9d2b17e83c2daa0bb11f521d6aef245d2f.tar.gz
android_packages_apps_Trebuchet-23c20a9d2b17e83c2daa0bb11f521d6aef245d2f.tar.bz2
android_packages_apps_Trebuchet-23c20a9d2b17e83c2daa0bb11f521d6aef245d2f.zip
Merge cherrypicks of [9540994, 9540080, 9540966, 9540888, 9540238, 9540889, 9540890, 9540891, 9540562, 9540996, 9540997, 9540998, 9540999, 9541000, 9540968, 9540969, 9540081, 9541003, 9539963, 9541104, 9541105, 9541144, 9541145, 9541146, 9541147, 9541148, 9541149, 9540970, 9541150, 9541152] into qt-qpr1-b-release
Change-Id: I757110e1b8cf1a21acc82cf12ed5e08259bf0166
-rw-r--r--quickstep/recents_ui_overrides/src/com/android/quickstep/RecentsAnimationWrapper.java27
-rw-r--r--quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java10
-rw-r--r--quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java11
-rw-r--r--src/com/android/launcher3/PagedView.java4
4 files changed, 46 insertions, 6 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) {
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java
index a3bd348e2..e1085e608 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java
@@ -923,7 +923,15 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity>
windowAnim.addListener(new AnimationSuccessListener() {
@Override
public void onAnimationSuccess(Animator animator) {
- setStateOnUiThread(target.endState);
+ if (target == NEW_TASK && mRecentsView != null
+ && mRecentsView.getNextPage() == mRecentsView.getRunningTaskIndex()) {
+ // We are about to launch the current running task, so use LAST_TASK state
+ // instead of NEW_TASK. This could happen, for example, if our scroll is
+ // aborted after we determined the target to be NEW_TASK.
+ setStateOnUiThread(LAST_TASK.endState);
+ } else {
+ setStateOnUiThread(target.endState);
+ }
}
});
windowAnim.start();
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java
index d98ef425e..ef54d3f89 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java
@@ -17,7 +17,6 @@
package com.android.quickstep.views;
import static androidx.dynamicanimation.animation.DynamicAnimation.MIN_VISIBLE_CHANGE_PIXELS;
-
import static com.android.launcher3.BaseActivity.STATE_HANDLER_INVISIBILITY_FLAGS;
import static com.android.launcher3.InvariantDeviceProfile.CHANGE_FLAG_ICON_PARAMS;
import static com.android.launcher3.LauncherAnimUtils.SCALE_PROPERTY;
@@ -572,9 +571,13 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl
final TaskView taskView = (TaskView) getChildAt(pageIndex);
taskView.bind(task);
}
- TaskView runningTaskView = getRunningTaskView();
- if (runningTaskView != null) {
- setCurrentPage(indexOfChild(runningTaskView));
+
+ if (mNextPage == INVALID_PAGE) {
+ // Set the current page to the running task, but not if settling on new task.
+ TaskView runningTaskView = getRunningTaskView();
+ if (runningTaskView != null) {
+ setCurrentPage(indexOfChild(runningTaskView));
+ }
}
if (mIgnoreResetTaskId != -1 && getTaskView(mIgnoreResetTaskId) != ignoreRestTaskView) {
diff --git a/src/com/android/launcher3/PagedView.java b/src/com/android/launcher3/PagedView.java
index 70b55a44d..79d6ca793 100644
--- a/src/com/android/launcher3/PagedView.java
+++ b/src/com/android/launcher3/PagedView.java
@@ -1088,7 +1088,9 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
if (mFreeScroll) {
setCurrentPage(getNextPage());
} else if (wasFreeScroll) {
- snapToPage(getNextPage());
+ if (getScrollForPage(getNextPage()) != getScrollX()) {
+ snapToPage(getNextPage());
+ }
}
}