Loading media/java/android/media/AudioSystem.java +4 −4 Original line number Original line Diff line number Diff line Loading @@ -803,14 +803,14 @@ public class AudioSystem 4, // STREAM_VOICE_CALL 4, // STREAM_VOICE_CALL 7, // STREAM_SYSTEM 7, // STREAM_SYSTEM 5, // STREAM_RING 5, // STREAM_RING 11, // STREAM_MUSIC 5, // STREAM_MUSIC 6, // STREAM_ALARM 6, // STREAM_ALARM 5, // STREAM_NOTIFICATION 5, // STREAM_NOTIFICATION 7, // STREAM_BLUETOOTH_SCO 7, // STREAM_BLUETOOTH_SCO 7, // STREAM_SYSTEM_ENFORCED 7, // STREAM_SYSTEM_ENFORCED 11, // STREAM_DTMF 5, // STREAM_DTMF 11, // STREAM_TTS 5, // STREAM_TTS 11, // STREAM_ACCESSIBILITY 5, // STREAM_ACCESSIBILITY }; }; public static String streamToString(int stream) { public static String streamToString(int stream) { Loading services/core/java/com/android/server/audio/AudioService.java +37 −13 Original line number Original line Diff line number Diff line Loading @@ -648,20 +648,29 @@ public class AudioService extends IAudioService.Stub mHasVibrator = vibrator == null ? false : vibrator.hasVibrator(); mHasVibrator = vibrator == null ? false : vibrator.hasVibrator(); // Initialize volume // Initialize volume int maxVolume = SystemProperties.getInt("ro.config.vc_call_vol_steps", int maxCallVolume = SystemProperties.getInt("ro.config.vc_call_vol_steps", -1); MAX_STREAM_VOLUME[AudioSystem.STREAM_VOICE_CALL]); if (maxCallVolume != -1) { if (maxVolume != MAX_STREAM_VOLUME[AudioSystem.STREAM_VOICE_CALL]) { MAX_STREAM_VOLUME[AudioSystem.STREAM_VOICE_CALL] = maxCallVolume; MAX_STREAM_VOLUME[AudioSystem.STREAM_VOICE_CALL] = maxVolume; AudioSystem.DEFAULT_STREAM_VOLUME[AudioSystem.STREAM_VOICE_CALL] = AudioSystem.DEFAULT_STREAM_VOLUME[AudioSystem.STREAM_VOICE_CALL] = (maxVolume * 3) / 4; (maxCallVolume * 3) / 4; } } maxVolume = SystemProperties.getInt("ro.config.media_vol_steps", MAX_STREAM_VOLUME[AudioSystem.STREAM_MUSIC]); int maxMusicVolume = SystemProperties.getInt("ro.config.media_vol_steps", -1); if (maxVolume != MAX_STREAM_VOLUME[AudioSystem.STREAM_MUSIC]) { if (maxMusicVolume != -1) { MAX_STREAM_VOLUME[AudioSystem.STREAM_MUSIC] = maxVolume; MAX_STREAM_VOLUME[AudioSystem.STREAM_MUSIC] = maxMusicVolume; } int defaultMusicVolume = SystemProperties.getInt("ro.config.media_vol_default", -1); if (defaultMusicVolume != -1 && defaultMusicVolume <= MAX_STREAM_VOLUME[AudioSystem.STREAM_MUSIC]) { AudioSystem.DEFAULT_STREAM_VOLUME[AudioSystem.STREAM_MUSIC] = defaultMusicVolume; } else { if (isPlatformTelevision()) { if (isPlatformTelevision()) { AudioSystem.DEFAULT_STREAM_VOLUME[AudioSystem.STREAM_MUSIC] = maxVolume / 4; AudioSystem.DEFAULT_STREAM_VOLUME[AudioSystem.STREAM_MUSIC] = MAX_STREAM_VOLUME[AudioSystem.STREAM_MUSIC] / 4; } else { } else { AudioSystem.DEFAULT_STREAM_VOLUME[AudioSystem.STREAM_MUSIC] = (maxVolume * 3) / 4; AudioSystem.DEFAULT_STREAM_VOLUME[AudioSystem.STREAM_MUSIC] = MAX_STREAM_VOLUME[AudioSystem.STREAM_MUSIC] / 3; } } } } Loading Loading @@ -982,6 +991,19 @@ public class AudioService extends IAudioService.Stub checkAllFixedVolumeDevices(); checkAllFixedVolumeDevices(); checkAllAliasStreamVolumes(); checkAllAliasStreamVolumes(); checkMuteAffectedStreams(); checkMuteAffectedStreams(); updateDefaultVolumes(); } // Update default indexes from aliased streams. Must be called after mStreamStates is created private void updateDefaultVolumes() { for (int stream = 0; stream < mStreamStates.length; stream++) { if (stream != mStreamVolumeAlias[stream]) { AudioSystem.DEFAULT_STREAM_VOLUME[stream] = rescaleIndex( AudioSystem.DEFAULT_STREAM_VOLUME[mStreamVolumeAlias[stream]], mStreamVolumeAlias[stream], stream); } } } } private void dumpStreamStates(PrintWriter pw) { private void dumpStreamStates(PrintWriter pw) { Loading Loading @@ -1030,7 +1052,9 @@ public class AudioService extends IAudioService.Stub mStreamVolumeAlias[AudioSystem.STREAM_DTMF] = dtmfStreamAlias; mStreamVolumeAlias[AudioSystem.STREAM_DTMF] = dtmfStreamAlias; mStreamVolumeAlias[AudioSystem.STREAM_ACCESSIBILITY] = a11yStreamAlias; mStreamVolumeAlias[AudioSystem.STREAM_ACCESSIBILITY] = a11yStreamAlias; if (updateVolumes) { if (updateVolumes && mStreamStates != null) { updateDefaultVolumes(); mStreamStates[AudioSystem.STREAM_DTMF].setAllIndexes(mStreamStates[dtmfStreamAlias], mStreamStates[AudioSystem.STREAM_DTMF].setAllIndexes(mStreamStates[dtmfStreamAlias], caller); caller); Loading Loading
media/java/android/media/AudioSystem.java +4 −4 Original line number Original line Diff line number Diff line Loading @@ -803,14 +803,14 @@ public class AudioSystem 4, // STREAM_VOICE_CALL 4, // STREAM_VOICE_CALL 7, // STREAM_SYSTEM 7, // STREAM_SYSTEM 5, // STREAM_RING 5, // STREAM_RING 11, // STREAM_MUSIC 5, // STREAM_MUSIC 6, // STREAM_ALARM 6, // STREAM_ALARM 5, // STREAM_NOTIFICATION 5, // STREAM_NOTIFICATION 7, // STREAM_BLUETOOTH_SCO 7, // STREAM_BLUETOOTH_SCO 7, // STREAM_SYSTEM_ENFORCED 7, // STREAM_SYSTEM_ENFORCED 11, // STREAM_DTMF 5, // STREAM_DTMF 11, // STREAM_TTS 5, // STREAM_TTS 11, // STREAM_ACCESSIBILITY 5, // STREAM_ACCESSIBILITY }; }; public static String streamToString(int stream) { public static String streamToString(int stream) { Loading
services/core/java/com/android/server/audio/AudioService.java +37 −13 Original line number Original line Diff line number Diff line Loading @@ -648,20 +648,29 @@ public class AudioService extends IAudioService.Stub mHasVibrator = vibrator == null ? false : vibrator.hasVibrator(); mHasVibrator = vibrator == null ? false : vibrator.hasVibrator(); // Initialize volume // Initialize volume int maxVolume = SystemProperties.getInt("ro.config.vc_call_vol_steps", int maxCallVolume = SystemProperties.getInt("ro.config.vc_call_vol_steps", -1); MAX_STREAM_VOLUME[AudioSystem.STREAM_VOICE_CALL]); if (maxCallVolume != -1) { if (maxVolume != MAX_STREAM_VOLUME[AudioSystem.STREAM_VOICE_CALL]) { MAX_STREAM_VOLUME[AudioSystem.STREAM_VOICE_CALL] = maxCallVolume; MAX_STREAM_VOLUME[AudioSystem.STREAM_VOICE_CALL] = maxVolume; AudioSystem.DEFAULT_STREAM_VOLUME[AudioSystem.STREAM_VOICE_CALL] = AudioSystem.DEFAULT_STREAM_VOLUME[AudioSystem.STREAM_VOICE_CALL] = (maxVolume * 3) / 4; (maxCallVolume * 3) / 4; } } maxVolume = SystemProperties.getInt("ro.config.media_vol_steps", MAX_STREAM_VOLUME[AudioSystem.STREAM_MUSIC]); int maxMusicVolume = SystemProperties.getInt("ro.config.media_vol_steps", -1); if (maxVolume != MAX_STREAM_VOLUME[AudioSystem.STREAM_MUSIC]) { if (maxMusicVolume != -1) { MAX_STREAM_VOLUME[AudioSystem.STREAM_MUSIC] = maxVolume; MAX_STREAM_VOLUME[AudioSystem.STREAM_MUSIC] = maxMusicVolume; } int defaultMusicVolume = SystemProperties.getInt("ro.config.media_vol_default", -1); if (defaultMusicVolume != -1 && defaultMusicVolume <= MAX_STREAM_VOLUME[AudioSystem.STREAM_MUSIC]) { AudioSystem.DEFAULT_STREAM_VOLUME[AudioSystem.STREAM_MUSIC] = defaultMusicVolume; } else { if (isPlatformTelevision()) { if (isPlatformTelevision()) { AudioSystem.DEFAULT_STREAM_VOLUME[AudioSystem.STREAM_MUSIC] = maxVolume / 4; AudioSystem.DEFAULT_STREAM_VOLUME[AudioSystem.STREAM_MUSIC] = MAX_STREAM_VOLUME[AudioSystem.STREAM_MUSIC] / 4; } else { } else { AudioSystem.DEFAULT_STREAM_VOLUME[AudioSystem.STREAM_MUSIC] = (maxVolume * 3) / 4; AudioSystem.DEFAULT_STREAM_VOLUME[AudioSystem.STREAM_MUSIC] = MAX_STREAM_VOLUME[AudioSystem.STREAM_MUSIC] / 3; } } } } Loading Loading @@ -982,6 +991,19 @@ public class AudioService extends IAudioService.Stub checkAllFixedVolumeDevices(); checkAllFixedVolumeDevices(); checkAllAliasStreamVolumes(); checkAllAliasStreamVolumes(); checkMuteAffectedStreams(); checkMuteAffectedStreams(); updateDefaultVolumes(); } // Update default indexes from aliased streams. Must be called after mStreamStates is created private void updateDefaultVolumes() { for (int stream = 0; stream < mStreamStates.length; stream++) { if (stream != mStreamVolumeAlias[stream]) { AudioSystem.DEFAULT_STREAM_VOLUME[stream] = rescaleIndex( AudioSystem.DEFAULT_STREAM_VOLUME[mStreamVolumeAlias[stream]], mStreamVolumeAlias[stream], stream); } } } } private void dumpStreamStates(PrintWriter pw) { private void dumpStreamStates(PrintWriter pw) { Loading Loading @@ -1030,7 +1052,9 @@ public class AudioService extends IAudioService.Stub mStreamVolumeAlias[AudioSystem.STREAM_DTMF] = dtmfStreamAlias; mStreamVolumeAlias[AudioSystem.STREAM_DTMF] = dtmfStreamAlias; mStreamVolumeAlias[AudioSystem.STREAM_ACCESSIBILITY] = a11yStreamAlias; mStreamVolumeAlias[AudioSystem.STREAM_ACCESSIBILITY] = a11yStreamAlias; if (updateVolumes) { if (updateVolumes && mStreamStates != null) { updateDefaultVolumes(); mStreamStates[AudioSystem.STREAM_DTMF].setAllIndexes(mStreamStates[dtmfStreamAlias], mStreamStates[AudioSystem.STREAM_DTMF].setAllIndexes(mStreamStates[dtmfStreamAlias], caller); caller); Loading