Loading services/core/java/com/android/server/audio/AudioService.java +21 −13 Original line number Original line Diff line number Diff line Loading @@ -929,11 +929,8 @@ public class AudioService extends IAudioService.Stub synchronized (VolumeStreamState.class) { synchronized (VolumeStreamState.class) { int numStreamTypes = AudioSystem.getNumStreamTypes(); int numStreamTypes = AudioSystem.getNumStreamTypes(); for (int streamType = 0; streamType < numStreamTypes; streamType++) { for (int streamType = 0; streamType < numStreamTypes; streamType++) { if (streamType != mStreamVolumeAlias[streamType]) { mStreamStates[streamType] mStreamStates[streamType]. .setAllIndexes(mStreamStates[mStreamVolumeAlias[streamType]], TAG); setAllIndexes(mStreamStates[mStreamVolumeAlias[streamType]], TAG); } // apply stream volume // apply stream volume if (!mStreamStates[streamType].mIsMuted) { if (!mStreamStates[streamType].mIsMuted) { mStreamStates[streamType].applyAllVolumes(); mStreamStates[streamType].applyAllVolumes(); Loading Loading @@ -1022,20 +1019,21 @@ public class AudioService extends IAudioService.Stub } } mStreamVolumeAlias[AudioSystem.STREAM_DTMF] = dtmfStreamAlias; mStreamVolumeAlias[AudioSystem.STREAM_DTMF] = dtmfStreamAlias; final int oldStreamA11yAlias = mStreamVolumeAlias[AudioSystem.STREAM_ACCESSIBILITY]; if (oldStreamA11yAlias != a11yStreamAlias) { mStreamVolumeAlias[AudioSystem.STREAM_ACCESSIBILITY] = a11yStreamAlias; mStreamVolumeAlias[AudioSystem.STREAM_ACCESSIBILITY] = a11yStreamAlias; mStreamStates[AudioSystem.STREAM_ACCESSIBILITY].mVolumeIndexSettingName = System.VOLUME_SETTINGS_INT[a11yStreamAlias]; // restore the value from the settings when the alias changes mStreamStates[AudioSystem.STREAM_ACCESSIBILITY].readSettings(); } if (updateVolumes) { if (updateVolumes) { mStreamStates[AudioSystem.STREAM_DTMF].setAllIndexes(mStreamStates[dtmfStreamAlias], mStreamStates[AudioSystem.STREAM_DTMF].setAllIndexes(mStreamStates[dtmfStreamAlias], caller); caller); mStreamStates[AudioSystem.STREAM_ACCESSIBILITY].mVolumeIndexSettingName = System.VOLUME_SETTINGS_INT[a11yStreamAlias]; mStreamStates[AudioSystem.STREAM_ACCESSIBILITY].setAllIndexes( mStreamStates[AudioSystem.STREAM_ACCESSIBILITY].setAllIndexes( mStreamStates[a11yStreamAlias], caller); mStreamStates[a11yStreamAlias], caller); if (sIndependentA11yVolume) { // restore the a11y values from the settings mStreamStates[AudioSystem.STREAM_ACCESSIBILITY].readSettings(); } // apply stream mute states according to new value of mRingerModeAffectedStreams // apply stream mute states according to new value of mRingerModeAffectedStreams setRingerModeInt(getRingerModeInternal(), false); setRingerModeInt(getRingerModeInternal(), false); sendMsg(mAudioHandler, sendMsg(mAudioHandler, Loading Loading @@ -4228,7 +4226,17 @@ public class AudioService extends IAudioService.Stub return mIndexMin; return mIndexMin; } } /** * Copies all device/index pairs from the given VolumeStreamState after initializing * them with the volume for DEVICE_OUT_DEFAULT. No-op if the source VolumeStreamState * has the same stream type as this instance. * @param srcStream * @param caller */ public void setAllIndexes(VolumeStreamState srcStream, String caller) { public void setAllIndexes(VolumeStreamState srcStream, String caller) { if (mStreamType == srcStream.mStreamType) { return; } synchronized (VolumeStreamState.class) { synchronized (VolumeStreamState.class) { int srcStreamType = srcStream.getStreamType(); int srcStreamType = srcStream.getStreamType(); // apply default device volume from source stream to all devices first in case // apply default device volume from source stream to all devices first in case Loading Loading
services/core/java/com/android/server/audio/AudioService.java +21 −13 Original line number Original line Diff line number Diff line Loading @@ -929,11 +929,8 @@ public class AudioService extends IAudioService.Stub synchronized (VolumeStreamState.class) { synchronized (VolumeStreamState.class) { int numStreamTypes = AudioSystem.getNumStreamTypes(); int numStreamTypes = AudioSystem.getNumStreamTypes(); for (int streamType = 0; streamType < numStreamTypes; streamType++) { for (int streamType = 0; streamType < numStreamTypes; streamType++) { if (streamType != mStreamVolumeAlias[streamType]) { mStreamStates[streamType] mStreamStates[streamType]. .setAllIndexes(mStreamStates[mStreamVolumeAlias[streamType]], TAG); setAllIndexes(mStreamStates[mStreamVolumeAlias[streamType]], TAG); } // apply stream volume // apply stream volume if (!mStreamStates[streamType].mIsMuted) { if (!mStreamStates[streamType].mIsMuted) { mStreamStates[streamType].applyAllVolumes(); mStreamStates[streamType].applyAllVolumes(); Loading Loading @@ -1022,20 +1019,21 @@ public class AudioService extends IAudioService.Stub } } mStreamVolumeAlias[AudioSystem.STREAM_DTMF] = dtmfStreamAlias; mStreamVolumeAlias[AudioSystem.STREAM_DTMF] = dtmfStreamAlias; final int oldStreamA11yAlias = mStreamVolumeAlias[AudioSystem.STREAM_ACCESSIBILITY]; if (oldStreamA11yAlias != a11yStreamAlias) { mStreamVolumeAlias[AudioSystem.STREAM_ACCESSIBILITY] = a11yStreamAlias; mStreamVolumeAlias[AudioSystem.STREAM_ACCESSIBILITY] = a11yStreamAlias; mStreamStates[AudioSystem.STREAM_ACCESSIBILITY].mVolumeIndexSettingName = System.VOLUME_SETTINGS_INT[a11yStreamAlias]; // restore the value from the settings when the alias changes mStreamStates[AudioSystem.STREAM_ACCESSIBILITY].readSettings(); } if (updateVolumes) { if (updateVolumes) { mStreamStates[AudioSystem.STREAM_DTMF].setAllIndexes(mStreamStates[dtmfStreamAlias], mStreamStates[AudioSystem.STREAM_DTMF].setAllIndexes(mStreamStates[dtmfStreamAlias], caller); caller); mStreamStates[AudioSystem.STREAM_ACCESSIBILITY].mVolumeIndexSettingName = System.VOLUME_SETTINGS_INT[a11yStreamAlias]; mStreamStates[AudioSystem.STREAM_ACCESSIBILITY].setAllIndexes( mStreamStates[AudioSystem.STREAM_ACCESSIBILITY].setAllIndexes( mStreamStates[a11yStreamAlias], caller); mStreamStates[a11yStreamAlias], caller); if (sIndependentA11yVolume) { // restore the a11y values from the settings mStreamStates[AudioSystem.STREAM_ACCESSIBILITY].readSettings(); } // apply stream mute states according to new value of mRingerModeAffectedStreams // apply stream mute states according to new value of mRingerModeAffectedStreams setRingerModeInt(getRingerModeInternal(), false); setRingerModeInt(getRingerModeInternal(), false); sendMsg(mAudioHandler, sendMsg(mAudioHandler, Loading Loading @@ -4228,7 +4226,17 @@ public class AudioService extends IAudioService.Stub return mIndexMin; return mIndexMin; } } /** * Copies all device/index pairs from the given VolumeStreamState after initializing * them with the volume for DEVICE_OUT_DEFAULT. No-op if the source VolumeStreamState * has the same stream type as this instance. * @param srcStream * @param caller */ public void setAllIndexes(VolumeStreamState srcStream, String caller) { public void setAllIndexes(VolumeStreamState srcStream, String caller) { if (mStreamType == srcStream.mStreamType) { return; } synchronized (VolumeStreamState.class) { synchronized (VolumeStreamState.class) { int srcStreamType = srcStream.getStreamType(); int srcStreamType = srcStream.getStreamType(); // apply default device volume from source stream to all devices first in case // apply default device volume from source stream to all devices first in case Loading