From 09cc13e20cb034f527fedb135cb8364f71e83d19 Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Fri, 27 Apr 2018 16:45:51 -0700 Subject: [PATCH] Let Launcher handle proxy touch events even if it is not focused Bug: 74616863 Bug: 78367228 Change-Id: I8c9271e95583793af0832e3b07c988261b6267e8 --- .../quickstep/TouchInteractionService.java | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/quickstep/src/com/android/quickstep/TouchInteractionService.java b/quickstep/src/com/android/quickstep/TouchInteractionService.java index b89a835617..25649fa617 100644 --- a/quickstep/src/com/android/quickstep/TouchInteractionService.java +++ b/quickstep/src/com/android/quickstep/TouchInteractionService.java @@ -22,6 +22,8 @@ import static android.view.MotionEvent.ACTION_POINTER_DOWN; import static android.view.MotionEvent.ACTION_POINTER_UP; import static android.view.MotionEvent.ACTION_UP; +import static com.android.systemui.shared.system.ActivityManagerWrapper + .CLOSE_SYSTEM_WINDOWS_REASON_RECENTS; import static com.android.systemui.shared.system.NavigationBarCompat.HIT_TARGET_NONE; import android.annotation.TargetApi; @@ -256,7 +258,6 @@ public class TouchInteractionService extends Service { private boolean mTrackingStarted = false; private boolean mInvalidated = false; - private boolean mHadWindowFocusOnDown; private float mLastProgress = 0; private boolean mStartPending = false; @@ -281,8 +282,7 @@ public class TouchInteractionService extends Service { if (action == ACTION_DOWN) { mTrackingStarted = false; mDownPos.set(ev.getX(), ev.getY()); - mHadWindowFocusOnDown = mTarget.hasWindowFocus(); - } else if (!mTrackingStarted && mHadWindowFocusOnDown) { + } else if (!mTrackingStarted) { switch (action) { case ACTION_POINTER_UP: case ACTION_POINTER_DOWN: @@ -327,12 +327,24 @@ public class TouchInteractionService extends Service { ev.setEdgeFlags(flags); } + @Override + public void onQuickStep(float eventX, float eventY, long eventTime) { + if (mInvalidated) { + return; + } + mActivityHelper.onQuickstepGestureStarted(mActivity, true); + ActivityManagerWrapper.getInstance() + .closeSystemWindows(CLOSE_SYSTEM_WINDOWS_REASON_RECENTS); + } + @Override public void updateTouchTracking(int interactionType) { if (mInvalidated) { return; } if (interactionType == INTERACTION_QUICK_SCRUB) { + ActivityManagerWrapper.getInstance() + .closeSystemWindows(CLOSE_SYSTEM_WINDOWS_REASON_RECENTS); mStartPending = true; Runnable action = () -> { @@ -345,7 +357,6 @@ public class TouchInteractionService extends Service { mQuickScrubController.onQuickScrubEnd(); mEndPending = false; } - }; mActivityHelper.executeOnWindowAvailable(mActivity, action);