Merge changes Ie60a211e,Id9923d05 into main am: 97011cfed3 am: 3b6b95b8a7
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Virtualization/+/3080662
Change-Id: I79dd31ab271b9e6b372eb3c85c01bfb6edad2c7d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/java/framework/src/android/system/virtualmachine/VirtualMachineConfig.java b/java/framework/src/android/system/virtualmachine/VirtualMachineConfig.java
index a8f318c..1b915cd 100644
--- a/java/framework/src/android/system/virtualmachine/VirtualMachineConfig.java
+++ b/java/framework/src/android/system/virtualmachine/VirtualMachineConfig.java
@@ -601,7 +601,7 @@
config.name = Optional.ofNullable(customImageConfig.getName()).orElse("");
config.instanceId = new byte[64];
config.kernel =
- Optional.of(customImageConfig.getKernelPath())
+ Optional.ofNullable(customImageConfig.getKernelPath())
.map(
(path) -> {
try {
diff --git a/java/framework/src/android/system/virtualmachine/VirtualMachineCustomImageConfig.java b/java/framework/src/android/system/virtualmachine/VirtualMachineCustomImageConfig.java
index 8d294fd..8ec9d2c 100644
--- a/java/framework/src/android/system/virtualmachine/VirtualMachineCustomImageConfig.java
+++ b/java/framework/src/android/system/virtualmachine/VirtualMachineCustomImageConfig.java
@@ -16,7 +16,6 @@
package android.system.virtualmachine;
-import android.annotation.NonNull;
import android.annotation.Nullable;
import android.os.PersistableBundle;
@@ -38,7 +37,7 @@
private static final String KEY_KEYBOARD = "keyboard";
@Nullable private final String name;
- @NonNull private final String kernelPath;
+ @Nullable private final String kernelPath;
@Nullable private final String initrdPath;
@Nullable private final String bootloaderPath;
@Nullable private final String[] params;
@@ -62,7 +61,7 @@
return initrdPath;
}
- @NonNull
+ @Nullable
public String getKernelPath() {
return kernelPath;
}
diff --git a/vmlauncher_app/java/com/android/virtualization/vmlauncher/MainActivity.java b/vmlauncher_app/java/com/android/virtualization/vmlauncher/MainActivity.java
index 4c42bb4..ec0f8e8 100644
--- a/vmlauncher_app/java/com/android/virtualization/vmlauncher/MainActivity.java
+++ b/vmlauncher_app/java/com/android/virtualization/vmlauncher/MainActivity.java
@@ -91,7 +91,7 @@
.forEach(customImageConfigBuilder::addParam);
}
if (json.has("bootloader")) {
- customImageConfigBuilder.setInitrdPath(json.getString("bootloader"));
+ customImageConfigBuilder.setBootloaderPath(json.getString("bootloader"));
}
if (json.has("disks")) {
JSONArray diskArr = json.getJSONArray("disks");