diff options
author | Michael Wright <michaelwr@google.com> | 2017-01-31 18:33:54 +0000 |
---|---|---|
committer | Michael Wright <michaelwr@google.com> | 2017-03-20 16:09:51 +0000 |
commit | 7121697a5e2d4458f6f63e9eb3b5deec62ee6202 (patch) | |
tree | 62b6318b0535f6429b4b0b23b203fe97ef48bfde /tests/permission | |
parent | 66dc7be9e69158e44bd933d9dc6eedded67cea3d (diff) |
BZZZZZZT! BZZZZZT! New Vibrator APIs
Replace the existing Vibrator APIs with a new class to encapsulate the
haptic effect information, and add the ability to control the vibration
strength.
Test: cts-tradefed run commandAndExit cts-dev -m CtsOsTestCases -t android.os.cts.VibratorTest
cts-tradefed run commandAndExit cts-dev -m CtsOsTestCases -t android.os.cts.VibrationEffectTest
runtest systemui-notification
Manual testing with $T/google_experimental/users/michaelwr/Vibrator
Bug: 30961353
Change-Id: Idbb9864a7b084c85e7b7de3257a0e6b40d9d91d6
Diffstat (limited to 'tests/permission')
-rw-r--r-- | tests/permission/src/com/android/framework/permission/tests/VibratorServicePermissionTest.java | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/tests/permission/src/com/android/framework/permission/tests/VibratorServicePermissionTest.java b/tests/permission/src/com/android/framework/permission/tests/VibratorServicePermissionTest.java index b12ed94467b7..2757296f588f 100644 --- a/tests/permission/src/com/android/framework/permission/tests/VibratorServicePermissionTest.java +++ b/tests/permission/src/com/android/framework/permission/tests/VibratorServicePermissionTest.java @@ -24,6 +24,7 @@ import android.os.IVibratorService; import android.os.Process; import android.os.RemoteException; import android.os.ServiceManager; +import android.os.VibrationEffect; import android.test.suitebuilder.annotation.SmallTest; /** @@ -48,7 +49,9 @@ public class VibratorServicePermissionTest extends TestCase { */ public void testVibrate() throws RemoteException { try { - mVibratorService.vibrate(Process.myUid(), null, 2000, AudioManager.STREAM_ALARM, + final VibrationEffect effect = + VibrationEffect.createOneShot(100, VibrationEffect.DEFAULT_AMPLITUDE); + mVibratorService.vibrate(Process.myUid(), null, effect, AudioManager.STREAM_ALARM, new Binder()); fail("vibrate did not throw SecurityException as expected"); } catch (SecurityException e) { @@ -57,23 +60,6 @@ public class VibratorServicePermissionTest extends TestCase { } /** - * Test that calling {@link android.os.IVibratorService#vibratePattern(long[], - * int, android.os.IBinder)} requires permissions. - * <p>Tests permission: - * {@link android.Manifest.permission#VIBRATE} - * @throws RemoteException - */ - public void testVibratePattern() throws RemoteException { - try { - mVibratorService.vibratePattern(Process.myUid(), null, new long[] {0}, 0, - AudioManager.STREAM_ALARM, new Binder()); - fail("vibratePattern did not throw SecurityException as expected"); - } catch (SecurityException e) { - // expected - } - } - - /** * Test that calling {@link android.os.IVibratorService#cancelVibrate()} requires permissions. * <p>Tests permission: * {@link android.Manifest.permission#VIBRATE} |