Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit aa722e45 authored by Sundeep Gopalaswamy's avatar Sundeep Gopalaswamy Committed by Android (Google) Code Review
Browse files

Merge "Read minimum volume for alarm from config" into main

parents f5ee9099 b23d8238
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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>
+1 −0
Original line number Diff line number Diff line
@@ -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" />
+14 −0
Original line number Diff line number Diff line
@@ -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]) {