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

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

Snap for 7343210 from 58adb0a2 to sc-v2-release

Change-Id: Ic99d6ca1a5457513a1e7b353dc7810919167e794
parents d4672873 58adb0a2
Loading
Loading
Loading
Loading
+17 −10
Original line number Diff line number Diff line
@@ -7155,18 +7155,25 @@ void CameraHidlTest::castDevice(const sp<device::V3_2::ICameraDevice>& device,
                                sp<device::V3_5::ICameraDevice>* device3_5 /*out*/,
                                sp<device::V3_7::ICameraDevice>* device3_7 /*out*/) {
    ASSERT_NE(nullptr, device3_5);
    if (deviceVersion == CAMERA_DEVICE_API_VERSION_3_5) {
        auto castResult = device::V3_5::ICameraDevice::castFrom(device);
        ASSERT_TRUE(castResult.isOk());
        *device3_5 = castResult;
    }

    ASSERT_NE(nullptr, device3_7);
    if (deviceVersion == CAMERA_DEVICE_API_VERSION_3_7) {

    switch (deviceVersion) {
        case CAMERA_DEVICE_API_VERSION_3_7: {
            auto castResult = device::V3_7::ICameraDevice::castFrom(device);
            ASSERT_TRUE(castResult.isOk());
            *device3_7 = castResult;
        }
            [[fallthrough]];
        case CAMERA_DEVICE_API_VERSION_3_5: {
            auto castResult = device::V3_5::ICameraDevice::castFrom(device);
            ASSERT_TRUE(castResult.isOk());
            *device3_5 = castResult;
            break;
        }
        default:
            // no-op
            return;
    }
}

//Cast camera provider to corresponding version if available
+14 −12
Original line number Diff line number Diff line
@@ -505,10 +505,10 @@ enum Tag {

    /**
     * Tag::APPLICATION_ID.  When provided to generateKey or importKey, this tag specifies data
     * that is necessary during all uses of the key.  In particular, calls to exportKey() must
     * provide the same value to the clientId parameter, and calls to begin() must provide this
     * tag and the same associated data as part of the inParams set.  If the correct data is not
     * provided, the method must return ErrorCode::INVALID_KEY_BLOB.
     * that is necessary during all uses of the key.  In particular, calls to exportKey() and
     * getKeyCharacteristics() must provide the same value to the clientId parameter, and calls to
     * begin() must provide this tag and the same associated data as part of the inParams set.  If
     * the correct data is not provided, the method must return ErrorCode::INVALID_KEY_BLOB.
     *
     * The content of this tag must be bound to the key cryptographically, meaning it must not be
     * possible for an adversary who has access to all of the secure world secrets but does not have
@@ -573,8 +573,8 @@ enum Tag {
     * Tag::OS_VERSION specifies the system OS version with which the key may be used.  This tag is
     * never sent to the IKeyMintDevice, but is added to the hardware-enforced authorization list
     * by the TA.  Any attempt to use a key with a Tag::OS_VERSION value different from the
     * currently-running OS version must cause begin() or exportKey() to return
     * ErrorCode::KEY_REQUIRES_UPGRADE.  See upgradeKey() for details.
     * currently-running OS version must cause begin(), getKeyCharacteristics() or exportKey() to
     * return ErrorCode::KEY_REQUIRES_UPGRADE.  See upgradeKey() for details.
     *
     * The value of the tag is an integer of the form MMmmss, where MM is the major version number,
     * mm is the minor version number, and ss is the sub-minor version number.  For example, for a
@@ -596,8 +596,9 @@ enum Tag {
     * Tag::OS_PATCHLEVEL specifies the system security patch level with which the key may be used.
     * This tag is never sent to the keyMint TA, but is added to the hardware-enforced
     * authorization list by the TA.  Any attempt to use a key with a Tag::OS_PATCHLEVEL value
     * different from the currently-running system patchlevel must cause begin() or
     * exportKey() to return ErrorCode::KEY_REQUIRES_UPGRADE.  See upgradeKey() for details.
     * different from the currently-running system patchlevel must cause begin(),
     * getKeyCharacteristics() or exportKey() to return ErrorCode::KEY_REQUIRES_UPGRADE.  See
     * upgradeKey() for details.
     *
     * The value of the tag is an integer of the form YYYYMM, where YYYY is the four-digit year of
     * the last update and MM is the two-digit month of the last update.  For example, for a key
@@ -789,8 +790,9 @@ enum Tag {
     * Tag::VENDOR_PATCHLEVEL specifies the vendor image security patch level with which the key may
     * be used.  This tag is never sent to the keyMint TA, but is added to the hardware-enforced
     * authorization list by the TA.  Any attempt to use a key with a Tag::VENDOR_PATCHLEVEL value
     * different from the currently-running system patchlevel must cause begin() or
     * exportKey() to return ErrorCode::KEY_REQUIRES_UPGRADE.  See upgradeKey() for details.
     * different from the currently-running system patchlevel must cause begin(),
     * getKeyCharacteristics() or exportKey() to return ErrorCode::KEY_REQUIRES_UPGRADE.  See
     * upgradeKey() for details.
     *
     * The value of the tag is an integer of the form YYYYMMDD, where YYYY is the four-digit year of
     * the last update, MM is the two-digit month and DD is the two-digit day of the last
@@ -811,8 +813,8 @@ enum Tag {
     * key may be used.  This tag is never sent to the keyMint TA, but is added to the
     * hardware-enforced authorization list by the TA.  Any attempt to use a key with a
     * Tag::BOOT_PATCHLEVEL value different from the currently-running system patchlevel must
     * cause begin() or exportKey() to return ErrorCode::KEY_REQUIRES_UPGRADE.  See upgradeKey() for
     * details.
     * cause begin(), getKeyCharacteristics() or exportKey() to return
     * ErrorCode::KEY_REQUIRES_UPGRADE.  See upgradeKey() for details.
     *
     * The value of the tag is an integer of the form YYYYMMDD, where YYYY is the four-digit year of
     * the last update, MM is the two-digit month and DD is the two-digit day of the last
+43 −3
Original line number Diff line number Diff line
@@ -654,7 +654,8 @@ TEST_P(NewKeyGenerationTest, AesInvalidPadding) {
                    }
                    auto result = Begin(KeyPurpose::ENCRYPT, params);
                    EXPECT_TRUE(result == ErrorCode::INCOMPATIBLE_PADDING_MODE ||
                                result == ErrorCode::INVALID_KEY_BLOB);
                                result == ErrorCode::INVALID_KEY_BLOB)
                            << "unexpected result: " << result;
                } else {
                    // The KeyMint implementation detected that the generated key
                    // is unusable.
@@ -3263,6 +3264,7 @@ TEST_P(ImportKeyTest, AesFailure) {
    string key = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
    uint32_t bitlen = key.size() * 8;
    for (uint32_t key_size : {bitlen - 1, bitlen + 1, bitlen - 8, bitlen + 8}) {
        // Explicit key size doesn't match that of the provided key.
        auto result = ImportKey(AuthorizationSetBuilder()
                                    .Authorization(TAG_NO_AUTH_REQUIRED)
                                    .AesEncryptionKey(key_size)
@@ -3270,8 +3272,27 @@ TEST_P(ImportKeyTest, AesFailure) {
                                    .Padding(PaddingMode::PKCS7),
                                KeyFormat::RAW, key);
        ASSERT_TRUE(result == ErrorCode::IMPORT_PARAMETER_MISMATCH ||
                    result == ErrorCode::UNSUPPORTED_KEY_SIZE);
                    result == ErrorCode::UNSUPPORTED_KEY_SIZE)
                << "unexpected result: " << result;
    }

    // Explicit key size matches that of the provided key, but it's not a valid size.
    string long_key = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
    ASSERT_EQ(ErrorCode::UNSUPPORTED_KEY_SIZE,
              ImportKey(AuthorizationSetBuilder()
                                .Authorization(TAG_NO_AUTH_REQUIRED)
                                .AesEncryptionKey(long_key.size() * 8)
                                .EcbMode()
                                .Padding(PaddingMode::PKCS7),
                        KeyFormat::RAW, long_key));
    string short_key = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
    ASSERT_EQ(ErrorCode::UNSUPPORTED_KEY_SIZE,
              ImportKey(AuthorizationSetBuilder()
                                .Authorization(TAG_NO_AUTH_REQUIRED)
                                .AesEncryptionKey(short_key.size() * 8)
                                .EcbMode()
                                .Padding(PaddingMode::PKCS7),
                        KeyFormat::RAW, short_key));
}

/*
@@ -3310,6 +3331,7 @@ TEST_P(ImportKeyTest, TripleDesFailure) {
    string key = hex2str("a49d7564199e97cb529d2c9d97bf2f98d35edf57ba1f7358");
    uint32_t bitlen = key.size() * 8;
    for (uint32_t key_size : {bitlen - 1, bitlen + 1, bitlen - 8, bitlen + 8}) {
        // Explicit key size doesn't match that of the provided key.
        auto result = ImportKey(AuthorizationSetBuilder()
                                    .Authorization(TAG_NO_AUTH_REQUIRED)
                                    .TripleDesEncryptionKey(key_size)
@@ -3317,8 +3339,26 @@ TEST_P(ImportKeyTest, TripleDesFailure) {
                                    .Padding(PaddingMode::PKCS7),
                                KeyFormat::RAW, key);
        ASSERT_TRUE(result == ErrorCode::IMPORT_PARAMETER_MISMATCH ||
                    result == ErrorCode::UNSUPPORTED_KEY_SIZE);
                    result == ErrorCode::UNSUPPORTED_KEY_SIZE)
                << "unexpected result: " << result;
    }
    // Explicit key size matches that of the provided key, but it's not a valid size.
    string long_key = hex2str("a49d7564199e97cb529d2c9d97bf2f98d35edf57ba1f7358");
    ASSERT_EQ(ErrorCode::UNSUPPORTED_KEY_SIZE,
              ImportKey(AuthorizationSetBuilder()
                                .Authorization(TAG_NO_AUTH_REQUIRED)
                                .TripleDesEncryptionKey(long_key.size() * 8)
                                .EcbMode()
                                .Padding(PaddingMode::PKCS7),
                        KeyFormat::RAW, long_key));
    string short_key = hex2str("a49d7564199e97cb529d2c9d97bf2f98d35edf57ba1f7358");
    ASSERT_EQ(ErrorCode::UNSUPPORTED_KEY_SIZE,
              ImportKey(AuthorizationSetBuilder()
                                .Authorization(TAG_NO_AUTH_REQUIRED)
                                .TripleDesEncryptionKey(short_key.size() * 8)
                                .EcbMode()
                                .Padding(PaddingMode::PKCS7),
                        KeyFormat::RAW, short_key));
}

/*
+9 −3
Original line number Diff line number Diff line
@@ -276,7 +276,9 @@ TEST_P(VibratorAidl, ValidateEffectWithCallback) {
            if (!status.isOk())
                continue;

            std::chrono::milliseconds timeout{lengthMs * 2};
            //TODO(b/187207798): revert back to conservative timeout values once
            //latencies have been fixed
            std::chrono::milliseconds timeout{lengthMs * 8};
            EXPECT_EQ(completionFuture.wait_for(timeout), std::future_status::ready);
        }
    }
@@ -588,7 +590,9 @@ TEST_P(VibratorAidl, ComposeCallback) {
            EXPECT_EQ(Status::EX_NONE, vibrator->compose(composite, callback).exceptionCode())
                << toString(primitive);

            EXPECT_EQ(completionFuture.wait_for(duration * 2), std::future_status::ready)
            //TODO(b/187207798): revert back to conservative timeout values once
            //latencies have been fixed
            EXPECT_EQ(completionFuture.wait_for(duration * 4), std::future_status::ready)
                << toString(primitive);
            end = high_resolution_clock::now();

@@ -739,7 +743,9 @@ TEST_P(VibratorAidl, ComposeValidPwleWithCallback) {
    sp<CompletionCallback> callback =
        new CompletionCallback([&completionPromise] { completionPromise.set_value(); });
    uint32_t durationMs = 2100;  // Sum of 2 active and 1 braking below
    std::chrono::milliseconds timeout{durationMs * 2};
    //TODO(b/187207798): revert back to conservative timeout values once
    //latencies have been fixed
    std::chrono::milliseconds timeout{durationMs * 4};

    ActivePwle active = composeValidActivePwle(vibrator, capabilities);