summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI
diff options
context:
space:
mode:
authorJohn Spurlock <jspurlock@google.com>2015-03-10 21:33:44 -0400
committerJohn Spurlock <jspurlock@google.com>2015-03-13 11:02:01 -0400
commitb6e19e3e0f0170d058636101e23f964196f6f4b2 (patch)
tree19f605a5db398b21c9260da6da69d0194908f97c /packages/SystemUI
parent63b9e8200e96fd66eefc19bb48cfe7b7f084e4c5 (diff)
downloadframeworks_base-b6e19e3e0f0170d058636101e23f964196f6f4b2.zip
frameworks_base-b6e19e3e0f0170d058636101e23f964196f6f4b2.tar.gz
frameworks_base-b6e19e3e0f0170d058636101e23f964196f6f4b2.tar.bz2
AudioService: Define minimum levels for volume streams.
- Set a floor of 1 for voice call + bluetooth sco, otherwise 0. - All api calls validated to ensure a floor of the min level. - Volume UI updated to shift the seekbar by the min value. - Remove duplicate static max method in AudioService. - Ensure streams with a min level > 0 are not considered muteable. Bug: 19260237 Change-Id: I213180c9c277f51bd3897b7f777e5f88ed1db125
Diffstat (limited to 'packages/SystemUI')
-rw-r--r--packages/SystemUI/src/com/android/systemui/volume/VolumePanel.java42
1 files changed, 14 insertions, 28 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumePanel.java b/packages/SystemUI/src/com/android/systemui/volume/VolumePanel.java
index 51adaac..d16b818 100644
--- a/packages/SystemUI/src/com/android/systemui/volume/VolumePanel.java
+++ b/packages/SystemUI/src/com/android/systemui/volume/VolumePanel.java
@@ -253,6 +253,7 @@ public class VolumePanel extends Handler implements DemoMode {
int iconRes;
int iconMuteRes;
int iconSuppressedRes;
+ int minVolume;
}
// Synchronize when accessing this
@@ -558,6 +559,14 @@ public class VolumePanel extends Handler implements DemoMode {
}
}
+ private int getStreamMinVolume(int streamType) {
+ if (streamType == STREAM_REMOTE_MUSIC) {
+ return 0;
+ } else {
+ return mAudioManager.getStreamMinVolume(streamType);
+ }
+ }
+
private int getStreamMaxVolume(int streamType) {
if (streamType == STREAM_REMOTE_MUSIC) {
if (mStreamControls != null) {
@@ -661,9 +670,8 @@ public class VolumePanel extends Handler implements DemoMode {
}
});
}
- final int plusOne = (streamType == AudioSystem.STREAM_BLUETOOTH_SCO ||
- streamType == AudioSystem.STREAM_VOICE_CALL) ? 1 : 0;
- sc.seekbarView.setMax(getStreamMaxVolume(streamType) + plusOne);
+ sc.minVolume = getStreamMinVolume(streamType);
+ sc.seekbarView.setMax(getStreamMaxVolume(streamType) - sc.minVolume);
sc.seekbarView.setOnSeekBarChangeListener(mSeekListener);
sc.seekbarView.setTag(sc);
mStreamControls.put(streamType, sc);
@@ -706,7 +714,7 @@ public class VolumePanel extends Handler implements DemoMode {
if (progress < 0) {
progress = getStreamVolume(sc.streamType);
}
- sc.seekbarView.setProgress(progress);
+ sc.seekbarView.setProgress(progress - sc.minVolume);
if (isRinger) {
mLastRingerProgress = progress;
}
@@ -1034,7 +1042,7 @@ public class VolumePanel extends Handler implements DemoMode {
// get max volume for progress bar
- int max = getStreamMaxVolume(streamType);
+ int max = getStreamMaxVolume(streamType) - getStreamMinVolume(streamType);
StreamControl sc = mStreamControls.get(streamType);
switch (streamType) {
@@ -1061,17 +1069,6 @@ public class VolumePanel extends Handler implements DemoMode {
break;
}
- case AudioManager.STREAM_VOICE_CALL: {
- /*
- * For in-call voice call volume, there is no inaudible volume.
- * Rescale the UI control so the progress bar doesn't go all
- * the way to zero and don't show the mute icon.
- */
- index++;
- max++;
- break;
- }
-
case AudioManager.STREAM_ALARM: {
break;
}
@@ -1085,17 +1082,6 @@ public class VolumePanel extends Handler implements DemoMode {
break;
}
- case AudioManager.STREAM_BLUETOOTH_SCO: {
- /*
- * For in-call voice call volume, there is no inaudible volume.
- * Rescale the UI control so the progress bar doesn't go all
- * the way to zero and don't show the mute icon.
- */
- index++;
- max++;
- break;
- }
-
case STREAM_REMOTE_MUSIC: {
if (controller == null && sc != null) {
// If we weren't passed one try using the last one set.
@@ -1493,7 +1479,7 @@ public class VolumePanel extends Handler implements DemoMode {
final Object tag = seekBar.getTag();
if (fromUser && tag instanceof StreamControl) {
StreamControl sc = (StreamControl) tag;
- setStreamVolume(sc, progress,
+ setStreamVolume(sc, progress + sc.minVolume,
AudioManager.FLAG_SHOW_UI | AudioManager.FLAG_VIBRATE);
}
resetTimeout();