summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorDanny Baumann <dannybaumann@web.de>2013-01-28 17:13:09 +0100
committerDanny Baumann <dannybaumann@web.de>2013-01-28 17:13:09 +0100
commitb97190552b2b7e5e2ca2a3f6478bb5aeb9e05c70 (patch)
treeae586d1fbc5bca4d1d9bbcbc20ea80e3dd95e240 /media
parente77b6efa6e6917a4360ecfe10dff189d56da780a (diff)
downloadframeworks_base-b97190552b2b7e5e2ca2a3f6478bb5aeb9e05c70.zip
frameworks_base-b97190552b2b7e5e2ca2a3f6478bb5aeb9e05c70.tar.gz
frameworks_base-b97190552b2b7e5e2ca2a3f6478bb5aeb9e05c70.tar.bz2
Prevent audio players starting on startup.
Previously, (at least) Apollo was started on startup (in that it appeared in the notification bar) because it listens to the AUDIO_BECOMING_NOISY intent to silence itself in that case. This intent is broadcast by AudioService when there's a user switch to silence any potential audio players for the old user. As the system also sends around a USER_SWITCHED intent on startup, this led to the aforementioned player startup. As the intent of AudioService was to act on a user backgrounding anyway, send out AUDIO_BECOMING_NOISY as reaction to a USER_BACKGROUND intent instead of the USER_SWITCHED intent. Change-Id: Iba35844a1274c9dd195f104068304e6a7ffa809e
Diffstat (limited to 'media')
-rwxr-xr-xmedia/java/android/media/AudioService.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/media/java/android/media/AudioService.java b/media/java/android/media/AudioService.java
index 01c2c5b..e11e075 100755
--- a/media/java/android/media/AudioService.java
+++ b/media/java/android/media/AudioService.java
@@ -516,6 +516,7 @@ public class AudioService extends IAudioService.Stub implements OnFinished {
intentFilter.addAction(Intent.ACTION_BOOT_COMPLETED);
intentFilter.addAction(Intent.ACTION_SCREEN_ON);
intentFilter.addAction(Intent.ACTION_SCREEN_OFF);
+ intentFilter.addAction(Intent.ACTION_USER_BACKGROUND);
intentFilter.addAction(Intent.ACTION_USER_SWITCHED);
intentFilter.addAction(Intent.ACTION_WIFI_DISPLAY_AUDIO);
@@ -3975,7 +3976,7 @@ public class AudioService extends IAudioService.Stub implements OnFinished {
AudioSystem.setParameters("screen_state=off");
} else if (action.equalsIgnoreCase(Intent.ACTION_CONFIGURATION_CHANGED)) {
handleConfigurationChanged(context);
- } else if (action.equals(Intent.ACTION_USER_SWITCHED)) {
+ } else if (action.equals(Intent.ACTION_USER_BACKGROUND)) {
// attempt to stop music playback for background user
sendMsg(mAudioHandler,
MSG_BROADCAST_AUDIO_BECOMING_NOISY,
@@ -3984,6 +3985,7 @@ public class AudioService extends IAudioService.Stub implements OnFinished {
0,
null,
0);
+ } else if (action.equals(Intent.ACTION_USER_SWITCHED)) {
// the current audio focus owner is no longer valid
discardAudioFocusOwner();