Merge 24Q3 (ab/11976889) to aosp-main-future

Bug: 347831320
Merged-In: Idd3360fd629347a35012c43a512feac609dba0ec
Change-Id: I16cf5c783769a0c08c6de055c19916037e35fef0
diff --git a/target_preparers/src/com/android/catbox/targetpreparer/LowPerformanceTargetPreparer.java b/target_preparers/src/com/android/catbox/targetpreparer/LowPerformanceTargetPreparer.java
new file mode 100644
index 0000000..17a24ab
--- /dev/null
+++ b/target_preparers/src/com/android/catbox/targetpreparer/LowPerformanceTargetPreparer.java
@@ -0,0 +1,177 @@
+/*
+ * Copyright (C) 2024 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.catbox.targetpreparer;
+
+import com.android.tradefed.config.Option;
+import com.android.tradefed.config.OptionClass;
+import com.android.tradefed.device.DeviceNotAvailableException;
+import com.android.tradefed.device.ITestDevice;
+import com.android.tradefed.invoker.TestInformation;
+import com.android.tradefed.log.LogUtil;
+import com.android.tradefed.result.error.InfraErrorIdentifier;
+import com.android.tradefed.targetprep.BaseTargetPreparer;
+import com.android.tradefed.targetprep.BuildError;
+import com.android.tradefed.targetprep.TargetSetupError;
+import com.android.tradefed.util.CommandResult;
+
+import java.util.Objects;
+
+/**
+ * Sets the device into a low performance state for the test duration
+ */
+@OptionClass(alias = "low-performance")
+public class LowPerformanceTargetPreparer extends BaseTargetPreparer {
+    /**
+     * An object containing strings with device info data
+     */
+    private static class OemDeviceInfo {
+        private final String mNrCpus;
+        private final String mMem;
+
+        public OemDeviceInfo(String nrCpus, String mem) {
+            mNrCpus = nrCpus;
+            mMem = mem;
+        }
+
+        @Override
+        public boolean equals(Object other) {
+            if (other instanceof OemDeviceInfo o) {
+                return o.mMem.equals(this.mMem) && o.mNrCpus.equals(this.mNrCpus);
+            }
+            return false;
+        }
+
+        @Override
+        public int hashCode() {
+            return Objects.hash(mNrCpus, mMem);
+        }
+    }
+
+    @Option(name = "nr-cpus", description = "Limit number of cores")
+    private String mNrCpus = "4";
+
+    @Option(name = "mem", description = "Limit memory in gb")
+    private String mMem = "4";
+
+    private OemDeviceInfo mLowPerformanceDeviceInfo;
+    private OemDeviceInfo mInitialDeviceInfo;
+
+    /** {@inheritDoc} */
+    @Override
+    public void setUp(TestInformation testInformation)
+            throws TargetSetupError, BuildError, DeviceNotAvailableException {
+        mLowPerformanceDeviceInfo = new OemDeviceInfo(mNrCpus, mMem);
+
+        ITestDevice device = testInformation.getDevice();
+        device.rebootIntoBootloader();
+        try {
+            mInitialDeviceInfo = getOemDeviceInfo(device);
+            executeFastbootCommand(device,
+                    String.format("oem nr-cpus %s", mLowPerformanceDeviceInfo.mNrCpus));
+            executeFastbootCommand(device,
+                    String.format("oem mem %s", mLowPerformanceDeviceInfo.mMem));
+            if (!isDeviceInLowPerformanceState(device)) {
+                throw new TargetSetupError("Device is not in a low performance state after setUp.",
+                        device.getDeviceDescriptor(),
+                        InfraErrorIdentifier.INVOCATION_CANCELLED);
+            }
+        } finally {
+            device.reboot();
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public void tearDown(TestInformation testInformation, Throwable e)
+            throws DeviceNotAvailableException {
+        ITestDevice device = testInformation.getDevice();
+        device.rebootIntoBootloader();
+        try {
+            executeFastbootCommand(device, String.format("oem mem %s", mInitialDeviceInfo.mMem));
+            executeFastbootCommand(device,
+                    String.format("oem nr-cpus %s", mInitialDeviceInfo.mNrCpus));
+            if (isDeviceInLowPerformanceState(device)) {
+                throw new TargetSetupError("Failed to reset device to the initial state.");
+            }
+        } catch (TargetSetupError exception) {
+            LogUtil.CLog.e(exception);
+            throw new DeviceNotAvailableException("Failed to reset device to the initial state.",
+                    exception,
+                    device.getSerialNumber());
+        } finally {
+            device.reboot();
+        }
+    }
+
+    private CommandResult executeFastbootCommand(ITestDevice device, String command)
+            throws DeviceNotAvailableException, TargetSetupError {
+        if (!device.isStateBootloaderOrFastbootd()) {
+            throw new TargetSetupError(
+                    "Device is not in fastboot mode",
+                    device.getDeviceDescriptor(),
+                    InfraErrorIdentifier.OPTION_CONFIGURATION_ERROR
+            );
+        }
+        LogUtil.CLog.v(String.format("Executing fastboot command: %s", command));
+        final CommandResult result = device.executeFastbootCommand(command.split("\\s+"));
+        if (result.getExitCode() != 0) {
+            throw new TargetSetupError(
+                    String.format(
+                            "Command %s failed, stdout = [%s], stderr = [%s].",
+                            command, result.getStdout(), result.getStderr()),
+                    device.getDeviceDescriptor(),
+                    InfraErrorIdentifier.OPTION_CONFIGURATION_ERROR);
+        }
+        LogUtil.CLog.v(String.format(
+                "Command %s returned: stdout = [%s], stderr = [%s].",
+                command, result.getStdout(), result.getStderr()));
+        return result;
+    }
+
+    private OemDeviceInfo getOemDeviceInfo(ITestDevice device)
+            throws DeviceNotAvailableException, TargetSetupError {
+        String mem = "";
+        String nrCpus = "";
+
+        CommandResult deviceInfoCmdResult = executeFastbootCommand(device, "oem device-info");
+        for (String line : deviceInfoCmdResult.getStderr().split("\n")) {
+            // (bootloader) Nr cpus: 4
+            // (bootloader) Mem Size: 4G
+            String[] split = line.split(": ");
+            if (split.length == 2) {
+                if (split[0].equals("(bootloader) Nr cpus")) {
+                    nrCpus = split[1];
+                }
+                if (split[0].equals("(bootloader) Mem Size")) {
+                    mem = split[1].replaceAll("\\D", "");
+                }
+            }
+        }
+        if (nrCpus.isBlank() || mem.isBlank()) {
+            throw new TargetSetupError(String.format(
+                    "Couldn't get current memory or CPU cores values. CPU: %s. Memory: %s.",
+                    nrCpus, mem), device.getDeviceDescriptor(),
+                    InfraErrorIdentifier.OPTION_CONFIGURATION_ERROR);
+        }
+        return new OemDeviceInfo(nrCpus, mem);
+    }
+
+    private boolean isDeviceInLowPerformanceState(ITestDevice device)
+            throws DeviceNotAvailableException, TargetSetupError {
+        return mLowPerformanceDeviceInfo.equals(getOemDeviceInfo(device));
+    }
+}
diff --git a/tools/catbox-common/res/config/catbox-preparer.xml b/tools/catbox-common/res/config/catbox-preparer.xml
index 21109c5..53ca96e 100644
--- a/tools/catbox-common/res/config/catbox-preparer.xml
+++ b/tools/catbox-common/res/config/catbox-preparer.xml
@@ -34,6 +34,11 @@
     <option name="set-secure-setting" key="location_mode" value="1" />
   </target_preparer>
 
+  <!-- Target Preparers - Limit resources on the device for low performance testing -->
+  <target_preparer class="com.android.catbox.targetpreparer.LowPerformanceTargetPreparer">
+    <option name="disable" value="true" />
+  </target_preparer>
+
   <!-- Target Preparers - ADB Root -->
   <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer" />
 
diff --git a/tools/catbox-tradefed/res/config/catbox-functional-admin-user-grant-permissions.xml b/tools/catbox-tradefed/res/config/catbox-functional-admin-user-grant-permissions.xml
index ea1afcd..0a7e913 100644
--- a/tools/catbox-tradefed/res/config/catbox-functional-admin-user-grant-permissions.xml
+++ b/tools/catbox-tradefed/res/config/catbox-functional-admin-user-grant-permissions.xml
@@ -20,6 +20,9 @@
   <!-- Device Preparers -->
   <include name="catbox-preparer"/>
 
+  <!-- Enable system user target preparer to run as user 0 -->
+  <option name="run-on-system-user:disable" value="false" />
+
   <!-- Plan -->
   <option name="plan" value="  functional_tests.catbox_functional_admin_user_grant_permissions
 "/>
diff --git a/tools/catbox-tradefed/res/config/catbox-performance-boot-test-common.xml b/tools/catbox-tradefed/res/config/catbox-performance-boot-test-common.xml
new file mode 100644
index 0000000..ec7a831
--- /dev/null
+++ b/tools/catbox-tradefed/res/config/catbox-performance-boot-test-common.xml
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2024 Google Inc.
+
+     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="CATBOX BootTime Target Preparer Configuration">
+  <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer" />
+    <!-- Needed to set perfetto trace property before fastboot commands -->
+    <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer" />
+    <target_preparer class="com.android.tradefed.targetprep.FastbootCommandPreparer" />
+    <!-- Needed multiple run command target preparer for running commands before/after install. -->
+    <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer" />
+    <target_preparer class="com.android.tradefed.targetprep.TestAppInstallSetup" />
+    <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer" />
+    <target_preparer class="com.android.tradefed.targetprep.InstrumentationPreparer" >
+    <option name="disable" value="true" />
+  </target_preparer>
+
+  <test class="com.android.tradefed.testtype.HostTest" >
+    <option name="class" value="android.boottime.BootTimeTest" />
+    <option name="include-filter" value="android.boottime.BootTimeTest#testSuccessiveBoots" />
+    <option name="set-option" value="boot-delay:20000" />
+    <option name="set-option"
+        value="successive-boot-prepare-cmd:am start -n com.google.android.car.setupwizard/.ExitActivity"/>
+    <option name="set-option"
+        value="successive-boot-prepare-cmd:setprop persist.aae.suw.disable_short_notice true"/>
+    <option name="set-option"
+        value="successive-boot-prepare-cmd:cmd car_service enable-feature car_evs_service"/>
+    <!-- Add an after boot delay to capture logcat entries for post processor -->
+    <option name="set-option" value="after-boot-delay:5000" />
+  </test>
+
+  <metrics_collector class="com.android.tradefed.device.metric.AtraceCollector"/>
+  <metrics_collector class="com.android.tradefed.device.metric.PerfettoPullerMetricCollector">
+    <option name="collect-on-run-ended-only" value="false" />
+  </metrics_collector>
+
+  <metric_post_processor class="com.android.tradefed.postprocessor.PerfettoGenericPostProcessor" />
+  <metric_post_processor class="com.android.tradefed.postprocessor.MetricFilePostProcessor">
+    <option name="aggregate-similar-tests" value="true" />
+  </metric_post_processor>
+  <metric_post_processor class="android.boottime.postprocessor.LogcatPostProcessor">
+    <option name="file-regex" value=".*Successive_reboots_logcat.*"/>
+    <!-- For custom boot time metrics -->
+    <option name="boot-time-pattern" key="boot_to_ble_on"
+        value="BluetoothAdapterService: updateAdapterState\(\) \- Broadcasting state BLE_ON"/>
+    <option name="boot-time-pattern" key="boot_to_carlauncher_fully_drawn"
+        value="Fully drawn com.android.car.carlauncher/.CarLauncher"/>
+    <option name="boot-time-pattern" key="boot_to_first_user_unlocked"
+        value="CarServiceHelper: Time to unlock 1st user"/>
+    <option name="boot-time-pattern" key="boot_to_maps_displayed"
+        value="Displayed com.google.android.apps.maps"/>
+    <option name="boot-time-pattern" key="boot_to_settings_fallbackhome_displayed"
+        value="Displayed com.android.car.settings/.FallbackHome"/>
+    <option name="boot-time-pattern" key="boot_to_user0_unlocked"
+        value="SystemServerTiming: SystemUserUnlock took to complete"/>
+    <option name="boot-time-pattern" key="boot_to_user10_unlocked"
+        value="SystemServerTiming: User10Unlock took to complete"/>
+    <option name="boot-time-pattern" key="boot_to_gmscore_started_experimental"
+        value="ActivityManager: Start proc \d+:com.google.android.gms/u0"/>
+    <option name="boot-time-pattern" key="boot_to_car_evs_service_started"
+        value="CAR.InitTiming: CarEvsService took to complete"/>
+  </metric_post_processor>
+  <metric_post_processor class="android.boottime.postprocessor.DmesgPostProcessor">
+    <option name="file-regex" value=".*Successive_reboots_dmesg.*"/>
+  </metric_post_processor>
+
+</configuration>
\ No newline at end of file
diff --git a/tools/catbox-tradefed/res/config/catbox-performance-cold-app-start-up-dialer.xml b/tools/catbox-tradefed/res/config/catbox-performance-cold-app-start-up-dialer.xml
index b1bf271..7cbb12a 100644
--- a/tools/catbox-tradefed/res/config/catbox-performance-cold-app-start-up-dialer.xml
+++ b/tools/catbox-tradefed/res/config/catbox-performance-cold-app-start-up-dialer.xml
@@ -42,7 +42,7 @@
   <option name="compatibility:test-arg" value="com.android.tradefed.testtype.AndroidJUnitTest:package:android.platform.test.scenario.dial" />
 
   <!-- Test -->
-  <option name="compatibility:include-filter" value="AndroidAutomotiveDialScenarioTests android.platform.test.scenario.dial.OpenAppMicrobenchmark#testOpen" />
+  <option name="compatibility:include-filter" value="AndroidAutomotiveDialScenarioTests android.platform.test.scenario.dial.OpenAppMicrobenchmark" />
 
   <!-- Test Metrics Report Options -->
   <option name="report-log-name" value="CatboxPerformanceTests" />
diff --git a/tools/catbox-tradefed/res/config/catbox-performance-cold-app-start-up-mediacenter.xml b/tools/catbox-tradefed/res/config/catbox-performance-cold-app-start-up-mediacenter.xml
index 50d39fa..4a75c5c 100644
--- a/tools/catbox-tradefed/res/config/catbox-performance-cold-app-start-up-mediacenter.xml
+++ b/tools/catbox-tradefed/res/config/catbox-performance-cold-app-start-up-mediacenter.xml
@@ -42,7 +42,7 @@
   <option name="compatibility:test-arg" value="com.android.tradefed.testtype.AndroidJUnitTest:package:android.platform.test.scenario.mediacenter" />
 
   <!-- Test -->
-  <option name="compatibility:include-filter" value="AndroidAutomotiveMediaCenterScenarioTests android.platform.test.scenario.mediacenter.OpenAppMicrobenchmark#testOpen" />
+  <option name="compatibility:include-filter" value="AndroidAutomotiveMediaCenterScenarioTests android.platform.test.scenario.mediacenter.OpenAppMicrobenchmark" />
 
   <!-- Test Metrics Report Options -->
   <option name="report-log-name" value="CatboxPerformanceTests" />
diff --git a/tools/catbox-tradefed/res/config/catbox-performance-cold-app-start-up-settings.xml b/tools/catbox-tradefed/res/config/catbox-performance-cold-app-start-up-settings.xml
index df05367..94649b6 100644
--- a/tools/catbox-tradefed/res/config/catbox-performance-cold-app-start-up-settings.xml
+++ b/tools/catbox-tradefed/res/config/catbox-performance-cold-app-start-up-settings.xml
@@ -42,7 +42,7 @@
   <option name="compatibility:test-arg" value="com.android.tradefed.testtype.AndroidJUnitTest:package:android.platform.test.scenario.settings" />
 
   <!-- Test -->
-  <option name="compatibility:include-filter" value="AndroidAutomotiveSettingsScenarioTests android.platform.test.scenario.settings.OpenAppMicrobenchmark#testOpen" />
+  <option name="compatibility:include-filter" value="AndroidAutomotiveSettingsScenarioTests android.platform.test.scenario.settings.OpenAppMicrobenchmark" />
 
   <!-- Test Metrics Report Options -->
   <option name="report-log-name" value="CatboxPerformanceTests" />
diff --git a/tools/catbox-tradefed/res/config/catbox-performance-hot-app-start-up-dialer.xml b/tools/catbox-tradefed/res/config/catbox-performance-hot-app-start-up-dialer.xml
index 32f8c08..a182b80 100644
--- a/tools/catbox-tradefed/res/config/catbox-performance-hot-app-start-up-dialer.xml
+++ b/tools/catbox-tradefed/res/config/catbox-performance-hot-app-start-up-dialer.xml
@@ -42,7 +42,7 @@
   <option name="compatibility:test-arg" value="com.android.tradefed.testtype.AndroidJUnitTest:package:android.platform.test.scenario.dial" />
 
   <!-- Test -->
-  <option name="compatibility:include-filter" value="AndroidAutomotiveDialScenarioTests android.platform.test.scenario.dial.OpenAppMicrobenchmark#testOpen" />
+  <option name="compatibility:include-filter" value="AndroidAutomotiveDialScenarioTests android.platform.test.scenario.dial.OpenAppMicrobenchmark" />
 
   <!-- Test Metrics Report Options -->
   <option name="report-log-name" value="CatboxPerformanceTests" />
diff --git a/tools/catbox-tradefed/res/config/catbox-performance-hot-app-start-up-mediacenter.xml b/tools/catbox-tradefed/res/config/catbox-performance-hot-app-start-up-mediacenter.xml
index e7e23a5..b2aa489 100644
--- a/tools/catbox-tradefed/res/config/catbox-performance-hot-app-start-up-mediacenter.xml
+++ b/tools/catbox-tradefed/res/config/catbox-performance-hot-app-start-up-mediacenter.xml
@@ -42,7 +42,7 @@
   <option name="compatibility:test-arg" value="com.android.tradefed.testtype.AndroidJUnitTest:package:android.platform.test.scenario.mediacenter" />
 
   <!-- Test -->
-  <option name="compatibility:include-filter" value="AndroidAutomotiveMediaCenterScenarioTests android.platform.test.scenario.mediacenter.OpenAppMicrobenchmark#testOpen" />
+  <option name="compatibility:include-filter" value="AndroidAutomotiveMediaCenterScenarioTests android.platform.test.scenario.mediacenter.OpenAppMicrobenchmark" />
 
   <!-- Test Metrics Report Options -->
   <option name="report-log-name" value="CatboxPerformanceTests" />
diff --git a/tools/catbox-tradefed/res/config/catbox-performance-hot-app-start-up-settings.xml b/tools/catbox-tradefed/res/config/catbox-performance-hot-app-start-up-settings.xml
index 4294da8..45b190b 100644
--- a/tools/catbox-tradefed/res/config/catbox-performance-hot-app-start-up-settings.xml
+++ b/tools/catbox-tradefed/res/config/catbox-performance-hot-app-start-up-settings.xml
@@ -42,7 +42,7 @@
   <option name="compatibility:test-arg" value="com.android.tradefed.testtype.AndroidJUnitTest:package:android.platform.test.scenario.settings" />
 
   <!-- Test -->
-  <option name="compatibility:include-filter" value="AndroidAutomotiveSettingsScenarioTests android.platform.test.scenario.settings.OpenAppMicrobenchmark#testOpen" />
+  <option name="compatibility:include-filter" value="AndroidAutomotiveSettingsScenarioTests android.platform.test.scenario.settings.OpenAppMicrobenchmark" />
 
   <!-- Test Metrics Report Options -->
   <option name="report-log-name" value="CatboxPerformanceTests" />
diff --git a/tools/catbox-tradefed/res/config/catbox-performance-jank-appgrid.xml b/tools/catbox-tradefed/res/config/catbox-performance-jank-appgrid.xml
index be24379..acf5e76 100644
--- a/tools/catbox-tradefed/res/config/catbox-performance-jank-appgrid.xml
+++ b/tools/catbox-tradefed/res/config/catbox-performance-jank-appgrid.xml
@@ -37,7 +37,7 @@
   <option name="compatibility:test-arg" value="com.android.tradefed.testtype.AndroidJUnitTest:package:android.platform.test.scenario.appgrid" />
 
   <!-- Test -->
-  <option name="compatibility:include-filter" value="AndroidAutomotiveAppGridScenarioTests android.platform.test.scenario.appgrid.ScrollMicrobenchmark#testScrollForwardAndBackward" />
+  <option name="compatibility:include-filter" value="AndroidAutomotiveAppGridScenarioTests android.platform.test.scenario.appgrid.ScrollMicrobenchmark" />
 
   <!-- Jank Package -->
   <option name="compatibility:module-arg" value="AndroidAutomotiveAppGridScenarioTests:instrumentation-arg:jank-package-names:=com.android.car.carlauncher" />
diff --git a/tools/catbox-tradefed/res/config/catbox-performance-jank-contact-list.xml b/tools/catbox-tradefed/res/config/catbox-performance-jank-contact-list.xml
index 76d0469..defd204 100644
--- a/tools/catbox-tradefed/res/config/catbox-performance-jank-contact-list.xml
+++ b/tools/catbox-tradefed/res/config/catbox-performance-jank-contact-list.xml
@@ -37,7 +37,7 @@
   <option name="compatibility:test-arg" value="com.android.tradefed.testtype.AndroidJUnitTest:package:android.platform.test.scenario.dial" />
 
   <!-- Test -->
-  <option name="compatibility:include-filter" value="AndroidAutomotiveDialScenarioTests android.platform.test.scenario.dial.ScrollContactListMicrobenchmark#testScrollDownAndUp" />
+  <option name="compatibility:include-filter" value="AndroidAutomotiveDialScenarioTests android.platform.test.scenario.dial.ScrollContactListMicrobenchmark" />
 
   <!-- Jank Package -->
   <option name="compatibility:module-arg" value="AndroidAutomotiveDialScenarioTests:instrumentation-arg:jank-package-names:=com.android.car.dialer" />
diff --git a/tools/catbox-tradefed/res/config/catbox-performance-jank-media-switch-playback.xml b/tools/catbox-tradefed/res/config/catbox-performance-jank-media-switch-playback.xml
index f0fea15..9f5af76 100644
--- a/tools/catbox-tradefed/res/config/catbox-performance-jank-media-switch-playback.xml
+++ b/tools/catbox-tradefed/res/config/catbox-performance-jank-media-switch-playback.xml
@@ -38,7 +38,7 @@
     <option name="compatibility:test-arg" value="com.android.tradefed.testtype.AndroidJUnitTest:package:android.platform.test.scenario.mediacenter" />
 
     <!-- Test -->
-    <option name="compatibility:include-filter" value="AndroidAutomotiveMediaCenterScenarioTests android.platform.test.scenario.mediacenter.SwitchPlaybackMicrobenchmark#testSwitchPlayback" />
+    <option name="compatibility:include-filter" value="AndroidAutomotiveMediaCenterScenarioTests android.platform.test.scenario.mediacenter.SwitchPlaybackMicrobenchmark" />
 
     <!-- Jank Package -->
     <option name="compatibility:module-arg" value="AndroidAutomotiveMediaCenterScenarioTests:instrumentation-arg:jank-package-names:=com.android.car.media" />
diff --git a/tools/catbox-tradefed/res/config/catbox-performance-jank-media.xml b/tools/catbox-tradefed/res/config/catbox-performance-jank-media.xml
index 4212fa3..7a0dd7d 100644
--- a/tools/catbox-tradefed/res/config/catbox-performance-jank-media.xml
+++ b/tools/catbox-tradefed/res/config/catbox-performance-jank-media.xml
@@ -37,7 +37,7 @@
   <option name="compatibility:test-arg" value="com.android.tradefed.testtype.AndroidJUnitTest:package:android.platform.test.scenario.mediacenter" />
 
   <!-- Test -->
-  <option name="compatibility:include-filter" value="AndroidAutomotiveMediaCenterScenarioTests android.platform.test.scenario.mediacenter.ScrollMicrobenchmark#testScrollDownAndUp" />
+  <option name="compatibility:include-filter" value="AndroidAutomotiveMediaCenterScenarioTests android.platform.test.scenario.mediacenter.ScrollMicrobenchmark" />
 
   <!-- Jank Package -->
   <option name="compatibility:module-arg" value="AndroidAutomotiveMediaCenterScenarioTests:instrumentation-arg:jank-package-names:=com.android.car.media" />
diff --git a/tools/catbox-tradefed/res/config/catbox-performance-jank-notifications.xml b/tools/catbox-tradefed/res/config/catbox-performance-jank-notifications.xml
index 34d1883..42266cc 100644
--- a/tools/catbox-tradefed/res/config/catbox-performance-jank-notifications.xml
+++ b/tools/catbox-tradefed/res/config/catbox-performance-jank-notifications.xml
@@ -37,7 +37,7 @@
   <option name="compatibility:test-arg" value="com.android.tradefed.testtype.AndroidJUnitTest:package:android.platform.test.scenario.notification" />
 
   <!-- Test -->
-  <option name="compatibility:include-filter" value="AndroidAutomotiveNotificationScenarioTests android.platform.test.scenario.notification.ScrollMicrobenchmark#testScrollUpAndDown" />
+  <option name="compatibility:include-filter" value="AndroidAutomotiveNotificationScenarioTests android.platform.test.scenario.notification.ScrollMicrobenchmark" />
 
   <!-- Jank Package -->
   <option name="compatibility:module-arg" value="AndroidAutomotiveNotificationScenarioTests:instrumentation-arg:jank-package-names:=com.android.systemui" />
diff --git a/tools/catbox-tradefed/res/config/catbox-performance-jank-settings.xml b/tools/catbox-tradefed/res/config/catbox-performance-jank-settings.xml
index d7f384f..688efa0 100644
--- a/tools/catbox-tradefed/res/config/catbox-performance-jank-settings.xml
+++ b/tools/catbox-tradefed/res/config/catbox-performance-jank-settings.xml
@@ -37,7 +37,7 @@
   <option name="compatibility:test-arg" value="com.android.tradefed.testtype.AndroidJUnitTest:package:android.platform.test.scenario.settings" />
 
   <!-- Test -->
-  <option name="compatibility:include-filter" value="AndroidAutomotiveSettingsScenarioTests android.platform.test.scenario.settings.ScrollInAppMicrobenchmark#testScrollDownAndUp" />
+  <option name="compatibility:include-filter" value="AndroidAutomotiveSettingsScenarioTests android.platform.test.scenario.settings.ScrollInAppMicrobenchmark" />
 
   <!-- Jank Package -->
   <option name="compatibility:module-arg" value="AndroidAutomotiveSettingsScenarioTests:instrumentation-arg:jank-package-names:=com.android.car.settings" />
diff --git a/tools/catbox-tradefed/res/config/catbox-performance-successive-boottime.xml b/tools/catbox-tradefed/res/config/catbox-performance-successive-boottime.xml
index 24be4be..95422d7 100644
--- a/tools/catbox-tradefed/res/config/catbox-performance-successive-boottime.xml
+++ b/tools/catbox-tradefed/res/config/catbox-performance-successive-boottime.xml
@@ -16,64 +16,7 @@
 
 <configuration>
     <include name="catbox-performance-base" />
-
-    <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer" />
-    <!-- Needed to set perfetto trace property before fastboot commands -->
-    <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer" />
-    <target_preparer class="com.android.tradefed.targetprep.FastbootCommandPreparer" />
-    <!-- Needed multiple run command target preparer for running commands before/after install. -->
-    <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer" />
-    <target_preparer class="com.android.tradefed.targetprep.TestAppInstallSetup" />
-    <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer" />
-    <target_preparer class="com.android.tradefed.targetprep.InstrumentationPreparer" >
-        <option name="disable" value="true" />
-    </target_preparer>
-
-    <test class="com.android.tradefed.testtype.HostTest" >
-        <option name="class" value="android.boottime.BootTimeTest" />
-        <option name="set-option" value="boot-delay:20000" />
-        <option name="set-option"
-                value="successive-boot-prepare-cmd:am start -n com.google.android.car.setupwizard/.ExitActivity"/>
-        <option name="set-option"
-                value="successive-boot-prepare-cmd:setprop persist.aae.suw.disable_short_notice true"/>
-        <option name="set-option"
-                value="successive-boot-prepare-cmd:cmd car_service enable-feature car_evs_service"/>
-    </test>
-
-    <metrics_collector class="com.android.tradefed.device.metric.AtraceCollector"/>
-    <metrics_collector class="com.android.tradefed.device.metric.PerfettoPullerMetricCollector">
-        <option name="collect-on-run-ended-only" value="false" />
-    </metrics_collector>
-
-    <metric_post_processor class="com.android.tradefed.postprocessor.PerfettoGenericPostProcessor" />
-    <metric_post_processor class="com.android.tradefed.postprocessor.MetricFilePostProcessor">
-        <option name="aggregate-similar-tests" value="true" />
-    </metric_post_processor>
-    <metric_post_processor class="android.boottime.postprocessor.LogcatPostProcessor">
-        <option name="file-regex" value=".*Successive_reboots_logcat.*"/>
-        <!-- For custom boot time metrics -->
-        <option name="boot-time-pattern" key="boot_to_ble_on"
-                value="BluetoothAdapterService: updateAdapterState\(\) \- Broadcasting state BLE_ON"/>
-        <option name="boot-time-pattern" key="boot_to_carlauncher_fully_drawn"
-                value="Fully drawn com.android.car.carlauncher/.CarLauncher"/>
-        <option name="boot-time-pattern" key="boot_to_first_user_unlocked"
-                value="CarServiceHelper: Time to unlock 1st user"/>
-        <option name="boot-time-pattern" key="boot_to_maps_displayed"
-                value="Displayed com.google.android.apps.maps"/>
-        <option name="boot-time-pattern" key="boot_to_settings_fallbackhome_displayed"
-                value="Displayed com.android.car.settings/.FallbackHome"/>
-        <option name="boot-time-pattern" key="boot_to_user0_unlocked"
-                value="SystemServerTiming: SystemUserUnlock took to complete"/>
-        <option name="boot-time-pattern" key="boot_to_user10_unlocked"
-                value="SystemServerTiming: User10Unlock took to complete"/>
-        <option name="boot-time-pattern" key="boot_to_gmscore_started_experimental"
-                value="ActivityManager: Start proc \d+:com.google.android.gms/u0"/>
-        <option name="boot-time-pattern" key="boot_to_car_evs_service_started"
-                value="CAR.InitTiming: CarEvsService took to complete"/>s
-    </metric_post_processor>
-    <metric_post_processor class="android.boottime.postprocessor.DmesgPostProcessor">
-        <option name="file-regex" value=".*Successive_reboots_dmesg.*"/>
-    </metric_post_processor>
+    <include name="catbox-performance-boot-test-common" />
 
     <!-- Artificially disabling tests in CompatibilityTestSuite -->
     <!-- See com.android.tradefed.testtype.suite.CompatibilityTestSuite:loadTests() -->