Loading media/java/android/media/AudioManager.java +17 −0 Original line number Diff line number Diff line Loading @@ -7006,6 +7006,23 @@ public class AudioManager { } } /** * Check whether a user can mute this stream type from a given UI element. * * <p>Only useful for volume controllers. * * @param streamType type of stream to check if it's mutable from UI * * @hide */ public boolean isStreamMutableByUi(int streamType) { try { return getService().isStreamMutableByUi(streamType); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Only useful for volume controllers. * @hide Loading media/java/android/media/IAudioService.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -305,6 +305,8 @@ interface IAudioService { boolean isStreamAffectedByMute(int streamType); boolean isStreamMutableByUi(int streamType); void disableSafeMediaVolume(String callingPackage); oneway void lowerVolumeToRs1(String callingPackage); Loading packages/SettingsLib/src/com/android/settingslib/volume/data/repository/AudioRepository.kt +1 −1 Original line number Diff line number Diff line Loading @@ -182,7 +182,7 @@ class AudioRepositoryImpl( minVolume = getMinVolume(audioStream), maxVolume = audioManager.getStreamMaxVolume(audioStream.value), volume = audioManager.getStreamVolume(audioStream.value), isAffectedByMute = audioManager.isStreamAffectedByMute(audioStream.value), isAffectedByMute = audioManager.isStreamMutableByUi(audioStream.value), isAffectedByRingerMode = audioManager.isStreamAffectedByRingerMode(audioStream.value), isMuted = audioManager.isStreamMute(audioStream.value), ) Loading packages/SystemUI/src/com/android/systemui/volume/VolumeDialogControllerImpl.java +1 −1 Original line number Diff line number Diff line Loading @@ -567,7 +567,7 @@ public class VolumeDialogControllerImpl implements VolumeDialogController, Dumpa streamStateW(stream).levelMax = Math.max(1, getAudioManagerStreamMaxVolume(stream)); updateStreamMuteW(stream, mAudio.isStreamMute(stream)); final StreamState ss = streamStateW(stream); ss.muteSupported = mAudio.isStreamAffectedByMute(stream); ss.muteSupported = mAudio.isStreamMutableByUi(stream); ss.name = STREAMS.get(stream); checkRoutedToBluetoothW(stream); } Loading services/core/java/com/android/server/audio/AudioService.java +20 −1 Original line number Diff line number Diff line Loading @@ -708,10 +708,14 @@ public class AudioService extends IAudioService.Stub // Streams currently muted by ringer mode and dnd protected static volatile int sRingerAndZenModeMutedStreams; /** Streams that can be muted. Do not resolve to aliases when checking. /** Streams that can be muted by system. Do not resolve to aliases when checking. * @see System#MUTE_STREAMS_AFFECTED */ private int mMuteAffectedStreams; /** Streams that can be muted by user. Do not resolve to aliases when checking. * @see System#MUTE_STREAMS_AFFECTED */ private int mUserMutableStreams; @NonNull private SoundEffectsHelper mSfxHelper; Loading Loading @@ -2346,6 +2350,7 @@ public class AudioService extends IAudioService.Stub mMuteAffectedStreams &= ~(1 << vss.mStreamType); } } updateUserMutableStreams(); } private void createStreamStates() { Loading Loading @@ -2415,6 +2420,8 @@ public class AudioService extends IAudioService.Stub } pw.print("\n- mute affected streams = 0x"); pw.println(Integer.toHexString(mMuteAffectedStreams)); pw.print("\n- user mutable streams = 0x"); pw.println(Integer.toHexString(mUserMutableStreams)); } private void updateStreamVolumeAlias(boolean updateVolumes, String caller) { Loading Loading @@ -2909,6 +2916,7 @@ public class AudioService extends IAudioService.Stub mMuteAffectedStreams = mSettings.getSystemIntForUser(cr, System.MUTE_STREAMS_AFFECTED, AudioSystem.DEFAULT_MUTE_STREAMS_AFFECTED, UserHandle.USER_CURRENT); updateUserMutableStreams(); updateMasterMono(cr); Loading @@ -2928,6 +2936,12 @@ public class AudioService extends IAudioService.Stub mVolumeController.loadSettings(cr); } private void updateUserMutableStreams() { mUserMutableStreams = mMuteAffectedStreams; mUserMutableStreams &= ~(1 << AudioSystem.STREAM_VOICE_CALL); mUserMutableStreams &= ~(1 << AudioSystem.STREAM_BLUETOOTH_SCO); } @GuardedBy("mSettingsLock") private void resetActiveAssistantUidsLocked() { mActiveAssistantServiceUids = NO_ACTIVE_ASSISTANT_SERVICE_UIDS; Loading Loading @@ -7142,6 +7156,11 @@ public class AudioService extends IAudioService.Stub return (mMuteAffectedStreams & (1 << streamType)) != 0; } @Override public boolean isStreamMutableByUi(int streamType) { return (mUserMutableStreams & (1 << streamType)) != 0; } private void ensureValidDirection(int direction) { switch (direction) { case AudioManager.ADJUST_LOWER: Loading Loading
media/java/android/media/AudioManager.java +17 −0 Original line number Diff line number Diff line Loading @@ -7006,6 +7006,23 @@ public class AudioManager { } } /** * Check whether a user can mute this stream type from a given UI element. * * <p>Only useful for volume controllers. * * @param streamType type of stream to check if it's mutable from UI * * @hide */ public boolean isStreamMutableByUi(int streamType) { try { return getService().isStreamMutableByUi(streamType); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Only useful for volume controllers. * @hide Loading
media/java/android/media/IAudioService.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -305,6 +305,8 @@ interface IAudioService { boolean isStreamAffectedByMute(int streamType); boolean isStreamMutableByUi(int streamType); void disableSafeMediaVolume(String callingPackage); oneway void lowerVolumeToRs1(String callingPackage); Loading
packages/SettingsLib/src/com/android/settingslib/volume/data/repository/AudioRepository.kt +1 −1 Original line number Diff line number Diff line Loading @@ -182,7 +182,7 @@ class AudioRepositoryImpl( minVolume = getMinVolume(audioStream), maxVolume = audioManager.getStreamMaxVolume(audioStream.value), volume = audioManager.getStreamVolume(audioStream.value), isAffectedByMute = audioManager.isStreamAffectedByMute(audioStream.value), isAffectedByMute = audioManager.isStreamMutableByUi(audioStream.value), isAffectedByRingerMode = audioManager.isStreamAffectedByRingerMode(audioStream.value), isMuted = audioManager.isStreamMute(audioStream.value), ) Loading
packages/SystemUI/src/com/android/systemui/volume/VolumeDialogControllerImpl.java +1 −1 Original line number Diff line number Diff line Loading @@ -567,7 +567,7 @@ public class VolumeDialogControllerImpl implements VolumeDialogController, Dumpa streamStateW(stream).levelMax = Math.max(1, getAudioManagerStreamMaxVolume(stream)); updateStreamMuteW(stream, mAudio.isStreamMute(stream)); final StreamState ss = streamStateW(stream); ss.muteSupported = mAudio.isStreamAffectedByMute(stream); ss.muteSupported = mAudio.isStreamMutableByUi(stream); ss.name = STREAMS.get(stream); checkRoutedToBluetoothW(stream); } Loading
services/core/java/com/android/server/audio/AudioService.java +20 −1 Original line number Diff line number Diff line Loading @@ -708,10 +708,14 @@ public class AudioService extends IAudioService.Stub // Streams currently muted by ringer mode and dnd protected static volatile int sRingerAndZenModeMutedStreams; /** Streams that can be muted. Do not resolve to aliases when checking. /** Streams that can be muted by system. Do not resolve to aliases when checking. * @see System#MUTE_STREAMS_AFFECTED */ private int mMuteAffectedStreams; /** Streams that can be muted by user. Do not resolve to aliases when checking. * @see System#MUTE_STREAMS_AFFECTED */ private int mUserMutableStreams; @NonNull private SoundEffectsHelper mSfxHelper; Loading Loading @@ -2346,6 +2350,7 @@ public class AudioService extends IAudioService.Stub mMuteAffectedStreams &= ~(1 << vss.mStreamType); } } updateUserMutableStreams(); } private void createStreamStates() { Loading Loading @@ -2415,6 +2420,8 @@ public class AudioService extends IAudioService.Stub } pw.print("\n- mute affected streams = 0x"); pw.println(Integer.toHexString(mMuteAffectedStreams)); pw.print("\n- user mutable streams = 0x"); pw.println(Integer.toHexString(mUserMutableStreams)); } private void updateStreamVolumeAlias(boolean updateVolumes, String caller) { Loading Loading @@ -2909,6 +2916,7 @@ public class AudioService extends IAudioService.Stub mMuteAffectedStreams = mSettings.getSystemIntForUser(cr, System.MUTE_STREAMS_AFFECTED, AudioSystem.DEFAULT_MUTE_STREAMS_AFFECTED, UserHandle.USER_CURRENT); updateUserMutableStreams(); updateMasterMono(cr); Loading @@ -2928,6 +2936,12 @@ public class AudioService extends IAudioService.Stub mVolumeController.loadSettings(cr); } private void updateUserMutableStreams() { mUserMutableStreams = mMuteAffectedStreams; mUserMutableStreams &= ~(1 << AudioSystem.STREAM_VOICE_CALL); mUserMutableStreams &= ~(1 << AudioSystem.STREAM_BLUETOOTH_SCO); } @GuardedBy("mSettingsLock") private void resetActiveAssistantUidsLocked() { mActiveAssistantServiceUids = NO_ACTIVE_ASSISTANT_SERVICE_UIDS; Loading Loading @@ -7142,6 +7156,11 @@ public class AudioService extends IAudioService.Stub return (mMuteAffectedStreams & (1 << streamType)) != 0; } @Override public boolean isStreamMutableByUi(int streamType) { return (mUserMutableStreams & (1 << streamType)) != 0; } private void ensureValidDirection(int direction) { switch (direction) { case AudioManager.ADJUST_LOWER: Loading