Remove support for command-line args

We no longer support passing string arguments to a VM. Any
customization needed can be done by having the host communicate with
the VM after it starts.

Also start adding a header to provide the entry-point prototype for
better safety.

Bug: 249064104
Bug: 243513572
Test: atest MicrodroidTests MicrodroidHostTestCases
Change-Id: I0a1775f3b6a0b11c71c4831f6c380d96bb637c00
diff --git a/microdroid/README.md b/microdroid/README.md
index 3523e9d..2519416 100644
--- a/microdroid/README.md
+++ b/microdroid/README.md
@@ -42,10 +42,10 @@
 ## Building an app
 
 An app in microdroid is a shared library file embedded in an APK. The shared
-library should have an entry point `android_native_main` as shown below:
+library should have an entry point `AVmPayload_main` as shown below:
 
 ```C++
-extern "C" int android_native_main(int argc, char* argv[]) {
+extern "C" int AVmPayload_main() {
   printf("Hello Microdroid!\n");
 }
 ```
diff --git a/microdroid/payload/config/src/lib.rs b/microdroid/payload/config/src/lib.rs
index 54b745e..08b8b42 100644
--- a/microdroid/payload/config/src/lib.rs
+++ b/microdroid/payload/config/src/lib.rs
@@ -85,10 +85,6 @@
     /// - For executable task, this is the path to the executable.
     /// - For microdroid_launcher task, this is the name of .so
     pub command: String,
-
-    /// Args to the command
-    #[serde(default)]
-    pub args: Vec<String>,
 }
 
 impl Default for TaskType {
diff --git a/microdroid/payload/metadata.proto b/microdroid/payload/metadata.proto
index 06cbbf4..1d8dd8c 100644
--- a/microdroid/payload/metadata.proto
+++ b/microdroid/payload/metadata.proto
@@ -67,9 +67,4 @@
   // Required.
   // Path to the payload binary file inside the APK.
   string payload_binary_path = 1;
-
-  // Optional.
-  // Arguments to be passed to the payload.
-  // TODO(b/249064104): Remove this
-  repeated string args = 2;
 }
diff --git a/microdroid/vm_payload/Android.bp b/microdroid/vm_payload/Android.bp
index a68595f..925928e 100644
--- a/microdroid/vm_payload/Android.bp
+++ b/microdroid/vm_payload/Android.bp
@@ -31,3 +31,8 @@
         "libvm_payload",
     ],
 }
+
+cc_library_headers {
+    name: "vm_payload_headers",
+    export_include_dirs: ["include"],
+}
diff --git a/microdroid/vm_payload/include/vm_main.h b/microdroid/vm_payload/include/vm_main.h
new file mode 100644
index 0000000..e351174
--- /dev/null
+++ b/microdroid/vm_payload/include/vm_main.h
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+typedef int AVmPayload_main_t();
+AVmPayload_main_t AVmPayload_main;
+}
+#else
+typedef int AVmPayload_main_t(void);
+extern int AVmPayload_main(void);
+#endif
diff --git a/microdroid/vm_payload/include/vm_payload.h b/microdroid/vm_payload/include/vm_payload.h
index 05abdce..4ed07b8 100644
--- a/microdroid/vm_payload/include/vm_payload.h
+++ b/microdroid/vm_payload/include/vm_payload.h
@@ -19,6 +19,8 @@
 #include <stdbool.h>
 #include <stddef.h>
 
+#include "vm_main.h"
+
 #ifdef __cplusplus
 extern "C" {
 #endif