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

Commit e4702cc8 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 5736565 from 954f4fef to qt-c2f2-release

Change-Id: Ida99791ab641a0a744aed4f89c99501a42eb5284
parents 12297563 954f4fef
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -59,6 +59,11 @@ TEST_F(GnssHalTest, TestGnssMeasurementCallback) {
 * each received location.
 */
TEST_F(GnssHalTest, GetLocationLowPower) {
    if (!IsGnssHalVersion_1_1()) {
        ALOGI("Test GetLocationLowPower skipped. GNSS HAL version is greater than 1.1.");
        return;
    }

    const int kMinIntervalMsec = 5000;
    const int kLocationTimeoutSubsequentSec = (kMinIntervalMsec / 1000) * 2;
    const int kNoLocationPeriodSec = (kMinIntervalMsec / 1000) / 2;
+67 −0
Original line number Diff line number Diff line
@@ -415,6 +415,70 @@ TEST_F(GnssHalTest, TestGnssBatchingExtension) {
    ASSERT_TRUE(gnssBatching_2_0.isOk());
}

/*
 * GetLocationLowPower:
 * Turns on location, waits for at least 5 locations allowing max of LOCATION_TIMEOUT_SUBSEQUENT_SEC
 * between one location and the next. Also ensure that MIN_INTERVAL_MSEC is respected by waiting
 * NO_LOCATION_PERIOD_SEC and verfiy that no location is received. Also perform validity checks on
 * each received location.
 */
TEST_F(GnssHalTest, GetLocationLowPower) {
    if (!(gnss_cb_->last_capabilities_ & IGnssCallback::Capabilities::LOW_POWER_MODE)) {
        ALOGI("Test GetLocationLowPower skipped. LOW_POWER_MODE capability not supported.");
        return;
    }

    const int kMinIntervalMsec = 5000;
    const int kLocationTimeoutSubsequentSec = (kMinIntervalMsec / 1000) * 2;
    const int kNoLocationPeriodSec = (kMinIntervalMsec / 1000) / 2;
    const int kLocationsToCheck = 5;
    const bool kLowPowerMode = true;

    // Warmup period - VTS doesn't have AGPS access via GnssLocationProvider
    gnss_cb_->location_cbq_.reset();
    StartAndCheckLocations(kLocationsToCheck);
    StopAndClearLocations();
    gnss_cb_->location_cbq_.reset();

    // Start of Low Power Mode test
    SetPositionMode(kMinIntervalMsec, kLowPowerMode);

    // Don't expect true - as without AGPS access
    if (!StartAndCheckFirstLocation()) {
        ALOGW("GetLocationLowPower test - no first low power location received.");
    }

    for (int i = 1; i < kLocationsToCheck; i++) {
        // Verify that kMinIntervalMsec is respected by waiting kNoLocationPeriodSec and
        // ensure that no location is received yet

        gnss_cb_->location_cbq_.retrieve(gnss_cb_->last_location_, kNoLocationPeriodSec);
        const int locationCalledCount = gnss_cb_->location_cbq_.calledCount();

        // Tolerate (ignore) one extra location right after the first one
        // to handle startup edge case scheduling limitations in some implementations
        if ((i == 1) && (locationCalledCount == 2)) {
            CheckLocation(gnss_cb_->last_location_, true);
            continue;  // restart the quiet wait period after this too-fast location
        }
        EXPECT_LE(locationCalledCount, i);
        if (locationCalledCount != i) {
            ALOGW("GetLocationLowPower test - not enough locations received. %d vs. %d expected ",
                  locationCalledCount, i);
        }

        if (!gnss_cb_->location_cbq_.retrieve(
                    gnss_cb_->last_location_,
                    kLocationTimeoutSubsequentSec - kNoLocationPeriodSec)) {
            ALOGW("GetLocationLowPower test - timeout awaiting location %d", i);
        } else {
            CheckLocation(gnss_cb_->last_location_, true);
        }
    }

    StopAndClearLocations();
}

/*
 * MapConstellationType:
 * Given a GnssConstellationType_2_0 type constellation, maps to its equivalent
@@ -537,6 +601,8 @@ IGnssConfiguration_1_1::BlacklistedSource FindStrongFrequentNonGpsSource(
 */
TEST_F(GnssHalTest, BlacklistIndividualSatellites) {
    if (!(gnss_cb_->last_capabilities_ & IGnssCallback::Capabilities::SATELLITE_BLACKLIST)) {
        ALOGI("Test BlacklistIndividualSatellites skipped. SATELLITE_BLACKLIST capability"
              " not supported.");
        return;
    }

@@ -680,6 +746,7 @@ TEST_F(GnssHalTest, BlacklistIndividualSatellites) {
 */
TEST_F(GnssHalTest, BlacklistConstellation) {
    if (!(gnss_cb_->last_capabilities_ & IGnssCallback::Capabilities::SATELLITE_BLACKLIST)) {
        ALOGI("Test BlacklistConstellation skipped. SATELLITE_BLACKLIST capability not supported.");
        return;
    }

+1 −1
Original line number Diff line number Diff line
@@ -790,7 +790,7 @@ TEST_F(GraphicsComposerHidlCommandTest, PRESENT_DISPLAY) {
TEST_F(GraphicsComposerHidlCommandTest, PRESENT_DISPLAY_NO_LAYER_STATE_CHANGES) {
    mWriter->selectDisplay(mPrimaryDisplay);
    mComposerClient->setPowerMode(mPrimaryDisplay, IComposerClient::PowerMode::ON);
    mComposerClient->setColorMode(mPrimaryDisplay, ColorMode::SRGB);
    mComposerClient->setColorMode(mPrimaryDisplay, ColorMode::NATIVE);

    auto handle = allocate();
    ASSERT_NE(nullptr, handle);
+53 −33
Original line number Diff line number Diff line
@@ -182,6 +182,14 @@ class GraphicsComposerReadbackTest : public ::testing::VtsHalHidlTargetTestBase
        mReader = std::make_unique<TestCommandReader>();
        mGralloc = std::make_shared<Gralloc>();

        std::vector<ColorMode> colorModes = mComposerClient->getColorModes(mPrimaryDisplay);
        if (std::find(colorModes.begin(), colorModes.end(), ColorMode::SRGB) == colorModes.end()) {
            mHasReadbackBuffer = false;
            return;
        }
        mWriter->selectDisplay(mPrimaryDisplay);
        ASSERT_NO_FATAL_FAILURE(mComposerClient->setColorMode(mPrimaryDisplay, ColorMode::SRGB,
                                                              RenderIntent::COLORIMETRIC));
        mComposerClient->getRaw()->getReadbackBufferAttributes(
            mPrimaryDisplay,
            [&](const auto& tmpError, const auto& tmpPixelFormat, const auto& tmpDataspace) {
@@ -471,12 +479,12 @@ class TestBufferLayer : public TestLayer {

TEST_F(GraphicsComposerReadbackTest, SingleSolidColorLayer) {
    if (!mHasReadbackBuffer) {
        std::cout << "Readback not supported or unsuppported pixelFormat/dataspace or SRGB not a "
                     "valid color mode"
                  << std::endl;
        GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
        return;
    }
    mWriter->selectDisplay(mPrimaryDisplay);
    ASSERT_NO_FATAL_FAILURE(mComposerClient->setColorMode(mPrimaryDisplay, ColorMode::SRGB,
                                                          RenderIntent::COLORIMETRIC));

    auto layer = std::make_shared<TestColorLayer>(mComposerClient, mPrimaryDisplay);
    IComposerClient::Rect coloredSquare({0, 0, mDisplayWidth, mDisplayHeight});
@@ -515,12 +523,13 @@ TEST_F(GraphicsComposerReadbackTest, SingleSolidColorLayer) {

TEST_F(GraphicsComposerReadbackTest, SetLayerBuffer) {
    if (!mHasReadbackBuffer) {
        std::cout << "Readback not supported or unsuppported pixelFormat/dataspace or SRGB not a "
                     "valid color mode"
                  << std::endl;
        GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
        return;
    }

    mWriter->selectDisplay(mPrimaryDisplay);

    ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mGralloc, mDisplayWidth,
                                  mDisplayHeight, mPixelFormat, mDataspace);
    ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
@@ -562,13 +571,13 @@ TEST_F(GraphicsComposerReadbackTest, SetLayerBuffer) {

TEST_F(GraphicsComposerReadbackTest, SetLayerBufferNoEffect) {
    if (!mHasReadbackBuffer) {
        std::cout << "Readback not supported or unsuppported pixelFormat/dataspace or SRGB not a "
                     "valid color mode"
                  << std::endl;
        GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
        return;
    }

    mWriter->selectDisplay(mPrimaryDisplay);
    ASSERT_NO_FATAL_FAILURE(mComposerClient->setColorMode(mPrimaryDisplay, ColorMode::SRGB,
                                                          RenderIntent::COLORIMETRIC));

    auto layer = std::make_shared<TestColorLayer>(mComposerClient, mPrimaryDisplay);
    IComposerClient::Rect coloredSquare({0, 0, mDisplayWidth, mDisplayHeight});
@@ -611,12 +620,13 @@ TEST_F(GraphicsComposerReadbackTest, SetLayerBufferNoEffect) {

TEST_F(GraphicsComposerReadbackTest, ClientComposition) {
    if (!mHasReadbackBuffer) {
        std::cout << "Readback not supported or unsuppported pixelFormat/dataspace or SRGB not a "
                     "valid color mode"
                  << std::endl;
        GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
        return;
    }

    mWriter->selectDisplay(mPrimaryDisplay);

    std::vector<IComposerClient::Color> expectedColors(mDisplayWidth * mDisplayHeight);
    fillColorsArea(expectedColors, mDisplayWidth, {0, 0, mDisplayWidth, mDisplayHeight / 4}, RED);
    fillColorsArea(expectedColors, mDisplayWidth,
@@ -690,11 +700,13 @@ TEST_F(GraphicsComposerReadbackTest, ClientComposition) {

TEST_F(GraphicsComposerReadbackTest, DeviceAndClientComposition) {
    if (!mHasReadbackBuffer) {
        std::cout << "Readback not supported or unsuppported pixelFormat/dataspace or SRGB not a "
                     "valid color mode"
                  << std::endl;
        GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
        return;
    }

    mWriter->selectDisplay(mPrimaryDisplay);
    ASSERT_NO_FATAL_FAILURE(
        mComposerClient->setClientTargetSlotCount(mPrimaryDisplay, kClientTargetSlotCount));

@@ -776,12 +788,13 @@ TEST_F(GraphicsComposerReadbackTest, DeviceAndClientComposition) {

TEST_F(GraphicsComposerReadbackTest, SetLayerDamage) {
    if (!mHasReadbackBuffer) {
        std::cout << "Readback not supported or unsuppported pixelFormat/dataspace or SRGB not a "
                     "valid color mode"
                  << std::endl;
        GTEST_SUCCEED() << "Readback not supported or unsupported pixelformat/dataspace";
        return;
    }

    mWriter->selectDisplay(mPrimaryDisplay);

    IComposerClient::Rect redRect = {0, 0, mDisplayWidth / 4, mDisplayHeight / 4};

    std::vector<IComposerClient::Color> expectedColors(mDisplayWidth * mDisplayHeight);
@@ -842,14 +855,13 @@ TEST_F(GraphicsComposerReadbackTest, SetLayerDamage) {

TEST_F(GraphicsComposerReadbackTest, SetLayerPlaneAlpha) {
    if (!mHasReadbackBuffer) {
        std::cout << "Readback not supported or unsuppported pixelFormat/dataspace or SRGB not a "
                     "valid color mode"
                  << std::endl;
        GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
        return;
    }

    mWriter->selectDisplay(mPrimaryDisplay);
    ASSERT_NO_FATAL_FAILURE(mComposerClient->setColorMode(mPrimaryDisplay, ColorMode::SRGB,
                                                          RenderIntent::COLORIMETRIC));

    auto layer = std::make_shared<TestColorLayer>(mComposerClient, mPrimaryDisplay);
    layer->setColor(RED);
    layer->setDisplayFrame({0, 0, mDisplayWidth, mDisplayHeight});
@@ -886,12 +898,13 @@ TEST_F(GraphicsComposerReadbackTest, SetLayerPlaneAlpha) {

TEST_F(GraphicsComposerReadbackTest, SetLayerSourceCrop) {
    if (!mHasReadbackBuffer) {
        std::cout << "Readback not supported or unsuppported pixelFormat/dataspace or SRGB not a "
                     "valid color mode"
                  << std::endl;
        GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
        return;
    }

    mWriter->selectDisplay(mPrimaryDisplay);

    std::vector<IComposerClient::Color> expectedColors(mDisplayWidth * mDisplayHeight);
    fillColorsArea(expectedColors, mDisplayWidth, {0, 0, mDisplayWidth, mDisplayHeight / 4}, RED);
    fillColorsArea(expectedColors, mDisplayWidth,
@@ -931,14 +944,13 @@ TEST_F(GraphicsComposerReadbackTest, SetLayerSourceCrop) {

TEST_F(GraphicsComposerReadbackTest, SetLayerZOrder) {
    if (!mHasReadbackBuffer) {
        std::cout << "Readback not supported or unsuppported pixelFormat/dataspace or SRGB not a "
                     "valid color mode"
                  << std::endl;
        GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
        return;
    }

    mWriter->selectDisplay(mPrimaryDisplay);
    ASSERT_NO_FATAL_FAILURE(mComposerClient->setColorMode(mPrimaryDisplay, ColorMode::SRGB,
                                                          RenderIntent::COLORIMETRIC));

    IComposerClient::Rect redRect = {0, 0, mDisplayWidth, mDisplayHeight / 2};
    IComposerClient::Rect blueRect = {0, mDisplayHeight / 4, mDisplayWidth, mDisplayHeight};
    auto redLayer = std::make_shared<TestColorLayer>(mComposerClient, mPrimaryDisplay);
@@ -1081,12 +1093,13 @@ class GraphicsComposerBlendModeReadbackTest : public GraphicsComposerReadbackTes

TEST_P(GraphicsComposerBlendModeReadbackTest, None) {
    if (!mHasReadbackBuffer) {
        std::cout << "Readback not supported or unsuppported pixelFormat/dataspace or SRGB not a "
                     "valid color mode"
                  << std::endl;
        GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
        return;
    }

    mWriter->selectDisplay(mPrimaryDisplay);

    std::vector<IComposerClient::Color> expectedColors(mDisplayWidth * mDisplayHeight);

    setBackgroundColor(BLACK);
@@ -1118,12 +1131,13 @@ TEST_P(GraphicsComposerBlendModeReadbackTest, None) {
// alpha of .2, expected 10.2
TEST_P(GraphicsComposerBlendModeReadbackTest, DISABLED_Coverage) {
    if (!mHasReadbackBuffer) {
        std::cout << "Readback not supported or unsuppported pixelFormat/dataspace or SRGB not a "
                     "valid color mode"
                  << std::endl;
        GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
        return;
    }

    mWriter->selectDisplay(mPrimaryDisplay);

    std::vector<IComposerClient::Color> expectedColors(mDisplayWidth * mDisplayHeight);

    setBackgroundColor(BLACK);
@@ -1153,12 +1167,13 @@ TEST_P(GraphicsComposerBlendModeReadbackTest, DISABLED_Coverage) {

TEST_P(GraphicsComposerBlendModeReadbackTest, Premultiplied) {
    if (!mHasReadbackBuffer) {
        std::cout << "Readback not supported or unsuppported pixelFormat/dataspace or SRGB not a "
                     "valid color mode"
                  << std::endl;
        GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
        return;
    }

    mWriter->selectDisplay(mPrimaryDisplay);

    std::vector<IComposerClient::Color> expectedColors(mDisplayWidth * mDisplayHeight);

    setBackgroundColor(BLACK);
@@ -1193,10 +1208,6 @@ class GraphicsComposerTransformReadbackTest : public GraphicsComposerReadbackTes
    void SetUp() override {
        GraphicsComposerReadbackTest::SetUp();

        mWriter->selectDisplay(mPrimaryDisplay);
        ASSERT_NO_FATAL_FAILURE(mComposerClient->setColorMode(mPrimaryDisplay, ColorMode::SRGB,
                                                              RenderIntent::COLORIMETRIC));

        auto backgroundLayer = std::make_shared<TestColorLayer>(mComposerClient, mPrimaryDisplay);
        backgroundLayer->setColor({0, 0, 0, 0});
        backgroundLayer->setDisplayFrame({0, 0, mDisplayWidth, mDisplayHeight});
@@ -1230,6 +1241,9 @@ class GraphicsComposerTransformReadbackTest : public GraphicsComposerReadbackTes

TEST_F(GraphicsComposerTransformReadbackTest, FLIP_H) {
    if (!mHasReadbackBuffer) {
        std::cout << "Readback not supported or unsuppported pixelFormat/dataspace or SRGB not a "
                     "valid color mode"
                  << std::endl;
        GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
        return;
    }
@@ -1262,6 +1276,9 @@ TEST_F(GraphicsComposerTransformReadbackTest, FLIP_H) {

TEST_F(GraphicsComposerTransformReadbackTest, FLIP_V) {
    if (!mHasReadbackBuffer) {
        std::cout << "Readback not supported or unsuppported pixelFormat/dataspace or SRGB not a "
                     "valid color mode"
                  << std::endl;
        GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
        return;
    }
@@ -1295,6 +1312,9 @@ TEST_F(GraphicsComposerTransformReadbackTest, FLIP_V) {

TEST_F(GraphicsComposerTransformReadbackTest, ROT_180) {
    if (!mHasReadbackBuffer) {
        std::cout << "Readback not supported or unsuppported pixelFormat/dataspace or SRGB not a "
                     "valid color mode"
                  << std::endl;
        GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
        return;
    }