Add support for checking whether feature is enabled on device
In case of AVF development most of the features will be protected for
build time flags, meaning that we need to provide a way for tests to
query whether device build actually has the feature enabled.
This is achieved by providing isFeatureEnabled @TestApi. As part of this
change I've also switched the payloadIsNotRoot test to use this new API
as an example of how the API can be used in tests.
Bug: 298012279
Bug: 298008232
Test: atest MicrodroidTests
Change-Id: If9afc013e178439f45627c1ac7dfe50242799f09
diff --git a/javalib/api/test-current.txt b/javalib/api/test-current.txt
index cf95770..51c2223 100644
--- a/javalib/api/test-current.txt
+++ b/javalib/api/test-current.txt
@@ -17,5 +17,10 @@
method @NonNull public android.system.virtualmachine.VirtualMachineConfig.Builder setVmConsoleInputSupported(boolean);
}
+ public class VirtualMachineManager {
+ method @RequiresPermission(android.system.virtualmachine.VirtualMachine.MANAGE_VIRTUAL_MACHINE_PERMISSION) public boolean isFeatureEnabled(String) throws android.system.virtualmachine.VirtualMachineException;
+ field public static final String FEATURE_PAYLOAD_NOT_ROOT = "com.android.kvm.PAYLOAD_NON_ROOT";
+ }
+
}