From 748afbec352718eb87d986ae3282eb64ba83b9c5 Mon Sep 17 00:00:00 2001 From: Samuel Fufa Date: Thu, 5 Mar 2020 11:32:54 -0800 Subject: [PATCH] Prevent hotseat touch hijack Bug: 148639821 Test: Manual Change-Id: Ia08af6b243a3492a898371b7bc66158df49d2427 --- .../launcher3/allapps/AllAppsContainerView.java | 14 ++++++++++++-- .../allapps/LauncherAllAppsContainerView.java | 5 ++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java index fcccc598ec..afb72172b8 100644 --- a/src/com/android/launcher3/allapps/AllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java @@ -98,8 +98,8 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo protected boolean mUsingTabs; private boolean mSearchModeWhileUsingTabs = false; - private RecyclerViewFastScroller mTouchHandler; - private final Point mFastScrollerOffset = new Point(); + protected RecyclerViewFastScroller mTouchHandler; + protected final Point mFastScrollerOffset = new Point(); private final MultiValueAlpha mMultiValueAlpha; @@ -238,6 +238,16 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo @Override public boolean onTouchEvent(MotionEvent ev) { + if (ev.getAction() == MotionEvent.ACTION_DOWN) { + AllAppsRecyclerView rv = getActiveRecyclerView(); + if (rv != null && rv.getScrollbar().isHitInParent(ev.getX(), ev.getY(), + mFastScrollerOffset)) { + mTouchHandler = rv.getScrollbar(); + } else { + mTouchHandler = null; + + } + } if (mTouchHandler != null) { mTouchHandler.handleTouchEvent(ev, mFastScrollerOffset); return true; diff --git a/src/com/android/launcher3/allapps/LauncherAllAppsContainerView.java b/src/com/android/launcher3/allapps/LauncherAllAppsContainerView.java index 25db0e7f1d..f6766c4023 100644 --- a/src/com/android/launcher3/allapps/LauncherAllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/LauncherAllAppsContainerView.java @@ -51,7 +51,10 @@ public class LauncherAllAppsContainerView extends AllAppsContainerView { public boolean onInterceptTouchEvent(MotionEvent ev) { // The AllAppsContainerView houses the QSB and is hence visible from the Workspace // Overview states. We shouldn't intercept for the scrubber in these cases. - if (!mLauncher.isInState(LauncherState.ALL_APPS)) return false; + if (!mLauncher.isInState(LauncherState.ALL_APPS)) { + mTouchHandler = null; + return false; + } return super.onInterceptTouchEvent(ev); }