From 035bb22298b0e8705cf1a67017a923a2c98bafc6 Mon Sep 17 00:00:00 2001 From: Tracy Zhou Date: Mon, 1 Feb 2021 20:34:27 -0800 Subject: [PATCH] [Live Tile] Fix a bunch of issues related to touch input Here are the issues - Touch down again during transition of quick switch brings back the previous app - During transition to overview, touch down on task / in the background area results in weird behaviors These issues related to touch input are caused by the z-ordering of app and launcher. Because in the current implementation we place launcher on top upon initial swipe up, during the transition (to overview / quick switch), any touch event goes directly to launcher instead of the overview input consumer (where it normally goes to in the non-live tile case), resulting in these weird behaviors mentioned above. The reason we put app below launcher upon swipe up is to render task view icon earlier (before swipe up settles into overview), which, is not as critical (we don't have the feature now), and we can find other ways to make that happen. So here are the proposed changes - Place app on top upon swipe up. Only place launcher on top after transition to overview. - Remove the temporary fix to disable click for live tile task during transition. - Remove icon logic in live tile overlay (in this change I only removed the call, but let me know if it's preferred that they are completely removed from LiveTileOverlay in this change) Test: manual Fixes: 178640174 Fixes: 175039524 Change-Id: Ib97804c8bbc487bc55160719375c0f2ff3ba7fd3 --- .../src/com/android/quickstep/AbsSwipeUpHandler.java | 10 ---------- .../com/android/quickstep/views/LiveTileOverlay.java | 5 +++++ .../src/com/android/quickstep/views/TaskView.java | 4 ---- 3 files changed, 5 insertions(+), 14 deletions(-) diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java index 6bcc4bfdce..36b51cdf1c 100644 --- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java @@ -731,7 +731,6 @@ public abstract class AbsSwipeUpHandler, Q extends setIsLikelyToStartNewTask(isLikelyToStartNewTask, false /* animate */); mStateCallback.setStateOnUiThread(STATE_GESTURE_STARTED); mGestureStarted = true; - mTaskViewSimulator.setDrawsBelowRecents(true); } /** @@ -958,7 +957,6 @@ public abstract class AbsSwipeUpHandler, Q extends if (endTarget == HOME) { duration = Math.max(MIN_OVERSHOOT_DURATION, duration); } else if (endTarget == RECENTS) { - LiveTileOverlay.INSTANCE.startIconAnimation(); if (mRecentsView != null) { int nearestPage = mRecentsView.getPageNearestToCenterOfScreen(); if (mRecentsView.getNextPage() != nearestPage) { @@ -971,9 +969,6 @@ public abstract class AbsSwipeUpHandler, Q extends } duration = Math.max(duration, mRecentsView.getScroller().getDuration()); } - if (ENABLE_QUICKSTEP_LIVE_TILE.get()) { - mRecentsView.getRunningTaskView().setIsClickableAsLiveTile(false); - } } // Let RecentsView handle the scrolling to the task, which we launch in startNewTask() @@ -1067,7 +1062,6 @@ public abstract class AbsSwipeUpHandler, Q extends } if (mGestureState.getEndTarget() == HOME) { - mTaskViewSimulator.setDrawsBelowRecents(false); getOrientationHandler().adjustFloatingIconStartVelocity(velocityPxPerMs); final RemoteAnimationTargetCompat runningTaskTarget = mRecentsAnimationTargets != null ? mRecentsAnimationTargets.findTask(mGestureState.getRunningTaskId()) @@ -1453,10 +1447,6 @@ public abstract class AbsSwipeUpHandler, Q extends private void finishCurrentTransitionToRecents() { if (ENABLE_QUICKSTEP_LIVE_TILE.get()) { mStateCallback.setStateOnUiThread(STATE_CURRENT_TASK_FINISHED); - final TaskView runningTaskView = mRecentsView.getRunningTaskView(); - if (runningTaskView != null) { - runningTaskView.setIsClickableAsLiveTile(true); - } } else if (!hasTargets() || mRecentsAnimationController == null) { // If there are no targets or the animation not started, then there is nothing to finish mStateCallback.setStateOnUiThread(STATE_CURRENT_TASK_FINISHED); diff --git a/quickstep/src/com/android/quickstep/views/LiveTileOverlay.java b/quickstep/src/com/android/quickstep/views/LiveTileOverlay.java index 747c3f28a1..8210ab0ca8 100644 --- a/quickstep/src/com/android/quickstep/views/LiveTileOverlay.java +++ b/quickstep/src/com/android/quickstep/views/LiveTileOverlay.java @@ -85,6 +85,11 @@ public class LiveTileOverlay extends Drawable { mIcon = icon; } + // TODO: consider cleaning this up and drawing icon in another way. Previously we place app + // below launcher during the initial swipe up and render the icon in this live tile overlay. + // However, this resulted in a bunch of touch input issues caused by Launcher getting the input + // events during transition (to overview / to another app (quick switch). So now our new + // solution places app on top in live tile until it fully settles in Overview. public void startIconAnimation() { if (mIconAnimator != null) { mIconAnimator.cancel(); diff --git a/quickstep/src/com/android/quickstep/views/TaskView.java b/quickstep/src/com/android/quickstep/views/TaskView.java index e8f590f28d..59cf3b2b8b 100644 --- a/quickstep/src/com/android/quickstep/views/TaskView.java +++ b/quickstep/src/com/android/quickstep/views/TaskView.java @@ -356,10 +356,6 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable { return false; } - public void setIsClickableAsLiveTile(boolean isClickableAsLiveTile) { - mIsClickableAsLiveTile = isClickableAsLiveTile; - } - private void computeAndSetIconTouchDelegate() { float iconHalfSize = mIconView.getWidth() / 2f; mIconCenterCoords[0] = mIconCenterCoords[1] = iconHalfSize;