diff --git a/.prebuilt_info/prebuilt_info_packages_CtsShim_apk__riscv64_CtsShimPriv_apk.asciipb b/.prebuilt_info/prebuilt_info_packages_CtsShim_apk__riscv64_CtsShimPriv_apk.asciipb
index e89809138548d45f2f4e8a1aedbff303a4aa07af..e8e7ec9017857b983ba593e24e3a0696add87b5a 100644
--- a/.prebuilt_info/prebuilt_info_packages_CtsShim_apk__riscv64_CtsShimPriv_apk.asciipb
+++ b/.prebuilt_info/prebuilt_info_packages_CtsShim_apk__riscv64_CtsShimPriv_apk.asciipb
@@ -1,6 +1,6 @@
drops {
android_build_drop {
- build_id: "9653376"
+ build_id: "11947186"
target: "CtsShim"
source_file: "aosp_riscv64/CtsShimPriv.apk"
}
@@ -8,7 +8,7 @@ drops {
version: ""
version_group: ""
git_project: "platform/frameworks/base"
- git_branch: "master"
+ git_branch: "main"
transform: TRANSFORM_NONE
transform_options {
}
diff --git a/.prebuilt_info/prebuilt_info_packages_CtsShim_apk__riscv64_CtsShim_apk.asciipb b/.prebuilt_info/prebuilt_info_packages_CtsShim_apk__riscv64_CtsShim_apk.asciipb
index 04092366c257688325f97b71a52c6796332dc2d4..6113b6a6dc8f289875ca897a57cc8880ce690f93 100644
--- a/.prebuilt_info/prebuilt_info_packages_CtsShim_apk__riscv64_CtsShim_apk.asciipb
+++ b/.prebuilt_info/prebuilt_info_packages_CtsShim_apk__riscv64_CtsShim_apk.asciipb
@@ -1,6 +1,6 @@
drops {
android_build_drop {
- build_id: "9653376"
+ build_id: "11947186"
target: "CtsShim"
source_file: "aosp_riscv64/CtsShim.apk"
}
@@ -8,7 +8,7 @@ drops {
version: ""
version_group: ""
git_project: "platform/frameworks/base"
- git_branch: "master"
+ git_branch: "main"
transform: TRANSFORM_NONE
transform_options {
}
diff --git a/AconfigFlags.bp b/AconfigFlags.bp
index e71ded922ae66720ce11da38c0eb0ded819fbc06..403bb74e12d4af8fbb956e63be59f182916342e4 100644
--- a/AconfigFlags.bp
+++ b/AconfigFlags.bp
@@ -21,11 +21,15 @@ aconfig_declarations_group {
java_aconfig_libraries: [
// !!! KEEP THIS LIST ALPHABETICAL !!!
"aconfig_mediacodec_flags_java_lib",
+ "android-sdk-flags-java",
"android.adaptiveauth.flags-aconfig-java",
+ "android.app.appfunctions.flags-aconfig-java",
"android.app.contextualsearch.flags-aconfig-java",
"android.app.flags-aconfig-java",
+ "android.app.jank.flags-aconfig-java",
"android.app.ondeviceintelligence-aconfig-java",
"android.app.smartspace.flags-aconfig-java",
+ "android.app.supervision.flags-aconfig-java",
"android.app.usage.flags-aconfig-java",
"android.app.wearable.flags-aconfig-java",
"android.appwidget.flags-aconfig-java",
@@ -101,6 +105,9 @@ aconfig_declarations_group {
"framework-jobscheduler-job.flags-aconfig-java",
"framework_graphics_flags_java_lib",
"hwui_flags_java_lib",
+ "interaction_jank_monitor_flags_lib",
+ "libcore_exported_aconfig_flags_lib",
+ "libgui_flags_java_lib",
"power_flags_lib",
"sdk_sandbox_flags_lib",
"surfaceflinger_flags_java_lib",
@@ -151,6 +158,14 @@ java_aconfig_library {
defaults: ["framework-minus-apex-aconfig-java-defaults"],
}
+// Core Libraries / libcore
+java_aconfig_library {
+ name: "libcore_exported_aconfig_flags_lib",
+ aconfig_declarations: "libcore-aconfig-flags",
+ mode: "exported",
+ defaults: ["framework-minus-apex-aconfig-java-defaults"],
+}
+
// Telecom
java_aconfig_library {
name: "telecom_flags_core_java_lib",
@@ -173,6 +188,7 @@ cc_aconfig_library {
// Window
aconfig_declarations {
name: "com.android.window.flags.window-aconfig",
+ exportable: true,
package: "com.android.window.flags",
container: "system",
srcs: ["core/java/android/window/flags/*.aconfig"],
@@ -244,6 +260,12 @@ cc_aconfig_library {
aconfig_declarations: "com.android.text.flags-aconfig",
}
+rust_aconfig_library {
+ name: "libandroid_text_flags_rust",
+ crate_name: "android_text_flags",
+ aconfig_declarations: "com.android.text.flags-aconfig",
+}
+
// Location
aconfig_declarations {
name: "android.location.flags-aconfig",
@@ -374,6 +396,7 @@ java_aconfig_library {
min_sdk_version: "30",
apex_available: [
"//apex_available:platform",
+ "com.android.btservices",
"com.android.mediaprovider",
"com.android.permission",
],
@@ -414,6 +437,8 @@ java_aconfig_library {
cc_aconfig_library {
name: "android.companion.virtualdevice.flags-aconfig-cc",
aconfig_declarations: "android.companion.virtualdevice.flags-aconfig",
+ host_supported: true,
+ mode: "test",
}
java_aconfig_library {
@@ -426,9 +451,22 @@ aconfig_declarations {
name: "android.companion.virtualdevice.flags-aconfig",
package: "android.companion.virtualdevice.flags",
container: "system",
+ exportable: true,
srcs: ["core/java/android/companion/virtual/flags/*.aconfig"],
}
+java_aconfig_library {
+ name: "android.companion.virtualdevice.flags-aconfig-java-export",
+ aconfig_declarations: "android.companion.virtualdevice.flags-aconfig",
+ defaults: ["framework-minus-apex-aconfig-java-defaults"],
+ mode: "exported",
+ min_sdk_version: "30",
+ apex_available: [
+ "//apex_available:platform",
+ "com.android.permission",
+ ],
+}
+
java_aconfig_library {
name: "android.companion.virtual.flags-aconfig-java",
aconfig_declarations: "android.companion.virtual.flags-aconfig",
@@ -686,7 +724,7 @@ aconfig_declarations {
exportable: true,
package: "android.media.tv.flags",
container: "system",
- srcs: ["media/java/android/media/tv/flags/media_tv.aconfig"],
+ srcs: ["media/java/android/media/tv/flags/*.aconfig"],
}
java_aconfig_library {
@@ -1105,6 +1143,7 @@ cc_aconfig_library {
// Chooser / "Sharesheet"
aconfig_declarations {
name: "android.service.chooser.flags-aconfig",
+ exportable: true,
package: "android.service.chooser",
container: "system",
srcs: ["core/java/android/service/chooser/flags.aconfig"],
@@ -1206,6 +1245,21 @@ java_aconfig_library {
defaults: ["framework-minus-apex-aconfig-java-defaults"],
}
+// Supervision
+aconfig_declarations {
+ name: "android.app.supervision.flags-aconfig",
+ exportable: true,
+ package: "android.app.supervision.flags",
+ container: "system",
+ srcs: ["core/java/android/app/supervision/flags.aconfig"],
+}
+
+java_aconfig_library {
+ name: "android.app.supervision.flags-aconfig-java",
+ aconfig_declarations: "android.app.supervision.flags-aconfig",
+ defaults: ["framework-minus-apex-aconfig-java-defaults"],
+}
+
// SurfaceFlinger
java_aconfig_library {
name: "surfaceflinger_flags_java_lib",
@@ -1213,6 +1267,12 @@ java_aconfig_library {
defaults: ["framework-minus-apex-aconfig-java-defaults"],
}
+java_aconfig_library {
+ name: "libgui_flags_java_lib",
+ aconfig_declarations: "libgui_flags",
+ defaults: ["framework-minus-apex-aconfig-java-defaults"],
+}
+
// Content Capture
aconfig_declarations {
name: "android.view.contentcapture.flags-aconfig",
@@ -1372,6 +1432,33 @@ java_aconfig_library {
defaults: ["framework-minus-apex-aconfig-java-defaults"],
}
+// AppFunctions
+aconfig_declarations {
+ name: "android.app.appfunctions.flags-aconfig",
+ exportable: true,
+ package: "android.app.appfunctions.flags",
+ container: "system",
+ srcs: ["core/java/android/app/appfunctions/flags/flags.aconfig"],
+}
+
+java_aconfig_library {
+ name: "android.app.appfunctions.flags-aconfig-java",
+ aconfig_declarations: "android.app.appfunctions.flags-aconfig",
+ defaults: ["framework-minus-apex-aconfig-java-defaults"],
+}
+
+java_aconfig_library {
+ name: "android.app.appfunctions.exported-flags-aconfig-java",
+ aconfig_declarations: "android.app.appfunctions.flags-aconfig",
+ defaults: ["framework-minus-apex-aconfig-java-defaults"],
+ mode: "exported",
+ apex_available: [
+ "//apex_available:platform",
+ "com.android.permission",
+ ],
+ min_sdk_version: "30",
+}
+
// Adaptive Auth
aconfig_declarations {
name: "android.adaptiveauth.flags-aconfig",
@@ -1507,6 +1594,13 @@ java_aconfig_library {
defaults: ["framework-minus-apex-aconfig-java-defaults"],
}
+java_aconfig_library {
+ name: "backstage_power_flags_lib-host",
+ aconfig_declarations: "backstage_power_flags",
+ host_supported: true,
+ defaults: ["framework-minus-apex-aconfig-java-defaults"],
+}
+
// Dropbox data
aconfig_declarations {
name: "dropbox_flags",
@@ -1523,6 +1617,34 @@ java_aconfig_library {
defaults: ["framework-minus-apex-aconfig-java-defaults"],
}
+// Zero Jank
+aconfig_declarations {
+ name: "interaction_jank_monitor_flags",
+ package: "com.android.internal.jank",
+ container: "system",
+ srcs: ["core/java/com/android/internal/jank/flags.aconfig"],
+}
+
+java_aconfig_library {
+ name: "interaction_jank_monitor_flags_lib",
+ aconfig_declarations: "interaction_jank_monitor_flags",
+ defaults: ["framework-minus-apex-aconfig-java-defaults"],
+}
+
+// App Jank
+aconfig_declarations {
+ name: "android.app.jank.flags-aconfig",
+ package: "android.app.jank",
+ container: "system",
+ srcs: ["core/java/android/app/jank/flags.aconfig"],
+}
+
+java_aconfig_library {
+ name: "android.app.jank.flags-aconfig-java",
+ aconfig_declarations: "android.app.jank.flags-aconfig",
+ defaults: ["framework-minus-apex-aconfig-java-defaults"],
+}
+
// Trade in mode
aconfig_declarations {
name: "aconfig_trade_in_mode_flags",
diff --git a/Android.bp b/Android.bp
index d2e80034423b8c0870b296ae169118a085da78fd..e537480a376e6e18d57db07c960aa51a3753a051 100644
--- a/Android.bp
+++ b/Android.bp
@@ -97,6 +97,8 @@ filegroup {
":android.frameworks.location.altitude-V2-java-source",
":android.hardware.biometrics.common-V4-java-source",
":android.hardware.biometrics.fingerprint-V5-java-source",
+ ":android.hardware.biometrics.fingerprint.virtualhal-java-source",
+ ":android.hardware.biometrics.face.virtualhal-java-source",
":android.hardware.biometrics.face-V4-java-source",
":android.hardware.gnss-V2-java-source",
":android.hardware.graphics.common-V3-java-source",
@@ -108,7 +110,7 @@ filegroup {
":android.hardware.security.keymint-V3-java-source",
":android.hardware.security.secureclock-V1-java-source",
":android.hardware.thermal-V2-java-source",
- ":android.hardware.tv.tuner-V2-java-source",
+ ":android.hardware.tv.tuner-V3-java-source",
":android.security.apc-java-source",
":android.security.authorization-java-source",
":android.security.legacykeystore-java-source",
@@ -248,7 +250,7 @@ java_library {
"android.hardware.vibrator-V1.1-java",
"android.hardware.vibrator-V1.2-java",
"android.hardware.vibrator-V1.3-java",
- "android.hardware.vibrator-V2-java",
+ "android.hardware.vibrator-V3-java",
"android.se.omapi-V1-java",
"android.system.suspend.control.internal-java",
"devicepolicyprotosnano",
@@ -418,6 +420,7 @@ java_defaults {
"modules-utils-expresslog",
"perfetto_trace_javastream_protos_jarjar",
"libaconfig_java_proto_nano",
+ "aconfig_device_paths_java",
],
}
diff --git a/SQLITE_OWNERS b/SQLITE_OWNERS
index 1ff72e7689a7ba9cba8ed83d72e1b897aed3fcba..783a0b6f6212349e92a911e80da1d01fe4b973aa 100644
--- a/SQLITE_OWNERS
+++ b/SQLITE_OWNERS
@@ -1,2 +1,9 @@
+# Android platform SQLite owners are responsible for:
+# 1. Periodically updating libsqlite from upstream sqlite.org.
+# 2. Escalating libsqlite bug reports to upstream sqlite.org.
+# 3. Addressing bugs, performance regressions, and feature requests
+# in Android SDK SQLite wrappers (android.database.sqlite.*).
+# 4. Reviewing proposed changes to said Android SDK SQLite wrappers.
+
shayba@google.com
shombert@google.com
diff --git a/TEST_MAPPING b/TEST_MAPPING
index bdae506115e8517675aa7c43a2c6b87767a7277f..e469f167d32f6afcc5eb1bc5259f71987ac896ef 100644
--- a/TEST_MAPPING
+++ b/TEST_MAPPING
@@ -52,13 +52,20 @@
"name": "CtsStrictJavaPackagesTestCases"
}
],
- "postsubmit-ravenwood": [
+ "ravenwood-presubmit": [
{
"name": "CtsUtilTestCasesRavenwood",
"host": true,
"file_patterns": [
"[Rr]avenwood"
]
+ },
+ {
+ "name": "RavenwoodBivalentTest",
+ "host": true,
+ "file_patterns": [
+ "[Rr]avenwood"
+ ]
}
],
"postsubmit-managedprofile-stress": [
diff --git a/WEAR_OWNERS b/WEAR_OWNERS
index 4ffb239e24ceb14373c8929765edb43a6250204e..52c07e01cdbec7c210cfb0a8e7b208aa4881901f 100644
--- a/WEAR_OWNERS
+++ b/WEAR_OWNERS
@@ -12,3 +12,4 @@ nalmalki@google.com
shijianli@google.com
latkin@google.com
djsollen@google.com
+hdhabu@google.com
\ No newline at end of file
diff --git a/android-sdk-flags/Android.bp b/android-sdk-flags/Android.bp
new file mode 100644
index 0000000000000000000000000000000000000000..79a0b9a4f27300eacf0819bc1b93a6c50e0c6430
--- /dev/null
+++ b/android-sdk-flags/Android.bp
@@ -0,0 +1,30 @@
+// 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 {
+ default_applicable_licenses: ["frameworks_base_license"],
+}
+
+aconfig_declarations {
+ name: "android-sdk-flags",
+ package: "android.sdk",
+ container: "system",
+ srcs: ["flags.aconfig"],
+}
+
+java_aconfig_library {
+ name: "android-sdk-flags-java",
+ aconfig_declarations: "android-sdk-flags",
+ defaults: ["framework-minus-apex-aconfig-java-defaults"],
+}
diff --git a/android-sdk-flags/flags.aconfig b/android-sdk-flags/flags.aconfig
new file mode 100644
index 0000000000000000000000000000000000000000..cfe298e187d150fe9a63bf926797117f772af857
--- /dev/null
+++ b/android-sdk-flags/flags.aconfig
@@ -0,0 +1,12 @@
+package: "android.sdk"
+container: "system"
+
+flag {
+ name: "major_minor_versioning_scheme"
+ namespace: "android_sdk"
+ description: "Use the new SDK major.minor versioning scheme (e.g. Android 40.1) which replaces the old single-integer scheme (e.g. Android 15)."
+ bug: "350458259"
+
+ # Use is_fixed_read_only because DeviceConfig may not be available when Build.VERSION_CODES is first accessed
+ is_fixed_read_only: true
+}
diff --git a/apct-tests/perftests/core/AndroidTest.xml b/apct-tests/perftests/core/AndroidTest.xml
index 86f41e1f496c0912a66764ddc51b6db9a4bf3f1c..c2d54707d9f2d0506e0cdba4fd1c1ec61031ef3b 100644
--- a/apct-tests/perftests/core/AndroidTest.xml
+++ b/apct-tests/perftests/core/AndroidTest.xml
@@ -17,6 +17,17 @@
+ // Deal with Play Protect blocking apk installations.
+ // The first setting disables the verification, the second one lowers the timeout from
+ // 1hr to 10s, the third one resets the value after the test is complete, and the final
+ // setting skips the device reboot after modifying the settings.
+
+
+
+
+
+
+
diff --git a/apct-tests/perftests/core/src/android/app/OverlayManagerPerfTest.java b/apct-tests/perftests/core/src/android/app/OverlayManagerPerfTest.java
index fcb13a8d51f159ea137bf59afacd9f6d3d76e98d..a12121fd13f78d7928dd6293ecedfb49de370d7b 100644
--- a/apct-tests/perftests/core/src/android/app/OverlayManagerPerfTest.java
+++ b/apct-tests/perftests/core/src/android/app/OverlayManagerPerfTest.java
@@ -37,9 +37,13 @@ import org.junit.Rule;
import org.junit.Test;
import java.util.ArrayList;
-import java.util.concurrent.Executor;
-import java.util.concurrent.FutureTask;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.concurrent.Callable;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
+import java.util.stream.Stream;
/**
* Benchmarks for {@link android.content.om.OverlayManager}.
@@ -49,7 +53,6 @@ public class OverlayManagerPerfTest {
private static final int OVERLAY_PKG_COUNT = 10;
private static Context sContext;
private static OverlayManager sOverlayManager;
- private static Executor sExecutor;
private static ArrayList sSmallOverlays =
new ArrayList<>();
private static ArrayList sLargeOverlays =
@@ -58,18 +61,45 @@ public class OverlayManagerPerfTest {
@Rule
public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ // Uncheck the checked exceptions in a callable for convenient stream usage.
+ // Any exception will fail the test anyway.
+ private static T uncheck(Callable c) {
+ try {
+ return c.call();
+ } catch (RuntimeException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
@BeforeClass
public static void classSetUp() throws Exception {
sContext = InstrumentationRegistry.getTargetContext();
sOverlayManager = new OverlayManager(sContext);
- sExecutor = (command) -> new Thread(command).start();
- // Install all of the test overlays.
- TestPackageInstaller installer = new TestPackageInstaller(sContext);
+ // Install all of the test overlays. Play Protect likes to block these for 10 sec each
+ // so let's install them in parallel to speed up the wait.
+ final var installer = new TestPackageInstaller(sContext);
+ final var es = Executors.newFixedThreadPool(2 * OVERLAY_PKG_COUNT);
+ final var smallFutures = new ArrayList>(
+ OVERLAY_PKG_COUNT);
+ final var largeFutures = new ArrayList>(
+ OVERLAY_PKG_COUNT);
for (int i = 0; i < OVERLAY_PKG_COUNT; i++) {
- sSmallOverlays.add(installer.installPackage("Overlay" + i +".apk"));
- sLargeOverlays.add(installer.installPackage("LargeOverlay" + i +".apk"));
+ final var index = i;
+ smallFutures.add(es.submit(() -> installer.installPackage("Overlay" + index + ".apk")));
+ largeFutures.add(
+ es.submit(() -> installer.installPackage("LargeOverlay" + index + ".apk")));
}
+ es.shutdown();
+ assertTrue(es.awaitTermination(15 * 2 * OVERLAY_PKG_COUNT, TimeUnit.SECONDS));
+ sSmallOverlays.addAll(smallFutures.stream().map(f -> uncheck(f::get)).sorted(
+ Comparator.comparing(
+ TestPackageInstaller.InstalledPackage::getPackageName)).toList());
+ sLargeOverlays.addAll(largeFutures.stream().map(f -> uncheck(f::get)).sorted(
+ Comparator.comparing(
+ TestPackageInstaller.InstalledPackage::getPackageName)).toList());
}
@AfterClass
@@ -77,7 +107,6 @@ public class OverlayManagerPerfTest {
for (TestPackageInstaller.InstalledPackage overlay : sSmallOverlays) {
overlay.uninstall();
}
-
for (TestPackageInstaller.InstalledPackage overlay : sLargeOverlays) {
overlay.uninstall();
}
@@ -86,37 +115,39 @@ public class OverlayManagerPerfTest {
@After
public void tearDown() throws Exception {
// Disable all test overlays after each test.
- for (TestPackageInstaller.InstalledPackage overlay : sSmallOverlays) {
- assertSetEnabled(sContext, overlay.getPackageName(), false);
- }
-
- for (TestPackageInstaller.InstalledPackage overlay : sLargeOverlays) {
- assertSetEnabled(sContext, overlay.getPackageName(), false);
- }
+ assertSetEnabled(false, sContext,
+ Stream.concat(sSmallOverlays.stream(), sLargeOverlays.stream()).map(
+ p -> p.getPackageName()));
}
/**
- * Enables the overlay and waits for the APK path change sto be propagated to the context
+ * Enables the overlay and waits for the APK path changes to be propagated to the context
* AssetManager.
*/
- private void assertSetEnabled(Context context, String overlayPackage, boolean eanabled)
- throws Exception {
- sOverlayManager.setEnabled(overlayPackage, true, UserHandle.SYSTEM);
+ private void assertSetEnabled(boolean enabled, Context context, Stream packagesStream) {
+ final var overlayPackages = packagesStream.toList();
+ overlayPackages.forEach(
+ name -> sOverlayManager.setEnabled(name, enabled, UserHandle.SYSTEM));
// Wait for the overlay changes to propagate
- FutureTask task = new FutureTask<>(() -> {
- while (true) {
- for (String path : context.getAssets().getApkPaths()) {
- if (eanabled == path.contains(overlayPackage)) {
- return true;
- }
- }
+ final var endTime = System.nanoTime() + TimeUnit.SECONDS.toNanos(20);
+ final var expectedPackagesFound = enabled ? overlayPackages.size() : 0;
+ boolean assetsUpdated = false;
+ do {
+ final var packagesFound = Arrays.stream(context.getAssets().getApkPaths()).filter(
+ assetPath -> overlayPackages.stream().anyMatch(assetPath::contains)).count();
+ if (packagesFound == expectedPackagesFound) {
+ assetsUpdated = true;
+ break;
}
- });
+ Thread.yield();
+ } while (System.nanoTime() < endTime);
+ assertTrue("Failed to set state to " + enabled + " for overlays " + overlayPackages,
+ assetsUpdated);
+ }
- sExecutor.execute(task);
- assertTrue("Failed to load overlay " + overlayPackage,
- task.get(20, TimeUnit.SECONDS));
+ private void assertSetEnabled(boolean enabled, Context context, String overlayPackage) {
+ assertSetEnabled(enabled, context, Stream.of(overlayPackage));
}
@Test
@@ -124,11 +155,11 @@ public class OverlayManagerPerfTest {
String packageName = sSmallOverlays.get(0).getPackageName();
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
- assertSetEnabled(sContext, packageName, true);
+ assertSetEnabled(true, sContext, packageName);
// Disable the overlay for the next iteration of the test
state.pauseTiming();
- assertSetEnabled(sContext, packageName, false);
+ assertSetEnabled(false, sContext, packageName);
state.resumeTiming();
}
}
@@ -138,11 +169,11 @@ public class OverlayManagerPerfTest {
String packageName = sSmallOverlays.get(0).getPackageName();
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
- assertSetEnabled(sContext, packageName, true);
+ assertSetEnabled(true, sContext, packageName);
// Disable the overlay and remove the idmap for the next iteration of the test
state.pauseTiming();
- assertSetEnabled(sContext, packageName, false);
+ assertSetEnabled(false, sContext, packageName);
sOverlayManager.invalidateCachesForOverlay(packageName, UserHandle.SYSTEM);
state.resumeTiming();
}
@@ -153,11 +184,11 @@ public class OverlayManagerPerfTest {
String packageName = sLargeOverlays.get(0).getPackageName();
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
- assertSetEnabled(sContext, packageName, true);
+ assertSetEnabled(true, sContext, packageName);
// Disable the overlay and remove the idmap for the next iteration of the test
state.pauseTiming();
- assertSetEnabled(sContext, packageName, false);
+ assertSetEnabled(false, sContext, packageName);
sOverlayManager.invalidateCachesForOverlay(packageName, UserHandle.SYSTEM);
state.resumeTiming();
}
@@ -169,30 +200,28 @@ public class OverlayManagerPerfTest {
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
state.pauseTiming();
- assertSetEnabled(sContext, packageName, true);
+ assertSetEnabled(true, sContext, packageName);
state.resumeTiming();
- assertSetEnabled(sContext, packageName, false);
+ assertSetEnabled(false, sContext, packageName);
}
}
@Test
public void getStringOneSmallOverlay() throws Exception {
String packageName = sSmallOverlays.get(0).getPackageName();
- assertSetEnabled(sContext, packageName, true);
+ assertSetEnabled(true, sContext, packageName);
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
sContext.getString(R.string.short_text);
}
-
- assertSetEnabled(sContext, packageName, false);
}
@Test
public void getStringOneLargeOverlay() throws Exception {
String packageName = sLargeOverlays.get(0).getPackageName();
- assertSetEnabled(sContext, packageName, true);
+ assertSetEnabled(true, sContext, packageName);
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
@@ -200,16 +229,12 @@ public class OverlayManagerPerfTest {
sContext.getString(resId);
}
}
-
- assertSetEnabled(sContext, packageName, false);
}
@Test
public void getStringTenOverlays() throws Exception {
- // Enable all test overlays
- for (TestPackageInstaller.InstalledPackage overlay : sSmallOverlays) {
- assertSetEnabled(sContext, overlay.getPackageName(), true);
- }
+ // Enable all small test overlays
+ assertSetEnabled(true, sContext, sSmallOverlays.stream().map(p -> p.getPackageName()));
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
@@ -219,10 +244,8 @@ public class OverlayManagerPerfTest {
@Test
public void getStringLargeTenOverlays() throws Exception {
- // Enable all test overlays
- for (TestPackageInstaller.InstalledPackage overlay : sLargeOverlays) {
- assertSetEnabled(sContext, overlay.getPackageName(), true);
- }
+ // Enable all large test overlays
+ assertSetEnabled(true, sContext, sLargeOverlays.stream().map(p -> p.getPackageName()));
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
diff --git a/apct-tests/perftests/core/src/android/libcore/AdditionPerfTest.java b/apct-tests/perftests/core/src/android/libcore/AdditionPerfTest.java
index 237c747e3a6f21f3fc96903081bc8600cca86b74..80cd86cf9a5b28fb2407b33708bdb36a51fc4a3f 100644
--- a/apct-tests/perftests/core/src/android/libcore/AdditionPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/AdditionPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -34,11 +34,11 @@ import org.junit.runner.RunWith;
public class AdditionPerfTest {
@Rule
- public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
@Test
public void timeAddConstantToLocalInt() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
int result = 0;
while (state.keepRunning()) {
result += 123;
@@ -46,7 +46,7 @@ public class AdditionPerfTest {
}
@Test
public void timeAddTwoLocalInts() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
int result = 0;
int constant = 123;
while (state.keepRunning()) {
@@ -55,7 +55,7 @@ public class AdditionPerfTest {
}
@Test
public void timeAddConstantToLocalLong() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
long result = 0;
while (state.keepRunning()) {
result += 123L;
@@ -63,7 +63,7 @@ public class AdditionPerfTest {
}
@Test
public void timeAddTwoLocalLongs() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
long result = 0;
long constant = 123L;
while (state.keepRunning()) {
@@ -72,7 +72,7 @@ public class AdditionPerfTest {
}
@Test
public void timeAddConstantToLocalFloat() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
float result = 0.0f;
while (state.keepRunning()) {
result += 123.0f;
@@ -80,7 +80,7 @@ public class AdditionPerfTest {
}
@Test
public void timeAddTwoLocalFloats() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
float result = 0.0f;
float constant = 123.0f;
while (state.keepRunning()) {
@@ -89,7 +89,7 @@ public class AdditionPerfTest {
}
@Test
public void timeAddConstantToLocalDouble() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
double result = 0.0;
while (state.keepRunning()) {
result += 123.0;
@@ -97,7 +97,7 @@ public class AdditionPerfTest {
}
@Test
public void timeAddTwoLocalDoubles() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
double result = 0.0;
double constant = 123.0;
while (state.keepRunning()) {
diff --git a/apct-tests/perftests/core/src/android/libcore/ArrayCopyPerfTest.java b/apct-tests/perftests/core/src/android/libcore/ArrayCopyPerfTest.java
index 1222bc242564f6985d8eaa294177fe036dbbfd94..2f6c37832d043fbdde4550c763b500e09f20d276 100644
--- a/apct-tests/perftests/core/src/android/libcore/ArrayCopyPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/ArrayCopyPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -33,11 +33,11 @@ import java.util.Arrays;
public class ArrayCopyPerfTest {
@Rule
- public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
@Test
public void timeManualArrayCopy() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
char[] src = new char[8192];
while (state.keepRunning()) {
char[] dst = new char[8192];
@@ -49,7 +49,7 @@ public class ArrayCopyPerfTest {
@Test
public void time_System_arrayCopy() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
char[] src = new char[8192];
while (state.keepRunning()) {
char[] dst = new char[8192];
@@ -59,7 +59,7 @@ public class ArrayCopyPerfTest {
@Test
public void time_Arrays_copyOf() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
char[] src = new char[8192];
while (state.keepRunning()) {
char[] dst = Arrays.copyOf(src, 8192);
@@ -68,7 +68,7 @@ public class ArrayCopyPerfTest {
@Test
public void time_Arrays_copyOfRange() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
char[] src = new char[8192];
while (state.keepRunning()) {
char[] dst = Arrays.copyOfRange(src, 0, 8192);
diff --git a/apct-tests/perftests/core/src/android/libcore/ArrayIterationPerfTest.java b/apct-tests/perftests/core/src/android/libcore/ArrayIterationPerfTest.java
index 3f95e3e44f84e9477bc2101fa6e7f92694bc9dd3..d17add767257bcaff43eacbcbd063d7c8bcd2874 100644
--- a/apct-tests/perftests/core/src/android/libcore/ArrayIterationPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/ArrayIterationPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -38,7 +38,7 @@ public class ArrayIterationPerfTest {
}
@Rule
- public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
Foo[] mArray = new Foo[27];
{
@@ -46,7 +46,7 @@ public class ArrayIterationPerfTest {
}
@Test
public void timeArrayIteration() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
int sum = 0;
for (int i = 0; i < mArray.length; i++) {
@@ -56,7 +56,7 @@ public class ArrayIterationPerfTest {
}
@Test
public void timeArrayIterationCached() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
int sum = 0;
Foo[] localArray = mArray;
@@ -69,7 +69,7 @@ public class ArrayIterationPerfTest {
}
@Test
public void timeArrayIterationForEach() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
int sum = 0;
for (Foo a: mArray) {
diff --git a/apct-tests/perftests/core/src/android/libcore/ArrayListIterationPerfTest.java b/apct-tests/perftests/core/src/android/libcore/ArrayListIterationPerfTest.java
index 1423a13b43dc1a403c2ec56fd5b417fe73c4df7f..3a57db8f323fdeba2d82d15746d03fd894533862 100644
--- a/apct-tests/perftests/core/src/android/libcore/ArrayListIterationPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/ArrayListIterationPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -39,7 +39,7 @@ public class ArrayListIterationPerfTest {
int mSplat;
}
@Rule
- public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
ArrayList mList = new ArrayList();
{
@@ -47,7 +47,7 @@ public class ArrayListIterationPerfTest {
}
@Test
public void timeArrayListIterationIndexed() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
int sum = 0;
ArrayList list = mList;
@@ -59,7 +59,7 @@ public class ArrayListIterationPerfTest {
}
@Test
public void timeArrayListIterationForEach() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
int sum = 0;
for (Foo a : mList) {
diff --git a/apct-tests/perftests/core/src/android/libcore/BigIntegerPerfTest.java b/apct-tests/perftests/core/src/android/libcore/BigIntegerPerfTest.java
index 02831055ff561f930e8a57db75cc86c0aeef1128..3fb3bc8c0ff2cd878c37d66b7cbfb44309a71b11 100644
--- a/apct-tests/perftests/core/src/android/libcore/BigIntegerPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/BigIntegerPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -38,8 +38,7 @@ import java.math.BigInteger;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class BigIntegerPerfTest {
- @Rule
- public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
// A simple sum of products computation, mostly so we can check timing in the
// absence of any division. Computes the sum from 1 to n of ((10^prec) << 30) + 1)^2,
@@ -62,7 +61,7 @@ public class BigIntegerPerfTest {
// Execute the above rep times, optionally timing it.
@Test
public void repeatInner() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
for (int i = 10; i <= 10_000; i *= 10) {
inner(100, i);
@@ -86,7 +85,7 @@ public class BigIntegerPerfTest {
// Check results for equality, and print one, to compaare against reference.
@Test
public void repeatHarmonic1000() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
for (int i = 5; i <= 5_000; i *= 10) {
BigInteger refRes = harmonic1000(i);
@@ -107,7 +106,7 @@ public class BigIntegerPerfTest {
// us to time and check it for consistency as well.
@Test
public void repeatToString() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
for (int i = 5; i <= 5_000; i *= 10) {
BigInteger refRes = harmonic1000(i);
@@ -147,7 +146,7 @@ public class BigIntegerPerfTest {
// to compare to reference.
@Test
public void repeatEApprox() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
for (int i = 10; i <= 10_000; i *= 10) {
BigInteger refRes = eApprox(100_000, i);
@@ -166,7 +165,7 @@ public class BigIntegerPerfTest {
// Test / time modPow()
@Test
public void repeatModPow() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
for (int i = 5; i <= 500; i *= 10) {
BigInteger odd1 = BigInteger.TEN.pow(i / 2).add(BigInteger.ONE);
@@ -199,7 +198,7 @@ public class BigIntegerPerfTest {
// Test / time modInverse()
@Test
public void repeatModInverse() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
for (int i = 10; i <= 10_000; i *= 10) {
BigInteger odd1 = BigInteger.TEN.pow(i / 2).add(BigInteger.ONE);
diff --git a/apct-tests/perftests/core/src/android/libcore/BufferedZipFilePerfTest.java b/apct-tests/perftests/core/src/android/libcore/BufferedZipFilePerfTest.java
index 11ca73acd45b2ba3337f3676397608bd4e581c15..2a1b5d1cc6ce4b1ee17f01e0139bd8d14b8f8cb8 100644
--- a/apct-tests/perftests/core/src/android/libcore/BufferedZipFilePerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/BufferedZipFilePerfTest.java
@@ -16,9 +16,8 @@
package android.libcore;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
-
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -40,8 +39,7 @@ import java.util.zip.ZipOutputStream;
@RunWith(AndroidJUnit4.class)
@LargeTest
public final class BufferedZipFilePerfTest {
- @Rule
- public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
int[] mReadSize = new int[] {4, 32, 128};
int[] mCompressedSize = new int[] {128, 1024, 8192, 65536};
@@ -69,7 +67,7 @@ public final class BufferedZipFilePerfTest {
@Test
public void timeUnbufferedRead() throws Exception {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
for (int i = 0; i < mCompressedSize.length; i++) {
for (int j = 0; j < mReadSize.length; j++) {
@@ -89,7 +87,7 @@ public final class BufferedZipFilePerfTest {
@Test
public void timeBufferedRead() throws Exception {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
for (int i = 0; i < mCompressedSize.length; i++) {
for (int j = 0; j < mReadSize.length; j++) {
diff --git a/apct-tests/perftests/core/src/android/libcore/ClassLoaderResourcePerfTest.java b/apct-tests/perftests/core/src/android/libcore/ClassLoaderResourcePerfTest.java
index 0abe194b6fdb497bf62bccfe81faa7a3b979f3df..5f599ea85eb4913e40027bc1cd5350b3acafbf2b 100644
--- a/apct-tests/perftests/core/src/android/libcore/ClassLoaderResourcePerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/ClassLoaderResourcePerfTest.java
@@ -16,8 +16,8 @@
package android.libcore;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -30,8 +30,7 @@ import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class ClassLoaderResourcePerfTest {
- @Rule
- public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
private static final String EXISTENT_RESOURCE = "java/util/logging/logging.properties";
private static final String MISSING_RESOURCE = "missing_entry";
@@ -41,7 +40,7 @@ public class ClassLoaderResourcePerfTest {
ClassLoader currentClassLoader = getClass().getClassLoader();
Assert.assertNotNull(currentClassLoader.getResource(EXISTENT_RESOURCE));
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
currentClassLoader.getResource(EXISTENT_RESOURCE);
}
@@ -52,7 +51,7 @@ public class ClassLoaderResourcePerfTest {
ClassLoader currentClassLoader = getClass().getClassLoader();
Assert.assertNull(currentClassLoader.getResource(MISSING_RESOURCE));
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
currentClassLoader.getResource(MISSING_RESOURCE);
}
diff --git a/apct-tests/perftests/core/src/android/libcore/ClonePerfTest.java b/apct-tests/perftests/core/src/android/libcore/ClonePerfTest.java
index 52441d1d868e49e894607662364d3bcb20c0c2b2..ea249848daad1cf5782d020f67b7501504dcff83 100644
--- a/apct-tests/perftests/core/src/android/libcore/ClonePerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/ClonePerfTest.java
@@ -16,8 +16,8 @@
package android.libcore;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -29,8 +29,7 @@ import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class ClonePerfTest {
- @Rule
- public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static class CloneableObject implements Cloneable {
public Object clone() throws CloneNotSupportedException {
@@ -1128,7 +1127,7 @@ public class ClonePerfTest {
public void time_Object_clone() {
try {
CloneableObject o = new CloneableObject();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
o.clone();
}
@@ -1141,7 +1140,7 @@ public class ClonePerfTest {
public void time_Object_manyFieldClone() {
try {
CloneableManyFieldObject o = new CloneableManyFieldObject();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
o.clone();
}
@@ -1154,7 +1153,7 @@ public class ClonePerfTest {
public void time_Object_deepClone() {
try {
DeepCloneable o = new DeepCloneable();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
o.clone();
}
@@ -1166,7 +1165,7 @@ public class ClonePerfTest {
@Test
public void time_Array_clone() {
int[] o = new int[32];
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
o.clone();
}
@@ -1178,7 +1177,7 @@ public class ClonePerfTest {
for (int i = 0; i < o.length / 2; ++i) {
o[i] = new Object();
}
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
o.clone();
}
@@ -1190,7 +1189,7 @@ public class ClonePerfTest {
for (int i = 0; i < o.length / 2; ++i) {
o[i] = new Object();
}
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
o.clone();
}
diff --git a/apct-tests/perftests/core/src/android/libcore/DeepArrayOpsPerfTest.java b/apct-tests/perftests/core/src/android/libcore/DeepArrayOpsPerfTest.java
index e6c5aca2c330b37c908e0cf2301a517faeb3e734..82247dcee772876983b243273ee86c41d0a5769c 100644
--- a/apct-tests/perftests/core/src/android/libcore/DeepArrayOpsPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/DeepArrayOpsPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
@@ -36,8 +36,7 @@ import java.util.Collection;
@RunWith(JUnitParamsRunner.class)
@LargeTest
public class DeepArrayOpsPerfTest {
- @Rule
- public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
private Object[] mArray;
private Object[] mArray2;
@@ -100,7 +99,7 @@ public class DeepArrayOpsPerfTest {
@Parameters(method = "getData")
public void deepHashCode(int arrayLength) throws Exception {
setUp(arrayLength);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Arrays.deepHashCode(mArray);
}
@@ -110,7 +109,7 @@ public class DeepArrayOpsPerfTest {
@Parameters(method = "getData")
public void deepEquals(int arrayLength) throws Exception {
setUp(arrayLength);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Arrays.deepEquals(mArray, mArray2);
}
diff --git a/apct-tests/perftests/core/src/android/libcore/FieldAccessPerfTest.java b/apct-tests/perftests/core/src/android/libcore/FieldAccessPerfTest.java
index 378137b417e927909676f31388dc59b4a29baa67..0bebf04c6897261caba03ddb0b60761a6983d1cc 100644
--- a/apct-tests/perftests/core/src/android/libcore/FieldAccessPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/FieldAccessPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -30,8 +30,7 @@ import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class FieldAccessPerfTest {
- @Rule
- public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
private static class Inner {
public int mPublicInnerIntVal;
@@ -48,7 +47,7 @@ public class FieldAccessPerfTest {
@Test
public void timeField() {
int result = 0;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = mIntVal;
}
@@ -57,7 +56,7 @@ public class FieldAccessPerfTest {
@Test
public void timeFieldFinal() {
int result = 0;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = mFinalIntVal;
}
@@ -66,7 +65,7 @@ public class FieldAccessPerfTest {
@Test
public void timeFieldStatic() {
int result = 0;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = sStaticIntVal;
}
@@ -75,7 +74,7 @@ public class FieldAccessPerfTest {
@Test
public void timeFieldStaticFinal() {
int result = 0;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = FINAL_INT_VAL;
}
@@ -85,7 +84,7 @@ public class FieldAccessPerfTest {
public void timeFieldCached() {
int result = 0;
int cachedIntVal = this.mIntVal;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = cachedIntVal;
}
@@ -95,7 +94,7 @@ public class FieldAccessPerfTest {
public void timeFieldPrivateInnerClassPublicField() {
int result = 0;
Inner inner = new Inner();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = inner.mPublicInnerIntVal;
}
@@ -105,7 +104,7 @@ public class FieldAccessPerfTest {
public void timeFieldPrivateInnerClassProtectedField() {
int result = 0;
Inner inner = new Inner();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = inner.mProtectedInnerIntVal;
}
@@ -115,7 +114,7 @@ public class FieldAccessPerfTest {
public void timeFieldPrivateInnerClassPrivateField() {
int result = 0;
Inner inner = new Inner();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = inner.mPrivateInnerIntVal;
}
@@ -125,7 +124,7 @@ public class FieldAccessPerfTest {
public void timeFieldPrivateInnerClassPackageField() {
int result = 0;
Inner inner = new Inner();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = inner.mPackageInnerIntVal;
}
diff --git a/apct-tests/perftests/core/src/android/libcore/HashedCollectionsPerfTest.java b/apct-tests/perftests/core/src/android/libcore/HashedCollectionsPerfTest.java
index 610e8e56c951f24022004f8313801b5a50c8372a..55c1027e1addc621bec4bf80500a5bc329ea3e8e 100644
--- a/apct-tests/perftests/core/src/android/libcore/HashedCollectionsPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/HashedCollectionsPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -35,14 +35,13 @@ import java.util.concurrent.ConcurrentHashMap;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class HashedCollectionsPerfTest {
- @Rule
- public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
@Test
public void timeHashMapGet() {
HashMap map = new HashMap();
map.put("hello", "world");
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
map.get("hello");
}
@@ -54,7 +53,7 @@ public class HashedCollectionsPerfTest {
synchronized (map) {
map.put("hello", "world");
}
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
synchronized (map) {
map.get("hello");
@@ -66,7 +65,7 @@ public class HashedCollectionsPerfTest {
public void timeHashtableGet() {
Hashtable map = new Hashtable();
map.put("hello", "world");
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
map.get("hello");
}
@@ -76,7 +75,7 @@ public class HashedCollectionsPerfTest {
public void timeLinkedHashMapGet() {
LinkedHashMap map = new LinkedHashMap();
map.put("hello", "world");
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
map.get("hello");
}
@@ -86,7 +85,7 @@ public class HashedCollectionsPerfTest {
public void timeConcurrentHashMapGet() {
ConcurrentHashMap map = new ConcurrentHashMap();
map.put("hello", "world");
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
map.get("hello");
}
diff --git a/apct-tests/perftests/core/src/android/libcore/ImtConflictPerfTest.java b/apct-tests/perftests/core/src/android/libcore/ImtConflictPerfTest.java
index 40c07e05bbdee2d7d42a52fbecba5efd65756e48..da60a777352883d623bc4a6943195e5e9f8b4147 100644
--- a/apct-tests/perftests/core/src/android/libcore/ImtConflictPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/ImtConflictPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -41,8 +41,7 @@ import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class ImtConflictPerfTest {
- @Rule
- public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
@Before
public void setup() {
@@ -281,7 +280,7 @@ public class ImtConflictPerfTest {
@Test
public void timeConflictDepth01() {
C0 c0 = new C0();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
callF0(c0);
callF0(c0);
@@ -309,7 +308,7 @@ public class ImtConflictPerfTest {
@Test
public void timeConflictDepth02() {
C1 c1 = new C1();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
callF0(c1);
callF19(c1);
@@ -337,7 +336,7 @@ public class ImtConflictPerfTest {
@Test
public void timeConflictDepth03() {
C2 c2 = new C2();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
callF0(c2);
callF19(c2);
@@ -365,7 +364,7 @@ public class ImtConflictPerfTest {
@Test
public void timeConflictDepth04() {
C3 c3 = new C3();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
callF0(c3);
callF19(c3);
@@ -393,7 +392,7 @@ public class ImtConflictPerfTest {
@Test
public void timeConflictDepth05() {
C4 c4 = new C4();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
callF0(c4);
callF19(c4);
@@ -421,7 +420,7 @@ public class ImtConflictPerfTest {
@Test
public void timeConflictDepth06() {
C5 c5 = new C5();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
callF0(c5);
callF19(c5);
@@ -449,7 +448,7 @@ public class ImtConflictPerfTest {
@Test
public void timeConflictDepth07() {
C6 c6 = new C6();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
callF0(c6);
callF19(c6);
@@ -477,7 +476,7 @@ public class ImtConflictPerfTest {
@Test
public void timeConflictDepth08() {
C7 c7 = new C7();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
callF0(c7);
callF19(c7);
@@ -505,7 +504,7 @@ public class ImtConflictPerfTest {
@Test
public void timeConflictDepth09() {
C8 c8 = new C8();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
callF0(c8);
callF19(c8);
@@ -533,7 +532,7 @@ public class ImtConflictPerfTest {
@Test
public void timeConflictDepth10() {
C9 c9 = new C9();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
callF0(c9);
callF19(c9);
@@ -561,7 +560,7 @@ public class ImtConflictPerfTest {
@Test
public void timeConflictDepth11() {
C10 c10 = new C10();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
callF0(c10);
callF19(c10);
@@ -589,7 +588,7 @@ public class ImtConflictPerfTest {
@Test
public void timeConflictDepth12() {
C11 c11 = new C11();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
callF0(c11);
callF19(c11);
@@ -617,7 +616,7 @@ public class ImtConflictPerfTest {
@Test
public void timeConflictDepth13() {
C12 c12 = new C12();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
callF0(c12);
callF19(c12);
@@ -645,7 +644,7 @@ public class ImtConflictPerfTest {
@Test
public void timeConflictDepth14() {
C13 c13 = new C13();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
callF0(c13);
callF19(c13);
@@ -673,7 +672,7 @@ public class ImtConflictPerfTest {
@Test
public void timeConflictDepth15() {
C14 c14 = new C14();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
callF0(c14);
callF19(c14);
@@ -701,7 +700,7 @@ public class ImtConflictPerfTest {
@Test
public void timeConflictDepth16() {
C15 c15 = new C15();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
callF0(c15);
callF19(c15);
@@ -729,7 +728,7 @@ public class ImtConflictPerfTest {
@Test
public void timeConflictDepth17() {
C16 c16 = new C16();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
callF0(c16);
callF19(c16);
@@ -757,7 +756,7 @@ public class ImtConflictPerfTest {
@Test
public void timeConflictDepth18() {
C17 c17 = new C17();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
callF0(c17);
callF19(c17);
@@ -785,7 +784,7 @@ public class ImtConflictPerfTest {
@Test
public void timeConflictDepth19() {
C18 c18 = new C18();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
callF0(c18);
callF19(c18);
@@ -813,7 +812,7 @@ public class ImtConflictPerfTest {
@Test
public void timeConflictDepth20() {
C19 c19 = new C19();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
callF0(c19);
callF19(c19);
diff --git a/apct-tests/perftests/core/src/android/libcore/MethodInvocationPerfTest.java b/apct-tests/perftests/core/src/android/libcore/MethodInvocationPerfTest.java
index e1d0bf2f949160b912eba94ec89c6703a74cfba5..6d9d0c92ff2517e48d958057fa9be196a4c0368a 100644
--- a/apct-tests/perftests/core/src/android/libcore/MethodInvocationPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/MethodInvocationPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -30,8 +30,7 @@ import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class MethodInvocationPerfTest {
- @Rule
- public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
interface I {
void emptyInterface();
@@ -66,12 +65,12 @@ public class MethodInvocationPerfTest {
}
public void timeInternalGetter() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
new C().timeInternalGetter(state);
}
public void timeInternalFieldAccess() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
new C().timeInternalFieldAccess(state);
}
@@ -79,7 +78,7 @@ public class MethodInvocationPerfTest {
@Test
public void timeStringLength() {
int result = 0;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = "hello, world!".length();
}
@@ -88,7 +87,7 @@ public class MethodInvocationPerfTest {
@Test
public void timeEmptyStatic() {
C c = new C();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
c.emptyStatic();
}
@@ -97,7 +96,7 @@ public class MethodInvocationPerfTest {
@Test
public void timeEmptyVirtual() {
C c = new C();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
c.emptyVirtual();
}
@@ -106,7 +105,7 @@ public class MethodInvocationPerfTest {
@Test
public void timeEmptyInterface() {
I c = new C();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
c.emptyInterface();
}
@@ -139,7 +138,7 @@ public class MethodInvocationPerfTest {
@Test
public void timePrivateInnerPublicMethod() {
Inner inner = new Inner();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
inner.publicMethod();
}
@@ -148,7 +147,7 @@ public class MethodInvocationPerfTest {
@Test
public void timePrivateInnerProtectedMethod() {
Inner inner = new Inner();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
inner.protectedMethod();
}
@@ -157,7 +156,7 @@ public class MethodInvocationPerfTest {
@Test
public void timePrivateInnerPrivateMethod() {
Inner inner = new Inner();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
inner.privateMethod();
}
@@ -166,7 +165,7 @@ public class MethodInvocationPerfTest {
@Test
public void timePrivateInnerPackageMethod() {
Inner inner = new Inner();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
inner.packageMethod();
}
@@ -175,7 +174,7 @@ public class MethodInvocationPerfTest {
@Test
public void timePrivateInnerFinalPackageMethod() {
Inner inner = new Inner();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
inner.finalPackageMethod();
}
diff --git a/apct-tests/perftests/core/src/android/libcore/MultiplicationPerfTest.java b/apct-tests/perftests/core/src/android/libcore/MultiplicationPerfTest.java
index c5e9d1e1d5e42b785a5a90d08855e35eea7a8770..09b09771e9de8df7b12ef50dce40b648fcd3a267 100644
--- a/apct-tests/perftests/core/src/android/libcore/MultiplicationPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/MultiplicationPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -30,13 +30,12 @@ import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class MultiplicationPerfTest {
- @Rule
- public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
@Test
public void timeMultiplyIntByConstant10() {
int result = 1;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result *= 10;
}
@@ -45,7 +44,7 @@ public class MultiplicationPerfTest {
@Test
public void timeMultiplyIntByConstant8() {
int result = 1;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result *= 8;
}
@@ -55,7 +54,7 @@ public class MultiplicationPerfTest {
public void timeMultiplyIntByVariable10() {
int result = 1;
int factor = 10;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result *= factor;
}
@@ -65,7 +64,7 @@ public class MultiplicationPerfTest {
public void timeMultiplyIntByVariable8() {
int result = 1;
int factor = 8;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result *= factor;
}
diff --git a/apct-tests/perftests/core/src/android/libcore/ReferenceGetPerfTest.java b/apct-tests/perftests/core/src/android/libcore/ReferenceGetPerfTest.java
index d073f9163f39f64a78ae3e1a14fe4cd62338b1ad..ba21ed33bdb245f083da5a83e3a741b74f2f93a8 100644
--- a/apct-tests/perftests/core/src/android/libcore/ReferenceGetPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/ReferenceGetPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -35,8 +35,7 @@ import java.lang.reflect.Field;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class ReferenceGetPerfTest {
- @Rule
- public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
boolean mIntrinsicDisabled;
@@ -52,7 +51,7 @@ public class ReferenceGetPerfTest {
@Test
public void timeSoftReferenceGet() throws Exception {
Reference soft = new SoftReference(mObj);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Object o = soft.get();
}
@@ -61,7 +60,7 @@ public class ReferenceGetPerfTest {
@Test
public void timeWeakReferenceGet() throws Exception {
Reference weak = new WeakReference(mObj);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Object o = weak.get();
}
@@ -72,7 +71,7 @@ public class ReferenceGetPerfTest {
Reference weak = new WeakReference(mObj);
mObj = null;
Runtime.getRuntime().gc();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Object o = weak.get();
}
diff --git a/apct-tests/perftests/core/src/android/libcore/ReferencePerfTest.java b/apct-tests/perftests/core/src/android/libcore/ReferencePerfTest.java
index af13773dd17722edac2db7ddc1ebf381d75317e3..293752ee5dd130702ab99f66c1c176157a75166c 100644
--- a/apct-tests/perftests/core/src/android/libcore/ReferencePerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/ReferencePerfTest.java
@@ -16,8 +16,8 @@
package android.libcore;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -34,8 +34,7 @@ import java.util.concurrent.atomic.AtomicInteger;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class ReferencePerfTest {
- @Rule
- public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
private Object mObject;
@@ -43,7 +42,7 @@ public class ReferencePerfTest {
@Test
public void timeAlloc() {
ReferenceQueue