summaryrefslogtreecommitdiff
path: root/media/tests
diff options
context:
space:
mode:
author Vlad Popa <pvlad@google.com> 2025-01-24 16:07:19 -0800
committer Android (Google) Code Review <android-gerrit@google.com> 2025-01-24 16:07:19 -0800
commitb4d54d9331118452c3e4ff025e378861f1aae6f2 (patch)
treee10356bf828da2e34c4bcb25dbaf4f44542041be /media/tests
parent3206850a7071f0687a4edef18680867bd492dcbb (diff)
parent4f416c50a7cb590336be31180bf8e3deee2afb4e (diff)
Merge "Use cache for volume getter" into main
Diffstat (limited to 'media/tests')
-rw-r--r--media/tests/AudioPolicyTest/src/com/android/audiopolicytest/AudioManagerTest.java36
1 files changed, 24 insertions, 12 deletions
diff --git a/media/tests/AudioPolicyTest/src/com/android/audiopolicytest/AudioManagerTest.java b/media/tests/AudioPolicyTest/src/com/android/audiopolicytest/AudioManagerTest.java
index 017a1029d35c..209734ca4a53 100644
--- a/media/tests/AudioPolicyTest/src/com/android/audiopolicytest/AudioManagerTest.java
+++ b/media/tests/AudioPolicyTest/src/com/android/audiopolicytest/AudioManagerTest.java
@@ -67,6 +67,17 @@ public class AudioManagerTest {
private AudioManager mAudioManager;
+ private static final int[] PUBLIC_STREAM_TYPES = {
+ STREAM_VOICE_CALL,
+ STREAM_SYSTEM,
+ STREAM_RING,
+ STREAM_MUSIC,
+ STREAM_ALARM,
+ STREAM_NOTIFICATION,
+ STREAM_DTMF,
+ STREAM_ACCESSIBILITY,
+ };
+
@Rule
public final AudioVolumesTestRule rule = new AudioVolumesTestRule();
@@ -226,18 +237,8 @@ public class AudioManagerTest {
public void getStreamMinMaxVolume_consistentWithAs() throws Exception {
IBinder b = ServiceManager.getService(Context.AUDIO_SERVICE);
IAudioService service = IAudioService.Stub.asInterface(b);
- final int[] streamTypes = {
- STREAM_VOICE_CALL,
- STREAM_SYSTEM,
- STREAM_RING,
- STREAM_MUSIC,
- STREAM_ALARM,
- STREAM_NOTIFICATION,
- STREAM_DTMF,
- STREAM_ACCESSIBILITY,
- };
-
- for (int streamType : streamTypes) {
+
+ for (int streamType : PUBLIC_STREAM_TYPES) {
assertEquals(service.getStreamMinVolume(streamType),
mAudioManager.getStreamMinVolume(streamType));
assertEquals(service.getStreamMaxVolume(streamType),
@@ -245,6 +246,17 @@ public class AudioManagerTest {
}
}
+ @Test
+ public void getStreamVolume_consistentWithAs() throws Exception {
+ IBinder b = ServiceManager.getService(Context.AUDIO_SERVICE);
+ IAudioService service = IAudioService.Stub.asInterface(b);
+
+ for (int streamType : PUBLIC_STREAM_TYPES) {
+ assertEquals(service.getStreamVolume(streamType),
+ mAudioManager.getStreamVolume(streamType));
+ }
+ }
+
//-----------------------------------------------------------------
// Test Volume per Attributes setter/getters
//-----------------------------------------------------------------