Merge "AudioService: fix missing CEC message on unmute after vol down" am: 4f86011710
am: 1d99b3aaa8
Change-Id: I7bf0572c66c7331e24fef67074ec82056b8c6396
This commit is contained in:
@@ -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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1925,12 +1918,35 @@ 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) {
|
||||||
@@ -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);
|
||||||
@@ -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) {
|
||||||
@@ -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() {
|
||||||
|
|||||||
Reference in New Issue
Block a user