summaryrefslogtreecommitdiff
path: root/tests/permission/src
diff options
context:
space:
mode:
author Michael Wright <michaelwr@google.com> 2019-06-20 19:36:57 +0100
committer Michael Wright <michaelwr@google.com> 2019-06-25 16:57:10 +0100
commit7f378787dc2c610138a41c3fbcefeed6de21be53 (patch)
tree847c0cc4f72705930f1cefbbb6b43798245be128 /tests/permission/src
parent7fca2368af0c55fc4203186c259ada234d28b475 (diff)
Ignore DND when FLAG_BYPASS_INTERRUPTION_POLICY is set.
When DND is on, it sets AppOps to return MODE_IGNORED for any non-touch vibrations. Unfortunately, this means it blocks critical vibrations as well, like emergency alerts. In order to avoid this, we need to respect FLAG_BYPASS_INTERRUPTION_POLICY when set on the vibration attributes. Bug: 132112663 Bug: 135686242 Test: Manual Change-Id: I59465eed057b077a4c0548af162e0fec1c29afdc
Diffstat (limited to 'tests/permission/src')
-rw-r--r--tests/permission/src/com/android/framework/permission/tests/VibratorServicePermissionTest.java12
1 files changed, 8 insertions, 4 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 388c7d03dff2..c50229ae30f4 100644
--- a/tests/permission/src/com/android/framework/permission/tests/VibratorServicePermissionTest.java
+++ b/tests/permission/src/com/android/framework/permission/tests/VibratorServicePermissionTest.java
@@ -16,9 +16,7 @@
package com.android.framework.permission.tests;
-import junit.framework.TestCase;
-
-import android.media.AudioManager;
+import android.media.AudioAttributes;
import android.os.Binder;
import android.os.IVibratorService;
import android.os.Process;
@@ -27,6 +25,9 @@ import android.os.ServiceManager;
import android.os.VibrationEffect;
import android.test.suitebuilder.annotation.SmallTest;
+import junit.framework.TestCase;
+
+
/**
* Verify that Hardware apis cannot be called without required permissions.
*/
@@ -51,7 +52,10 @@ public class VibratorServicePermissionTest extends TestCase {
try {
final VibrationEffect effect =
VibrationEffect.createOneShot(100, VibrationEffect.DEFAULT_AMPLITUDE);
- mVibratorService.vibrate(Process.myUid(), null, effect, AudioManager.STREAM_ALARM,
+ final AudioAttributes attrs = new AudioAttributes.Builder()
+ .setUsage(AudioAttributes.USAGE_ALARM)
+ .build();
+ mVibratorService.vibrate(Process.myUid(), null, effect, attrs,
"testVibrate", new Binder());
fail("vibrate did not throw SecurityException as expected");
} catch (SecurityException e) {