Add MicrodroidTestApp am: a7266ac893
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Virtualization/+/1708513
Change-Id: Ia8cd55a4cdfe7bf2bf4f06bc3c8ce2cbbfd08c43
diff --git a/apex/Android.bp b/apex/Android.bp
index 459545c..63f257b 100644
--- a/apex/Android.bp
+++ b/apex/Android.bp
@@ -51,6 +51,10 @@
"mk_cdisk",
"mk_payload",
],
+ apps: [
+ // TODO(jiyong): remove this when microdroid_payload.json is created by virt manager
+ "MicrodroidTestApp",
+ ],
prebuilts: [
"com.android.virt.init.rc",
"microdroid_cdisk.json",
diff --git a/tests/testapk/Android.bp b/tests/testapk/Android.bp
new file mode 100644
index 0000000..277ccc8
--- /dev/null
+++ b/tests/testapk/Android.bp
@@ -0,0 +1,19 @@
+package {
+ default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+android_app {
+ name: "MicrodroidTestApp",
+ srcs: ["src/java/**/*.java"],
+ jni_libs: ["MicrodroidTestNativeLib"],
+ sdk_version: "current",
+ apex_available: ["com.android.virt"], // TODO(jiyong): remove this from virt APEX
+}
+
+// TODO(jiyong): make this a binary, not a shared library
+cc_library_shared {
+ name: "MicrodroidTestNativeLib",
+ srcs: ["src/native/*.cpp"],
+ sdk_version: "current",
+ apex_available: ["com.android.virt"], // TODO(jiyong): remove this from virt APEX
+}
diff --git a/tests/testapk/AndroidManifest.xml b/tests/testapk/AndroidManifest.xml
new file mode 100644
index 0000000..05ebb4e
--- /dev/null
+++ b/tests/testapk/AndroidManifest.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2021 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.
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.microdroid.test">
+ <application android:label="Microdroid Test">
+ <activity android:name="TestActivity">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ </application>
+</manifest>
diff --git a/tests/testapk/src/java/com/android/microdroid/test/TestActivity.java b/tests/testapk/src/java/com/android/microdroid/test/TestActivity.java
new file mode 100644
index 0000000..b25869b
--- /dev/null
+++ b/tests/testapk/src/java/com/android/microdroid/test/TestActivity.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+package com.android.microdroid.test;
+
+import android.app.Activity;
+import android.os.Bundle;
+
+public class TestActivity extends Activity {
+ @Override
+ public void onCreate(Bundle savedInstanceState) {}
+}
diff --git a/tests/testapk/src/native/testbinary.cpp b/tests/testapk/src/native/testbinary.cpp
new file mode 100644
index 0000000..c315bf1
--- /dev/null
+++ b/tests/testapk/src/native/testbinary.cpp
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+#include <stdio.h>
+
+void say_hello() {
+ printf("Hello Microdroid\n");
+}