summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Sundeep Gopalaswamy <sgopalaswamy@google.com> 2023-11-29 19:16:59 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2023-11-29 19:16:59 +0000
commitaa722e45c33505bf48e33d7bd139cdec08bd4155 (patch)
tree0d9155627e975b687c54a02a8e4600431fff8ca6
parentf5ee90997ccd634b7fb28ccd1e00d3b631d9b1d1 (diff)
parentb23d82386e7782c15d8f8fc91e06943a07adf097 (diff)
Merge "Read minimum volume for alarm from config" into main
-rw-r--r--core/res/res/values/config.xml3
-rw-r--r--core/res/res/values/symbols.xml1
-rw-r--r--services/core/java/com/android/server/audio/AudioService.java14
3 files changed, 18 insertions, 0 deletions
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index 1d4e01a95591..c9d4ba468cd4 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -2246,6 +2246,9 @@
<!-- The default volume for the ring stream -->
<integer name="config_audio_ring_vol_default">5</integer>
+ <!-- The default min volume for the alarm stream -->
+ <integer name="config_audio_alarm_min_vol">1</integer>
+
<!-- The default value for whether head tracking for
spatial audio is enabled for a newly connected audio device -->
<bool name="config_spatial_audio_head_tracking_enabled_default">false</bool>
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 4b0fa4ba5173..efbab309b1d4 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -287,6 +287,7 @@
<java-symbol type="integer" name="config_audio_notif_vol_steps" />
<java-symbol type="integer" name="config_audio_ring_vol_default" />
<java-symbol type="integer" name="config_audio_ring_vol_steps" />
+ <java-symbol type="integer" name="config_audio_alarm_min_vol" />
<java-symbol type="bool" name="config_spatial_audio_head_tracking_enabled_default" />
<java-symbol type="bool" name="config_avoidGfxAccel" />
<java-symbol type="bool" name="config_bluetooth_address_validation" />
diff --git a/services/core/java/com/android/server/audio/AudioService.java b/services/core/java/com/android/server/audio/AudioService.java
index 5d47e35a8729..c2ca64b70037 100644
--- a/services/core/java/com/android/server/audio/AudioService.java
+++ b/services/core/java/com/android/server/audio/AudioService.java
@@ -38,6 +38,7 @@ import static android.provider.Settings.Secure.VOLUME_HUSH_MUTE;
import static android.provider.Settings.Secure.VOLUME_HUSH_OFF;
import static android.provider.Settings.Secure.VOLUME_HUSH_VIBRATE;
+import static com.android.media.audio.Flags.alarmMinVolumeZero;
import static com.android.media.audio.Flags.bluetoothMacAddressAnonymization;
import static com.android.media.audio.Flags.disablePrescaleAbsoluteVolume;
import static com.android.server.audio.SoundDoseHelper.ACTION_CHECK_MUSIC_ACTIVE;
@@ -1191,6 +1192,19 @@ public class AudioService extends IAudioService.Stub
MAX_STREAM_VOLUME[AudioSystem.STREAM_ALARM] = maxAlarmVolume;
}
+ if (alarmMinVolumeZero()) {
+ try {
+ int minAlarmVolume = mContext.getResources().getInteger(
+ com.android.internal.R.integer.config_audio_alarm_min_vol);
+ if (minAlarmVolume <= MAX_STREAM_VOLUME[AudioSystem.STREAM_ALARM]) {
+ MIN_STREAM_VOLUME[AudioSystem.STREAM_ALARM] = minAlarmVolume;
+ } else {
+ Log.e(TAG, "Error min alarm volume greater than max alarm volume");
+ }
+ } catch (Resources.NotFoundException e) {
+ Log.e(TAG, "Error querying for alarm min volume ", e);
+ }
+ }
int defaultAlarmVolume = SystemProperties.getInt("ro.config.alarm_vol_default", -1);
if (defaultAlarmVolume != -1 &&
defaultAlarmVolume <= MAX_STREAM_VOLUME[AudioSystem.STREAM_ALARM]) {