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

Commit 000c0144 authored by Robert Shih's avatar Robert Shih Committed by Android (Google) Code Review
Browse files

Merge "Add multiple provision attempts in vts openSession test" into tm-dev

parents 694e50be f782f643
Loading
Loading
Loading
Loading
+14 −3
Original line number Diff line number Diff line
@@ -73,6 +73,7 @@ std::string HalBaseName(const std::string& fullname) {
}

const char* kDrmIface = "android.hardware.drm.IDrmFactory";
const int MAX_OPEN_SESSION_ATTEMPTS = 3;

std::string HalFullName(const std::string& iface, const std::string& basename) {
    return iface + '/' + basename;
@@ -328,9 +329,19 @@ SessionId DrmHalTest::openSession(SecurityLevel level, Status* err) {
 */
SessionId DrmHalTest::openSession() {
    SessionId sessionId;

    int attmpt = 0;
    while (attmpt++ < MAX_OPEN_SESSION_ATTEMPTS) {
        auto ret = drmPlugin->openSession(SecurityLevel::DEFAULT, &sessionId);
        if(DrmErr(ret) == Status::ERROR_DRM_NOT_PROVISIONED) {
            provision();
        } else {
            EXPECT_OK(ret);
            EXPECT_NE(0u, sessionId.size());
            break;
        }
    }

    return sessionId;
}