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

Commit 9f41e2cc authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 9133013 from fc74dada to tm-qpr2-release

Change-Id: Iec700b28d767a450ac04250378144e3d57cd2ca9
parents bfcf2eda fc74dada
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -316,6 +316,11 @@ void Effect::getConfigImpl(int commandCode, const char* commandName, GetConfigCa

Result Effect::getCurrentConfigImpl(uint32_t featureId, uint32_t configSize,
                                    GetCurrentConfigSuccessCallback onSuccess) {
    if (configSize > kMaxDataSize - sizeof(uint32_t)) {
        ALOGE("%s: Config size is too big: %" PRIu32, __func__, configSize);
        android_errorWriteLog(0x534e4554, "240266798");
        return Result::INVALID_ARGUMENTS;
    }
    uint32_t halCmd = featureId;
    std::vector<uint32_t> halResult(alignedSizeIn<uint32_t>(sizeof(uint32_t) + configSize), 0);
    uint32_t halResultSize = 0;
@@ -350,8 +355,12 @@ Result Effect::getParameterImpl(uint32_t paramSize, const void* paramData,

Result Effect::getSupportedConfigsImpl(uint32_t featureId, uint32_t maxConfigs, uint32_t configSize,
                                       GetSupportedConfigsSuccessCallback onSuccess) {
    if (maxConfigs != 0 && configSize > (kMaxDataSize - 2 * sizeof(uint32_t)) / maxConfigs) {
        ALOGE("%s: Config size is too big: %" PRIu32, __func__, configSize);
        return Result::INVALID_ARGUMENTS;
    }
    uint32_t halCmd[2] = {featureId, maxConfigs};
    uint32_t halResultSize = 2 * sizeof(uint32_t) + maxConfigs * sizeof(configSize);
    uint32_t halResultSize = 2 * sizeof(uint32_t) + maxConfigs * configSize;
    std::vector<uint8_t> halResult(static_cast<size_t>(halResultSize), 0);
    return sendCommandReturningStatusAndData(
        EFFECT_CMD_GET_FEATURE_SUPPORTED_CONFIGS, "GET_FEATURE_SUPPORTED_CONFIGS", sizeof(halCmd),
+3 −0
Original line number Diff line number Diff line
@@ -184,6 +184,9 @@ struct Effect : public IEffect {
    using GetSupportedConfigsSuccessCallback =
        std::function<void(uint32_t supportedConfigs, void* configsData)>;

    // Sets the limit on the maximum size of vendor-provided data structures.
    static constexpr size_t kMaxDataSize = 1 << 20;

    static const char* sContextResultOfCommand;
    static const char* sContextCallToCommand;
    static const char* sContextCallFunction;
+31 −0
Original line number Diff line number Diff line
@@ -665,6 +665,37 @@ TEST_P(AudioEffectHidlTest, SetCurrentConfigForFeature) {
    EXPECT_TRUE(ret.isOk());
}

TEST_P(AudioEffectHidlTest, GetSupportedConfigsForFeatureInvalidConfigSize) {
    description("Verify that GetSupportedConfigsForFeature caps the maximum config size");
    const bool isNewDeviceLaunchingOnTPlus = property_get_int32("ro.vendor.api_level", 0) >= 33;
    if (!isNewDeviceLaunchingOnTPlus) {
        GTEST_SKIP() << "The test only applies to devices launching on T or later";
    }
    // Use very large size to ensure that the service does not crash.
    const uint32_t veryLargeConfigSize = std::numeric_limits<uint32_t>::max() - 100;
    Result retval = Result::OK;
    Return<void> ret = effect->getSupportedConfigsForFeature(
            0, 1, veryLargeConfigSize,
            [&](Result r, uint32_t, const hidl_vec<uint8_t>&) { retval = r; });
    EXPECT_TRUE(ret.isOk());
    EXPECT_EQ(Result::INVALID_ARGUMENTS, retval);
}

TEST_P(AudioEffectHidlTest, GetCurrentConfigForFeatureInvalidConfigSize) {
    description("Verify that GetCurrentConfigForFeature caps the maximum config size");
    const bool isNewDeviceLaunchingOnTPlus = property_get_int32("ro.vendor.api_level", 0) >= 33;
    if (!isNewDeviceLaunchingOnTPlus) {
        GTEST_SKIP() << "The test only applies to devices launching on T or later";
    }
    // Use very large size to ensure that the service does not crash.
    const uint32_t veryLargeConfigSize = std::numeric_limits<uint32_t>::max() - 100;
    Result retval = Result::OK;
    Return<void> ret = effect->getCurrentConfigForFeature(
            0, veryLargeConfigSize, [&](Result r, const hidl_vec<uint8_t>&) { retval = r; });
    EXPECT_TRUE(ret.isOk());
    EXPECT_EQ(Result::INVALID_ARGUMENTS, retval);
}

// The main test class for Equalizer Audio Effect HIDL HAL.
class EqualizerAudioEffectHidlTest : public AudioEffectHidlTest {
  public:
+3 −1
Original line number Diff line number Diff line
@@ -33,7 +33,9 @@ parcelable EvsEventDesc {
    @utf8InCpp
    String deviceId;
    /**
     * Possible additional vendor information that is opaque to the EvsManager
     * Possible additional vendor information that is opaque to the EvsManager.
     * The size of the payload must not exceed 16-byte if the HIDL recipients are
     * expected to exist.
     */
    int[] payload;
}
+4 −1
Original line number Diff line number Diff line
@@ -47,7 +47,10 @@ oneway interface IEvsCameraStream {
    /**
     * Receives calls from the HAL each time an event happens.
     *
     * @param in event EVS event with possible event information.
     * @param in event EVS event with possible event information.  If ths HIDL
     *                 recipients are expected to exist, the size of the event
     *                 payload must not exceed 16 bytes; otherwise, a notification
     *                 will not reach them.
     */
    void notify(in EvsEventDesc event);
}
Loading