[test] Fix permission for attestation test with GKI kernel
This cl grants permission for the VM attestation test to run with
the GKI kernel. The permission can be revoked if the VM
attestation test with the Microdroid kernel runs first.
Test: atest AvfRkpdVmAttestationTestApp
Bug: 334322137
Change-Id: I71ae2b0661d28b4ce9e7e7acfab111fbd2ad8634
diff --git a/service_vm/test_apk/src/java/com/android/virt/rkpd/vm_attestation/testapp/RkpdVmAttestationTest.java b/service_vm/test_apk/src/java/com/android/virt/rkpd/vm_attestation/testapp/RkpdVmAttestationTest.java
index 678e56f..f456cb4 100644
--- a/service_vm/test_apk/src/java/com/android/virt/rkpd/vm_attestation/testapp/RkpdVmAttestationTest.java
+++ b/service_vm/test_apk/src/java/com/android/virt/rkpd/vm_attestation/testapp/RkpdVmAttestationTest.java
@@ -95,6 +95,11 @@
if (mGki == null) {
// We don't need this permission to use the microdroid kernel.
revokePermission(VirtualMachine.USE_CUSTOM_VIRTUAL_MACHINE_PERMISSION);
+ } else {
+ // The permission is needed to use the GKI kernel.
+ // Granting the permission is needed as the microdroid kernel test setup
+ // can revoke the permission before the GKI kernel test.
+ grantPermission(VirtualMachine.USE_CUSTOM_VIRTUAL_MACHINE_PERMISSION);
}
prepareTestSetup(true /* protectedVm */, mGki);
setMaxPerformanceTaskProfile();