Microdroid Demo App supports non-protected and protected vm
[Description]
The Microdroid demonstration application has been enhanced to support
both non-protected and protected virtual machines (VMs). The default
behavior is to launch a non-protected VM instance.
Users now have the option to start a protected VM by selecting a newly
implemented checkbox within the application's user interface.
Since some chipsets are limited to supporting only non-protected VMs.
This compatibility consideration is essential for the application's
deployment across diverse hardware configurations.
Signed-off-by: Kevenny Hsieh <kevenny.hsieh@mediatek.com>
Signed-off-by: Jerry Wang <ze-yu.wang@mediatek.com>
Bug: 339324975
Test: microdroid demo app
Change-Id: I8307303ca2ab236f1acd5edf4703ab64b0649b87
diff --git a/demo/java/com/android/microdroid/demo/MainActivity.java b/demo/java/com/android/microdroid/demo/MainActivity.java
index f27b23b..906d18e 100644
--- a/demo/java/com/android/microdroid/demo/MainActivity.java
+++ b/demo/java/com/android/microdroid/demo/MainActivity.java
@@ -76,8 +76,10 @@
model.stop();
} else {
CheckBox debugModeCheckBox = findViewById(R.id.debugMode);
+ CheckBox protectedModeCheckBox = findViewById(R.id.protectedMode);
final boolean debug = debugModeCheckBox.isChecked();
- model.run(debug);
+ final boolean protectedVm = protectedModeCheckBox.isChecked();
+ model.run(debug, protectedVm);
}
});
@@ -157,7 +159,7 @@
}
/** Runs a VM */
- public void run(boolean debug) {
+ public void run(boolean debug, boolean protectedVm) {
// Create a VM and run it.
mExecutorService = Executors.newFixedThreadPool(4);
@@ -243,7 +245,8 @@
VirtualMachineConfig.Builder builder =
new VirtualMachineConfig.Builder(getApplication());
builder.setPayloadBinaryName("MicrodroidTestNativeLib.so");
- builder.setProtectedVm(true);
+ builder.setProtectedVm(protectedVm);
+
if (debug) {
builder.setDebugLevel(VirtualMachineConfig.DEBUG_LEVEL_FULL);
builder.setVmOutputCaptured(true);
diff --git a/demo/res/layout/activity_main.xml b/demo/res/layout/activity_main.xml
index f0e35d6..baa7b1f 100644
--- a/demo/res/layout/activity_main.xml
+++ b/demo/res/layout/activity_main.xml
@@ -31,6 +31,13 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Debug mode" />
+
+ <CheckBox
+ android:id="@+id/protectedMode"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:text="Protected vm" />
</LinearLayout>
<TextView