Sign MicrdroidTestApp using APK sig scheme V4

... and copy the idsig file to the device.

Note that the copied idsig file is not used currently, because
mk_payload can't handle the file yet.

Bug: N/A
Test: atest MicrodroidHostTestCases
Change-Id: I7db582ac7933decfe00395ebe83e146ed61618a6
diff --git a/tests/testapk/Android.bp b/tests/testapk/Android.bp
index f2dad62..35f2f08 100644
--- a/tests/testapk/Android.bp
+++ b/tests/testapk/Android.bp
@@ -16,3 +16,20 @@
     srcs: ["src/native/*.cpp"],
     sdk_version: "current",
 }
+
+genrule {
+    name: "MicrodroidTestApp.signed",
+    out: [
+        "MicrodroidTestApp.apk",
+        "MicrodroidTestApp.apk.idsig",
+    ],
+    srcs: [":MicrodroidTestApp"],
+    tools:["apksigner"],
+    tool_files: ["test.keystore"],
+    cmd: "$(location apksigner) sign " +
+         "--ks $(location test.keystore) " +
+         "--ks-pass=pass:testkey --key-pass=pass:testkey " +
+         "--in $(in) " +
+         "--out $(genDir)/MicrodroidTestApp.apk",
+         // $(genDir)/MicrodroidTestApp.apk.idsig is generated implicitly
+}