Loading core/java/android/provider/Settings.java +6 −0 Original line number Diff line number Diff line Loading @@ -1498,6 +1498,12 @@ public final class Settings { */ public static final String VOLUME_BLUETOOTH_SCO = "volume_bluetooth_sco"; /** * Master volume (float in the range 0.0f to 1.0f). * @hide */ public static final String VOLUME_MASTER = "volume_master"; /** * Whether the notifications should use the ring volume (value of 1) or a separate * notification volume (value of 0). In most cases, users will have this enabled so the Loading media/java/android/media/AudioService.java +12 −0 Original line number Diff line number Diff line Loading @@ -404,6 +404,15 @@ public class AudioService extends IAudioService.Stub { TelephonyManager tmgr = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); tmgr.listen(mPhoneStateListener, PhoneStateListener.LISTEN_CALL_STATE); if (context.getResources().getBoolean( com.android.internal.R.bool.config_useMasterVolume)) { float volume = Settings.System.getFloat(mContentResolver, Settings.System.VOLUME_MASTER, -1.0f); if (volume >= 0.0f) { AudioSystem.setMasterVolume(volume); } } } private void createAudioSystemThread() { Loading Loading @@ -619,6 +628,9 @@ public class AudioService extends IAudioService.Stub { if (volume < 0.0f) volume = 0.0f; } AudioSystem.setMasterVolume(volume); long origCallerIdentityToken = Binder.clearCallingIdentity(); Settings.System.putFloat(mContentResolver, Settings.System.VOLUME_MASTER, volume); Binder.restoreCallingIdentity(origCallerIdentityToken); } } Loading Loading
core/java/android/provider/Settings.java +6 −0 Original line number Diff line number Diff line Loading @@ -1498,6 +1498,12 @@ public final class Settings { */ public static final String VOLUME_BLUETOOTH_SCO = "volume_bluetooth_sco"; /** * Master volume (float in the range 0.0f to 1.0f). * @hide */ public static final String VOLUME_MASTER = "volume_master"; /** * Whether the notifications should use the ring volume (value of 1) or a separate * notification volume (value of 0). In most cases, users will have this enabled so the Loading
media/java/android/media/AudioService.java +12 −0 Original line number Diff line number Diff line Loading @@ -404,6 +404,15 @@ public class AudioService extends IAudioService.Stub { TelephonyManager tmgr = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); tmgr.listen(mPhoneStateListener, PhoneStateListener.LISTEN_CALL_STATE); if (context.getResources().getBoolean( com.android.internal.R.bool.config_useMasterVolume)) { float volume = Settings.System.getFloat(mContentResolver, Settings.System.VOLUME_MASTER, -1.0f); if (volume >= 0.0f) { AudioSystem.setMasterVolume(volume); } } } private void createAudioSystemThread() { Loading Loading @@ -619,6 +628,9 @@ public class AudioService extends IAudioService.Stub { if (volume < 0.0f) volume = 0.0f; } AudioSystem.setMasterVolume(volume); long origCallerIdentityToken = Binder.clearCallingIdentity(); Settings.System.putFloat(mContentResolver, Settings.System.VOLUME_MASTER, volume); Binder.restoreCallingIdentity(origCallerIdentityToken); } } Loading