Merge "AudioService: fix NOTIFICATION unmuted while in silent/vibrate mode" into udc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
2b9dbdfc9a
@@ -3373,8 +3373,13 @@ public class AudioService extends IAudioService.Stub
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
sVolumeLogger.enqueue(new VolumeEvent(VolumeEvent.VOL_ADJUST_STREAM_VOL, streamType,
|
final VolumeEvent evt = new VolumeEvent(VolumeEvent.VOL_ADJUST_STREAM_VOL, streamType,
|
||||||
direction/*val1*/, flags/*val2*/, callingPackage));
|
direction/*val1*/, flags/*val2*/, callingPackage);
|
||||||
|
sVolumeLogger.enqueue(evt);
|
||||||
|
// also logging mute/unmute calls to the dedicated logger
|
||||||
|
if (isMuteAdjust(direction)) {
|
||||||
|
sMuteLogger.enqueue(evt);
|
||||||
|
}
|
||||||
adjustStreamVolume(streamType, direction, flags, callingPackage, callingPackage,
|
adjustStreamVolume(streamType, direction, flags, callingPackage, callingPackage,
|
||||||
Binder.getCallingUid(), Binder.getCallingPid(), attributionTag,
|
Binder.getCallingUid(), Binder.getCallingPid(), attributionTag,
|
||||||
callingHasAudioSettingsPermission(), AudioDeviceVolumeManager.ADJUST_MODE_NORMAL);
|
callingHasAudioSettingsPermission(), AudioDeviceVolumeManager.ADJUST_MODE_NORMAL);
|
||||||
@@ -3475,7 +3480,7 @@ public class AudioService extends IAudioService.Stub
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If either the client forces allowing ringer modes for this adjustment,
|
// If either the client forces allowing ringer modes for this adjustment,
|
||||||
// or the stream type is one that is affected by ringer modes
|
// or stream is used for UI sonification
|
||||||
if (((flags & AudioManager.FLAG_ALLOW_RINGER_MODES) != 0) ||
|
if (((flags & AudioManager.FLAG_ALLOW_RINGER_MODES) != 0) ||
|
||||||
(isUiSoundsStreamType(streamTypeAlias))) {
|
(isUiSoundsStreamType(streamTypeAlias))) {
|
||||||
int ringerMode = getRingerModeInternal();
|
int ringerMode = getRingerModeInternal();
|
||||||
@@ -3496,6 +3501,13 @@ public class AudioService extends IAudioService.Stub
|
|||||||
if ((result & AudioManager.FLAG_SHOW_VIBRATE_HINT) != 0) {
|
if ((result & AudioManager.FLAG_SHOW_VIBRATE_HINT) != 0) {
|
||||||
flags |= AudioManager.FLAG_SHOW_VIBRATE_HINT;
|
flags |= AudioManager.FLAG_SHOW_VIBRATE_HINT;
|
||||||
}
|
}
|
||||||
|
} else if (isStreamMutedByRingerOrZenMode(streamTypeAlias) && streamState.mIsMuted) {
|
||||||
|
// if the stream is currently muted streams by ringer/zen mode
|
||||||
|
// then it cannot be unmuted (without FLAG_ALLOW_RINGER_MODES)
|
||||||
|
if (direction == AudioManager.ADJUST_TOGGLE_MUTE
|
||||||
|
|| direction == AudioManager.ADJUST_UNMUTE) {
|
||||||
|
adjustVolume = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the ringer mode or zen is muting the stream, do not change stream unless
|
// If the ringer mode or zen is muting the stream, do not change stream unless
|
||||||
|
|||||||
@@ -609,7 +609,7 @@ public class AudioServiceEvents {
|
|||||||
(mStreamType <= AudioSystem.getNumStreamTypes() && mStreamType >= 0)
|
(mStreamType <= AudioSystem.getNumStreamTypes() && mStreamType >= 0)
|
||||||
? AudioSystem.STREAM_NAMES[mStreamType]
|
? AudioSystem.STREAM_NAMES[mStreamType]
|
||||||
: ("stream " + mStreamType);
|
: ("stream " + mStreamType);
|
||||||
return new StringBuilder("Error trying to unmute ")
|
return new StringBuilder("Invalid call to unmute ")
|
||||||
.append(streamName)
|
.append(streamName)
|
||||||
.append(" despite muted streams 0x")
|
.append(" despite muted streams 0x")
|
||||||
.append(Integer.toHexString(mRingerZenMutedStreams))
|
.append(Integer.toHexString(mRingerZenMutedStreams))
|
||||||
|
|||||||
Reference in New Issue
Block a user