summaryrefslogtreecommitdiffstats
path: root/media/java
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2012-09-21 18:10:32 -0700
committerEric Laurent <elaurent@google.com>2012-09-21 18:21:24 -0700
commit9903e2638a6c502d96413680d3ebae4fb77fc412 (patch)
treed3991fbcbd65e889664c946db38f50f429b5a8c3 /media/java
parentf98db0de2248ad286b207eed6a826373cc60b786 (diff)
downloadframeworks_base-9903e2638a6c502d96413680d3ebae4fb77fc412.zip
frameworks_base-9903e2638a6c502d96413680d3ebae4fb77fc412.tar.gz
frameworks_base-9903e2638a6c502d96413680d3ebae4fb77fc412.tar.bz2
Volume keys control music volume after music stops
On phones, add a short delay during which volume keys still control music volume after music has stopped. This is similar to the tablet behavior for notifications volume. It allows users to control the prompt volume for talk back, voice search or navigation even after the prompt has stopped. Bug 7162364. Change-Id: Iffbca9ec30ebcbe5846f783ddd260b6e736caf2b
Diffstat (limited to 'media/java')
-rw-r--r--media/java/android/media/AudioService.java13
1 files changed, 8 insertions, 5 deletions
diff --git a/media/java/android/media/AudioService.java b/media/java/android/media/AudioService.java
index cee8da8..96c7ee1 100644
--- a/media/java/android/media/AudioService.java
+++ b/media/java/android/media/AudioService.java
@@ -387,9 +387,11 @@ public class AudioService extends IAudioService.Stub implements OnFinished {
private Looper mSoundPoolLooper = null;
// volume applied to sound played with playSoundEffect()
private static int sSoundEffectVolumeDb;
- // getActiveStreamType() will return STREAM_NOTIFICATION during this period after a notification
+ // getActiveStreamType() will return:
+ // - STREAM_NOTIFICATION on tablets during this period after a notification stopped
+ // - STREAM_MUSIC on phones during this period after music or talkback/voice search prompt
// stopped
- private static final int NOTIFICATION_VOLUME_DELAY_MS = 5000;
+ private static final int DEFAULT_STREAM_TYPE_OVERRIDE_DELAY_MS = 5000;
// previous volume adjustment direction received by checkForRingerModeChange()
private int mPrevVolDirection = AudioManager.ADJUST_SAME;
// Keyguard manager proxy
@@ -2340,7 +2342,8 @@ public class AudioService extends IAudioService.Stub implements OnFinished {
if (DEBUG_VOL)
Log.v(TAG, "getActiveStreamType: Forcing STREAM_REMOTE_MUSIC");
return STREAM_REMOTE_MUSIC;
- } else if (AudioSystem.isStreamActive(AudioSystem.STREAM_MUSIC, 0)) {
+ } else if (AudioSystem.isStreamActive(AudioSystem.STREAM_MUSIC,
+ DEFAULT_STREAM_TYPE_OVERRIDE_DELAY_MS)) {
if (DEBUG_VOL)
Log.v(TAG, "getActiveStreamType: Forcing STREAM_MUSIC stream active");
return AudioSystem.STREAM_MUSIC;
@@ -2369,9 +2372,9 @@ public class AudioService extends IAudioService.Stub implements OnFinished {
return AudioSystem.STREAM_VOICE_CALL;
}
} else if (AudioSystem.isStreamActive(AudioSystem.STREAM_NOTIFICATION,
- NOTIFICATION_VOLUME_DELAY_MS) ||
+ DEFAULT_STREAM_TYPE_OVERRIDE_DELAY_MS) ||
AudioSystem.isStreamActive(AudioSystem.STREAM_RING,
- NOTIFICATION_VOLUME_DELAY_MS)) {
+ DEFAULT_STREAM_TYPE_OVERRIDE_DELAY_MS)) {
if (DEBUG_VOL) Log.v(TAG, "getActiveStreamType: Forcing STREAM_NOTIFICATION");
return AudioSystem.STREAM_NOTIFICATION;
} else if (suggestedStreamType == AudioManager.USE_DEFAULT_STREAM_TYPE) {