Merge "Implement alternate SE RoT provisioning" into tm-dev
diff --git a/drm/aidl/vts/drm_hal_common.cpp b/drm/aidl/vts/drm_hal_common.cpp
index de7dc28..7de8167 100644
--- a/drm/aidl/vts/drm_hal_common.cpp
+++ b/drm/aidl/vts/drm_hal_common.cpp
@@ -73,6 +73,7 @@
 }
 
 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() {
     SessionId sessionId;
-    auto ret = drmPlugin->openSession(SecurityLevel::DEFAULT, &sessionId);
-    EXPECT_OK(ret);
-    EXPECT_NE(0u, sessionId.size());
+
+    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;
 }
 
diff --git a/graphics/allocator/aidl/vts/VtsHalGraphicsAllocatorAidl_TargetTest.cpp b/graphics/allocator/aidl/vts/VtsHalGraphicsAllocatorAidl_TargetTest.cpp
index c9d058d..59af5cf 100644
--- a/graphics/allocator/aidl/vts/VtsHalGraphicsAllocatorAidl_TargetTest.cpp
+++ b/graphics/allocator/aidl/vts/VtsHalGraphicsAllocatorAidl_TargetTest.cpp
@@ -153,7 +153,6 @@
             if (error == EX_SERVICE_SPECIFIC) {
                 error = status.getServiceSpecificError();
                 EXPECT_NE(OK, error) << "Failed to set error properly";
-                EXPECT_EQ(OK, error) << "Failed to allocate";
             } else {
                 EXPECT_EQ(OK, error) << "Allocation transport failure";
             }
@@ -278,6 +277,7 @@
     if (!supported) {
         ASSERT_EQ(nullptr, buffer.get())
                 << "Allocation succeeded, but IMapper::isSupported was false";
+        GTEST_SKIP();
     } else {
         ASSERT_NE(nullptr, buffer.get()) << "Allocation failed, but IMapper::isSupported was true";
     }
@@ -319,6 +319,7 @@
     if (!supported) {
         ASSERT_EQ(nullptr, buffer.get())
                 << "Allocation succeeded, but IMapper::isSupported was false";
+        GTEST_SKIP();
     } else {
         ASSERT_NE(nullptr, buffer.get()) << "Allocation failed, but IMapper::isSupported was true";
     }
@@ -375,4 +376,4 @@
         [](auto info) -> std::string {
             std::string name = std::to_string(info.index) + "/" + std::get<2>(info.param).name;
             return Sanitize(name);
-        });
\ No newline at end of file
+        });