summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Beverly Tai <beverlyt@google.com> 2021-12-01 19:03:17 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2021-12-01 19:03:17 +0000
commit9d7958a97e5f3e094889cd0507499138325237f8 (patch)
treefb572e9751bd2d5310ba14cc3217cff17bea0bdf
parent3e76eb37e1c8e1f38bf41def21436e610fbe04e2 (diff)
parent12aff06413622c2ce47a4967974d0e06ade17887 (diff)
Merge "Don't send lock icon touches to NotifShade" into sc-v2-dev am: 12aff06413
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16365346 Change-Id: I3c47370aed38bbd080e4041f0f881a9acd577fc9
-rw-r--r--packages/SystemUI/src/com/android/keyguard/LockIconViewController.java36
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationShadeWindowViewController.java5
2 files changed, 29 insertions, 12 deletions
diff --git a/packages/SystemUI/src/com/android/keyguard/LockIconViewController.java b/packages/SystemUI/src/com/android/keyguard/LockIconViewController.java
index 88476398e09d..163392314cfc 100644
--- a/packages/SystemUI/src/com/android/keyguard/LockIconViewController.java
+++ b/packages/SystemUI/src/com/android/keyguard/LockIconViewController.java
@@ -661,24 +661,36 @@ public class LockIconViewController extends ViewController<LockIconView> impleme
* @return whether to intercept the touch event
*/
public boolean onTouchEvent(MotionEvent event, Runnable onGestureDetectedRunnable) {
- if (mSensorTouchLocation.contains((int) event.getX(), (int) event.getY())
- && (mView.getVisibility() == View.VISIBLE
- || (mAodFp != null && mAodFp.getVisibility() == View.VISIBLE))) {
+ if (onInterceptTouchEvent(event)) {
mOnGestureDetectedRunnable = onGestureDetectedRunnable;
mGestureDetector.onTouchEvent(event);
+ return true;
}
- // we continue to intercept all following touches until we see MotionEvent.ACTION_CANCEL UP
- // or MotionEvent.ACTION_UP. this is to avoid passing the touch to NPV
- // after the lock icon disappears on device entry
- if (mDownDetected) {
- if (event.getAction() == MotionEvent.ACTION_CANCEL
- || event.getAction() == MotionEvent.ACTION_UP) {
- mDownDetected = false;
- }
+ mDownDetected = false;
+ return false;
+ }
+
+ /**
+ * Intercepts the touch if the onDown event and current event are within this lock icon view's
+ * bounds.
+ */
+ public boolean onInterceptTouchEvent(MotionEvent event) {
+ if (!inLockIconArea(event) || !isClickable()) {
+ return false;
+ }
+
+ if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
return true;
}
- return false;
+
+ return mDownDetected;
+ }
+
+ private boolean inLockIconArea(MotionEvent event) {
+ return mSensorTouchLocation.contains((int) event.getX(), (int) event.getY())
+ && (mView.getVisibility() == View.VISIBLE
+ || (mAodFp != null && mAodFp.getVisibility() == View.VISIBLE));
}
private boolean isClickable() {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationShadeWindowViewController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationShadeWindowViewController.java
index 01587f7fe98c..55f14500f8fc 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationShadeWindowViewController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationShadeWindowViewController.java
@@ -338,6 +338,11 @@ public class NotificationShadeWindowViewController {
return true;
}
+ if (mLockIconViewController.onInterceptTouchEvent(ev)) {
+ // immediately return true; don't send the touch to the drag down helper
+ return true;
+ }
+
boolean intercept = false;
if (mNotificationPanelViewController.isFullyExpanded()
&& mDragDownHelper.isDragDownEnabled()