Pass isFactory bit from host to Microdroid via payload metadata
The isolated compilation usecase demands that isFactory bit of an APEX
is the same across VM and host. This is because the bit is encoded in
the compiled artifact (in the VM), and matched against the same bit on
the host side.
This is now done by (1) reading isFactory bit from
/apex/apex-info-list.xml and (2) send the bit to the VM by writing it to
payload metadata. (3) On the VM side, apexd records the bit to
/apex/apex-info-list.xml. (See the other CL in the same topic for the
last step).
Bug: 210998761
Test: adb shell /apex/com.android.compos/bin/composd_cmd staged-apex-compile
Change-Id: I69dd73357132812766867db13f0f5cb9958bb113
Test: (1) build any APEX (e.g. com.android.virt) and install it
(2) add the name of the APEX to vm_config.json of the test app.
(3) run the test app and adb shell into the VM
(4) check /apex/apex-info-list.xml has isFactory="false" for the apex.
Change-Id: Iaed1e2c9b232a6e9a58a0624adb5044d06d88d2b
diff --git a/microdroid_manager/src/instance.rs b/microdroid_manager/src/instance.rs
index 1068792..5a77198 100644
--- a/microdroid_manager/src/instance.rs
+++ b/microdroid_manager/src/instance.rs
@@ -336,4 +336,5 @@
pub public_key: Vec<u8>,
pub root_digest: Vec<u8>,
pub last_update_seconds: u64,
+ pub is_factory: bool,
}
diff --git a/microdroid_manager/src/payload.rs b/microdroid_manager/src/payload.rs
index 661af5f..48535f3 100644
--- a/microdroid_manager/src/payload.rs
+++ b/microdroid_manager/src/payload.rs
@@ -48,6 +48,7 @@
public_key: result.public_key,
root_digest: result.root_digest,
last_update_seconds: apex.last_update_seconds,
+ is_factory: apex.is_factory,
})
})
.collect()
@@ -63,6 +64,7 @@
public_key: data.public_key.clone(),
root_digest: data.root_digest.clone(),
last_update_seconds: data.last_update_seconds,
+ is_factory: data.is_factory,
..Default::default()
})
.collect(),