Loading services/core/java/com/android/server/audio/AudioService.java +41 −27 Original line number Original line Diff line number Diff line Loading @@ -1905,16 +1905,9 @@ public class AudioService extends IAudioService.Stub } } } } if (mHdmiAudioSystemClient != null && if (streamTypeAlias == AudioSystem.STREAM_MUSIC mHdmiSystemAudioSupported && && (oldIndex != newIndex || isMuteAdjust)) { streamTypeAlias == AudioSystem.STREAM_MUSIC && maybeSendSystemAudioStatusCommand(isMuteAdjust); (oldIndex != newIndex || isMuteAdjust)) { final long identity = Binder.clearCallingIdentity(); mHdmiAudioSystemClient.sendReportAudioStatusCecCommand( isMuteAdjust, getStreamVolume(AudioSystem.STREAM_MUSIC), getStreamMaxVolume(AudioSystem.STREAM_MUSIC), isStreamMute(AudioSystem.STREAM_MUSIC)); Binder.restoreCallingIdentity(identity); } } } } } } Loading @@ -1925,13 +1918,36 @@ public class AudioService extends IAudioService.Stub // Called after a delay when volume down is pressed while muted // Called after a delay when volume down is pressed while muted private void onUnmuteStream(int stream, int flags) { private void onUnmuteStream(int stream, int flags) { VolumeStreamState streamState = mStreamStates[stream]; boolean wasMuted; streamState.mute(false); synchronized (VolumeStreamState.class) { final VolumeStreamState streamState = mStreamStates[stream]; wasMuted = streamState.mute(false); // if unmuting causes a change, it was muted final int device = getDeviceForStream(stream); final int device = getDeviceForStream(stream); final int index = mStreamStates[stream].getIndex(device); final int index = streamState.getIndex(device); sendVolumeUpdate(stream, index, index, flags, device); sendVolumeUpdate(stream, index, index, flags, device); } } if (stream == AudioSystem.STREAM_MUSIC && wasMuted) { synchronized (mHdmiClientLock) { maybeSendSystemAudioStatusCommand(true); } } } @GuardedBy("mHdmiClientLock") private void maybeSendSystemAudioStatusCommand(boolean isMuteAdjust) { if (mHdmiAudioSystemClient == null || !mHdmiSystemAudioSupported) { return; } final long identity = Binder.clearCallingIdentity(); mHdmiAudioSystemClient.sendReportAudioStatusCecCommand( isMuteAdjust, getStreamVolume(AudioSystem.STREAM_MUSIC), getStreamMaxVolume(AudioSystem.STREAM_MUSIC), isStreamMute(AudioSystem.STREAM_MUSIC)); Binder.restoreCallingIdentity(identity); } private void setSystemAudioVolume(int oldVolume, int newVolume, int maxVolume, int flags) { private void setSystemAudioVolume(int oldVolume, int newVolume, int maxVolume, int flags) { // Sets the audio volume of AVR when we are in system audio mode. The new volume info // Sets the audio volume of AVR when we are in system audio mode. The new volume info Loading Loading @@ -2343,17 +2359,9 @@ public class AudioService extends IAudioService.Stub } } } } synchronized (mHdmiClientLock) { synchronized (mHdmiClientLock) { if (mHdmiManager != null && if (streamTypeAlias == AudioSystem.STREAM_MUSIC mHdmiAudioSystemClient != null && && (oldIndex != index)) { mHdmiSystemAudioSupported && maybeSendSystemAudioStatusCommand(false); streamTypeAlias == AudioSystem.STREAM_MUSIC && (oldIndex != index)) { final long identity = Binder.clearCallingIdentity(); mHdmiAudioSystemClient.sendReportAudioStatusCecCommand( false, getStreamVolume(AudioSystem.STREAM_MUSIC), getStreamMaxVolume(AudioSystem.STREAM_MUSIC), isStreamMute(AudioSystem.STREAM_MUSIC)); Binder.restoreCallingIdentity(identity); } } } } sendVolumeUpdate(streamType, oldIndex, index, flags, device); sendVolumeUpdate(streamType, oldIndex, index, flags, device); Loading Loading @@ -4683,7 +4691,12 @@ public class AudioService extends IAudioService.Stub } } } } public void mute(boolean state) { /** * Mute/unmute the stream * @param state the new mute state * @return true if the mute state was changed */ public boolean mute(boolean state) { boolean changed = false; boolean changed = false; synchronized (VolumeStreamState.class) { synchronized (VolumeStreamState.class) { if (state != mIsMuted) { if (state != mIsMuted) { Loading @@ -4708,6 +4721,7 @@ public class AudioService extends IAudioService.Stub intent.putExtra(AudioManager.EXTRA_STREAM_VOLUME_MUTED, state); intent.putExtra(AudioManager.EXTRA_STREAM_VOLUME_MUTED, state); sendBroadcastToAll(intent); sendBroadcastToAll(intent); } } return changed; } } public int getStreamType() { public int getStreamType() { Loading Loading
services/core/java/com/android/server/audio/AudioService.java +41 −27 Original line number Original line Diff line number Diff line Loading @@ -1905,16 +1905,9 @@ public class AudioService extends IAudioService.Stub } } } } if (mHdmiAudioSystemClient != null && if (streamTypeAlias == AudioSystem.STREAM_MUSIC mHdmiSystemAudioSupported && && (oldIndex != newIndex || isMuteAdjust)) { streamTypeAlias == AudioSystem.STREAM_MUSIC && maybeSendSystemAudioStatusCommand(isMuteAdjust); (oldIndex != newIndex || isMuteAdjust)) { final long identity = Binder.clearCallingIdentity(); mHdmiAudioSystemClient.sendReportAudioStatusCecCommand( isMuteAdjust, getStreamVolume(AudioSystem.STREAM_MUSIC), getStreamMaxVolume(AudioSystem.STREAM_MUSIC), isStreamMute(AudioSystem.STREAM_MUSIC)); Binder.restoreCallingIdentity(identity); } } } } } } Loading @@ -1925,13 +1918,36 @@ public class AudioService extends IAudioService.Stub // Called after a delay when volume down is pressed while muted // Called after a delay when volume down is pressed while muted private void onUnmuteStream(int stream, int flags) { private void onUnmuteStream(int stream, int flags) { VolumeStreamState streamState = mStreamStates[stream]; boolean wasMuted; streamState.mute(false); synchronized (VolumeStreamState.class) { final VolumeStreamState streamState = mStreamStates[stream]; wasMuted = streamState.mute(false); // if unmuting causes a change, it was muted final int device = getDeviceForStream(stream); final int device = getDeviceForStream(stream); final int index = mStreamStates[stream].getIndex(device); final int index = streamState.getIndex(device); sendVolumeUpdate(stream, index, index, flags, device); sendVolumeUpdate(stream, index, index, flags, device); } } if (stream == AudioSystem.STREAM_MUSIC && wasMuted) { synchronized (mHdmiClientLock) { maybeSendSystemAudioStatusCommand(true); } } } @GuardedBy("mHdmiClientLock") private void maybeSendSystemAudioStatusCommand(boolean isMuteAdjust) { if (mHdmiAudioSystemClient == null || !mHdmiSystemAudioSupported) { return; } final long identity = Binder.clearCallingIdentity(); mHdmiAudioSystemClient.sendReportAudioStatusCecCommand( isMuteAdjust, getStreamVolume(AudioSystem.STREAM_MUSIC), getStreamMaxVolume(AudioSystem.STREAM_MUSIC), isStreamMute(AudioSystem.STREAM_MUSIC)); Binder.restoreCallingIdentity(identity); } private void setSystemAudioVolume(int oldVolume, int newVolume, int maxVolume, int flags) { private void setSystemAudioVolume(int oldVolume, int newVolume, int maxVolume, int flags) { // Sets the audio volume of AVR when we are in system audio mode. The new volume info // Sets the audio volume of AVR when we are in system audio mode. The new volume info Loading Loading @@ -2343,17 +2359,9 @@ public class AudioService extends IAudioService.Stub } } } } synchronized (mHdmiClientLock) { synchronized (mHdmiClientLock) { if (mHdmiManager != null && if (streamTypeAlias == AudioSystem.STREAM_MUSIC mHdmiAudioSystemClient != null && && (oldIndex != index)) { mHdmiSystemAudioSupported && maybeSendSystemAudioStatusCommand(false); streamTypeAlias == AudioSystem.STREAM_MUSIC && (oldIndex != index)) { final long identity = Binder.clearCallingIdentity(); mHdmiAudioSystemClient.sendReportAudioStatusCecCommand( false, getStreamVolume(AudioSystem.STREAM_MUSIC), getStreamMaxVolume(AudioSystem.STREAM_MUSIC), isStreamMute(AudioSystem.STREAM_MUSIC)); Binder.restoreCallingIdentity(identity); } } } } sendVolumeUpdate(streamType, oldIndex, index, flags, device); sendVolumeUpdate(streamType, oldIndex, index, flags, device); Loading Loading @@ -4683,7 +4691,12 @@ public class AudioService extends IAudioService.Stub } } } } public void mute(boolean state) { /** * Mute/unmute the stream * @param state the new mute state * @return true if the mute state was changed */ public boolean mute(boolean state) { boolean changed = false; boolean changed = false; synchronized (VolumeStreamState.class) { synchronized (VolumeStreamState.class) { if (state != mIsMuted) { if (state != mIsMuted) { Loading @@ -4708,6 +4721,7 @@ public class AudioService extends IAudioService.Stub intent.putExtra(AudioManager.EXTRA_STREAM_VOLUME_MUTED, state); intent.putExtra(AudioManager.EXTRA_STREAM_VOLUME_MUTED, state); sendBroadcastToAll(intent); sendBroadcastToAll(intent); } } return changed; } } public int getStreamType() { public int getStreamType() { Loading