Split single-app into app-instrumented-only and app-with-activity Bug: 441727732 Test: manually verified from command line and Android Studio Change-Id: Id5b041df1d7b0742aa4fbeebe3642b18f933655a
diff --git a/templates/single-app/.gitignore b/templates/app-instrumented-only/.gitignore similarity index 100% copy from templates/single-app/.gitignore copy to templates/app-instrumented-only/.gitignore
diff --git a/templates/single-app/.run/assembleSubmissionSources.run.xml b/templates/app-instrumented-only/.run/assembleSubmissionSources.run.xml similarity index 100% copy from templates/single-app/.run/assembleSubmissionSources.run.xml copy to templates/app-instrumented-only/.run/assembleSubmissionSources.run.xml
diff --git a/templates/single-app/.run/assembleSubmissionZip.run.xml b/templates/app-instrumented-only/.run/assembleSubmissionZip.run.xml similarity index 100% copy from templates/single-app/.run/assembleSubmissionZip.run.xml copy to templates/app-instrumented-only/.run/assembleSubmissionZip.run.xml
diff --git a/templates/single-app/.run/autorepro_nonroot_arm64.run.xml b/templates/app-instrumented-only/.run/autorepro_nonroot_arm64.run.xml similarity index 100% copy from templates/single-app/.run/autorepro_nonroot_arm64.run.xml copy to templates/app-instrumented-only/.run/autorepro_nonroot_arm64.run.xml
diff --git a/templates/single-app/.run/autorepro_nonroot_x86_64.run.xml b/templates/app-instrumented-only/.run/autorepro_nonroot_x86_64.run.xml similarity index 100% copy from templates/single-app/.run/autorepro_nonroot_x86_64.run.xml copy to templates/app-instrumented-only/.run/autorepro_nonroot_x86_64.run.xml
diff --git a/templates/single-app/.run/autorepro_root_arm64.run.xml b/templates/app-instrumented-only/.run/autorepro_root_arm64.run.xml similarity index 100% copy from templates/single-app/.run/autorepro_root_arm64.run.xml copy to templates/app-instrumented-only/.run/autorepro_root_arm64.run.xml
diff --git a/templates/single-app/.run/autorepro_root_x86_64.run.xml b/templates/app-instrumented-only/.run/autorepro_root_x86_64.run.xml similarity index 100% copy from templates/single-app/.run/autorepro_root_x86_64.run.xml copy to templates/app-instrumented-only/.run/autorepro_root_x86_64.run.xml
diff --git a/templates/single-app/.run/copyInvocationResultsToSubmission.run.xml b/templates/app-instrumented-only/.run/copyInvocationResultsToSubmission.run.xml similarity index 100% copy from templates/single-app/.run/copyInvocationResultsToSubmission.run.xml copy to templates/app-instrumented-only/.run/copyInvocationResultsToSubmission.run.xml
diff --git a/templates/single-app/README.md b/templates/app-instrumented-only/README.md similarity index 100% rename from templates/single-app/README.md rename to templates/app-instrumented-only/README.md
diff --git a/templates/single-app/gradle.properties b/templates/app-instrumented-only/gradle.properties similarity index 100% copy from templates/single-app/gradle.properties copy to templates/app-instrumented-only/gradle.properties
diff --git a/templates/single-app/gradle/wrapper/gradle-wrapper.jar b/templates/app-instrumented-only/gradle/wrapper/gradle-wrapper.jar similarity index 100% copy from templates/single-app/gradle/wrapper/gradle-wrapper.jar copy to templates/app-instrumented-only/gradle/wrapper/gradle-wrapper.jar Binary files differ
diff --git a/templates/single-app/gradle/wrapper/gradle-wrapper.properties b/templates/app-instrumented-only/gradle/wrapper/gradle-wrapper.properties similarity index 100% copy from templates/single-app/gradle/wrapper/gradle-wrapper.properties copy to templates/app-instrumented-only/gradle/wrapper/gradle-wrapper.properties
diff --git a/templates/single-app/gradlew b/templates/app-instrumented-only/gradlew similarity index 100% copy from templates/single-app/gradlew copy to templates/app-instrumented-only/gradlew
diff --git a/templates/single-app/gradlew.bat b/templates/app-instrumented-only/gradlew.bat similarity index 100% copy from templates/single-app/gradlew.bat copy to templates/app-instrumented-only/gradlew.bat
diff --git a/templates/single-app/settings.gradle.kts b/templates/app-instrumented-only/settings.gradle.kts similarity index 100% copy from templates/single-app/settings.gradle.kts copy to templates/app-instrumented-only/settings.gradle.kts
diff --git a/templates/single-app/submission/appTest/build.gradle.kts b/templates/app-instrumented-only/submission/appTest/build.gradle.kts similarity index 100% copy from templates/single-app/submission/appTest/build.gradle.kts copy to templates/app-instrumented-only/submission/appTest/build.gradle.kts
diff --git a/templates/app-instrumented-only/submission/appTest/src/main/AndroidManifest.xml b/templates/app-instrumented-only/submission/appTest/src/main/AndroidManifest.xml new file mode 100644 index 0000000..79466e8 --- /dev/null +++ b/templates/app-instrumented-only/submission/appTest/src/main/AndroidManifest.xml
@@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright 2025 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" + android:versionCode="1" + android:versionName="1.0"> + <instrumentation + android:name="androidx.test.runner.AndroidJUnitRunner" + android:targetPackage="${applicationId}" /> + <application + android:supportsRtl="true"> + </application> +</manifest>
diff --git a/templates/app-instrumented-only/submission/appTest/src/main/java/com/android/security/DeviceTest.java b/templates/app-instrumented-only/submission/appTest/src/main/java/com/android/security/DeviceTest.java new file mode 100644 index 0000000..818085f --- /dev/null +++ b/templates/app-instrumented-only/submission/appTest/src/main/java/com/android/security/DeviceTest.java
@@ -0,0 +1,62 @@ +/* + * Copyright (C) 2025 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.security; + +import static androidx.test.core.app.ApplicationProvider.getApplicationContext; +import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; +import android.util.Log; + +import androidx.test.ext.junit.runners.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.util.concurrent.Semaphore; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicReference; + +/** + * An example device-side test that runs on the Android device itself. + */ +@RunWith(AndroidJUnit4.class) +public class DeviceTest { + private static final String TAG = DeviceTest.class.getSimpleName(); + + /** + * This test runs on the Android device itself. + * Use this to interact with Android APIs or use UIAutomator. + */ + @Test + public void testDeviceSideMethod() throws Exception { + // TODO: Add your device-side PoC logic here. + // This test runs entirely on the device. + // If the PoC is successful (the vulnerability is present), this test should pass. + // The host-side test will then fail the overall test to indicate vulnerability. + // + // For example, you could try to access a protected component and assert + // that the access was successful. + assertTrue("Placeholder assertion", true); + } +}
diff --git a/templates/single-app/submission/build.gradle.kts b/templates/app-instrumented-only/submission/build.gradle.kts similarity index 100% copy from templates/single-app/submission/build.gradle.kts copy to templates/app-instrumented-only/submission/build.gradle.kts
diff --git a/templates/single-app/submission/hostTest/build.gradle.kts b/templates/app-instrumented-only/submission/hostTest/build.gradle.kts similarity index 100% copy from templates/single-app/submission/hostTest/build.gradle.kts copy to templates/app-instrumented-only/submission/hostTest/build.gradle.kts
diff --git a/templates/single-app/submission/hostTest/src/main/java/com/android/security/autorepro_placeholder/HostsideTest.java b/templates/app-instrumented-only/submission/hostTest/src/main/java/com/android/security/autorepro_placeholder/HostsideTest.java similarity index 100% rename from templates/single-app/submission/hostTest/src/main/java/com/android/security/autorepro_placeholder/HostsideTest.java rename to templates/app-instrumented-only/submission/hostTest/src/main/java/com/android/security/autorepro_placeholder/HostsideTest.java
diff --git a/templates/single-app/submission/hostTest/src/main/resources/AutoReproPlaceholder/README.md b/templates/app-instrumented-only/submission/hostTest/src/main/resources/AutoReproPlaceholder/README.md similarity index 100% copy from templates/single-app/submission/hostTest/src/main/resources/AutoReproPlaceholder/README.md copy to templates/app-instrumented-only/submission/hostTest/src/main/resources/AutoReproPlaceholder/README.md
diff --git a/templates/single-app/.gitignore b/templates/app-with-activity/.gitignore similarity index 100% rename from templates/single-app/.gitignore rename to templates/app-with-activity/.gitignore
diff --git a/templates/single-app/.run/assembleSubmissionSources.run.xml b/templates/app-with-activity/.run/assembleSubmissionSources.run.xml similarity index 100% rename from templates/single-app/.run/assembleSubmissionSources.run.xml rename to templates/app-with-activity/.run/assembleSubmissionSources.run.xml
diff --git a/templates/single-app/.run/assembleSubmissionZip.run.xml b/templates/app-with-activity/.run/assembleSubmissionZip.run.xml similarity index 100% rename from templates/single-app/.run/assembleSubmissionZip.run.xml rename to templates/app-with-activity/.run/assembleSubmissionZip.run.xml
diff --git a/templates/single-app/.run/autorepro_nonroot_arm64.run.xml b/templates/app-with-activity/.run/autorepro_nonroot_arm64.run.xml similarity index 100% rename from templates/single-app/.run/autorepro_nonroot_arm64.run.xml rename to templates/app-with-activity/.run/autorepro_nonroot_arm64.run.xml
diff --git a/templates/single-app/.run/autorepro_nonroot_x86_64.run.xml b/templates/app-with-activity/.run/autorepro_nonroot_x86_64.run.xml similarity index 100% rename from templates/single-app/.run/autorepro_nonroot_x86_64.run.xml rename to templates/app-with-activity/.run/autorepro_nonroot_x86_64.run.xml
diff --git a/templates/single-app/.run/autorepro_root_arm64.run.xml b/templates/app-with-activity/.run/autorepro_root_arm64.run.xml similarity index 100% rename from templates/single-app/.run/autorepro_root_arm64.run.xml rename to templates/app-with-activity/.run/autorepro_root_arm64.run.xml
diff --git a/templates/single-app/.run/autorepro_root_x86_64.run.xml b/templates/app-with-activity/.run/autorepro_root_x86_64.run.xml similarity index 100% rename from templates/single-app/.run/autorepro_root_x86_64.run.xml rename to templates/app-with-activity/.run/autorepro_root_x86_64.run.xml
diff --git a/templates/single-app/.run/copyInvocationResultsToSubmission.run.xml b/templates/app-with-activity/.run/copyInvocationResultsToSubmission.run.xml similarity index 100% rename from templates/single-app/.run/copyInvocationResultsToSubmission.run.xml rename to templates/app-with-activity/.run/copyInvocationResultsToSubmission.run.xml
diff --git a/templates/app-with-activity/README.md b/templates/app-with-activity/README.md new file mode 100644 index 0000000..cfde46f --- /dev/null +++ b/templates/app-with-activity/README.md
@@ -0,0 +1,14 @@ +# Single App Test Template + +This template is the most common starting point for an AutoRepro submission. + +## Use Case + +Use this template for vulnerabilities that can be demonstrated with: +1. A **host-side test** that runs on a computer and controls the device. +2. A **single device-side app** that is installed on the device to trigger the vulnerability. + +## Modules + +* `submission/hostTest`: The host-side Tradefed test. +* `submission/appTest`: The device-side instrumented app.
diff --git a/templates/single-app/gradle.properties b/templates/app-with-activity/gradle.properties similarity index 100% rename from templates/single-app/gradle.properties rename to templates/app-with-activity/gradle.properties
diff --git a/templates/single-app/gradle/wrapper/gradle-wrapper.jar b/templates/app-with-activity/gradle/wrapper/gradle-wrapper.jar similarity index 100% rename from templates/single-app/gradle/wrapper/gradle-wrapper.jar rename to templates/app-with-activity/gradle/wrapper/gradle-wrapper.jar Binary files differ
diff --git a/templates/single-app/gradle/wrapper/gradle-wrapper.properties b/templates/app-with-activity/gradle/wrapper/gradle-wrapper.properties similarity index 100% rename from templates/single-app/gradle/wrapper/gradle-wrapper.properties rename to templates/app-with-activity/gradle/wrapper/gradle-wrapper.properties
diff --git a/templates/single-app/gradlew b/templates/app-with-activity/gradlew similarity index 100% rename from templates/single-app/gradlew rename to templates/app-with-activity/gradlew
diff --git a/templates/single-app/gradlew.bat b/templates/app-with-activity/gradlew.bat similarity index 100% rename from templates/single-app/gradlew.bat rename to templates/app-with-activity/gradlew.bat
diff --git a/templates/single-app/settings.gradle.kts b/templates/app-with-activity/settings.gradle.kts similarity index 100% rename from templates/single-app/settings.gradle.kts rename to templates/app-with-activity/settings.gradle.kts
diff --git a/templates/single-app/submission/appTest/build.gradle.kts b/templates/app-with-activity/submission/appTest/build.gradle.kts similarity index 100% rename from templates/single-app/submission/appTest/build.gradle.kts rename to templates/app-with-activity/submission/appTest/build.gradle.kts
diff --git a/templates/single-app/submission/appTest/src/main/AndroidManifest.xml b/templates/app-with-activity/submission/appTest/src/main/AndroidManifest.xml similarity index 100% rename from templates/single-app/submission/appTest/src/main/AndroidManifest.xml rename to templates/app-with-activity/submission/appTest/src/main/AndroidManifest.xml
diff --git a/templates/single-app/submission/appTest/src/main/java/com/android/security/DeviceTest.java b/templates/app-with-activity/submission/appTest/src/main/java/com/android/security/DeviceTest.java similarity index 100% rename from templates/single-app/submission/appTest/src/main/java/com/android/security/DeviceTest.java rename to templates/app-with-activity/submission/appTest/src/main/java/com/android/security/DeviceTest.java
diff --git a/templates/single-app/submission/appTest/src/main/java/com/android/security/PocActivity.java b/templates/app-with-activity/submission/appTest/src/main/java/com/android/security/PocActivity.java similarity index 100% rename from templates/single-app/submission/appTest/src/main/java/com/android/security/PocActivity.java rename to templates/app-with-activity/submission/appTest/src/main/java/com/android/security/PocActivity.java
diff --git a/templates/single-app/submission/appTest/src/main/res/layout/activity_main.xml b/templates/app-with-activity/submission/appTest/src/main/res/layout/activity_main.xml similarity index 100% rename from templates/single-app/submission/appTest/src/main/res/layout/activity_main.xml rename to templates/app-with-activity/submission/appTest/src/main/res/layout/activity_main.xml
diff --git a/templates/single-app/submission/build.gradle.kts b/templates/app-with-activity/submission/build.gradle.kts similarity index 100% rename from templates/single-app/submission/build.gradle.kts rename to templates/app-with-activity/submission/build.gradle.kts
diff --git a/templates/single-app/submission/hostTest/build.gradle.kts b/templates/app-with-activity/submission/hostTest/build.gradle.kts similarity index 100% rename from templates/single-app/submission/hostTest/build.gradle.kts rename to templates/app-with-activity/submission/hostTest/build.gradle.kts
diff --git a/templates/single-app/submission/hostTest/src/main/java/com/android/security/autorepro_placeholder/HostsideTest.java b/templates/app-with-activity/submission/hostTest/src/main/java/com/android/security/autorepro_placeholder/HostsideTest.java similarity index 100% copy from templates/single-app/submission/hostTest/src/main/java/com/android/security/autorepro_placeholder/HostsideTest.java copy to templates/app-with-activity/submission/hostTest/src/main/java/com/android/security/autorepro_placeholder/HostsideTest.java
diff --git a/templates/single-app/submission/hostTest/src/main/resources/AutoReproPlaceholder/README.md b/templates/app-with-activity/submission/hostTest/src/main/resources/AutoReproPlaceholder/README.md similarity index 100% rename from templates/single-app/submission/hostTest/src/main/resources/AutoReproPlaceholder/README.md rename to templates/app-with-activity/submission/hostTest/src/main/resources/AutoReproPlaceholder/README.md