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

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

Merge "Changes for mute alarm feature" into main

parents 36d33866 291a40c4
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -4,6 +4,13 @@

package: "com.android.media.audio"

flag {
    name: "alarm_min_volume_zero"
    namespace: "media_audio"
    description: "Support configuring alarm min vol to zero"
    bug: "296884402"
}

flag {
    name: "bluetooth_mac_address_anonymization"
    namespace: "media_audio"
+4 −0
Original line number Diff line number Diff line
@@ -57,4 +57,8 @@ cc_library_static {
        "libaudiofoundation",
        "libaudiopolicycomponents",
    ],
    whole_static_libs: [
        "server_configurable_flags",
        "com.android.media.audio-aconfig-cc",
    ],
}
+19 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@
#include "EngineBase.h"
#include "EngineDefaultConfig.h"
#include <TypeConverter.h>
#include <com_android_media_audio.h>

namespace android {
namespace audio_policy {
@@ -178,6 +179,24 @@ engineConfig::ParsingResult EngineBase::processParsingResult(
                ALOGE("%s: Invalid %s", __FUNCTION__, configCurve.deviceCategory.c_str());
                continue;
            }
            if (!com::android::media::audio::alarm_min_volume_zero()) {
                /*
                 * This special handling is done because the audio_policy_volumes.xml
                 * is updated but if the flag is disabled, the min alarm volume can
                 * still be zero because the audio_policy_volumes.xml is the source of
                 * truth. So the index value is modified here to match the flag setting
                 */
                if (volumeConfig.name.compare(audio_stream_type_to_string(AUDIO_STREAM_ALARM)) == 0
                      && deviceCat == DEVICE_CATEGORY_SPEAKER) {
                    for (auto &point : configCurve.curvePoints) {
                        if (point.index == 1) {
                            ALOGD("Mute alarm disabled: Found point with index 1. setting it to 0");
                            point.index = 0;
                            break;
                        }
                    }
                }
            }
            sp<VolumeCurve> curve = new VolumeCurve(deviceCat);
            for (auto &point : configCurve.curvePoints) {
                curve->add({point.index, point.attenuationInMb});