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

Commit 11ee4fea authored by Xin Li's avatar Xin Li
Browse files

Merge android14-tests-dev

Bug: 263910020
Merged-In: I770dc5620648df2eab608e030c5e76cf190f315d
Change-Id: If4fe726d538386d70061e8051299d8fb393ef5df
parents b8c23a8a be23bf4f
Loading
Loading
Loading
Loading
+159 −67
Original line number Diff line number Diff line
@@ -32,11 +32,11 @@
#include <aidl/Gtest.h>
#include <aidl/Vintf.h>
#include <broadcastradio-utils-aidl/Utils.h>
#include <broadcastradio-vts-utils/mock-timeout.h>
#include <cutils/bitops.h>
#include <gmock/gmock.h>

#include <chrono>
#include <condition_variable>
#include <optional>
#include <regex>

@@ -61,11 +61,6 @@ using ::testing::SaveArg;

namespace bcutils = ::aidl::android::hardware::broadcastradio::utils;

inline constexpr std::chrono::seconds kTuneTimeoutSec =
        std::chrono::seconds(IBroadcastRadio::TUNER_TIMEOUT_MS * 1000);
inline constexpr std::chrono::seconds kProgramListScanTimeoutSec =
        std::chrono::seconds(IBroadcastRadio::LIST_COMPLETE_TIMEOUT_MS * 1000);

