Add CTS for vibrate with VibrationAttributes

Bug: 163119475
Test: VibratorTest
Change-Id: I39251aeb448982c18fc97fd2be9514485681bb33
diff --git a/tests/tests/os/src/android/os/cts/VibratorTest.java b/tests/tests/os/src/android/os/cts/VibratorTest.java
index 0b9daa1..df4b19a 100644
--- a/tests/tests/os/src/android/os/cts/VibratorTest.java
+++ b/tests/tests/os/src/android/os/cts/VibratorTest.java
@@ -30,6 +30,7 @@
 
 import android.media.AudioAttributes;
 import android.os.SystemClock;
+import android.os.VibrationAttributes;
 import android.os.VibrationEffect;
 import android.os.Vibrator;
 import android.os.Vibrator.OnVibratorStateChangedListener;
@@ -74,6 +75,10 @@
                     .setUsage(AudioAttributes.USAGE_MEDIA)
                     .setContentType(AudioAttributes.CONTENT_TYPE_MUSIC)
                     .build();
+    private static final VibrationAttributes VIBRATION_ATTRIBUTES =
+            new VibrationAttributes.Builder()
+                    .setUsage(VibrationAttributes.USAGE_TOUCH)
+                    .build();
     private static final long CALLBACK_TIMEOUT_MILLIS = 5000;
     private static final int[] PREDEFINED_EFFECTS = new int[]{
             VibrationEffect.EFFECT_CLICK,
@@ -259,6 +264,12 @@
     }
 
     @Test
+    public void testVibrateWithAttributes() {
+        mVibrator.vibrate(VibrationEffect.createOneShot(10, 10), VIBRATION_ATTRIBUTES);
+        assertStartsVibrating();
+    }
+
+    @Test
     public void testGetId() {
         // The system vibrator should not be mapped to any physical vibrator and use a default id.
         assertEquals(-1, mVibrator.getId());