diff options
author | John Spurlock <jspurlock@google.com> | 2015-03-04 22:59:39 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-03-04 22:59:41 +0000 |
commit | 75328b703f8f83fdd62f11105ecd61df2ebe4420 (patch) | |
tree | 7ce7fdf95a6508cb2ae9027743ab1ae9fb72043f /packages | |
parent | a9b33ddf31e9f40698b5ee1255ed505b2a9b7906 (diff) | |
parent | ee5ad729b90deff435f9875337cbc434be4f8fe7 (diff) | |
download | frameworks_base-75328b703f8f83fdd62f11105ecd61df2ebe4420.zip frameworks_base-75328b703f8f83fdd62f11105ecd61df2ebe4420.tar.gz frameworks_base-75328b703f8f83fdd62f11105ecd61df2ebe4420.tar.bz2 |
Merge "Audio: Remove the concept of master volume."
Diffstat (limited to 'packages')
3 files changed, 12 insertions, 73 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java index 0168b95..275a6be 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java @@ -172,7 +172,7 @@ public class KeyguardViewMediator extends SystemUI { private static final String KEYGUARD_ANALYTICS_SETTING = "keyguard_analytics"; /** The stream type that the lock sounds are tied to. */ - private int mMasterStreamType; + private int mUiSoundsStreamType; private AlarmManager mAlarmManager; private AudioManager mAudioManager; @@ -1244,10 +1244,10 @@ public class KeyguardViewMediator extends SystemUI { if (mAudioManager == null) { mAudioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE); if (mAudioManager == null) return; - mMasterStreamType = mAudioManager.getMasterStreamType(); + mUiSoundsStreamType = mAudioManager.getUiSoundsStreamType(); } // If the stream is muted, don't play the sound - if (mAudioManager.isStreamMute(mMasterStreamType)) return; + if (mAudioManager.isStreamMute(mUiSoundsStreamType)) return; mLockSoundStreamId = mLockSounds.play(soundId, mLockSoundVolume, mLockSoundVolume, 1/*priortiy*/, 0/*loop*/, 1.0f/*rate*/); diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumePanel.java b/packages/SystemUI/src/com/android/systemui/volume/VolumePanel.java index 31264ee..51adaac 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/VolumePanel.java +++ b/packages/SystemUI/src/com/android/systemui/volume/VolumePanel.java @@ -125,8 +125,6 @@ public class VolumePanel extends Handler implements DemoMode { private static final int MSG_NOTIFICATION_EFFECTS_SUPPRESSOR_CHANGED = 15; private static final int MSG_INTERNAL_RINGER_MODE_CHANGED = 16; - // Pseudo stream type for master volume - private static final int STREAM_MASTER = -100; // Pseudo stream type for remote volume private static final int STREAM_REMOTE_MUSIC = -200; @@ -154,10 +152,6 @@ public class VolumePanel extends Handler implements DemoMode { private int mLastRingerProgress = 0; private int mDemoIcon; - // True if we want to play tones on the system stream when the master stream is specified. - private final boolean mPlayMasterStreamTones; - - /** Volume panel content view */ private final View mView; /** Dialog hosting the panel */ @@ -213,12 +207,6 @@ public class VolumePanel extends Handler implements DemoMode { com.android.systemui.R.drawable.ic_ringer_audible, com.android.systemui.R.drawable.ic_ringer_mute, true), - // for now, use media resources for master volume - MasterStream(STREAM_MASTER, - R.string.volume_icon_description_media, //FIXME should have its own description - IC_AUDIO_VOL, - IC_AUDIO_VOL_MUTE, - false), RemoteStream(STREAM_REMOTE_MUSIC, R.string.volume_icon_description_media, //FIXME should have its own description com.android.systemui.R.drawable.ic_audio_remote, @@ -249,7 +237,6 @@ public class VolumePanel extends Handler implements DemoMode { StreamResources.MediaStream, StreamResources.NotificationStream, StreamResources.AlarmStream, - StreamResources.MasterStream, StreamResources.RemoteStream }; @@ -371,15 +358,6 @@ public class VolumePanel extends Handler implements DemoMode { mSecondaryIconTransition = new SecondaryIconTransition(); mIconPulser = new IconPulser(context); - // For now, only show master volume if master volume is supported - final Resources res = context.getResources(); - final boolean useMasterVolume = res.getBoolean(R.bool.config_useMasterVolume); - if (useMasterVolume) { - for (int i = 0; i < STREAMS.length; i++) { - StreamResources streamRes = STREAMS[i]; - streamRes.show = (streamRes.streamType == STREAM_MASTER); - } - } if (LOGD) Log.d(mTag, "new VolumePanel"); mDisabledAlpha = 0.5f; @@ -419,6 +397,7 @@ public class VolumePanel extends Handler implements DemoMode { mDialog.create(); + final Resources res = context.getResources(); window.setAttributes(getDialogLayoutParams(window, res)); updateWidth(); @@ -447,16 +426,12 @@ public class VolumePanel extends Handler implements DemoMode { mHasVibrator = mVibrator != null && mVibrator.hasVibrator(); mVoiceCapable = context.getResources().getBoolean(R.bool.config_voice_capable); - if (mZenController != null && !useMasterVolume) { + if (mZenController != null) { mZenModeAvailable = mZenController.isZenAvailable(); mNotificationEffectsSuppressor = mZenController.getEffectsSuppressor(); mZenController.addCallback(mZenCallback); } - final boolean masterVolumeOnly = res.getBoolean(R.bool.config_useMasterVolume); - final boolean masterVolumeKeySounds = res.getBoolean(R.bool.config_useVolumeKeySounds); - mPlayMasterStreamTones = masterVolumeOnly && masterVolumeKeySounds; - registerReceiver(); } @@ -489,7 +464,6 @@ public class VolumePanel extends Handler implements DemoMode { pw.print(" mDisabledAlpha="); pw.println(mDisabledAlpha); pw.print(" mLastRingerMode="); pw.println(mLastRingerMode); pw.print(" mLastRingerProgress="); pw.println(mLastRingerProgress); - pw.print(" mPlayMasterStreamTones="); pw.println(mPlayMasterStreamTones); pw.print(" isShowing()="); pw.println(isShowing()); pw.print(" mCallback="); pw.println(mCallback); pw.print(" sConfirmSafeVolumeDialog="); @@ -576,9 +550,7 @@ public class VolumePanel extends Handler implements DemoMode { } private boolean isMuted(int streamType) { - if (streamType == STREAM_MASTER) { - return mAudioManager.isMasterMute(); - } else if (streamType == STREAM_REMOTE_MUSIC) { + if (streamType == STREAM_REMOTE_MUSIC) { // TODO do we need to support a distinct mute property for remote? return false; } else { @@ -587,9 +559,7 @@ public class VolumePanel extends Handler implements DemoMode { } private int getStreamMaxVolume(int streamType) { - if (streamType == STREAM_MASTER) { - return mAudioManager.getMasterMaxVolume(); - } else if (streamType == STREAM_REMOTE_MUSIC) { + if (streamType == STREAM_REMOTE_MUSIC) { if (mStreamControls != null) { StreamControl sc = mStreamControls.get(streamType); if (sc != null && sc.controller != null) { @@ -604,9 +574,7 @@ public class VolumePanel extends Handler implements DemoMode { } private int getStreamVolume(int streamType) { - if (streamType == STREAM_MASTER) { - return mAudioManager.getLastAudibleMasterVolume(); - } else if (streamType == STREAM_REMOTE_MUSIC) { + if (streamType == STREAM_REMOTE_MUSIC) { if (mStreamControls != null) { StreamControl sc = mStreamControls.get(streamType); if (sc != null && sc.controller != null) { @@ -628,11 +596,7 @@ public class VolumePanel extends Handler implements DemoMode { Log.w(mTag, "Adjusting remote volume without a controller!"); } } else if (getStreamVolume(sc.streamType) != index) { - if (sc.streamType == STREAM_MASTER) { - mAudioManager.setMasterVolume(index, flags); - } else { - mAudioManager.setStreamVolume(sc.streamType, index, flags); - } + mAudioManager.setStreamVolume(sc.streamType, index, flags); } } @@ -833,7 +797,7 @@ public class VolumePanel extends Handler implements DemoMode { sc.icon.setAlpha(mDisabledAlpha); sc.icon.setClickable(false); } else if (fixedVolume || - (sc.streamType != mAudioManager.getMasterStreamType() && !isRinger && muted) || + (sc.streamType != mAudioManager.getUiSoundsStreamType() && !isRinger && muted) || (sSafetyWarning != null)) { sc.seekbarView.setEnabled(false); } else { @@ -977,10 +941,6 @@ public class VolumePanel extends Handler implements DemoMode { obtainMessage(MSG_REMOTE_VOLUME_UPDATE_IF_SHOWN).sendToTarget(); } - public void postMasterVolumeChanged(int flags) { - postVolumeChanged(STREAM_MASTER, flags); - } - public void postMuteChanged(int streamType, int flags) { if (hasMessages(MSG_VOLUME_CHANGED)) return; synchronized (this) { @@ -992,10 +952,6 @@ public class VolumePanel extends Handler implements DemoMode { obtainMessage(MSG_MUTE_CHANGED, streamType, flags).sendToTarget(); } - public void postMasterMuteChanged(int flags) { - postMuteChanged(STREAM_MASTER, flags); - } - public void postDisplaySafeVolumeWarning(int flags) { if (hasMessages(MSG_DISPLAY_SAFE_VOLUME_WARNING)) return; obtainMessage(MSG_DISPLAY_SAFE_VOLUME_WARNING, flags, 0).sendToTarget(); @@ -1192,9 +1148,7 @@ public class VolumePanel extends Handler implements DemoMode { if (!isShowing()) { int stream = (streamType == STREAM_REMOTE_MUSIC) ? -1 : streamType; // when the stream is for remote playback, use -1 to reset the stream type evaluation - if (stream != STREAM_MASTER) { - mAudioManager.forceVolumeControlStream(stream); - } + mAudioManager.forceVolumeControlStream(stream); mDialog.show(); if (mCallback != null) { mCallback.onVisible(true); @@ -1360,16 +1314,6 @@ public class VolumePanel extends Handler implements DemoMode { * Lock on this VolumePanel instance as long as you use the returned ToneGenerator. */ private ToneGenerator getOrCreateToneGenerator(int streamType) { - if (streamType == STREAM_MASTER) { - // For devices that use the master volume setting only but still want to - // play a volume-changed tone, direct the master volume pseudostream to - // the system stream's tone generator. - if (mPlayMasterStreamTones) { - streamType = AudioManager.STREAM_SYSTEM; - } else { - return null; - } - } synchronized (this) { if (mToneGenerators[streamType] == null) { try { diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumeUI.java b/packages/SystemUI/src/com/android/systemui/volume/VolumeUI.java index f7f3bd8..7603c7d 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/VolumeUI.java +++ b/packages/SystemUI/src/com/android/systemui/volume/VolumeUI.java @@ -201,13 +201,8 @@ public class VolumeUI extends SystemUI { } @Override - public void masterVolumeChanged(int flags) throws RemoteException { - mPanel.postMasterVolumeChanged(flags); - } - - @Override public void masterMuteChanged(int flags) throws RemoteException { - mPanel.postMasterMuteChanged(flags); + // no-op } @Override |