Move reporter_test_cts.cc into a separate file

We want to run the rest of the perfetto cts tests on mainline with an
android api level 31 (S). This test requires an app that uses android
api level 33 (T). So let's move this into a separate test binary with a
separate AndroidTest.xml

Tested: atest CtsPerfettoTestCases
Tested: atest CtsPerfettoReporterTestCases

Bug: 268041903
Bug: 272300250
Change-Id: I4fcb28f36a60d45d2eac94a096e37af73a723303
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:eba5c03505728c0fcd99014709de69616ad2c76f)
Merged-In: I4fcb28f36a60d45d2eac94a096e37af73a723303
diff --git a/test/cts/Android.bp b/test/cts/Android.bp
index c5a8ed6..c05189a 100644
--- a/test/cts/Android.bp
+++ b/test/cts/Android.bp
@@ -14,7 +14,6 @@
     "end_to_end_integrationtest_cts.cc",
     "heapprofd_java_test_cts.cc",
     "heapprofd_test_cts.cc",
-    "reporter_test_cts.cc",
     "traced_perf_test_cts.cc",
     ":perfetto_protos_perfetto_config_cpp_gen",
     ":perfetto_protos_perfetto_common_cpp_gen"
@@ -59,7 +58,6 @@
         ":CtsPerfettoProducerApp",
         ":CtsPerfettoReleaseApp",
         ":CtsPerfettoDebuggableApp",
-        ":CtsPerfettoReporterApp"
   ],
   stl: "libc++_static",
   // This test is also run via Mainline Testing against the ART Mainline
diff --git a/test/cts/AndroidTest.xml b/test/cts/AndroidTest.xml
index 84e72bc..27ccef1 100644
--- a/test/cts/AndroidTest.xml
+++ b/test/cts/AndroidTest.xml
@@ -28,7 +28,6 @@
         <option name="test-file-name" value="CtsPerfettoReleaseApp.apk" />
         <option name="test-file-name" value="CtsPerfettoProfileableApp.apk" />
         <option name="test-file-name" value="CtsPerfettoNonProfileableApp.apk" />
-        <option name="test-file-name" value="CtsPerfettoReporterApp.apk" />
     </target_preparer>
     <target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher">
         <option name="cleanup" value="true" />
diff --git a/test/cts/reporter/Android.bp b/test/cts/reporter/Android.bp
new file mode 100644
index 0000000..597426c
--- /dev/null
+++ b/test/cts/reporter/Android.bp
@@ -0,0 +1,57 @@
+package {
+    // See: http://go/android-license-faq
+    // A large-scale-change added 'default_applicable_licenses' to import
+    // all of the 'license_kinds' from "external_perfetto_license"
+    // to get the below license kinds:
+    //   SPDX-license-identifier-Apache-2.0
+    default_applicable_licenses: ["external_perfetto_license"],
+}
+
+cc_test {
+  name: "CtsPerfettoReporterTestCases",
+  srcs: [
+    "reporter_test_cts.cc",
+    ":perfetto_protos_perfetto_config_cpp_gen",
+    ":perfetto_protos_perfetto_common_cpp_gen"
+  ],
+  generated_headers: [
+    "perfetto_protos_perfetto_config_cpp_gen_headers",
+    "perfetto_protos_perfetto_common_cpp_gen_headers",
+  ],
+  static_libs: [
+    "libgmock",
+    "libprotobuf-cpp-lite",
+    "libperfetto_client_experimental",
+    "perfetto_cts_deps",
+    "perfetto_trace_protos",
+  ],
+  whole_static_libs: [
+    "perfetto_gtest_logcat_printer",
+  ],
+  shared_libs: [
+    "libandroid",
+    "liblog",
+  ],
+  test_suites: [
+    "cts",
+    "vts10",
+    "general-tests",
+  ],
+  compile_multilib: "both",
+  multilib: {
+    lib32: {
+        suffix: "32",
+    },
+    lib64: {
+        suffix: "64",
+    },
+  },
+  per_testcase_directory: true,
+  data: [
+        ":CtsPerfettoReporterApp"
+  ],
+  stl: "libc++_static",
+  defaults: [
+    "perfetto_defaults",
+  ],
+}
diff --git a/test/cts/reporter/AndroidTest.xml b/test/cts/reporter/AndroidTest.xml
new file mode 100644
index 0000000..0fe8c0e
--- /dev/null
+++ b/test/cts/reporter/AndroidTest.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2023 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.
+-->
+<configuration description="Config for CTS Perfetto Reporter test cases">
+    <option name="config-descriptor:metadata" key="component" value="metrics" />
+    <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
+    <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+    <option name="test-suite-tag" value="cts" />
+    <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
+        <option name="cleanup-apks" value="true" />
+        <option name="test-file-name" value="CtsPerfettoReporterApp.apk" />
+    </target_preparer>
+    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher">
+        <option name="cleanup" value="true" />
+        <option name="push" value="CtsPerfettoReporterTestCases->/data/local/tmp/CtsPerfettoReporterTestCases" />
+        <option name="append-bitness" value="true" />
+    </target_preparer>
+    <test class="com.android.tradefed.testtype.GTest" >
+        <option name="native-test-device-path" value="/data/local/tmp" />
+        <option name="module-name" value="CtsPerfettoReporterTestCases" />
+        <option name="runtime-hint" value="0m40s" />
+        <!-- test-timeout unit is ms -->
+        <option name="native-test-timeout" value="40000" />
+    </test>
+</configuration>
diff --git a/test/cts/reporter_test_cts.cc b/test/cts/reporter/reporter_test_cts.cc
similarity index 100%
rename from test/cts/reporter_test_cts.cc
rename to test/cts/reporter/reporter_test_cts.cc