Add notifyError/onError notification for VM errors
For now, microdroid_manager shuts down a VM instance when it fails to
verify the VM payload. This change adds a new "error" notification to
deliver the error to the VM app.
Fow now this doesn't change the workflow. In a follow-up change this
will be changed so that VM app can decide to shutdown or not "onError".
Bug: 205778374
Test: MicrodroidHostTestCases
Change-Id: If7fdac3996b69601be0eda17da3e4cf218b4d1d8
diff --git a/vm/src/run.rs b/vm/src/run.rs
index 1cd51a1..7f5f9fc 100644
--- a/vm/src/run.rs
+++ b/vm/src/run.rs
@@ -271,6 +271,11 @@
Ok(())
}
+ fn onError(&self, _cid: i32, error_code: i32, message: &str) -> BinderResult<()> {
+ eprintln!("VM encountered an error: code={}, message={}", error_code, message);
+ Ok(())
+ }
+
fn onDied(&self, _cid: i32) -> BinderResult<()> {
// No need to explicitly report the event to the user (e.g. via println!) because this
// callback is registered only when the vm tool is invoked as interactive mode (e.g. not