How does Android customize vibrator's various vibration modes M specific methods

  • 2020-05-19 05:42:25
  • OfStack

The configuration of 1 type vibration time is as follows:

frameworks/base/core/res/res/values/config.xml
    <!--  Long press vibration  -->
    <!-- Vibrator pattern for feedback about a long screen/key press -->
    <integer-array name="config_longPressVibePattern">
        <item>0</item>
        <item>1</item>
        <item>20</item>
        <item>21</item>
    </integer-array>

    <!--  Virtual keystroke vibration  -->
    <!-- Vibrator pattern for feedback about touching a virtual key -->
    <integer-array name="config_virtualKeyVibePattern">
        <item>0</item>
        <item>10</item>
        <item>20</item>
        <item>30</item>
    </integer-array>

    <!--  Soft keyboard keys vibrate  -->
    <!-- Vibrator pattern for a very short but reliable vibration for soft keyboard tap -->
    <integer-array name="config_keyboardTapVibePattern">
        <item>40</item>
    </integer-array>

    <!--  Start vibration in non-safe mode  -->
    <!-- Vibrator pattern for feedback about booting with safe mode disabled -->
    <integer-array name="config_safeModeDisabledVibePattern">
        <item>0</item>
        <item>1</item>
        <item>20</item>
        <item>21</item>
    </integer-array>

    <!--  Safe mode starts vibration  -->
    <!-- Vibrator pattern for feedback about booting with safe mode disabled -->
    <integer-array name="config_safeModeEnabledVibePattern">
        <item>0</item>
        <item>1</item>
        <item>20</item>
        <item>21</item>
        <item>500</item>
        <item>600</item>
    </integer-array>

In the form of array above, the odd position represents the pause time, and the even position represents the vibration time. The unit is ms

Related articles: