Give a better name to STOP_REASON_ERROR

It indicates crosvm failed to start the VM, so
STOP_REASON_START_FAILED.

Slightly gratuitously I also renamed the internal DeathReason - mainly
because this is just a much clearer name.

I didn't change the statslog version, because that would just be too
complicated.

Bug: 261037705
Test: atest MicrodroidTests
Change-Id: I5effdba86ea49ff919d82810926fb14ccbbd8499
diff --git a/javalib/api/system-current.txt b/javalib/api/system-current.txt
index f38d8fd..f364f4c 100644
--- a/javalib/api/system-current.txt
+++ b/javalib/api/system-current.txt
@@ -38,7 +38,6 @@
     field public static final int STOP_REASON_BOOTLOADER_INSTANCE_IMAGE_CHANGED = 10; // 0xa
     field public static final int STOP_REASON_BOOTLOADER_PUBLIC_KEY_MISMATCH = 9; // 0x9
     field public static final int STOP_REASON_CRASH = 6; // 0x6
-    field public static final int STOP_REASON_ERROR = 4; // 0x4
     field public static final int STOP_REASON_HANGUP = 16; // 0x10
     field public static final int STOP_REASON_INFRASTRUCTURE_ERROR = 0; // 0x0
     field public static final int STOP_REASON_KILLED = 1; // 0x1
@@ -51,6 +50,7 @@
     field public static final int STOP_REASON_PVM_FIRMWARE_PUBLIC_KEY_MISMATCH = 7; // 0x7
     field public static final int STOP_REASON_REBOOT = 5; // 0x5
     field public static final int STOP_REASON_SHUTDOWN = 3; // 0x3
+    field public static final int STOP_REASON_START_FAILED = 4; // 0x4
     field public static final int STOP_REASON_UNKNOWN = 2; // 0x2
     field public static final int STOP_REASON_VIRTUALIZATION_SERVICE_DIED = -1; // 0xffffffff
   }
diff --git a/javalib/src/android/system/virtualmachine/VirtualMachine.java b/javalib/src/android/system/virtualmachine/VirtualMachine.java
index 63b5628..0305650 100644
--- a/javalib/src/android/system/virtualmachine/VirtualMachine.java
+++ b/javalib/src/android/system/virtualmachine/VirtualMachine.java
@@ -26,7 +26,6 @@
 import static android.system.virtualmachine.VirtualMachineCallback.STOP_REASON_BOOTLOADER_INSTANCE_IMAGE_CHANGED;
 import static android.system.virtualmachine.VirtualMachineCallback.STOP_REASON_BOOTLOADER_PUBLIC_KEY_MISMATCH;
 import static android.system.virtualmachine.VirtualMachineCallback.STOP_REASON_CRASH;
-import static android.system.virtualmachine.VirtualMachineCallback.STOP_REASON_ERROR;
 import static android.system.virtualmachine.VirtualMachineCallback.STOP_REASON_HANGUP;
 import static android.system.virtualmachine.VirtualMachineCallback.STOP_REASON_INFRASTRUCTURE_ERROR;
 import static android.system.virtualmachine.VirtualMachineCallback.STOP_REASON_KILLED;
@@ -39,6 +38,7 @@
 import static android.system.virtualmachine.VirtualMachineCallback.STOP_REASON_PVM_FIRMWARE_PUBLIC_KEY_MISMATCH;
 import static android.system.virtualmachine.VirtualMachineCallback.STOP_REASON_REBOOT;
 import static android.system.virtualmachine.VirtualMachineCallback.STOP_REASON_SHUTDOWN;
+import static android.system.virtualmachine.VirtualMachineCallback.STOP_REASON_START_FAILED;
 import static android.system.virtualmachine.VirtualMachineCallback.STOP_REASON_UNKNOWN;
 
 import static java.util.Objects.requireNonNull;
@@ -1034,8 +1034,8 @@
                 return STOP_REASON_KILLED;
             case DeathReason.SHUTDOWN:
                 return STOP_REASON_SHUTDOWN;
