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

Commit b1f12e0f authored by Vlad Popa's avatar Vlad Popa Committed by Android (Google) Code Review
Browse files

Merge "CSD: Persist csd and recover after boot or audioserver crash"

parents 0196ba00 774b6d56
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -15497,6 +15497,25 @@ public final class Settings {
        @Readable
        public static final String AUDIO_SAFE_VOLUME_STATE = "audio_safe_volume_state";
        /**
         * Persisted safe hearding current CSD value. Values are stored as float percentages where
         * 1.f represents 100% sound dose has been reached.
         * @hide
         */
        public static final String AUDIO_SAFE_CSD_CURRENT_VALUE = "audio_safe_csd_current_value";
        /**
         * Persisted safe hearding next CSD warning value. Values are stored as float percentages.
         * @hide
         */
        public static final String AUDIO_SAFE_CSD_NEXT_WARNING = "audio_safe_csd_next_warning";
        /**
         * Persisted safe hearding dose records (see {@link android.media.SoundDoseRecord})
         * @hide
         */
        public static final String AUDIO_SAFE_CSD_DOSE_RECORDS = "audio_safe_csd_dose_records";
        /**
         * URL for tzinfo (time zone) updates
         * @hide
+4 −1
Original line number Diff line number Diff line
@@ -88,6 +88,9 @@ message GlobalSettingsProto {

    optional SettingProto assisted_gps_enabled = 14 [ (android.privacy).dest = DEST_AUTOMATIC ];
    optional SettingProto audio_safe_volume_state = 15 [ (android.privacy).dest = DEST_AUTOMATIC ];
    optional SettingProto audio_safe_csd_current_value = 157 [ (android.privacy).dest = DEST_AUTOMATIC ];
    optional SettingProto audio_safe_csd_next_warning = 158 [ (android.privacy).dest = DEST_AUTOMATIC ];
    optional SettingProto audio_safe_csd_dose_records = 159 [ (android.privacy).dest = DEST_AUTOMATIC ];

    reserved 17; // Used to be autofill_compat_mode_allowed_packages

@@ -1087,5 +1090,5 @@ message GlobalSettingsProto {

    // Please insert fields in alphabetical order and group them into messages
    // if possible (to avoid reaching the method limit).
    // Next tag = 157;
    // Next tag = 160;
}
+9 −0
Original line number Diff line number Diff line
@@ -238,6 +238,15 @@ class SettingsProtoDumpUtil {
        dumpSetting(s, p,
                Settings.Global.AUDIO_SAFE_VOLUME_STATE,
                GlobalSettingsProto.AUDIO_SAFE_VOLUME_STATE);
        dumpSetting(s, p,
                Settings.Global.AUDIO_SAFE_CSD_CURRENT_VALUE,
                GlobalSettingsProto.AUDIO_SAFE_CSD_CURRENT_VALUE);
        dumpSetting(s, p,
                Settings.Global.AUDIO_SAFE_CSD_NEXT_WARNING,
                GlobalSettingsProto.AUDIO_SAFE_CSD_NEXT_WARNING);
        dumpSetting(s, p,
                Settings.Global.AUDIO_SAFE_CSD_DOSE_RECORDS,
                GlobalSettingsProto.AUDIO_SAFE_CSD_DOSE_RECORDS);

        final long autofillToken = p.start(GlobalSettingsProto.AUTOFILL);
        dumpSetting(s, p,
+3 −0
Original line number Diff line number Diff line
@@ -131,6 +131,9 @@ public class SettingsBackupTest {
                    Settings.Global.ART_VERIFIER_VERIFY_DEBUGGABLE,
                    Settings.Global.ASSISTED_GPS_ENABLED,
                    Settings.Global.AUDIO_SAFE_VOLUME_STATE,
                    Settings.Global.AUDIO_SAFE_CSD_CURRENT_VALUE,
                    Settings.Global.AUDIO_SAFE_CSD_NEXT_WARNING,
                    Settings.Global.AUDIO_SAFE_CSD_DOSE_RECORDS,
                    Settings.Global.AUTOFILL_LOGGING_LEVEL,
                    Settings.Global.AUTOFILL_MAX_PARTITIONS_SIZE,
                    Settings.Global.AUTOFILL_MAX_VISIBLE_DATASETS,
+2 −2
Original line number Diff line number Diff line
@@ -1462,7 +1462,7 @@ public class AudioService extends IAudioService.Stub
        mNm = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);
        mSoundDoseHelper.configureSafeMediaVolume(/*forced=*/true, TAG);
        mSoundDoseHelper.configureSafeMedia(/*forced=*/true, TAG);
        initA11yMonitoring();
@@ -10236,7 +10236,7 @@ public class AudioService extends IAudioService.Stub
            // reading new configuration "safely" (i.e. under try catch) in case anything
            // goes wrong.
            Configuration config = context.getResources().getConfiguration();
            mSoundDoseHelper.configureSafeMediaVolume(/*forced*/false, TAG);
            mSoundDoseHelper.configureSafeMedia(/*forced*/false, TAG);
            boolean cameraSoundForced = readCameraSoundForced();
            synchronized (mSettingsLock) {
Loading