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

Commit 844995bd authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 8591367 from 3357ac9f to tm-d1-release

Change-Id: I5354fc074996e2527af594b60c7ee599b92f6fef
parents 68185f94 3357ac9f
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@
#include <type_traits>
#include <utility>

#include <binder/Enums.h>
#include <binder/Status.h>
#include <error/Result.h>

@@ -269,6 +270,15 @@ ConversionResult<UnionFieldType<T, tag>> unionGetField(const T& u) {

namespace aidl_utils {

/**
 * Return true if the value is valid for the AIDL enumeration.
 */
template <typename T>
bool isValidEnum(T value) {
    constexpr android::enum_range<T> er{};
    return std::find(er.begin(), er.end(), value) != er.end();
}

/**
 * Return the equivalent Android status_t from a binder exception code.
 *
+0 −6
Original line number Diff line number Diff line
@@ -571,12 +571,6 @@ status_t SwAudioOutputDescriptor::open(const audio_config_t *halConfig,
        lHalConfig.offload_info.channel_mask = lHalConfig.channel_mask;
        lHalConfig.offload_info.format = lHalConfig.format;
        lHalConfig.offload_info.stream_type = stream;
        lHalConfig.offload_info.duration_us = -1;
        lHalConfig.offload_info.has_video = true; // conservative
        lHalConfig.offload_info.is_streaming = true; // likely
        lHalConfig.offload_info.encapsulation_mode = lHalConfig.offload_info.encapsulation_mode;
        lHalConfig.offload_info.content_id = lHalConfig.offload_info.content_id;
        lHalConfig.offload_info.sync_id = lHalConfig.offload_info.sync_id;
    }

    audio_config_base_t lMixerConfig;
+65 −5
Original line number Diff line number Diff line
@@ -214,21 +214,79 @@ status_t Spatializer::loadEngineConfiguration(sp<EffectHalInterface> effect) {
    status_t status = getHalParameter<false>(effect, SPATIALIZER_PARAM_HEADTRACKING_SUPPORTED,
                                         &supportsHeadTracking);
    if (status != NO_ERROR) {
        ALOGW("%s: cannot get SPATIALIZER_PARAM_HEADTRACKING_SUPPORTED", __func__);
        return status;
    }
    mSupportsHeadTracking = supportsHeadTracking[0];

    status = getHalParameter<true>(effect, SPATIALIZER_PARAM_SUPPORTED_LEVELS, &mLevels);
    std::vector<media::SpatializationLevel> spatializationLevels;
    status = getHalParameter<true>(effect, SPATIALIZER_PARAM_SUPPORTED_LEVELS,
            &spatializationLevels);
    if (status != NO_ERROR) {
        ALOGW("%s: cannot get SPATIALIZER_PARAM_SUPPORTED_LEVELS", __func__);
        return status;
    }
    bool noneLevelFound = false;
    bool activeLevelFound = false;
    for (const auto spatializationLevel : spatializationLevels) {
        if (!aidl_utils::isValidEnum(spatializationLevel)) {
            ALOGW("%s: ignoring spatializationLevel:%d", __func__, (int)spatializationLevel);
            continue;
        }
        if (spatializationLevel == media::SpatializationLevel::NONE) {
            noneLevelFound = true;
        } else {
            activeLevelFound = true;
        }
        // we don't detect duplicates.
        mLevels.emplace_back(spatializationLevel);
    }
    if (!noneLevelFound || !activeLevelFound) {
        ALOGW("%s: SPATIALIZER_PARAM_SUPPORTED_LEVELS must include NONE"
                " and another valid level",  __func__);
        return BAD_VALUE;
    }

    std::vector<media::SpatializationMode> spatializationModes;
    status = getHalParameter<true>(effect, SPATIALIZER_PARAM_SUPPORTED_SPATIALIZATION_MODES,
                                &mSpatializationModes);
            &spatializationModes);
    if (status != NO_ERROR) {
        ALOGW("%s: cannot get SPATIALIZER_PARAM_SUPPORTED_SPATIALIZATION_MODES", __func__);
        return status;
    }
    for (const auto spatializationMode : spatializationModes) {
        if (!aidl_utils::isValidEnum(spatializationMode)) {
            ALOGW("%s: ignoring spatializationMode:%d", __func__, (int)spatializationMode);
            continue;
        }
        // we don't detect duplicates.
        mSpatializationModes.emplace_back(spatializationMode);
    }
    if (mSpatializationModes.empty()) {
        ALOGW("%s: SPATIALIZER_PARAM_SUPPORTED_SPATIALIZATION_MODES reports empty", __func__);
        return BAD_VALUE;
    }

    std::vector<audio_channel_mask_t> channelMasks;
    status = getHalParameter<true>(effect, SPATIALIZER_PARAM_SUPPORTED_CHANNEL_MASKS,
                                 &channelMasks);
    if (status != NO_ERROR) {
        ALOGW("%s: cannot get SPATIALIZER_PARAM_SUPPORTED_CHANNEL_MASKS", __func__);
        return status;
    }
    return getHalParameter<true>(effect, SPATIALIZER_PARAM_SUPPORTED_CHANNEL_MASKS,
                                 &mChannelMasks);
    for (const auto channelMask : channelMasks) {
        if (!audio_is_channel_mask_spatialized(channelMask)) {
            ALOGW("%s: ignoring channelMask:%#x", __func__, channelMask);
            continue;
        }
        // we don't detect duplicates.
        mChannelMasks.emplace_back(channelMask);
    }
    if (mChannelMasks.empty()) {
        ALOGW("%s: SPATIALIZER_PARAM_SUPPORTED_CHANNEL_MASKS reports empty", __func__);
        return BAD_VALUE;
    }
    return NO_ERROR;
}

/** Gets the channel mask, sampling rate and format set for the spatializer input. */
@@ -238,8 +296,10 @@ audio_config_base_t Spatializer::getAudioInConfig() const {
    // For now use highest supported channel count
    uint32_t maxCount = 0;
    for ( auto mask : mChannelMasks) {
        if (audio_channel_count_from_out_mask(mask) > maxCount) {
        const size_t count = audio_channel_count_from_out_mask(mask);
        if (count > maxCount) {
            config.channel_mask = mask;
            maxCount = count;
        }
    }
    return config;
+1 −1
Original line number Diff line number Diff line
@@ -92,9 +92,9 @@ cc_library_shared {
        "gui/RingBufferConsumer.cpp",
        "hidl/AidlCameraDeviceCallbacks.cpp",
        "hidl/AidlCameraServiceListener.cpp",
        "hidl/Convert.cpp",
        "hidl/HidlCameraDeviceUser.cpp",
        "hidl/HidlCameraService.cpp",
        "hidl/Utils.cpp",
        "utils/CameraServiceProxyWrapper.cpp",
        "utils/CameraThreadState.cpp",
        "utils/CameraTraces.cpp",
+15 −4
Original line number Diff line number Diff line
@@ -3723,10 +3723,21 @@ void CameraService::UidPolicy::onUidIdle(uid_t uid, bool /* disabled */) {

void CameraService::UidPolicy::onUidStateChanged(uid_t uid, int32_t procState,
        int64_t procStateSeq __unused, int32_t capability __unused) {
    bool procStateChange = false;
    {
        Mutex::Autolock _l(mUidLock);
        if (mMonitoredUids.find(uid) != mMonitoredUids.end() &&
                mMonitoredUids[uid].procState != procState) {
            mMonitoredUids[uid].procState = procState;
            procStateChange = true;
        }
    }

    if (procStateChange) {
        sp<CameraService> service = mService.promote();
        if (service != nullptr) {
            service->notifyMonitoredUids();
        }
    }
}

Loading