diff options
| author | Andrei Stingaceanu <stg@google.com> | 2017-09-07 14:12:38 +0100 |
|---|---|---|
| committer | Andrei Stingaceanu <stg@google.com> | 2017-09-08 11:18:56 +0000 |
| commit | 4303f22535080267200a3d2b03a4dd0bc061bf38 (patch) | |
| tree | b3fa4bfcf8c243fcb4fced683e1ff6ba3b0e0c9a /core/java/android/widget/TextView.java | |
| parent | 0be3f49560b3f8ffefb2199e680dbc29bfceabf9 (diff) | |
TextView longpress 2 haptic feedback fix
TextView#performLongClick() calls View#performLongClick which
calls View#performLongClickInternal() which, if handled, performs
the longpress haptic feedback and returns handled. TextView
looks at this return value and if it is true then makes another
call to perform longpress haptic feedback. Remove the duplicate
call in TextView as the one in the parent (View) is sufficient.
Bug: 65397911
Test: manual
Change-Id: Ic73a86637486d5382b63f1c1b37783e238452841
Diffstat (limited to 'core/java/android/widget/TextView.java')
| -rw-r--r-- | core/java/android/widget/TextView.java | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index b2e2e889d16c..cd2d2fdf5a8a 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -10875,6 +10875,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener @Override public boolean performLongClick() { boolean handled = false; + boolean performedHapticFeedback = false; if (mEditor != null) { mEditor.mIsBeingLongClicked = true; @@ -10882,6 +10883,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener if (super.performLongClick()) { handled = true; + performedHapticFeedback = true; } if (mEditor != null) { @@ -10890,7 +10892,9 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener } if (handled) { - performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + if (!performedHapticFeedback) { + performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + } if (mEditor != null) mEditor.mDiscardNextActionUp = true; } else { MetricsLogger.action( |
