diff options
author | John Spurlock <jspurlock@google.com> | 2014-07-24 18:10:48 -0400 |
---|---|---|
committer | John Spurlock <jspurlock@google.com> | 2014-07-25 11:27:51 -0400 |
commit | 351346092acdfbfcc1d9ebf98d539d2a1196c5e8 (patch) | |
tree | cac60a4a224053998b911033a3a8aac3f38ccec9 /media | |
parent | ed1391a9297db5e2a8671bbf2d83654ee5d28702 (diff) | |
download | frameworks_base-351346092acdfbfcc1d9ebf98d539d2a1196c5e8.zip frameworks_base-351346092acdfbfcc1d9ebf98d539d2a1196c5e8.tar.gz frameworks_base-351346092acdfbfcc1d9ebf98d539d2a1196c5e8.tar.bz2 |
Volume: Show safe media warning in settings.
If the safe media warning is enabled, make sure
we display it from the new inline slider preference in
Settings (without showing the volume dialog itself).
Also:
- Update the warning dialog to the new sysui theme.
- Separate the warning sentences with an additional line.
- Fix the auto-dismiss timeout.
- Add a system property to additionally enable the safe
media warning for testing
- Add more information to audio service dumpsys.
Bug:15434662
Change-Id: I95fec12c9049bbfdb7ebdf246160e4b12c0c5be3
Diffstat (limited to 'media')
-rw-r--r-- | media/java/android/media/AudioManager.java | 6 | ||||
-rw-r--r-- | media/java/android/media/AudioService.java | 38 |
2 files changed, 38 insertions, 6 deletions
diff --git a/media/java/android/media/AudioManager.java b/media/java/android/media/AudioManager.java index 52608a9..20ac8e9 100644 --- a/media/java/android/media/AudioManager.java +++ b/media/java/android/media/AudioManager.java @@ -354,6 +354,12 @@ public class AudioManager { public static final int FLAG_ACTIVE_MEDIA_ONLY = 1 << 9; /** + * Like FLAG_SHOW_UI, but only dialog warnings and confirmations, no sliders. + * @hide + */ + public static final int FLAG_SHOW_UI_WARNINGS = 1 << 10; + + /** * Ringer mode that will be silent and will not vibrate. (This overrides the * vibrate setting.) * diff --git a/media/java/android/media/AudioService.java b/media/java/android/media/AudioService.java index 050c268..d43aceb 100644 --- a/media/java/android/media/AudioService.java +++ b/media/java/android/media/AudioService.java @@ -1131,6 +1131,13 @@ public class AudioService extends IAudioService.Stub { mFlags = flags; mDevice = device; } + + @Override + public String toString() { + return new StringBuilder().append("{streamType=").append(mStreamType).append(",index=") + .append(mIndex).append(",flags=").append(mFlags).append(",device=") + .append(mDevice).append('}').toString(); + } }; private void onSetStreamVolume(int streamType, int index, int flags, int device) { @@ -2724,8 +2731,10 @@ public class AudioService extends IAudioService.Stub { if ((mMcc != mcc) || ((mMcc == 0) && force)) { mSafeMediaVolumeIndex = mContext.getResources().getInteger( com.android.internal.R.integer.config_safe_media_volume_index) * 10; - boolean safeMediaVolumeEnabled = mContext.getResources().getBoolean( - com.android.internal.R.bool.config_safe_media_volume_enabled); + boolean safeMediaVolumeEnabled = + SystemProperties.getBoolean("audio.safemedia.force", false) + || mContext.getResources().getBoolean( + com.android.internal.R.bool.config_safe_media_volume_enabled); // The persisted state is either "disabled" or "active": this is the state applied // next time we boot and cannot be "inactive" @@ -4863,10 +4872,10 @@ public class AudioService extends IAudioService.Stub { // SAFE_MEDIA_VOLUME_DISABLED according to country option. If not SAFE_MEDIA_VOLUME_DISABLED, it // can be set to SAFE_MEDIA_VOLUME_INACTIVE by calling AudioService.disableSafeMediaVolume() // (when user opts out). - private final int SAFE_MEDIA_VOLUME_NOT_CONFIGURED = 0; - private final int SAFE_MEDIA_VOLUME_DISABLED = 1; - private final int SAFE_MEDIA_VOLUME_INACTIVE = 2; - private final int SAFE_MEDIA_VOLUME_ACTIVE = 3; + private static final int SAFE_MEDIA_VOLUME_NOT_CONFIGURED = 0; + private static final int SAFE_MEDIA_VOLUME_DISABLED = 1; + private static final int SAFE_MEDIA_VOLUME_INACTIVE = 2; // confirmed + private static final int SAFE_MEDIA_VOLUME_ACTIVE = 3; // unconfirmed private Integer mSafeMediaVolumeState; private int mMcc = 0; @@ -5058,7 +5067,24 @@ public class AudioService extends IAudioService.Stub { pw.println("\nAudio routes:"); pw.print(" mMainType=0x"); pw.println(Integer.toHexString(mCurAudioRoutes.mMainType)); pw.print(" mBluetoothName="); pw.println(mCurAudioRoutes.mBluetoothName); + + pw.println("\nOther state:"); pw.print(" mVolumeController="); pw.println(mVolumeController); + pw.print(" mSafeMediaVolumeState="); + pw.println(safeMediaVolumeStateToString(mSafeMediaVolumeState)); + pw.print(" mSafeMediaVolumeIndex="); pw.println(mSafeMediaVolumeIndex); + pw.print(" mPendingVolumeCommand="); pw.println(mPendingVolumeCommand); + pw.print(" mMusicActiveMs="); pw.println(mMusicActiveMs); + } + + private static String safeMediaVolumeStateToString(Integer state) { + switch(state) { + case SAFE_MEDIA_VOLUME_NOT_CONFIGURED: return "SAFE_MEDIA_VOLUME_NOT_CONFIGURED"; + case SAFE_MEDIA_VOLUME_DISABLED: return "SAFE_MEDIA_VOLUME_DISABLED"; + case SAFE_MEDIA_VOLUME_INACTIVE: return "SAFE_MEDIA_VOLUME_INACTIVE"; + case SAFE_MEDIA_VOLUME_ACTIVE: return "SAFE_MEDIA_VOLUME_ACTIVE"; + } + return null; } // Inform AudioFlinger of our device's low RAM attribute |