Permalink
Browse files

AudioService: Show safe volume panel for non-interactive volume adjus…

…tments

If safe volume is active, apps calling mp.setVolume() to adjust the
headset to a value higher than the threshold will have the operation
fail silently because no volume dialog is active to pop up the
"do you wish to override" question.
This is particularly bad for peripherals that use the audio jack
(Square readers, Jawbone bands), since they usually require levels
close to maximum for proper communication and the app isn't prepared
to deal with a silent rejection of the requested volume.

Change-Id: Ice3313a55132cb6f01e9c2a6a710a2a4af5e9f8a
  • Loading branch information...
sdroyds authored and akhilnarang committed Oct 13, 2015
1 parent 93790c0 commit 3cdc793b1a45612bf0631cb47b4e0cea46b14cd9
Showing with 1 addition and 1 deletion.
  1. +1 −1 services/core/java/com/android/server/audio/AudioService.java
@@ -1569,7 +1569,7 @@ private void adjustStreamVolume(int streamType, int direction, int flags,
} else if ((direction == AudioManager.ADJUST_RAISE) &&
!checkSafeMediaVolume(streamTypeAlias, aliasIndex + step, device)) {
Log.e(TAG, "adjustStreamVolume() safe volume index = " + oldIndex);
mVolumeController.postDisplaySafeVolumeWarning(flags);
mVolumeController.postDisplaySafeVolumeWarning(flags | AudioManager.FLAG_SHOW_UI);
} else if (streamState.adjustIndex(direction * step, device, caller)
|| streamState.mIsMuted) {
// Post message to set system volume (it in turn will post a

0 comments on commit 3cdc793

Please sign in to comment.