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

Commit 8d499179 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "AudioPolicyManager: Update property get"

parents 5f3ff7e3 0f6e6400
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -2811,13 +2811,10 @@ bool AudioPolicyManager::isOffloadSupported(const audio_offload_info_t& offloadI
    }

    // Check if offload has been disabled
    char propValue[PROPERTY_VALUE_MAX];
    if (property_get("audio.offload.disable", propValue, "0")) {
        if (atoi(propValue) != 0) {
            ALOGV("offload disabled by audio.offload.disable=%s", propValue );
    if (property_get_bool("audio.offload.disable", false /* default_value */)) {
        ALOGV("offload disabled by audio.offload.disable");
        return false;
    }
    }

    // Check if stream type is music, then only allow offload as of now.
    if (offloadInfo.stream_type != AUDIO_STREAM_MUSIC)
@@ -2835,9 +2832,12 @@ bool AudioPolicyManager::isOffloadSupported(const audio_offload_info_t& offloadI
    }

    //If duration is less than minimum value defined in property, return false
    if (property_get("audio.offload.min.duration.secs", propValue, NULL)) {
        if (offloadInfo.duration_us < (atoi(propValue) * 1000000 )) {
            ALOGV("Offload denied by duration < audio.offload.min.duration.secs(=%s)", propValue);
    const int min_duration_secs = property_get_int32(
            "audio.offload.min.duration.secs", -1 /* default_value */);
    if (min_duration_secs >= 0) {
        if (offloadInfo.duration_us < min_duration_secs * 1000000LL) {
            ALOGV("Offload denied by duration < audio.offload.min.duration.secs(=%d)",
                    min_duration_secs);
            return false;
        }
    } else if (offloadInfo.duration_us < OFFLOAD_DEFAULT_MIN_DURATION_SECS * 1000000) {