diff options
author | Eric Laurent <elaurent@google.com> | 2013-03-19 18:15:31 -0700 |
---|---|---|
committer | Eric Laurent <elaurent@google.com> | 2013-03-21 18:43:00 -0700 |
commit | 83a017b6b7c099d1a0293e5839be6477325aef06 (patch) | |
tree | 7ecdcd95f23900c35f2dc551bbb1690a6bf748db /media/tests/MediaFrameworkTest/src | |
parent | e37478c4ebbe6e95ef3904b9f2fa0e93e1b258ac (diff) | |
download | frameworks_base-83a017b6b7c099d1a0293e5839be6477325aef06.zip frameworks_base-83a017b6b7c099d1a0293e5839be6477325aef06.tar.gz frameworks_base-83a017b6b7c099d1a0293e5839be6477325aef06.tar.bz2 |
audio service: add config option for fixed volume
Add a boolean configuration option config_useFixedVolume indicating if
stream volumes or master volume can be modified.
If the option is true, the AudioManager volume and mute APIs will be no ops and the
volumes will be maxed out.
To be consistent:
- the ringer mode is forced to normal and cannot be modified
- volume panel is never displayed
- volume settings are not available
- ringer mode global action is not displayed.
The default for this option if false.
This is useful for a class of devices intended for connection to a digital
audio output only, where the volume is directly controlled on the audio sink.
Bug 8161458
Change-Id: I2571d5ee79952ef0914d8fd1985816467a80adcd
Diffstat (limited to 'media/tests/MediaFrameworkTest/src')
-rw-r--r-- | media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/audio/MediaAudioManagerTest.java | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/audio/MediaAudioManagerTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/audio/MediaAudioManagerTest.java index 7967ce7..e232338 100644 --- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/audio/MediaAudioManagerTest.java +++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/audio/MediaAudioManagerTest.java @@ -42,6 +42,7 @@ public class MediaAudioManagerTest extends ActivityInstrumentationTestCase2<Medi private final static int WAIT_FOR_LOOPER_TO_INITIALIZE_MS = 60000; // 60s private int[] ringtoneMode = {AudioManager.RINGER_MODE_NORMAL, AudioManager.RINGER_MODE_SILENT, AudioManager.RINGER_MODE_VIBRATE}; + private boolean mUseFixedVolume; public MediaAudioManagerTest() { super("com.android.mediaframeworktest", MediaFrameworkTest.class); @@ -65,6 +66,10 @@ public class MediaAudioManagerTest extends ActivityInstrumentationTestCase2<Medi @Override protected void setUp() throws Exception { super.setUp(); + + mUseFixedVolume = getActivity().getResources().getBoolean( + com.android.internal.R.bool.config_useFixedVolume); + synchronized(mLooperLock) { initializeAudioManagerWithLooper(); try { @@ -91,10 +96,12 @@ public class MediaAudioManagerTest extends ActivityInstrumentationTestCase2<Medi public boolean validateSetRingTone(int i) { int getRingtone = mAudioManager.getRingerMode(); - if (i != getRingtone) - return false; - else - return true; + + if (mUseFixedVolume) { + return (getRingtone == AudioManager.RINGER_MODE_NORMAL); + } else { + return (getRingtone == i); + } } // Test case 1: Simple test case to validate the set ringtone mode |