OSDN Git Service

Introduce HapticFeedbackConstants.TEXT_HANDLE_MOVE
authorYohei Yukawa <yukawa@google.com>
Fri, 9 Jun 2017 19:01:51 +0000 (12:01 -0700)
committerYohei Yukawa <yukawa@google.com>
Fri, 9 Jun 2017 19:01:51 +0000 (12:01 -0700)
This CL introduces a new haptic feedback type for the scenario where
the user is manually moving the text insertion/selection handle on the
touch devices such as touch screen.

Having a dedicated constant is necessary for device-wide consistency and
flexibility to fine tune the feedback in future.

Bug: 62454887
Bug: 62487772
Fixes: 62486763
Test: Confirmed that View#performHapticFeedback() with this constant
      triggers vibration.
Change-Id: I25841f20c3b8dbf0e9dabe75227c41d954193d33

core/java/android/view/HapticFeedbackConstants.java
services/core/java/com/android/server/policy/PhoneWindowManager.java

index 31cece4..0a73949 100644 (file)
@@ -62,6 +62,12 @@ public class HapticFeedbackConstants {
     public static final int VIRTUAL_KEY_RELEASE = 7;
 
     /**
+     * The user has performed a selection/insertion handle move on text field.
+     * @hide
+     */
+    public static final int TEXT_HANDLE_MOVE = 8;
+
+    /**
      * This is a private constant.  Feel free to renumber as desired.
      * @hide
      */
index f46aeac..1dbbdd5 100644 (file)
@@ -7694,6 +7694,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                 return VibrationEffect.get(VibrationEffect.EFFECT_TICK);
             case HapticFeedbackConstants.VIRTUAL_KEY_RELEASE:
                 return VibrationEffect.get(VibrationEffect.EFFECT_TICK);
+            case HapticFeedbackConstants.TEXT_HANDLE_MOVE:
+                return VibrationEffect.get(VibrationEffect.EFFECT_TICK);
             default:
                 return null;
         }