Support checking partitions for APEXes
Currently virtmgr only checks the root directory to find partitions of
files. But then vendor APEX files are regarded as non-vendor because
"apex" != "vendor". Preinstalled paths in apex info list must be used.
Bug: 383969737
Test: run vm tool with vendor APEX files
Change-Id: If93e22c733b085a049f2f78d7b71f9f919eae5be
diff --git a/android/virtmgr/src/payload.rs b/android/virtmgr/src/payload.rs
index 5811314..bd6bf10 100644
--- a/android/virtmgr/src/payload.rs
+++ b/android/virtmgr/src/payload.rs
@@ -48,15 +48,19 @@
/// Represents the list of APEXes
#[derive(Clone, Debug, Deserialize, Eq, PartialEq)]
-struct ApexInfoList {
+pub(crate) struct ApexInfoList {
+ /// The list of APEXes
#[serde(rename = "apex-info")]
- list: Vec<ApexInfo>,
+ pub(crate) list: Vec<ApexInfo>,
}
+/// Represents info of an APEX
#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq)]
-struct ApexInfo {
+pub(crate) struct ApexInfo {
+ /// Name of APEX
#[serde(rename = "moduleName")]
- name: String,
+ pub(crate) name: String,
+
#[serde(rename = "versionCode")]
version: u64,
#[serde(rename = "modulePath")]
@@ -80,11 +84,15 @@
#[serde(rename = "preinstalledModulePath")]
preinstalled_path: PathBuf,
+
+ /// Partition of APEX
+ #[serde(default)]
+ pub(crate) partition: String,
}
impl ApexInfoList {
/// Loads ApexInfoList
- fn load() -> Result<&'static ApexInfoList> {
+ pub(crate) fn load() -> Result<&'static ApexInfoList> {
static INSTANCE: OnceCell<ApexInfoList> = OnceCell::new();
INSTANCE.get_or_try_init(|| {
let apex_info_list = File::open(APEX_INFO_LIST_PATH)