diff --git a/core/tests/bugreports/Android.bp b/core/tests/bugreports/Android.bp
index e9d5bb135e02c..1edd9623ed2d6 100644
--- a/core/tests/bugreports/Android.bp
+++ b/core/tests/bugreports/Android.bp
@@ -15,12 +15,18 @@
android_test {
name: "BugreportManagerTestCases",
srcs: ["src/**/*.java"],
+ data: [":bugreport_artifacts"],
libs: [
"android.test.runner",
"android.test.base",
],
static_libs: ["androidx.test.rules", "truth-prebuilt"],
+ test_suites: ["general-tests"],
sdk_version: "test_current",
platform_apis: true,
}
+filegroup {
+ name: "bugreport_artifacts",
+ srcs: ["config/test-sysconfig.xml"],
+}
diff --git a/core/tests/bugreports/AndroidTest.xml b/core/tests/bugreports/AndroidTest.xml
index 410ca60435838..2c2f0d69e3474 100644
--- a/core/tests/bugreports/AndroidTest.xml
+++ b/core/tests/bugreports/AndroidTest.xml
@@ -21,11 +21,16 @@
-
-
-
+
+
+
+
+
+
+
-
+
+
diff --git a/core/tests/bugreports/run.sh b/core/tests/bugreports/run.sh
deleted file mode 100755
index 0103398365389..0000000000000
--- a/core/tests/bugreports/run.sh
+++ /dev/null
@@ -1,61 +0,0 @@
-#!/bin/bash
-
-# Copyright (C) 2019 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.
-
-# Script to run bugreport unitests
-# Must run on a rooted device.
-# Must run lunch before running the script
-# Usage: ${ANDROID_BUILD_TOP}/frameworks/base/core/tests/bugreports/run.sh
-
-# NOTE: This script replaces the framework-sysconfig.xml on your device, so use with caution.
-# It tries to replace it when done, but if the script does not finish cleanly
-# (for e.g. force stopped mid-way) your device will be left in an inconsistent state.
-# Reflashing will restore the right config.
-
-TMP_SYS_CONFIG=/var/tmp/framework-sysconfig.xml
-
-if [[ -z $ANDROID_PRODUCT_OUT ]]; then
- echo "Please lunch before running this test."
- exit 0
-fi
-
-# Print every command to console.
-set -x
-
-make -j BugreportManagerTestCases &&
- adb root &&
- adb remount &&
- adb wait-for-device &&
- # Save the sysconfig file in a tmp location and push the test config in
- adb pull /system/etc/sysconfig/framework-sysconfig.xml "${TMP_SYS_CONFIG}" &&
- adb push $ANDROID_BUILD_TOP/frameworks/base/core/tests/bugreports/config/test-sysconfig.xml /system/etc/sysconfig/framework-sysconfig.xml &&
- # The test app needs to be a priv-app.
- adb push $OUT/testcases/BugreportManagerTestCases/*/BugreportManagerTestCases.apk /system/priv-app ||
- exit 1
-
-adb reboot &&
-adb wait-for-device &&
-atest BugreportManagerTest || echo "Tests FAILED!"
-
-# Restore the saved config file
-if [ -f "${TMP_SYS_CONFIG}" ]; then
- SIZE=$(stat --printf="%s" "${TMP_SYS_CONFIG}")
- if [ SIZE > 0 ]; then
- adb remount &&
- adb wait-for-device &&
- adb push "${TMP_SYS_CONFIG}" /system/etc/sysconfig/framework-sysconfig.xml &&
- rm "${TMP_SYS_CONFIG}"
- fi
-fi
diff --git a/core/tests/bugreports/src/android/server/bugreports/BugreportManagerTest.java b/core/tests/bugreports/src/com/android/os/bugreports/tests/BugreportManagerTest.java
similarity index 100%
rename from core/tests/bugreports/src/android/server/bugreports/BugreportManagerTest.java
rename to core/tests/bugreports/src/com/android/os/bugreports/tests/BugreportManagerTest.java