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

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

Snap for 6622447 from 4eb6ec36 to mainline-release

Change-Id: If350b8e2926cfe6ac04e22394eb016ecde04bedc
parents 12a107af 4eb6ec36
Loading
Loading
Loading
Loading
+50 −0
Original line number Diff line number Diff line
@@ -661,6 +661,56 @@ TEST_P(GraphicsMapperHidlTest, Lock_YCRCB_420_SP) {
    ASSERT_NO_FATAL_FAILURE(fence.reset(mGralloc->unlock(bufferHandle)));
}

TEST_P(GraphicsMapperHidlTest, YV12SubsampleMetadata) {
    auto info = mDummyDescriptorInfo;
    info.format = PixelFormat::YV12;

    const native_handle_t* bufferHandle;
    uint32_t stride;
    ASSERT_NO_FATAL_FAILURE(
            bufferHandle = mGralloc->allocate(info, true, Tolerance::kToleranceStrict, &stride));

    const IMapper::Rect region{0, 0, static_cast<int32_t>(info.width),
                               static_cast<int32_t>(info.height)};
    unique_fd fence;
    ASSERT_NO_FATAL_FAILURE(mGralloc->lock(bufferHandle, info.usage, region, fence.release()));

    hidl_vec<uint8_t> vec;
    ASSERT_EQ(Error::NONE, mGralloc->get(bufferHandle, gralloc4::MetadataType_PlaneLayouts, &vec));
    std::vector<PlaneLayout> planeLayouts;
    ASSERT_EQ(NO_ERROR, gralloc4::decodePlaneLayouts(vec, &planeLayouts));

    ASSERT_EQ(3, planeLayouts.size());

    auto yPlane = planeLayouts[0];
    auto crPlane = planeLayouts[1];
    auto cbPlane = planeLayouts[2];

    constexpr uint32_t kCbCrSubSampleFactor = 2;
    EXPECT_EQ(kCbCrSubSampleFactor, crPlane.horizontalSubsampling);
    EXPECT_EQ(kCbCrSubSampleFactor, crPlane.verticalSubsampling);

    EXPECT_EQ(kCbCrSubSampleFactor, cbPlane.horizontalSubsampling);
    EXPECT_EQ(kCbCrSubSampleFactor, cbPlane.verticalSubsampling);

    const long chromaSampleWidth = info.width / kCbCrSubSampleFactor;
    const long chromaSampleHeight = info.height / kCbCrSubSampleFactor;

    EXPECT_EQ(info.width, yPlane.widthInSamples);
    EXPECT_EQ(info.height, yPlane.heightInSamples);

    EXPECT_EQ(chromaSampleWidth, crPlane.widthInSamples);
    EXPECT_EQ(chromaSampleHeight, crPlane.heightInSamples);

    EXPECT_EQ(chromaSampleWidth, cbPlane.widthInSamples);
    EXPECT_EQ(chromaSampleHeight, cbPlane.heightInSamples);

    EXPECT_LE(crPlane.widthInSamples, crPlane.strideInBytes);
    EXPECT_LE(cbPlane.widthInSamples, cbPlane.strideInBytes);

    ASSERT_NO_FATAL_FAILURE(fence.reset(mGralloc->unlock(bufferHandle)));
}

TEST_P(GraphicsMapperHidlTest, Lock_YV12) {
    auto info = mDummyDescriptorInfo;
    info.format = PixelFormat::YV12;
+7 −0
Original line number Diff line number Diff line
Many of the tests in this directory may require that TEE Keymaster
"EARLY_BOOT_ONLY" keys be usable when this test runs. In order to accomplish
this, a build of "vold" that omits the call to "earlyBootEnded()" function
should be made. Then these DISABLED tests may be run successfully.

The CTS test ResumeOnRebootHostTests will test the functionality without a
special build.
+22 −4
Original line number Diff line number Diff line
@@ -60,7 +60,10 @@ class RebootEscrowAidlTest : public testing::TestWithParam<std::string> {
    };
};

TEST_P(RebootEscrowAidlTest, StoreAndRetrieve_Success) {
// This test assumes that it can retrieve keys immediately, but some
// implementations use the TEE's EARLY_BOOT_ONLY keys. This means that the
// earlyBootEnded() calls will need to be disabled to test this correctly.
TEST_P(RebootEscrowAidlTest, DISABLED_StoreAndRetrieve_Success) {
    SKIP_UNSUPPORTED;

    ASSERT_TRUE(rebootescrow->storeKey(KEY_1).isOk());
@@ -70,7 +73,10 @@ TEST_P(RebootEscrowAidlTest, StoreAndRetrieve_Success) {
    EXPECT_EQ(actualKey, KEY_1);
}

TEST_P(RebootEscrowAidlTest, StoreAndRetrieve_SecondRetrieveSucceeds) {
// This test assumes that it can retrieve keys immediately, but some
// implementations use the TEE's EARLY_BOOT_ONLY keys. This means that the
// earlyBootEnded() calls will need to be disabled to test this correctly.
TEST_P(RebootEscrowAidlTest, DISABLED_StoreAndRetrieve_SecondRetrieveSucceeds) {
    SKIP_UNSUPPORTED;

    ASSERT_TRUE(rebootescrow->storeKey(KEY_1).isOk());
@@ -83,7 +89,10 @@ TEST_P(RebootEscrowAidlTest, StoreAndRetrieve_SecondRetrieveSucceeds) {
    EXPECT_EQ(actualKey, KEY_1);
}

TEST_P(RebootEscrowAidlTest, StoreTwiceOverwrites_Success) {
// This test assumes that it can retrieve keys immediately, but some
// implementations use the TEE's EARLY_BOOT_ONLY keys. This means that the
// earlyBootEnded() calls will need to be disabled to test this correctly.
TEST_P(RebootEscrowAidlTest, DISABLED_StoreTwiceOverwrites_Success) {
    SKIP_UNSUPPORTED;

    ASSERT_TRUE(rebootescrow->storeKey(KEY_1).isOk());
@@ -94,7 +103,10 @@ TEST_P(RebootEscrowAidlTest, StoreTwiceOverwrites_Success) {
    EXPECT_EQ(actualKey, KEY_2);
}

TEST_P(RebootEscrowAidlTest, StoreEmpty_AfterGetEmptyKey_Success) {
// This test assumes that it can retrieve keys immediately, but some
// implementations use the TEE's EARLY_BOOT_ONLY keys. This means that the
// earlyBootEnded() calls will need to be disabled to test this correctly.
TEST_P(RebootEscrowAidlTest, DISABLED_StoreEmpty_AfterGetEmptyKey_Success) {
    SKIP_UNSUPPORTED;

    rebootescrow->storeKey(KEY_1);
@@ -105,6 +117,12 @@ TEST_P(RebootEscrowAidlTest, StoreEmpty_AfterGetEmptyKey_Success) {
    EXPECT_EQ(actualKey, EMPTY_KEY);
}

TEST_P(RebootEscrowAidlTest, Store_Success) {
    SKIP_UNSUPPORTED;

    rebootescrow->storeKey(KEY_1);
}

INSTANTIATE_TEST_SUITE_P(
        RebootEscrow, RebootEscrowAidlTest,
        testing::ValuesIn(android::getAidlHalInstanceNames(IRebootEscrow::descriptor)),