const ConfigFlag kConfigFlagValues[] = {
        ConfigFlag::FORCE_MONO,
        ConfigFlag::FORCE_ANALOG,
@@ -108,20 +103,68 @@ bool supportsFM(const AmFmRegionConfig& config) {

}  // namespace

class TunerCallbackMock : public BnTunerCallback {
class CallbackFlag final {
  public:
    CallbackFlag(int timeoutMs) { mTimeoutMs = timeoutMs; }
    /**
     * Notify that the callback is called.
     */
    void notify() {
        std::unique_lock<std::mutex> lock(mMutex);
        mCalled = true;
        lock.unlock();
        mCv.notify_all();
    };

    /**
     * Wait for the timeout passed into the constructor.
     */
    bool wait() {
        std::unique_lock<std::mutex> lock(mMutex);
        return mCv.wait_for(lock, std::chrono::milliseconds(mTimeoutMs),
                            [this] { return mCalled; });
    };

    /**
     * Reset the callback to not called.
     */
    void reset() {
        std::unique_lock<std::mutex> lock(mMutex);
        mCalled = false;
    }

  private:
    std::mutex mMutex;
    bool mCalled GUARDED_BY(mMutex) = false;
    std::condition_variable mCv;
    int mTimeoutMs;
};

class TunerCallbackImpl final : public BnTunerCallback {
  public:
    TunerCallbackMock();
    TunerCallbackImpl();
    ScopedAStatus onTuneFailed(Result result, const ProgramSelector& selector) override;
    MOCK_TIMEOUT_METHOD1(onCurrentProgramInfoChangedMock, ScopedAStatus(const ProgramInfo&));
    ScopedAStatus onCurrentProgramInfoChanged(const ProgramInfo& info) override;
    ScopedAStatus onProgramListUpdated(const ProgramListChunk& chunk) override;
    MOCK_METHOD1(onAntennaStateChange, ScopedAStatus(bool connected));
    MOCK_METHOD1(onParametersUpdated, ScopedAStatus(const vector<VendorKeyValue>& parameters));
    MOCK_METHOD2(onConfigFlagUpdated, ScopedAStatus(ConfigFlag in_flag, bool in_value));
    MOCK_TIMEOUT_METHOD0(onProgramListReady, void());
    ScopedAStatus onParametersUpdated(const vector<VendorKeyValue>& parameters) override;
    ScopedAStatus onAntennaStateChange(bool connected) override;
    ScopedAStatus onConfigFlagUpdated(ConfigFlag in_flag, bool in_value) override;

    bool waitOnCurrentProgramInfoChangedCallback();
    bool waitProgramReady();
    void reset();

    bool getAntennaConnectionState();
    ProgramInfo getCurrentProgramInfo();
    bcutils::ProgramInfoSet getProgramList();

  private:
    std::mutex mLock;
    bool mAntennaConnectionState GUARDED_BY(mLock);
    ProgramInfo mCurrentProgramInfo GUARDED_BY(mLock);
    bcutils::ProgramInfoSet mProgramList GUARDED_BY(mLock);
    CallbackFlag mOnCurrentProgramInfoChangedFlag = CallbackFlag(IBroadcastRadio::TUNER_TIMEOUT_MS);
    CallbackFlag mOnProgramListReadyFlag = CallbackFlag(IBroadcastRadio::LIST_COMPLETE_TIMEOUT_MS);
};

struct AnnouncementListenerMock : public BnAnnouncementListener {
@@ -139,7 +182,7 @@ class BroadcastRadioHalTest : public testing::TestWithParam<string> {

    std::shared_ptr<IBroadcastRadio> mModule;
    Properties mProperties;
    std::shared_ptr<TunerCallbackMock> mCallback = SharedRefBase::make<TunerCallbackMock>();
    std::shared_ptr<TunerCallbackImpl> mCallback;
};

MATCHER_P(InfoHasId, id, string(negation ? "does not contain" : "contains") + " " + id.toString()) {
@@ -147,20 +190,18 @@ MATCHER_P(InfoHasId, id, string(negation ? "does not contain" : "contains") + "
    return ids.end() != find(ids.begin(), ids.end(), id.value);
}

TunerCallbackMock::TunerCallbackMock() {
    EXPECT_TIMEOUT_CALL(*this, onCurrentProgramInfoChangedMock, _).Times(AnyNumber());

    // we expect the antenna is connected through the whole test
    EXPECT_CALL(*this, onAntennaStateChange(false)).Times(0);
TunerCallbackImpl::TunerCallbackImpl() {
    mAntennaConnectionState = true;
}

ScopedAStatus TunerCallbackMock::onTuneFailed(Result result, const ProgramSelector& selector) {
ScopedAStatus TunerCallbackImpl::onTuneFailed(Result result, const ProgramSelector& selector) {
    LOG(DEBUG) << "Tune failed for selector" << selector.toString();
    EXPECT_TRUE(result == Result::CANCELED);
    return ndk::ScopedAStatus::ok();
}

ScopedAStatus TunerCallbackMock::onCurrentProgramInfoChanged(const ProgramInfo& info) {
ScopedAStatus TunerCallbackImpl::onCurrentProgramInfoChanged(const ProgramInfo& info) {
    LOG(DEBUG) << "onCurrentProgramInfoChanged called";
    for (const auto& id : info.selector) {
        EXPECT_NE(id.type, IdentifierType::INVALID);
    }
@@ -196,21 +237,75 @@ ScopedAStatus TunerCallbackMock::onCurrentProgramInfoChanged(const ProgramInfo&
        }
    }

    return onCurrentProgramInfoChangedMock(info);
    {
        std::lock_guard<std::mutex> lk(mLock);
        mCurrentProgramInfo = info;
    }

ScopedAStatus TunerCallbackMock::onProgramListUpdated(const ProgramListChunk& chunk) {
    std::lock_guard<std::mutex> lk(mLock);
    mOnCurrentProgramInfoChangedFlag.notify();
    return ndk::ScopedAStatus::ok();
}

ScopedAStatus TunerCallbackImpl::onProgramListUpdated(const ProgramListChunk& chunk) {
    LOG(DEBUG) << "onProgramListUpdated called";
    {
        std::lock_guard<std::mutex> lk(mLock);
        updateProgramList(chunk, &mProgramList);
    }

    if (chunk.complete) {
        onProgramListReady();
        mOnProgramListReadyFlag.notify();
    }

    return ndk::ScopedAStatus::ok();
}

ScopedAStatus TunerCallbackImpl::onParametersUpdated(
        [[maybe_unused]] const vector<VendorKeyValue>& parameters) {
    return ndk::ScopedAStatus::ok();
}

ScopedAStatus TunerCallbackImpl::onAntennaStateChange(bool connected) {
    if (!connected) {
        std::lock_guard<std::mutex> lk(mLock);
        mAntennaConnectionState = false;
    }
    return ndk::ScopedAStatus::ok();
}

ScopedAStatus TunerCallbackImpl::onConfigFlagUpdated([[maybe_unused]] ConfigFlag in_flag,
                                                     [[maybe_unused]] bool in_value) {
    return ndk::ScopedAStatus::ok();
}

bool TunerCallbackImpl::waitOnCurrentProgramInfoChangedCallback() {
    return mOnCurrentProgramInfoChangedFlag.wait();
}

bool TunerCallbackImpl::waitProgramReady() {
    return mOnProgramListReadyFlag.wait();
}

void TunerCallbackImpl::reset() {
    mOnCurrentProgramInfoChangedFlag.reset();
    mOnProgramListReadyFlag.reset();
}

bool TunerCallbackImpl::getAntennaConnectionState() {
    std::lock_guard<std::mutex> lk(mLock);
    return mAntennaConnectionState;
}

ProgramInfo TunerCallbackImpl::getCurrentProgramInfo() {
    std::lock_guard<std::mutex> lk(mLock);
    return mCurrentProgramInfo;
}

bcutils::ProgramInfoSet TunerCallbackImpl::getProgramList() {
    std::lock_guard<std::mutex> lk(mLock);
    return mProgramList;
}

void BroadcastRadioHalTest::SetUp() {
    EXPECT_EQ(mModule.get(), nullptr) << "Module is already open";

@@ -228,6 +323,8 @@ void BroadcastRadioHalTest::SetUp() {
    EXPECT_FALSE(mProperties.product.empty());
    EXPECT_GT(mProperties.supportedIdentifierTypes.size(), 0u);

    mCallback = SharedRefBase::make<TunerCallbackImpl>();

    // set callback
    EXPECT_TRUE(mModule->setTunerCallback(mCallback).isOk());
}
@@ -236,6 +333,11 @@ void BroadcastRadioHalTest::TearDown() {
    if (mModule) {
        ASSERT_TRUE(mModule->unsetTunerCallback().isOk());
    }
    if (mCallback) {
        // we expect the antenna is connected through the whole test
        EXPECT_TRUE(mCallback->getAntennaConnectionState());
        mCallback = nullptr;
    }
}

bool BroadcastRadioHalTest::getAmFmRegionConfig(bool full, AmFmRegionConfig* config) {
@@ -256,7 +358,7 @@ std::optional<bcutils::ProgramInfoSet> BroadcastRadioHalTest::getProgramList() {

std::optional<bcutils::ProgramInfoSet> BroadcastRadioHalTest::getProgramList(
        const ProgramFilter& filter) {
    EXPECT_TIMEOUT_CALL(*mCallback, onProgramListReady).Times(AnyNumber());
    mCallback->reset();

    auto startResult = mModule->startProgramListUpdates(filter);

@@ -268,13 +370,13 @@ std::optional<bcutils::ProgramInfoSet> BroadcastRadioHalTest::getProgramList(
    if (!startResult.isOk()) {
        return std::nullopt;
    }
    EXPECT_TIMEOUT_CALL_WAIT(*mCallback, onProgramListReady, kProgramListScanTimeoutSec);
    EXPECT_TRUE(mCallback->waitProgramReady());

    auto stopResult = mModule->stopProgramListUpdates();

    EXPECT_TRUE(stopResult.isOk());

    return mCallback->mProgramList;
    return mCallback->getProgramList();
}

/**
@@ -456,7 +558,7 @@ TEST_P(BroadcastRadioHalTest, TuneFailsWithoutTunerCallback) {
 *  - if it is supported, the test is ignored;
 */
TEST_P(BroadcastRadioHalTest, TuneFailsWithNotSupported) {
    LOG(DEBUG) << "TuneFailsWithInvalid Test";
    LOG(DEBUG) << "TuneFailsWithNotSupported Test";

    vector<ProgramIdentifier> supportTestId = {
            makeIdentifier(IdentifierType::AMFM_FREQUENCY_KHZ, 0),           // invalid
@@ -477,9 +579,9 @@ TEST_P(BroadcastRadioHalTest, TuneFailsWithNotSupported) {
    for (const auto& id : supportTestId) {
        ProgramSelector sel{id, {}};

        if (!bcutils::isSupported(mProperties, sel)) {
            auto result = mModule->tune(sel);

        if (!bcutils::isSupported(mProperties, sel)) {
            EXPECT_EQ(result.getServiceSpecificError(), notSupportedError);
        }
    }
@@ -508,9 +610,9 @@ TEST_P(BroadcastRadioHalTest, TuneFailsWithInvalid) {
    for (const auto& id : invalidId) {
        ProgramSelector sel{id, {}};

        if (bcutils::isSupported(mProperties, sel)) {
            auto result = mModule->tune(sel);

        if (bcutils::isSupported(mProperties, sel)) {
            EXPECT_EQ(result.getServiceSpecificError(), invalidArgumentsError);
        }
    }
@@ -549,13 +651,7 @@ TEST_P(BroadcastRadioHalTest, FmTune) {
    int64_t freq = 90900;  // 90.9 FM
    ProgramSelector sel = makeSelectorAmfm(freq);
    // try tuning
    ProgramInfo infoCb = {};
    EXPECT_TIMEOUT_CALL(*mCallback, onCurrentProgramInfoChangedMock,
                        InfoHasId(makeIdentifier(IdentifierType::AMFM_FREQUENCY_KHZ, freq)))
            .Times(AnyNumber())
            .WillOnce(DoAll(SaveArg<0>(&infoCb), testing::Return(ByMove(ndk::ScopedAStatus::ok()))))
            .WillRepeatedly(testing::InvokeWithoutArgs([] { return ndk::ScopedAStatus::ok(); }));

    mCallback->reset();
    auto result = mModule->tune(sel);

    // expect a failure if it's not supported
@@ -566,7 +662,8 @@ TEST_P(BroadcastRadioHalTest, FmTune) {

    // expect a callback if it succeeds
    EXPECT_TRUE(result.isOk());
    EXPECT_TIMEOUT_CALL_WAIT(*mCallback, onCurrentProgramInfoChangedMock, kTuneTimeoutSec);
    EXPECT_TRUE(mCallback->waitOnCurrentProgramInfoChangedCallback());
    ProgramInfo infoCb = mCallback->getCurrentProgramInfo();

    LOG(DEBUG) << "Current program info: " << infoCb.toString();

@@ -638,12 +735,6 @@ TEST_P(BroadcastRadioHalTest, DabTune) {
    }

    // try tuning
    ProgramInfo infoCb = {};
    EXPECT_TIMEOUT_CALL(*mCallback, onCurrentProgramInfoChangedMock,
                        InfoHasId(makeIdentifier(IdentifierType::DAB_FREQUENCY_KHZ, freq)))
            .Times(AnyNumber())
            .WillOnce(
                    DoAll(SaveArg<0>(&infoCb), testing::Return(ByMove(ndk::ScopedAStatus::ok()))));

    auto result = mModule->tune(sel);

@@ -655,7 +746,9 @@ TEST_P(BroadcastRadioHalTest, DabTune) {

    // expect a callback if it succeeds
    EXPECT_TRUE(result.isOk());
    EXPECT_TIMEOUT_CALL_WAIT(*mCallback, onCurrentProgramInfoChangedMock, kTuneTimeoutSec);
    EXPECT_TRUE(mCallback->waitOnCurrentProgramInfoChangedCallback());
    ProgramInfo infoCb = mCallback->getCurrentProgramInfo();

    LOG(DEBUG) << "Current program info: " << infoCb.toString();

    // it should tune exactly to what was requested
@@ -669,13 +762,13 @@ TEST_P(BroadcastRadioHalTest, DabTune) {
 *
 * Verifies that:
 *  - the method succeeds;
 *  - the program info is changed within kTuneTimeoutSec;
 *  - the program info is changed within kTuneTimeoutMs;
 *  - works both directions and with or without skipping sub-channel.
 */
TEST_P(BroadcastRadioHalTest, Seek) {
    LOG(DEBUG) << "Seek Test";

    EXPECT_TIMEOUT_CALL(*mCallback, onCurrentProgramInfoChangedMock, _).Times(AnyNumber());
    mCallback->reset();

    auto result = mModule->seek(/* in_directionUp= */ true, /* in_skipSubChannel= */ true);

@@ -685,14 +778,14 @@ TEST_P(BroadcastRadioHalTest, Seek) {
    }

    EXPECT_TRUE(result.isOk());
    EXPECT_TIMEOUT_CALL_WAIT(*mCallback, onCurrentProgramInfoChangedMock, kTuneTimeoutSec);
    EXPECT_TRUE(mCallback->waitOnCurrentProgramInfoChangedCallback());

    EXPECT_TIMEOUT_CALL(*mCallback, onCurrentProgramInfoChangedMock, _).Times(AnyNumber());
    mCallback->reset();

    result = mModule->seek(/* in_directionUp= */ false, /* in_skipSubChannel= */ false);

    EXPECT_TRUE(result.isOk());
    EXPECT_TIMEOUT_CALL_WAIT(*mCallback, onCurrentProgramInfoChangedMock, kTuneTimeoutSec);
    EXPECT_TRUE(mCallback->waitOnCurrentProgramInfoChangedCallback());
}

/**
@@ -720,13 +813,13 @@ TEST_P(BroadcastRadioHalTest, SeekFailsWithoutTunerCallback) {
 *
 * Verifies that:
 *  - the method succeeds or returns NOT_SUPPORTED;
 *  - the program info is changed within kTuneTimeoutSec if the method succeeded;
 *  - the program info is changed within kTuneTimeoutMs if the method succeeded;
 *  - works both directions.
 */
TEST_P(BroadcastRadioHalTest, Step) {
    LOG(DEBUG) << "Step Test";

    EXPECT_TIMEOUT_CALL(*mCallback, onCurrentProgramInfoChangedMock, _).Times(AnyNumber());
    mCallback->reset();

    auto result = mModule->step(/* in_directionUp= */ true);

@@ -735,14 +828,14 @@ TEST_P(BroadcastRadioHalTest, Step) {
        return;
    }
    EXPECT_TRUE(result.isOk());
    EXPECT_TIMEOUT_CALL_WAIT(*mCallback, onCurrentProgramInfoChangedMock, kTuneTimeoutSec);
    EXPECT_TRUE(mCallback->waitOnCurrentProgramInfoChangedCallback());

    EXPECT_TIMEOUT_CALL(*mCallback, onCurrentProgramInfoChangedMock, _).Times(AnyNumber());
    mCallback->reset();

    result = mModule->step(/* in_directionUp= */ false);

    EXPECT_TRUE(result.isOk());
    EXPECT_TIMEOUT_CALL_WAIT(*mCallback, onCurrentProgramInfoChangedMock, kTuneTimeoutSec);
    EXPECT_TRUE(mCallback->waitOnCurrentProgramInfoChangedCallback());
}

/**
@@ -904,13 +997,12 @@ TEST_P(BroadcastRadioHalTest, SetConfigFlags) {
    LOG(DEBUG) << "SetConfigFlags Test";

    auto get = [&](ConfigFlag flag) -> bool {
        bool* gotValue = nullptr;
        bool gotValue;

        auto halResult = mModule->isConfigFlagSet(flag, gotValue);
        auto halResult = mModule->isConfigFlagSet(flag, &gotValue);

        EXPECT_FALSE(gotValue == nullptr);
        EXPECT_TRUE(halResult.isOk());
        return *gotValue;
        return gotValue;
    };

    auto notSupportedError = resultToInt(Result::NOT_SUPPORTED);
@@ -955,7 +1047,7 @@ TEST_P(BroadcastRadioHalTest, SetConfigFlags) {
 *
 * Verifies that:
 * - startProgramListUpdates either succeeds or returns NOT_SUPPORTED;
 * - the complete list is fetched within kProgramListScanTimeoutSec;
 * - the complete list is fetched within kProgramListScanTimeoutMs;
 * - stopProgramListUpdates does not crash.
 */
TEST_P(BroadcastRadioHalTest, GetProgramListFromEmptyFilter) {
@@ -969,7 +1061,7 @@ TEST_P(BroadcastRadioHalTest, GetProgramListFromEmptyFilter) {
 *
 * Verifies that:
 * - startProgramListUpdates either succeeds or returns NOT_SUPPORTED;
 * - the complete list is fetched within kProgramListScanTimeoutSec;
 * - the complete list is fetched within kProgramListScanTimeoutMs;
 * - stopProgramListUpdates does not crash;
 * - result for startProgramListUpdates using a filter with AMFM_FREQUENCY_KHZ value of the first
 *   AMFM program matches the expected result.
@@ -1017,7 +1109,7 @@ TEST_P(BroadcastRadioHalTest, GetProgramListFromAmFmFilter) {
 *
 * Verifies that:
 * - startProgramListUpdates either succeeds or returns NOT_SUPPORTED;
 * - the complete list is fetched within kProgramListScanTimeoutSec;
 * - the complete list is fetched within kProgramListScanTimeoutMs;
 * - stopProgramListUpdates does not crash;
 * - result for startProgramListUpdates using a filter with DAB_ENSEMBLE value of the first DAB
 *   program matches the expected result.
+5 −0
Original line number Diff line number Diff line
@@ -552,6 +552,11 @@ TEST_P(CameraAidlTest, configureStreamsAvailableOutputs) {
            stream.rotation = StreamRotation::ROTATION_0;
            stream.dynamicRangeProfile = RequestAvailableDynamicRangeProfilesMap::
                    ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD;
            stream.useCase = ScalerAvailableStreamUseCases::
                    ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_DEFAULT;
            stream.colorSpace = static_cast<int>(
                    RequestAvailableColorSpaceProfilesMap::
                            ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_UNSPECIFIED);

            std::vector<Stream> streams = {stream};
            StreamConfiguration config;
+61 −45
Original line number Diff line number Diff line
@@ -45,8 +45,6 @@ using ::aidl::android::hardware::camera::common::TorchModeStatus;
using ::aidl::android::hardware::camera::device::CameraMetadata;
using ::aidl::android::hardware::camera::device::ICameraDevice;
using ::aidl::android::hardware::camera::metadata::CameraMetadataTag;
using ::aidl::android::hardware::camera::metadata::RequestAvailableColorSpaceProfilesMap;
using ::aidl::android::hardware::camera::metadata::RequestAvailableDynamicRangeProfilesMap;
using ::aidl::android::hardware::camera::metadata::SensorInfoColorFilterArrangement;
using ::aidl::android::hardware::camera::metadata::SensorPixelMode;
using ::aidl::android::hardware::camera::provider::BnCameraProviderCallback;
@@ -122,7 +120,7 @@ void CameraAidlTest::SetUp() {
    ABinderProcess_startThreadPool();

    SpAIBinder cameraProviderBinder =
            SpAIBinder(AServiceManager_getService(serviceDescriptor.c_str()));
            SpAIBinder(AServiceManager_waitForService(serviceDescriptor.c_str()));
    ASSERT_NE(cameraProviderBinder.get(), nullptr);

    std::shared_ptr<ICameraProvider> cameraProvider =
@@ -2321,7 +2319,8 @@ void CameraAidlTest::configureStreamUseCaseInternal(const AvailableStream &thres
        }

        std::vector<Stream> streams(1);
        streams[0] = {0,
        streams[0] = {
                0,
                StreamType::OUTPUT,
                outputPreviewStreams[0].width,
                outputPreviewStreams[0].height,
@@ -2335,7 +2334,11 @@ void CameraAidlTest::configureStreamUseCaseInternal(const AvailableStream &thres
                -1,
                {SensorPixelMode::ANDROID_SENSOR_PIXEL_MODE_DEFAULT},
                RequestAvailableDynamicRangeProfilesMap::
                              ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD};
                        ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD,
                ScalerAvailableStreamUseCases::ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_DEFAULT,
                static_cast<int>(
                        RequestAvailableColorSpaceProfilesMap::
                                ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_UNSPECIFIED)};

        int32_t streamConfigCounter = 0;
        CameraMetadata req;
@@ -2479,7 +2482,11 @@ void CameraAidlTest::configureSingleStream(
                  /*groupId*/ -1,
                  {SensorPixelMode::ANDROID_SENSOR_PIXEL_MODE_DEFAULT},
                  RequestAvailableDynamicRangeProfilesMap::
                          ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD};
                          ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD,
                  ScalerAvailableStreamUseCases::ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_DEFAULT,
                  static_cast<int>(
                          RequestAvailableColorSpaceProfilesMap::
                                  ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_UNSPECIFIED)};

    StreamConfiguration config;
    config.streams = streams;
@@ -2810,7 +2817,8 @@ void CameraAidlTest::configurePreviewStreams(
    std::vector<Stream> streams(physicalIds.size());
    int32_t streamId = 0;
    for (auto const& physicalId : physicalIds) {
        streams[streamId] = {streamId,
        streams[streamId] = {
                streamId,
                StreamType::OUTPUT,
                outputPreviewStreams[0].width,
                outputPreviewStreams[0].height,
@@ -2824,7 +2832,11 @@ void CameraAidlTest::configurePreviewStreams(
                -1,
                {SensorPixelMode::ANDROID_SENSOR_PIXEL_MODE_DEFAULT},
                RequestAvailableDynamicRangeProfilesMap::
                                     ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD};
                        ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD,
                ScalerAvailableStreamUseCases::ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_DEFAULT,
                static_cast<int>(
                        RequestAvailableColorSpaceProfilesMap::
                                ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_UNSPECIFIED)};
        streamId++;
    }

@@ -2883,7 +2895,8 @@ void CameraAidlTest::configureStreams(const std::string& name,
                                      bool* supportsPartialResults, int32_t* partialResultCount,
                                      bool* useHalBufManager, std::shared_ptr<DeviceCb>* outCb,
                                      uint32_t streamConfigCounter, bool maxResolution,
                                      RequestAvailableDynamicRangeProfilesMap prof) {
                                      RequestAvailableDynamicRangeProfilesMap dynamicRangeProf,
                                      RequestAvailableColorSpaceProfilesMap colorSpaceProf) {
    ASSERT_NE(nullptr, session);
    ASSERT_NE(nullptr, halStreams);
    ASSERT_NE(nullptr, previewStream);
@@ -2965,7 +2978,9 @@ void CameraAidlTest::configureStreams(const std::string& name,
                  -1,
                  {maxResolution ? SensorPixelMode::ANDROID_SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION
                                 : SensorPixelMode::ANDROID_SENSOR_PIXEL_MODE_DEFAULT},
                  prof};
                  dynamicRangeProf,
                  ScalerAvailableStreamUseCases::ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_DEFAULT,
                  static_cast<int>(colorSpaceProf)};

    StreamConfiguration config;
    config.streams = streams;
@@ -3416,7 +3431,11 @@ void CameraAidlTest::configureOfflineStillStream(
                  /*groupId*/ 0,
                  {SensorPixelMode::ANDROID_SENSOR_PIXEL_MODE_DEFAULT},
                  RequestAvailableDynamicRangeProfilesMap::
                          ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD};
                          ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD,
                  ScalerAvailableStreamUseCases::ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_DEFAULT,
                  static_cast<int>(
                          RequestAvailableColorSpaceProfilesMap::
                                  ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_UNSPECIFIED)};

    StreamConfiguration config = {streams, StreamConfigurationMode::NORMAL_MODE, CameraMetadata()};

@@ -3531,15 +3550,12 @@ void CameraAidlTest::processColorSpaceRequest(
        Stream previewStream;
        std::shared_ptr<DeviceCb> cb;

        previewStream.usage =
            static_cast<aidl::android::hardware::graphics::common::BufferUsage>(
        previewStream.usage = static_cast<aidl::android::hardware::graphics::common::BufferUsage>(
                GRALLOC1_CONSUMER_USAGE_HWCOMPOSER);
        previewStream.dataSpace = getDataspace(PixelFormat::IMPLEMENTATION_DEFINED);
        previewStream.colorSpace = static_cast<int32_t>(colorSpace);
        configureStreams(name, mProvider, PixelFormat::IMPLEMENTATION_DEFINED, &mSession,
                            &previewStream, &halStreams, &supportsPartialResults,
                            &partialResultCount, &useHalBufManager, &cb, 0,
                            /*maxResolution*/ false, dynamicRangeProfile);
                         &previewStream, &halStreams, &supportsPartialResults, &partialResultCount,
                         &useHalBufManager, &cb, 0,
                         /*maxResolution*/ false, dynamicRangeProfile, colorSpace);
        ASSERT_NE(mSession, nullptr);

        ::aidl::android::hardware::common::fmq::MQDescriptor<
+17 −21

File changed.

Preview size limit exceeded, changes collapsed.

+0 −1
Original line number Diff line number Diff line
@@ -54,7 +54,6 @@ cc_test {
        "libgui",
        "libhidlbase",
        "libprocessgroup",
        "libtinyxml2",
        "android.hardware.graphics.mapper@2.0",
        "android.hardware.graphics.mapper@2.1",
        "android.hardware.graphics.mapper@3.0",
Loading