package { default_applicable_licenses: ["Android-Apache-2.0"], } android_app_certificate { name: "MicrodroidTestAppCert", // The default app cert is the same as the default platform cert // (on a test-keys build), which means we end up getting assigned // the permissions via signature and can't reliably disclaim // them. So instead we use our own custom cert. See b/290582742. // Created via: development/tools/make_key microdroid_test_app '/CN=microdroid_test_app' certificate: "microdroid_test_app", } java_defaults { name: "MicrodroidTestAppsDefaults", test_suites: [ "cts", "vts", "general-tests", ], static_libs: [ "com.android.microdroid.testservice-java", "com.android.microdroid.test.vmshare_service-java", "com.android.virt.vm_attestation.testservice-java", ], certificate: ":MicrodroidTestAppCert", sdk_version: "test_current", jni_uses_platform_apis: true, use_embedded_native_libs: true, // We only support 64-bit ABI, but CTS demands all APKs to be multi-ABI. compile_multilib: "both", } java_defaults { name: "MicrodroidVersionsTestAppDefaults", srcs: ["src/java/**/*.java"], defaults: ["MicrodroidTestAppsDefaults"], static_libs: [ "MicrodroidDeviceTestHelper", "VmAttestationTestUtil", "androidx.test.runner", "androidx.test.ext.junit", "authfs_test_apk_assets", "cbor-java", "truth", "compatibility-common-util-devicesidelib", "measure_io_as_jar", ], jni_libs: [ "MicrodroidTestNativeLib", "MicrodroidIdleNativeLib", "MicrodroidEmptyNativeLib", "MicrodroidExitNativeLib", "MicrodroidPrivateLinkingNativeLib", "MicrodroidCrashNativeLib", "libvm_attestation_test_payload", ], min_sdk_version: "33", } android_test { name: "MicrodroidTestApp", defaults: ["MicrodroidVersionsTestAppDefaults"], manifest: "AndroidManifestV5.xml", // Defined in ../vmshareapp/Android.bp data: [ ":MicrodroidTestAppUpdated", ":MicrodroidVmShareApp", ":test_microdroid_vendor_image", ":test_microdroid_vendor_image_unsigned", ], } android_test_helper_app { name: "MicrodroidTestAppUpdated", defaults: ["MicrodroidVersionsTestAppDefaults"], manifest: "AndroidManifestV6.xml", } // Defaults shared between MicrodroidTestNativeLib and MicrodroidPayloadInOtherAppNativeLib shared // libs. They are expected to share everything apart from the name, so that one app // (MicrodroidTestApp) can start a payload defined in the another app (MicrodroidVmShareApp). cc_defaults { name: "MicrodroidTestNativeLibDefaults", defaults: ["avf_build_flags_cc"], srcs: ["src/native/testbinary.cpp"], stl: "libc++_static", header_libs: ["vm_payload_restricted_headers"], shared_libs: [ "libbinder_ndk", "libcap", "MicrodroidTestNativeLibSub", "libvm_payload#current", ], static_libs: [ "com.android.microdroid.testservice-ndk", "libbase", "libfstab", "libfsverity_digests_proto_cc", "liblog", "libprotobuf-cpp-lite-ndk", ], } cc_library_shared { name: "MicrodroidPayloadInOtherAppNativeLib", defaults: ["MicrodroidTestNativeLibDefaults"], } cc_library_shared { name: "MicrodroidTestNativeLib", defaults: ["MicrodroidTestNativeLibDefaults"], } cc_library_shared { name: "MicrodroidTestNativeLibSub", defaults: ["avf_build_flags_cc"], srcs: ["src/native/testlib.cpp"], stl: "libc++_static", } cc_library_shared { name: "MicrodroidIdleNativeLib", defaults: ["avf_build_flags_cc"], srcs: ["src/native/idlebinary.cpp"], header_libs: ["vm_payload_headers"], stl: "libc++_static", } // An empty payload missing AVmPayload_main cc_library_shared { name: "MicrodroidEmptyNativeLib", defaults: ["avf_build_flags_cc"], srcs: ["src/native/emptybinary.cpp"], stl: "none", } // A payload that exits immediately on start cc_library_shared { name: "MicrodroidExitNativeLib", defaults: ["avf_build_flags_cc"], srcs: ["src/native/exitbinary.cpp"], header_libs: ["vm_payload_headers"], stl: "libc++_static", } // A payload which tries to link against libselinux, one of private libraries cc_library_shared { name: "MicrodroidPrivateLinkingNativeLib", defaults: ["avf_build_flags_cc"], srcs: ["src/native/idlebinary.cpp"], header_libs: ["vm_payload_headers"], // HACK: linking against "libselinux" will embed libselinux.so into the apk // link against a stub to prevent libselinux.so from being embedded shared_libs: ["libselinux#latest"], stl: "libc++_static", } // A payload that crashes immediately on start cc_library_shared { name: "MicrodroidCrashNativeLib", defaults: ["avf_build_flags_cc"], srcs: ["src/native/crashbinary.cpp"], header_libs: ["vm_payload_headers"], stl: "libc++_static", }