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

Commit 9593062e authored by Vlad Popa's avatar Vlad Popa
Browse files

CSD: rename get/setOutputRs2 to include upper bound

RS2 represents an interval of power levels. This is why it is clearer to
specify upper bound in the naming to make it clear that we refer to the
upper limit which when exceeded will trigger a momentary exposure.

Test: atest SoundDoseHelperTest
Bug: 273961110
Change-Id: Ib1bf8258e064c6e421d71e7269637522a6411145
parent 5c2a9f41
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -6752,7 +6752,7 @@ public class AudioManager {

    /**
     * @hide
     * Lower media volume to RS1
     * Lower media volume to RS1 interval
     */
    public void lowerVolumeToRs1() {
        try {
@@ -6764,13 +6764,13 @@ public class AudioManager {

    /**
     * @hide
     * @return the RS2 value used for momentary exposure warnings
     * @return the RS2 upper bound used for momentary exposure warnings
     */
    @TestApi
    @RequiresPermission(Manifest.permission.MODIFY_AUDIO_SETTINGS_PRIVILEGED)
    public float getRs2Value() {
        try {
            return getService().getRs2Value();
            return getService().getOutputRs2UpperBound();
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
@@ -6778,13 +6778,13 @@ public class AudioManager {

    /**
     * @hide
     * Sets the RS2 value used for momentary exposure warnings
     * Sets the RS2 upper bound used for momentary exposure warnings
     */
    @TestApi
    @RequiresPermission(Manifest.permission.MODIFY_AUDIO_SETTINGS_PRIVILEGED)
    public void setRs2Value(float rs2Value) {
        try {
            getService().setRs2Value(rs2Value);
            getService().setOutputRs2UpperBound(rs2Value);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
+2 −2
Original line number Diff line number Diff line
@@ -296,10 +296,10 @@ interface IAudioService {
    void lowerVolumeToRs1(String callingPackage);

    @EnforcePermission("MODIFY_AUDIO_SETTINGS_PRIVILEGED")
    float getRs2Value();
    float getOutputRs2UpperBound();

    @EnforcePermission("MODIFY_AUDIO_SETTINGS_PRIVILEGED")
    oneway void setRs2Value(float rs2Value);
    oneway void setOutputRs2UpperBound(float rs2Value);

    @EnforcePermission("MODIFY_AUDIO_SETTINGS_PRIVILEGED")
    float getCsd();
+6 −6
Original line number Diff line number Diff line
@@ -10471,16 +10471,16 @@ public class AudioService extends IAudioService.Stub
    @Override
    @android.annotation.EnforcePermission(android.Manifest.permission.MODIFY_AUDIO_SETTINGS_PRIVILEGED)
    public float getRs2Value() {
        super.getRs2Value_enforcePermission();
        return mSoundDoseHelper.getRs2Value();
    public float getOutputRs2UpperBound() {
        super.getOutputRs2UpperBound_enforcePermission();
        return mSoundDoseHelper.getOutputRs2UpperBound();
    }
    @Override
    @android.annotation.EnforcePermission(android.Manifest.permission.MODIFY_AUDIO_SETTINGS_PRIVILEGED)
    public void setRs2Value(float rs2Value) {
        super.setRs2Value_enforcePermission();
        mSoundDoseHelper.setRs2Value(rs2Value);
    public void setOutputRs2UpperBound(float rs2Value) {
        super.setOutputRs2UpperBound_enforcePermission();
        mSoundDoseHelper.setOutputRs2UpperBound(rs2Value);
    }
    @Override
+4 −4
Original line number Diff line number Diff line
@@ -300,7 +300,7 @@ public class SoundDoseHelper {
                SAFE_MEDIA_VOLUME_UNINITIALIZED);
    }

    float getRs2Value() {
    float getOutputRs2UpperBound() {
        if (!mEnableCsd) {
            return 0.f;
        }
@@ -312,14 +312,14 @@ public class SoundDoseHelper {
        }

        try {
            return soundDose.getOutputRs2();
            return soundDose.getOutputRs2UpperBound();
        } catch (RemoteException e) {
            Log.e(TAG, "Exception while getting the RS2 exposure value", e);
            return 0.f;
        }
    }

    void setRs2Value(float rs2Value) {
    void setOutputRs2UpperBound(float rs2Value) {
        if (!mEnableCsd) {
            return;
        }
@@ -331,7 +331,7 @@ public class SoundDoseHelper {
        }

        try {
            soundDose.setOutputRs2(rs2Value);
            soundDose.setOutputRs2UpperBound(rs2Value);
        } catch (RemoteException e) {
            Log.e(TAG, "Exception while setting the RS2 exposure value", e);
        }