Cache package name not APK path
The APK path for an app can change, e.g. if an update is
installed. Where the caller hasn't specified an explicit APK path we
should store the package name rather than the current APK path in the
config file, and map it to the APK path on run().
I modified the builder/config tests to cover the changes.
I've manually tested this using my demo app and it is now possible to
start a VM after the APK is updated; it then fails (as expected)
because the APK hash has changed. And it succeeds if I reinstall the
same APK (so the path changes, but the hash doesn't).
Bug: 266395810
Test: atest MicrodroidTests
Change-Id: Ifa0680d3e6bc805282674eb37c89190a996a7af4
diff --git a/javalib/api/system-current.txt b/javalib/api/system-current.txt
index 1977321..fe9943d 100644
--- a/javalib/api/system-current.txt
+++ b/javalib/api/system-current.txt
@@ -56,7 +56,7 @@
}
public final class VirtualMachineConfig {
- method @NonNull public String getApkPath();
+ method @Nullable public String getApkPath();
method @NonNull public int getDebugLevel();
method @IntRange(from=0) public long getEncryptedStorageKib();
method @IntRange(from=0) public int getMemoryMib();