Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 5e01316

Browse files
TreeHugger RobotAndroid (Google) Code Review
authored andcommitted
Merge "Only intercept lockIcon touches after longpress" into sc-dev
2 parents c18be9f + cde9224 commit 5e01316

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/SystemUI/src/com/android/keyguard/LockIconViewController.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ public class LockIconViewController extends ViewController<LockIconView> impleme
119119
private boolean mShowLockIcon;
120120

121121
private boolean mDownDetected;
122+
private boolean mDetectedLongPress;
122123
private final Rect mSensorTouchLocation = new Rect();
123124

124125
@Inject
@@ -485,6 +486,7 @@ public void onConfigChanged(Configuration newConfig) {
485486
private final GestureDetector mGestureDetector =
486487
new GestureDetector(new SimpleOnGestureListener() {
487488
public boolean onDown(MotionEvent e) {
489+
mDetectedLongPress = false;
488490
if (!isClickable()) {
489491
mDownDetected = false;
490492
return false;
@@ -517,6 +519,7 @@ public void onLongPress(MotionEvent e) {
517519
"lockIcon-onLongPress",
518520
VIBRATION_SONIFICATION_ATTRIBUTES);
519521
}
522+
mDetectedLongPress = true;
520523
onAffordanceClick();
521524
}
522525

@@ -559,7 +562,7 @@ public boolean onTouchEvent(MotionEvent event) {
559562
// we continue to intercept all following touches until we see MotionEvent.ACTION_CANCEL UP
560563
// or MotionEvent.ACTION_UP. this is to avoid passing the touch to NPV
561564
// after the lock icon disappears on device entry
562-
if (mDownDetected) {
565+
if (mDownDetected && mDetectedLongPress) {
563566
if (event.getAction() == MotionEvent.ACTION_CANCEL
564567
|| event.getAction() == MotionEvent.ACTION_UP) {
565568
mDownDetected = false;

0 commit comments

Comments
 (0)