diff options
author | Beverly <beverlyt@google.com> | 2021-07-16 14:12:50 -0400 |
---|---|---|
committer | Beverly Tai <beverlyt@google.com> | 2021-07-18 20:01:01 +0000 |
commit | cde9224b7b28b68108e28231daa56a26c79fc8c3 (patch) | |
tree | 0890e9378132ba413d236fb7859d62b6aa2de032 /packages/SystemUI/src/com/android/keyguard/LockIconViewController.java | |
parent | 6522a7324829dc259a9ba3882fc10cde36c4f504 (diff) |
Only intercept lockIcon touches after longpress
All other touches should be let through to NPV in case
the user starts to swipe up from the lock icon
We still want to continue intercepting touches after a long press
so that the NPV won't mistakenly handle the touch + expand the
shade after a longpress.
Test: manual
Fixes: 193614314
Change-Id: I060f6f78c373a726fe4dbe1be5b5413364882e1d
Diffstat (limited to 'packages/SystemUI/src/com/android/keyguard/LockIconViewController.java')
-rw-r--r-- | packages/SystemUI/src/com/android/keyguard/LockIconViewController.java | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/packages/SystemUI/src/com/android/keyguard/LockIconViewController.java b/packages/SystemUI/src/com/android/keyguard/LockIconViewController.java index 5957be3c271b..8b974b4ac206 100644 --- a/packages/SystemUI/src/com/android/keyguard/LockIconViewController.java +++ b/packages/SystemUI/src/com/android/keyguard/LockIconViewController.java @@ -119,6 +119,7 @@ public class LockIconViewController extends ViewController<LockIconView> impleme private boolean mShowLockIcon; private boolean mDownDetected; + private boolean mDetectedLongPress; private final Rect mSensorTouchLocation = new Rect(); @Inject @@ -485,6 +486,7 @@ public class LockIconViewController extends ViewController<LockIconView> impleme private final GestureDetector mGestureDetector = new GestureDetector(new SimpleOnGestureListener() { public boolean onDown(MotionEvent e) { + mDetectedLongPress = false; if (!isClickable()) { mDownDetected = false; return false; @@ -517,6 +519,7 @@ public class LockIconViewController extends ViewController<LockIconView> impleme "lockIcon-onLongPress", VIBRATION_SONIFICATION_ATTRIBUTES); } + mDetectedLongPress = true; onAffordanceClick(); } @@ -559,7 +562,7 @@ public class LockIconViewController extends ViewController<LockIconView> impleme // 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 (mDownDetected && mDetectedLongPress) { if (event.getAction() == MotionEvent.ACTION_CANCEL || event.getAction() == MotionEvent.ACTION_UP) { mDownDetected = false; |