summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorJean-Michel Trivi <jmtrivi@google.com>2009-10-27 17:39:30 -0700
committerJean-Michel Trivi <jmtrivi@google.com>2009-10-27 17:49:13 -0700
commit11a74a75653197a3d31fe91590cd8312f5270c44 (patch)
tree33b5bc791898bf002e21c569c5966c958358c8f3 /media
parentf8e3ac851959efbd21da930a802f8efb65ccec5b (diff)
downloadframeworks_base-11a74a75653197a3d31fe91590cd8312f5270c44.zip
frameworks_base-11a74a75653197a3d31fe91590cd8312f5270c44.tar.gz
frameworks_base-11a74a75653197a3d31fe91590cd8312f5270c44.tar.bz2
Fix bug 2201417. Whenever the System setting that indicates
whether the notifcation stream uses the ring volume changes, the table of stream volume aliases in AudioService is updated. But the name of the alias stored in VolumeStreamState.mVolumeIndexSettingName was not updated whenever the NOTIFICATIONS_USE_RING_VOLUME setting was updated. This caused the wrong volume setting to be persisted. This change ensures the setting name is updated whenever the volume alias is, and persists the notification volume change right away (instead of after a delay), so that registered observers are notified right away. The notification seekbar in the sound settings is an example of such an observer.
Diffstat (limited to 'media')
-rw-r--r--media/java/android/media/AudioService.java20
1 files changed, 15 insertions, 5 deletions
diff --git a/media/java/android/media/AudioService.java b/media/java/android/media/AudioService.java
index d90871e..58a0bba 100644
--- a/media/java/android/media/AudioService.java
+++ b/media/java/android/media/AudioService.java
@@ -959,10 +959,10 @@ public class AudioService extends IAudioService.Stub {
///////////////////////////////////////////////////////////////////////////
public class VolumeStreamState {
- private final String mVolumeIndexSettingName;
- private final String mLastAudibleVolumeIndexSettingName;
private final int mStreamType;
+ private String mVolumeIndexSettingName;
+ private String mLastAudibleVolumeIndexSettingName;
private int mIndexMax;
private int mIndex;
private int mLastAudibleIndex;
@@ -970,8 +970,7 @@ public class AudioService extends IAudioService.Stub {
private VolumeStreamState(String settingName, int streamType) {
- mVolumeIndexSettingName = settingName;
- mLastAudibleVolumeIndexSettingName = settingName + System.APPEND_FOR_LAST_AUDIBLE;
+ setVolumeIndexSettingName(settingName);
mStreamType = streamType;
@@ -991,6 +990,11 @@ public class AudioService extends IAudioService.Stub {
mDeathHandlers = new ArrayList<VolumeDeathHandler>();
}
+ public void setVolumeIndexSettingName(String settingName) {
+ mVolumeIndexSettingName = settingName;
+ mLastAudibleVolumeIndexSettingName = settingName + System.APPEND_FOR_LAST_AUDIBLE;
+ }
+
public boolean adjustIndex(int deltaIndex) {
return setIndex(mIndex + deltaIndex * 10, true);
}
@@ -1370,11 +1374,17 @@ public class AudioService extends IAudioService.Stub {
mNotificationsUseRingVolume = notificationsUseRingVolume;
if (mNotificationsUseRingVolume == 1) {
STREAM_VOLUME_ALIAS[AudioSystem.STREAM_NOTIFICATION] = AudioSystem.STREAM_RING;
+ mStreamStates[AudioSystem.STREAM_NOTIFICATION].setVolumeIndexSettingName(
+ System.VOLUME_SETTINGS[AudioSystem.STREAM_RING]);
} else {
STREAM_VOLUME_ALIAS[AudioSystem.STREAM_NOTIFICATION] = AudioSystem.STREAM_NOTIFICATION;
+ mStreamStates[AudioSystem.STREAM_NOTIFICATION].setVolumeIndexSettingName(
+ System.VOLUME_SETTINGS[AudioSystem.STREAM_NOTIFICATION]);
// Persist notification volume volume as it was not persisted while aliased to ring volume
+ // and persist with no delay as there might be registered observers of the persisted
+ // notification volume.
sendMsg(mAudioHandler, MSG_PERSIST_VOLUME, AudioSystem.STREAM_NOTIFICATION,
- SENDMSG_REPLACE, 0, 0, mStreamStates[AudioSystem.STREAM_NOTIFICATION], PERSIST_DELAY);
+ SENDMSG_REPLACE, 0, 0, mStreamStates[AudioSystem.STREAM_NOTIFICATION], 0);
}
}
}