Detect Microdroid hangup during boot

Hangup in Microdroid is defined as a state where payload hasn't been
started for a long time. In that case AVF kills the VM and the death is
reported via onDied callback.

In addition, modified the client-facing java and rust libraries to add
death reasons that were added before but haven't surfaced yet.

Bug: 222228861
Test: I couldn't make a test for this because it was impossible to
intentionally make the hang by a test. Instead, I confirm that `onDied`
is called and the VM eventually is killed when I edited the timeout
value to a very small number (e.g. 100ms).

Change-Id: I53f232d0b609e6e8a429d996c7d6fdd0b37e7b4c
diff --git a/vmclient/src/death_reason.rs b/vmclient/src/death_reason.rs
index 657eaa2..b976f6f 100644
--- a/vmclient/src/death_reason.rs
+++ b/vmclient/src/death_reason.rs
@@ -44,6 +44,18 @@
     BootloaderPublicKeyMismatch,
     /// The bootloader failed to verify the VM because the instance image changed.
     BootloaderInstanceImageChanged,
+    /// The microdroid failed to connect to VirtualizationService's RPC server.
+    MicrodroidFailedToConnectToVirtualizationService,
+    /// The payload for microdroid is changed.
+    MicrodroidPayloadHasChanged,
+    /// The microdroid failed to verify given payload APK.
+    MicrodroidPayloadVerificationFailed,
+    /// The VM config for microdroid is invalid (e.g. missing tasks).
+    MicrodroidInvalidPayloadConfig,
+    /// There was a runtime error while running microdroid manager.
+    MicrodroidUnknownRuntimeError,
+    /// The VM was killed due to hangup.
+    Hangup,
     /// VirtualizationService sent a death reason which was not recognised by the client library.
     Unrecognised(AidlDeathReason),
 }
@@ -66,6 +78,20 @@
             AidlDeathReason::BOOTLOADER_INSTANCE_IMAGE_CHANGED => {
                 Self::BootloaderInstanceImageChanged
             }
+            AidlDeathReason::MICRODROID_FAILED_TO_CONNECT_TO_VIRTUALIZATION_SERVICE => {
+                Self::MicrodroidFailedToConnectToVirtualizationService
+            }
+            AidlDeathReason::MICRODROID_PAYLOAD_HAS_CHANGED => Self::MicrodroidPayloadHasChanged,
+            AidlDeathReason::MICRODROID_PAYLOAD_VERIFICATION_FAILED => {
+                Self::MicrodroidPayloadVerificationFailed
+            }
+            AidlDeathReason::MICRODROID_INVALID_PAYLOAD_CONFIG => {
+                Self::MicrodroidInvalidPayloadConfig
+            }
+            AidlDeathReason::MICRODROID_UNKNOWN_RUNTIME_ERROR => {
+                Self::MicrodroidUnknownRuntimeError
+            }
+            AidlDeathReason::HANGUP => Self::Hangup,
             _ => Self::Unrecognised(reason),
         }
     }
@@ -94,6 +120,20 @@
             Self::BootloaderInstanceImageChanged => {
                 "Bootloader failed to verify the VM because the instance image changed."
             }
+            Self::MicrodroidFailedToConnectToVirtualizationService => {
+                "The microdroid failed to connect to VirtualizationService's RPC server."
+            }
+            Self::MicrodroidPayloadHasChanged => "The payload for microdroid is changed.",
+            Self::MicrodroidPayloadVerificationFailed => {
+                "The microdroid failed to verify given payload APK."
+            }
+            Self::MicrodroidInvalidPayloadConfig => {
+                "The VM config for microdroid is invalid (e.g. missing tasks)."
+            }
+            Self::MicrodroidUnknownRuntimeError => {
+                "There was a runtime error while running microdroid manager."
+            }
+            Self::Hangup => "VM hangup.",
             Self::Unrecognised(reason) => {
                 return write!(f, "Unrecognised death reason {:?}.", reason);
             }