-            case DeathReason.ERROR:
-                return STOP_REASON_ERROR;
+            case DeathReason.START_FAILED:
+                return STOP_REASON_START_FAILED;
             case DeathReason.REBOOT:
                 return STOP_REASON_REBOOT;
             case DeathReason.CRASH:
diff --git a/javalib/src/android/system/virtualmachine/VirtualMachineCallback.java b/javalib/src/android/system/virtualmachine/VirtualMachineCallback.java
index f3c4831..fad2fa9 100644
--- a/javalib/src/android/system/virtualmachine/VirtualMachineCallback.java
+++ b/javalib/src/android/system/virtualmachine/VirtualMachineCallback.java
@@ -58,26 +58,28 @@
 
     /** @hide */
     @Retention(RetentionPolicy.SOURCE)
-    @IntDef(prefix = "STOP_REASON_", value = {
-        STOP_REASON_VIRTUALIZATION_SERVICE_DIED,
-        STOP_REASON_INFRASTRUCTURE_ERROR,
-        STOP_REASON_KILLED,
-        STOP_REASON_UNKNOWN,
-        STOP_REASON_SHUTDOWN,
-        STOP_REASON_ERROR,
-        STOP_REASON_REBOOT,
-        STOP_REASON_CRASH,
-        STOP_REASON_PVM_FIRMWARE_PUBLIC_KEY_MISMATCH,
-        STOP_REASON_PVM_FIRMWARE_INSTANCE_IMAGE_CHANGED,
-        STOP_REASON_BOOTLOADER_PUBLIC_KEY_MISMATCH,
-        STOP_REASON_BOOTLOADER_INSTANCE_IMAGE_CHANGED,
-        STOP_REASON_MICRODROID_FAILED_TO_CONNECT_TO_VIRTUALIZATION_SERVICE,
-        STOP_REASON_MICRODROID_PAYLOAD_HAS_CHANGED,
-        STOP_REASON_MICRODROID_PAYLOAD_VERIFICATION_FAILED,
-        STOP_REASON_MICRODROID_INVALID_PAYLOAD_CONFIG,
-        STOP_REASON_MICRODROID_UNKNOWN_RUNTIME_ERROR,
-        STOP_REASON_HANGUP,
-    })
+    @IntDef(
+            prefix = "STOP_REASON_",
+            value = {
+                STOP_REASON_VIRTUALIZATION_SERVICE_DIED,
+                STOP_REASON_INFRASTRUCTURE_ERROR,
+                STOP_REASON_KILLED,
+                STOP_REASON_UNKNOWN,
+                STOP_REASON_SHUTDOWN,
+                STOP_REASON_START_FAILED,
+                STOP_REASON_REBOOT,
+                STOP_REASON_CRASH,
+                STOP_REASON_PVM_FIRMWARE_PUBLIC_KEY_MISMATCH,
+                STOP_REASON_PVM_FIRMWARE_INSTANCE_IMAGE_CHANGED,
+                STOP_REASON_BOOTLOADER_PUBLIC_KEY_MISMATCH,
+                STOP_REASON_BOOTLOADER_INSTANCE_IMAGE_CHANGED,
+                STOP_REASON_MICRODROID_FAILED_TO_CONNECT_TO_VIRTUALIZATION_SERVICE,
+                STOP_REASON_MICRODROID_PAYLOAD_HAS_CHANGED,
+                STOP_REASON_MICRODROID_PAYLOAD_VERIFICATION_FAILED,
+                STOP_REASON_MICRODROID_INVALID_PAYLOAD_CONFIG,
+                STOP_REASON_MICRODROID_UNKNOWN_RUNTIME_ERROR,
+                STOP_REASON_HANGUP,
+            })
     @interface StopReason {}
 
     /** The virtualization service itself died, taking the VM down with it. */
@@ -98,7 +100,7 @@
     int STOP_REASON_SHUTDOWN = 3;
 
     /** crosvm had an error starting the VM. */
-    int STOP_REASON_ERROR = 4;
+    int STOP_REASON_START_FAILED = 4;
 
     /** The VM requested to reboot, possibly as the result of a kernel panic. */
     int STOP_REASON_REBOOT = 5;