diff --git a/AconfigFlags.bp b/AconfigFlags.bp index df4a3e5c3b3541f1b0ded5bc688cab89bd1e63d3..0ca97898e93637d78d05c5ea17a3cfe84692df6e 100644 --- a/AconfigFlags.bp +++ b/AconfigFlags.bp @@ -20,10 +20,12 @@ 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", @@ -76,6 +78,7 @@ aconfig_declarations_group { "android.view.inputmethod.flags-aconfig-java", "android.webkit.flags-aconfig-java", "android.widget.flags-aconfig-java", + "art_exported_aconfig_flags_lib", "backstage_power_flags_lib", "backup_flags_lib", "camera_platform_flags_core_java_lib", @@ -138,6 +141,14 @@ java_defaults { libs: ["fake_device_config"], } +// ART +java_aconfig_library { + name: "art_exported_aconfig_flags_lib", + aconfig_declarations: "art-aconfig-flags", + mode: "exported", + defaults: ["framework-minus-apex-aconfig-java-defaults"], +} + // Camera java_aconfig_library { name: "camera_platform_flags_core_java_lib", @@ -1605,3 +1616,17 @@ java_aconfig_library { 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"], +} diff --git a/Android.bp b/Android.bp index f8907f3d82e89a7882e0c95256843c2d5bebfc68..5b9f2cbf2d0de2c29978f69fa722de202cca01d9 100644 --- a/Android.bp +++ b/Android.bp @@ -98,6 +98,7 @@ 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-V4-java-source", ":android.hardware.gnss-V2-java-source", ":android.hardware.graphics.common-V3-java-source", @@ -426,6 +427,7 @@ java_defaults { "modules-utils-expresslog", "perfetto_trace_javastream_protos_jarjar", "libaconfig_java_proto_nano", + "aconfig_device_paths_java", ], } diff --git a/BROADCASTS_OWNERS b/BROADCASTS_OWNERS index 01f1f8a6ba57b5e189cab73e212841854f665fcd..f0cbe46ea402ecebbfdc312cc65a5d43c3119845 100644 --- a/BROADCASTS_OWNERS +++ b/BROADCASTS_OWNERS @@ -1,5 +1,5 @@ # Bug component: 316181 -ctate@android.com -jsharkey@google.com +set noparent + sudheersai@google.com yamasani@google.com #{LAST_RESORT_SUGGESTION} 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/Android.bp b/apct-tests/perftests/core/Android.bp index 65bc8ccd12f8ce9f20acbee90725f2adbb210c1f..1e299cdf8002c97182c36e9ff0b83ab832d6715b 100644 --- a/apct-tests/perftests/core/Android.bp +++ b/apct-tests/perftests/core/Android.bp @@ -52,7 +52,7 @@ android_test { "guava", ], - libs: ["android.test.base"], + libs: ["android.test.base.stubs.system"], java_resources: [":GoogleFontDancingScript"], diff --git a/apct-tests/perftests/core/src/android/conscrypt/conscrypt/ClientSocketPerfTest.java b/apct-tests/perftests/core/src/android/conscrypt/conscrypt/ClientSocketPerfTest.java index f20b1706129b3ee38bdf2e364e14f217d7550580..3577fcdf04d6e8cebd0276ecf501a09b4ea4a450 100644 --- a/apct-tests/perftests/core/src/android/conscrypt/conscrypt/ClientSocketPerfTest.java +++ b/apct-tests/perftests/core/src/android/conscrypt/conscrypt/ClientSocketPerfTest.java @@ -194,7 +194,7 @@ public final class ClientSocketPerfTest { /** * Simple benchmark for the amount of time to send a given number of messages */ - @Test + // @Test Temporarily disabled @Parameters(method = "getParams") public void time(Config config) throws Exception { reset(); diff --git a/apct-tests/perftests/core/src/android/conscrypt/conscrypt/ServerSocketPerfTest.java b/apct-tests/perftests/core/src/android/conscrypt/conscrypt/ServerSocketPerfTest.java index af3c405eab82a51c88c1b55285bebd17abe73bf6..ac5710047db9d443921354a1e7f00f2ee7354444 100644 --- a/apct-tests/perftests/core/src/android/conscrypt/conscrypt/ServerSocketPerfTest.java +++ b/apct-tests/perftests/core/src/android/conscrypt/conscrypt/ServerSocketPerfTest.java @@ -198,7 +198,7 @@ public final class ServerSocketPerfTest { executor.awaitTermination(5, TimeUnit.SECONDS); } - @Test + // @Test Temporarily disabled @Parameters(method = "getParams") public void throughput(Config config) throws Exception { setup(config); 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 queue = new ReferenceQueue(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { new PhantomReference(mObject, queue); } @@ -53,7 +52,7 @@ public class ReferencePerfTest { @Test public void timeAllocAndEnqueue() { ReferenceQueue queue = new ReferenceQueue(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { (new PhantomReference(mObject, queue)).enqueue(); } @@ -63,7 +62,7 @@ public class ReferencePerfTest { @Test public void timeAllocEnqueueAndPoll() { ReferenceQueue queue = new ReferenceQueue(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { (new PhantomReference(mObject, queue)).enqueue(); queue.poll(); @@ -74,7 +73,7 @@ public class ReferencePerfTest { @Test public void timeAllocEnqueueAndRemove() { ReferenceQueue queue = new ReferenceQueue(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { (new PhantomReference(mObject, queue)).enqueue(); try { @@ -103,7 +102,7 @@ public class ReferencePerfTest { // Allocate a bunch of finalizable objects. int n = 0; AtomicInteger count = new AtomicInteger(0); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { n++; new FinalizableObject(count); diff --git a/apct-tests/perftests/core/src/android/libcore/SmallBigIntegerPerfTest.java b/apct-tests/perftests/core/src/android/libcore/SmallBigIntegerPerfTest.java index cf573fa6f2507acfe911945c26627839e0d002e3..528b751d15513c8147f6c680561341709f3b62c0 100644 --- a/apct-tests/perftests/core/src/android/libcore/SmallBigIntegerPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/SmallBigIntegerPerfTest.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,9 +41,7 @@ import java.util.Random; @RunWith(AndroidJUnit4.class) @LargeTest public class SmallBigIntegerPerfTest { - @Rule - public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); - + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); // We allocate about 2 1/3 BigIntegers per iteration. // Assuming 100 bytes/BigInteger, this gives us around 500MB total. static final BigInteger BIG_THREE = BigInteger.valueOf(3); @@ -53,7 +51,7 @@ public class SmallBigIntegerPerfTest { public void testSmallBigInteger() { final Random r = new Random(); BigInteger x = new BigInteger(20, r); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { // We know this converges, but the compiler doesn't. if (x.and(BigInteger.ONE).equals(BigInteger.ONE)) { diff --git a/apct-tests/perftests/core/src/android/libcore/StringDexCachePerfTest.java b/apct-tests/perftests/core/src/android/libcore/StringDexCachePerfTest.java index d28154c760679674aa4e46dbe5ecf5b805dad645..1f301acd1dc6638eb4370d494b37d79badb8cd9b 100644 --- a/apct-tests/perftests/core/src/android/libcore/StringDexCachePerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/StringDexCachePerfTest.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,14 +30,13 @@ import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) @LargeTest public class StringDexCachePerfTest { - @Rule - public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); @Test public void timeStringDexCacheAccess() { int v = 0; int count = 0; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { // Deliberately obscured to make optimizations less likely. String s = (count >= 0) ? "hello, world!" : null; diff --git a/apct-tests/perftests/core/src/android/libcore/StringIterationPerfTest.java b/apct-tests/perftests/core/src/android/libcore/StringIterationPerfTest.java index 40a8db0c5903608d9bebf385e9993ef2a28fd75b..4268325f8c648904c29b0c98b44c8502c180460b 100644 --- a/apct-tests/perftests/core/src/android/libcore/StringIterationPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/StringIterationPerfTest.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 StringIterationPerfTest { - @Rule - public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); @Test public void timeStringIteration0() { String s = "hello, world!"; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { char ch; for (int i = 0; i < s.length(); ++i) { @@ -48,7 +47,7 @@ public class StringIterationPerfTest { @Test public void timeStringIteration1() { String s = "hello, world!"; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { char ch; for (int i = 0, length = s.length(); i < length; ++i) { @@ -60,7 +59,7 @@ public class StringIterationPerfTest { @Test public void timeStringIteration2() { String s = "hello, world!"; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { char ch; char[] chars = s.toCharArray(); @@ -73,7 +72,7 @@ public class StringIterationPerfTest { @Test public void timeStringToCharArray() { String s = "hello, world!"; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { char[] chars = s.toCharArray(); } diff --git a/apct-tests/perftests/core/src/android/libcore/VirtualVersusInterfacePerfTest.java b/apct-tests/perftests/core/src/android/libcore/VirtualVersusInterfacePerfTest.java index 147ea50f3a3c0fa49f87407f883f2ab0ffe7069c..cb3d3acb337f88881e64b4d4c241245c1f7eecb7 100644 --- a/apct-tests/perftests/core/src/android/libcore/VirtualVersusInterfacePerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/VirtualVersusInterfacePerfTest.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; @@ -36,13 +36,12 @@ import java.util.Map; @RunWith(AndroidJUnit4.class) @LargeTest public class VirtualVersusInterfacePerfTest { - @Rule - public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); @Test public void timeMapPut() { Map map = new HashMap(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { map.put("hello", "world"); } @@ -51,7 +50,7 @@ public class VirtualVersusInterfacePerfTest { @Test public void timeHashMapPut() { HashMap map = new HashMap(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { map.put("hello", "world"); } diff --git a/apct-tests/perftests/core/src/android/libcore/XmlSerializePerfTest.java b/apct-tests/perftests/core/src/android/libcore/XmlSerializePerfTest.java index bb1c298c67b206744abf884fd2ef5bbf827ce878..5be8ee6e67e246b86e98ad7b30e5cbd7f6abfd70 100644 --- a/apct-tests/perftests/core/src/android/libcore/XmlSerializePerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/XmlSerializePerfTest.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.Random; @RunWith(JUnitParamsRunner.class) @LargeTest public class XmlSerializePerfTest { - @Rule - public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); private Object[] getParams() { return new Object[][] { @@ -109,7 +108,7 @@ public class XmlSerializePerfTest { private void internalTimeSerializer(Constructor ctor, int seed) throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { serializeRandomXml(ctor, seed); } diff --git a/apct-tests/perftests/core/src/android/libcore/XmlSerializerPerfTest.java b/apct-tests/perftests/core/src/android/libcore/XmlSerializerPerfTest.java index 9360a25fc86a167461c0b4ec613fee624242803e..a37b89ddf033a09bd118737b3fdecc0ba1aaccac 100644 --- a/apct-tests/perftests/core/src/android/libcore/XmlSerializerPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/XmlSerializerPerfTest.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 android.util.Xml; import androidx.test.filters.LargeTest; @@ -44,11 +44,11 @@ import java.nio.charset.StandardCharsets; public class XmlSerializerPerfTest { @Rule - public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); @Test public void timeFastSerializer_nonIndent_depth100() throws IOException { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { XmlSerializer serializer = Xml.newFastSerializer(); runTest(serializer, 100); @@ -57,7 +57,7 @@ public class XmlSerializerPerfTest { @Test public void timeFastSerializer_indent_depth100() throws IOException { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { XmlSerializer serializer = Xml.newFastSerializer(); serializer.setFeature("http://xmlpull.org/v1/doc/features.html#indent-output", true); @@ -67,7 +67,7 @@ public class XmlSerializerPerfTest { @Test public void timeKXmlSerializer_nonIndent_depth100() throws IOException { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { XmlSerializer serializer = XmlObjectFactory.newXmlSerializer(); runTest(serializer, 100); @@ -76,7 +76,7 @@ public class XmlSerializerPerfTest { @Test public void timeKXmlSerializer_indent_depth100() throws IOException { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { XmlSerializer serializer = XmlObjectFactory.newXmlSerializer(); serializer.setFeature("http://xmlpull.org/v1/doc/features.html#indent-output", true); diff --git a/apct-tests/perftests/core/src/android/libcore/ZipFilePerfTest.java b/apct-tests/perftests/core/src/android/libcore/ZipFilePerfTest.java index 03f183a01d11ce6ed486d535c235cb1ec2437c5d..ed669beae1ce40c3277f97a3e381c25d4d521d0f 100644 --- a/apct-tests/perftests/core/src/android/libcore/ZipFilePerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/ZipFilePerfTest.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; @@ -42,8 +42,7 @@ import java.util.zip.ZipOutputStream; @RunWith(JUnitParamsRunner.class) @LargeTest public class ZipFilePerfTest { - @Rule - public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); private File mFile; @@ -66,7 +65,7 @@ public class ZipFilePerfTest { @Parameters(method = "getData") public void timeZipFileOpen(int numEntries) throws Exception { setUp(numEntries); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { ZipFile zf = new ZipFile(mFile); state.pauseTiming(); diff --git a/apct-tests/perftests/core/src/android/libcore/ZipFileReadPerfTest.java b/apct-tests/perftests/core/src/android/libcore/ZipFileReadPerfTest.java index 36140611c9782d87e96bc7bd10d6ecbe19249647..d239a054fac707f56304f16c56ec415b32becbb0 100644 --- a/apct-tests/perftests/core/src/android/libcore/ZipFileReadPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/ZipFileReadPerfTest.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; @@ -44,8 +44,7 @@ import java.util.zip.ZipOutputStream; @RunWith(JUnitParamsRunner.class) @LargeTest public class ZipFileReadPerfTest { - @Rule - public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); public static Collection getData() { return Arrays.asList(new Object[][] {{1024}, {16384}, {65536}}); @@ -92,7 +91,7 @@ public class ZipFileReadPerfTest { @Parameters(method = "getData") public void timeZipFileRead(int readBufferSize) throws Exception { byte[] readBuffer = new byte[readBufferSize]; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { ZipFile zipFile = new ZipFile(mFile); for (Enumeration e = zipFile.entries(); e.hasMoreElements(); ) { diff --git a/apct-tests/perftests/core/src/android/libcore/regression/AnnotatedElementPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/AnnotatedElementPerfTest.java index 8890f51fe5cd8e40aad16bac365c65e04235a94f..487295c03c0e00b0418b85aa21dbf074922c30c4 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/AnnotatedElementPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/AnnotatedElementPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -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.Method; @RunWith(AndroidJUnit4.class) @LargeTest public class AnnotatedElementPerfTest { - @Rule - public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); private Class mType; private Field mField; @@ -53,7 +52,7 @@ public class AnnotatedElementPerfTest { @Test public void timeGetTypeAnnotations() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mType.getAnnotations(); } @@ -61,7 +60,7 @@ public class AnnotatedElementPerfTest { @Test public void timeGetFieldAnnotations() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mField.getAnnotations(); } @@ -69,7 +68,7 @@ public class AnnotatedElementPerfTest { @Test public void timeGetMethodAnnotations() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mMethod.getAnnotations(); } @@ -77,7 +76,7 @@ public class AnnotatedElementPerfTest { @Test public void timeGetParameterAnnotations() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mMethod.getParameterAnnotations(); } @@ -85,7 +84,7 @@ public class AnnotatedElementPerfTest { @Test public void timeGetTypeAnnotation() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mType.getAnnotation(Marker.class); } @@ -93,7 +92,7 @@ public class AnnotatedElementPerfTest { @Test public void timeGetFieldAnnotation() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mField.getAnnotation(Marker.class); } @@ -101,7 +100,7 @@ public class AnnotatedElementPerfTest { @Test public void timeGetMethodAnnotation() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mMethod.getAnnotation(Marker.class); } @@ -109,7 +108,7 @@ public class AnnotatedElementPerfTest { @Test public void timeIsTypeAnnotationPresent() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mType.isAnnotationPresent(Marker.class); } @@ -117,7 +116,7 @@ public class AnnotatedElementPerfTest { @Test public void timeIsFieldAnnotationPresent() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mField.isAnnotationPresent(Marker.class); } @@ -125,7 +124,7 @@ public class AnnotatedElementPerfTest { @Test public void timeIsMethodAnnotationPresent() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mMethod.isAnnotationPresent(Marker.class); } @@ -135,7 +134,7 @@ public class AnnotatedElementPerfTest { @Test public void timeGetAllReturnsLargeAnnotation() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { HasLargeAnnotation.class.getAnnotations(); } @@ -143,7 +142,7 @@ public class AnnotatedElementPerfTest { @Test public void timeGetAllReturnsSmallAnnotation() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { HasSmallAnnotation.class.getAnnotations(); } @@ -151,7 +150,7 @@ public class AnnotatedElementPerfTest { @Test public void timeGetAllReturnsMarkerAnnotation() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { HasMarkerAnnotation.class.getAnnotations(); } @@ -159,7 +158,7 @@ public class AnnotatedElementPerfTest { @Test public void timeGetAllReturnsNoAnnotation() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { HasNoAnnotations.class.getAnnotations(); } @@ -167,7 +166,7 @@ public class AnnotatedElementPerfTest { @Test public void timeGetAllReturnsThreeAnnotations() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { HasThreeAnnotations.class.getAnnotations(); } @@ -177,7 +176,7 @@ public class AnnotatedElementPerfTest { @Test public void timeGetAnnotationsOnSubclass() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { ExtendsHasThreeAnnotations.class.getAnnotations(); } @@ -185,7 +184,7 @@ public class AnnotatedElementPerfTest { @Test public void timeGetDeclaredAnnotationsOnSubclass() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { ExtendsHasThreeAnnotations.class.getDeclaredAnnotations(); } @@ -195,7 +194,7 @@ public class AnnotatedElementPerfTest { @Test public void timeGetDeclaredClasses() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { AnnotatedElementPerfTest.class.getDeclaredClasses(); } @@ -203,7 +202,7 @@ public class AnnotatedElementPerfTest { @Test public void timeGetDeclaringClass() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { HasSmallAnnotation.class.getDeclaringClass(); } @@ -212,7 +211,7 @@ public class AnnotatedElementPerfTest { @Test public void timeGetEnclosingClass() { Object anonymousClass = new Object() {}; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { anonymousClass.getClass().getEnclosingClass(); } @@ -221,7 +220,7 @@ public class AnnotatedElementPerfTest { @Test public void timeGetEnclosingConstructor() { Object anonymousClass = new Object() {}; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { anonymousClass.getClass().getEnclosingConstructor(); } @@ -230,7 +229,7 @@ public class AnnotatedElementPerfTest { @Test public void timeGetEnclosingMethod() { Object anonymousClass = new Object() {}; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { anonymousClass.getClass().getEnclosingMethod(); } @@ -238,7 +237,7 @@ public class AnnotatedElementPerfTest { @Test public void timeGetModifiers() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { HasSmallAnnotation.class.getModifiers(); } @@ -246,7 +245,7 @@ public class AnnotatedElementPerfTest { @Test public void timeGetSimpleName() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { HasSmallAnnotation.class.getSimpleName(); } @@ -255,7 +254,7 @@ public class AnnotatedElementPerfTest { @Test public void timeIsAnonymousClass() { Object anonymousClass = new Object() {}; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { anonymousClass.getClass().isAnonymousClass(); } @@ -263,7 +262,7 @@ public class AnnotatedElementPerfTest { @Test public void timeIsLocalClass() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { HasSmallAnnotation.class.isLocalClass(); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/BidiPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/BidiPerfTest.java index baab8602b26556289ceb4f8b574ea168ad083c94..adc5d8c2bb3ec116db18ec0674a9b15ca0ca9d62 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/BidiPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/BidiPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -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,14 +34,14 @@ import java.text.DecimalFormat; @RunWith(AndroidJUnit4.class) @LargeTest public class BidiPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); private static final AttributedCharacterIterator CHAR_ITER = DecimalFormat.getInstance().formatToCharacterIterator(new BigDecimal(Math.PI)); @Test public void time_createBidiFromIter() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Bidi bidi = new Bidi(CHAR_ITER); } @@ -49,7 +49,7 @@ public class BidiPerfTest { @Test public void time_createBidiFromCharArray() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Bidi bd = new Bidi( @@ -64,7 +64,7 @@ public class BidiPerfTest { @Test public void time_createBidiFromString() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Bidi bidi = new Bidi("Hello", Bidi.DIRECTION_LEFT_TO_RIGHT); } @@ -72,7 +72,7 @@ public class BidiPerfTest { @Test public void time_reorderVisually() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Bidi.reorderVisually( new byte[] {2, 1, 3, 0, 4}, 0, new String[] {"H", "e", "l", "l", "o"}, 0, 5); @@ -81,7 +81,7 @@ public class BidiPerfTest { @Test public void time_hebrewBidi() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Bidi bd = new Bidi( @@ -104,7 +104,7 @@ public class BidiPerfTest { @Test public void time_complicatedOverrideBidi() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Bidi bd = new Bidi( @@ -119,7 +119,7 @@ public class BidiPerfTest { @Test public void time_requiresBidi() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Bidi.requiresBidi("\u05D0".toCharArray(), 1, 1); // false. Bidi.requiresBidi("\u05D0".toCharArray(), 0, 1); // true. diff --git a/apct-tests/perftests/core/src/android/libcore/regression/BigIntegerPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/BigIntegerPerfTest.java index 8a539f89d3ca050be5ce884afe984e189021ee86..286d70339c5f50ab1a830a52c4185a7fe4fca37b 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/BigIntegerPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/BigIntegerPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -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; @@ -32,14 +32,14 @@ import java.util.Random; @RunWith(AndroidJUnit4.class) @LargeTest public class BigIntegerPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); @Test public void timeRandomDivision() throws Exception { Random r = new Random(); BigInteger x = new BigInteger(1024, r); BigInteger y = new BigInteger(1024, r); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x.divide(y); } @@ -50,7 +50,7 @@ public class BigIntegerPerfTest { Random r = new Random(); BigInteger x = new BigInteger(1024, r); BigInteger y = new BigInteger(1024, r); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x.gcd(y); } @@ -61,7 +61,7 @@ public class BigIntegerPerfTest { Random r = new Random(); BigInteger x = new BigInteger(1024, r); BigInteger y = new BigInteger(1024, r); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x.multiply(y); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/BitSetPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/BitSetPerfTest.java index 1b46ff4f433ac954e66e1d67ecf4ee6eee469c57..d6462024a380a0166f1b37b44466b0f36e58dee2 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/BitSetPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/BitSetPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; @@ -35,7 +35,7 @@ import java.util.Collection; @RunWith(JUnitParamsRunner.class) @LargeTest public class BitSetPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); public static Collection getData() { return Arrays.asList(new Object[][] {{1000}, {10000}}); @@ -45,7 +45,7 @@ public class BitSetPerfTest { @Parameters(method = "getData") public void timeIsEmptyTrue(int size) { BitSet bitSet = new BitSet(size); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { if (!bitSet.isEmpty()) throw new RuntimeException(); } @@ -56,7 +56,7 @@ public class BitSetPerfTest { public void timeIsEmptyFalse(int size) { BitSet bitSet = new BitSet(size); bitSet.set(bitSet.size() - 1); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { if (bitSet.isEmpty()) throw new RuntimeException(); } @@ -66,7 +66,7 @@ public class BitSetPerfTest { @Parameters(method = "getData") public void timeGet(int size) { BitSet bitSet = new BitSet(size); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); int i = 1; while (state.keepRunning()) { bitSet.get(++i % size); @@ -77,7 +77,7 @@ public class BitSetPerfTest { @Parameters(method = "getData") public void timeClear(int size) { BitSet bitSet = new BitSet(size); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); int i = 1; while (state.keepRunning()) { bitSet.clear(++i % size); @@ -89,7 +89,7 @@ public class BitSetPerfTest { public void timeSet(int size) { BitSet bitSet = new BitSet(size); int i = 1; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { bitSet.set(++i % size); } @@ -100,7 +100,7 @@ public class BitSetPerfTest { public void timeSetOn(int size) { BitSet bitSet = new BitSet(size); int i = 1; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { bitSet.set(++i % size, true); } @@ -111,7 +111,7 @@ public class BitSetPerfTest { public void timeSetOff(int size) { BitSet bitSet = new BitSet(size); int i = 1; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { bitSet.set(++i % size, false); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/BreakIteratorPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/BreakIteratorPerfTest.java index 3c5e4fd159c8677db6f8902b5827c3a3c3d6bd05..b887f40334622dbea82931215f991a54bc642bb7 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/BreakIteratorPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/BreakIteratorPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -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,7 +36,7 @@ import java.util.Locale; @RunWith(JUnitParamsRunner.class) @LargeTest public final class BreakIteratorPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); public enum Text { LIPSUM( @@ -165,7 +165,7 @@ public final class BreakIteratorPerfTest { @Test @Parameters(method = "getData") public void timeBreakIterator(Text text) { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { BreakIterator it = BreakIterator.getLineInstance(text.mLocale); it.setText(text.mText); @@ -179,7 +179,7 @@ public final class BreakIteratorPerfTest { @Test @Parameters(method = "getData") public void timeIcuBreakIterator(Text text) { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { android.icu.text.BreakIterator it = android.icu.text.BreakIterator.getLineInstance(text.mLocale); diff --git a/apct-tests/perftests/core/src/android/libcore/regression/BulkPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/BulkPerfTest.java index 6df67bccae0675f95bb0cd1d00a77f1568a9fcd2..e4eaf12e9dcb8f37ce431abe5c21e3b03561b4f7 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/BulkPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/BulkPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; @@ -39,7 +39,7 @@ import java.util.Collection; @RunWith(JUnitParamsRunner.class) @LargeTest public class BulkPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); public static Collection getData() { return Arrays.asList( @@ -120,7 +120,7 @@ public class BulkPerfTest { throws Exception { ByteBuffer src = BulkPerfTest.newBuffer(align, sBuf, size); ByteBuffer data = BulkPerfTest.newBuffer(align, dBuf, size); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { src.position(align ? 0 : 1); data.position(align ? 0 : 1); diff --git a/apct-tests/perftests/core/src/android/libcore/regression/ByteBufferPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/ByteBufferPerfTest.java index f01ac0247908be5a9b79532d40759c713a7ab99e..42e3910aab4b1596f735c02cd0258337f06b875a 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/ByteBufferPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/ByteBufferPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; @@ -46,7 +46,7 @@ import java.util.Collection; @RunWith(JUnitParamsRunner.class) @LargeTest public class ByteBufferPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); public enum MyByteOrder { BIG(ByteOrder.BIG_ENDIAN), @@ -121,7 +121,7 @@ public class ByteBufferPerfTest { public void timeByteBuffer_getByte( MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception { ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { src.position(aligned ? 0 : 1); for (int i = 0; i < 1024; ++i) { @@ -136,7 +136,7 @@ public class ByteBufferPerfTest { MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception { ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType); byte[] dst = new byte[1024]; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { for (int i = 0; i < 1024; ++i) { src.position(aligned ? 0 : 1); @@ -150,7 +150,7 @@ public class ByteBufferPerfTest { public void timeByteBuffer_getByte_indexed( MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception { ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { src.position(aligned ? 0 : 1); for (int i = 0; i < 1024; ++i) { @@ -164,7 +164,7 @@ public class ByteBufferPerfTest { public void timeByteBuffer_getChar( MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception { ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { src.position(aligned ? 0 : 1); for (int i = 0; i < 1024; ++i) { @@ -180,7 +180,7 @@ public class ByteBufferPerfTest { CharBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType).asCharBuffer(); char[] dst = new char[1024]; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { for (int i = 0; i < 1024; ++i) { src.position(0); @@ -194,7 +194,7 @@ public class ByteBufferPerfTest { public void timeByteBuffer_getChar_indexed( MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception { ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { src.position(aligned ? 0 : 1); for (int i = 0; i < 1024; ++i) { @@ -208,7 +208,7 @@ public class ByteBufferPerfTest { public void timeByteBuffer_getDouble( MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception { ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { src.position(aligned ? 0 : 1); for (int i = 0; i < 1024; ++i) { @@ -224,7 +224,7 @@ public class ByteBufferPerfTest { DoubleBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType).asDoubleBuffer(); double[] dst = new double[1024]; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { for (int i = 0; i < 1024; ++i) { src.position(0); @@ -238,7 +238,7 @@ public class ByteBufferPerfTest { public void timeByteBuffer_getFloat( MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception { ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { src.position(aligned ? 0 : 1); for (int i = 0; i < 1024; ++i) { @@ -254,7 +254,7 @@ public class ByteBufferPerfTest { FloatBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType).asFloatBuffer(); float[] dst = new float[1024]; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { for (int i = 0; i < 1024; ++i) { src.position(0); @@ -268,7 +268,7 @@ public class ByteBufferPerfTest { public void timeByteBuffer_getInt( MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception { ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { src.position(aligned ? 0 : 1); for (int i = 0; i < 1024; ++i) { @@ -283,7 +283,7 @@ public class ByteBufferPerfTest { MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception { IntBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType).asIntBuffer(); int[] dst = new int[1024]; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { for (int i = 0; i < 1024; ++i) { src.position(0); @@ -297,7 +297,7 @@ public class ByteBufferPerfTest { public void timeByteBuffer_getLong( MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception { ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { src.position(aligned ? 0 : 1); for (int i = 0; i < 1024; ++i) { @@ -313,7 +313,7 @@ public class ByteBufferPerfTest { LongBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType).asLongBuffer(); long[] dst = new long[1024]; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { for (int i = 0; i < 1024; ++i) { src.position(0); @@ -327,7 +327,7 @@ public class ByteBufferPerfTest { public void timeByteBuffer_getShort( MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception { ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { src.position(aligned ? 0 : 1); for (int i = 0; i < 1024; ++i) { @@ -343,7 +343,7 @@ public class ByteBufferPerfTest { ShortBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType).asShortBuffer(); short[] dst = new short[1024]; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { for (int i = 0; i < 1024; ++i) { src.position(0); @@ -361,7 +361,7 @@ public class ByteBufferPerfTest { public void timeByteBuffer_putByte( MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception { ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { src.position(0); for (int i = 0; i < 1024; ++i) { @@ -376,7 +376,7 @@ public class ByteBufferPerfTest { MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception { ByteBuffer dst = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType); byte[] src = new byte[1024]; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { for (int i = 0; i < 1024; ++i) { dst.position(aligned ? 0 : 1); @@ -390,7 +390,7 @@ public class ByteBufferPerfTest { public void timeByteBuffer_putChar( MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception { ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { src.position(aligned ? 0 : 1); for (int i = 0; i < 1024; ++i) { @@ -406,7 +406,7 @@ public class ByteBufferPerfTest { CharBuffer dst = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType).asCharBuffer(); char[] src = new char[1024]; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { for (int i = 0; i < 1024; ++i) { dst.position(0); @@ -420,7 +420,7 @@ public class ByteBufferPerfTest { public void timeByteBuffer_putDouble( MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception { ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { src.position(aligned ? 0 : 1); for (int i = 0; i < 1024; ++i) { @@ -436,7 +436,7 @@ public class ByteBufferPerfTest { DoubleBuffer dst = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType).asDoubleBuffer(); double[] src = new double[1024]; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { for (int i = 0; i < 1024; ++i) { dst.position(0); @@ -450,7 +450,7 @@ public class ByteBufferPerfTest { public void timeByteBuffer_putFloat( MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception { ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { src.position(aligned ? 0 : 1); for (int i = 0; i < 1024; ++i) { @@ -466,7 +466,7 @@ public class ByteBufferPerfTest { FloatBuffer dst = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType).asFloatBuffer(); float[] src = new float[1024]; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { for (int i = 0; i < 1024; ++i) { dst.position(0); @@ -480,7 +480,7 @@ public class ByteBufferPerfTest { public void timeByteBuffer_putInt( MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception { ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { src.position(aligned ? 0 : 1); for (int i = 0; i < 1024; ++i) { @@ -495,7 +495,7 @@ public class ByteBufferPerfTest { MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception { IntBuffer dst = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType).asIntBuffer(); int[] src = new int[1024]; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { for (int i = 0; i < 1024; ++i) { dst.position(0); @@ -509,7 +509,7 @@ public class ByteBufferPerfTest { public void timeByteBuffer_putLong( MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception { ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { src.position(aligned ? 0 : 1); for (int i = 0; i < 1024; ++i) { @@ -525,7 +525,7 @@ public class ByteBufferPerfTest { LongBuffer dst = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType).asLongBuffer(); long[] src = new long[1024]; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { for (int i = 0; i < 1024; ++i) { dst.position(0); @@ -539,7 +539,7 @@ public class ByteBufferPerfTest { public void timeByteBuffer_putShort( MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception { ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { src.position(aligned ? 0 : 1); for (int i = 0; i < 1024; ++i) { @@ -555,7 +555,7 @@ public class ByteBufferPerfTest { ShortBuffer dst = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType).asShortBuffer(); short[] src = new short[1024]; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { for (int i = 0; i < 1024; ++i) { dst.position(0); @@ -566,7 +566,7 @@ public class ByteBufferPerfTest { @Test public void time_new_byteArray() throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { byte[] bs = new byte[8192]; } @@ -574,7 +574,7 @@ public class ByteBufferPerfTest { @Test public void time_ByteBuffer_allocate() throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { ByteBuffer bs = ByteBuffer.allocate(8192); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/ByteBufferScalarVersusVectorPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/ByteBufferScalarVersusVectorPerfTest.java index 8c318cd0a29818f624da78c991589555e9680c90..9ee927cfc353df38c4065073c85b5a4284299d58 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/ByteBufferScalarVersusVectorPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/ByteBufferScalarVersusVectorPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; @@ -35,7 +35,7 @@ import java.util.Collection; @RunWith(JUnitParamsRunner.class) @LargeTest public class ByteBufferScalarVersusVectorPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); public static Collection getData() { return Arrays.asList( @@ -112,7 +112,7 @@ public class ByteBufferScalarVersusVectorPerfTest { throws Exception { ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType); ByteBuffer dst = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { src.position(0); dst.position(0); @@ -127,7 +127,7 @@ public class ByteBufferScalarVersusVectorPerfTest { public void timeByteBufferBulkGet(boolean aligned) throws Exception { ByteBuffer src = ByteBuffer.allocate(aligned ? 8192 : 8192 + 1); byte[] dst = new byte[8192]; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { src.position(aligned ? 0 : 1); src.get(dst, 0, dst.length); @@ -139,7 +139,7 @@ public class ByteBufferScalarVersusVectorPerfTest { public void timeDirectByteBufferBulkGet(boolean aligned) throws Exception { ByteBuffer src = ByteBuffer.allocateDirect(aligned ? 8192 : 8192 + 1); byte[] dst = new byte[8192]; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { src.position(aligned ? 0 : 1); src.get(dst, 0, dst.length); diff --git a/apct-tests/perftests/core/src/android/libcore/regression/CharacterPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/CharacterPerfTest.java index 12c1f8cca0ecb9d7cfde22a7f93bc58d717281be..e4a4db739235bcf8909e3a429c1446853927dc55 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/CharacterPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/CharacterPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; @@ -38,7 +38,7 @@ import java.util.Collection; @RunWith(JUnitParamsRunner.class) @LargeTest public class CharacterPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); public static Collection getData() { return Arrays.asList( @@ -84,7 +84,7 @@ public class CharacterPerfTest { public void timeIsSpace(CharacterSet characterSet, Overload overload) { setUp(characterSet); boolean fake = false; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); if (overload == Overload.CHAR) { while (state.keepRunning()) { for (int ch = 0; ch < 65536; ++ch) { @@ -104,7 +104,7 @@ public class CharacterPerfTest { @Parameters(method = "getData") public void timeDigit(CharacterSet characterSet, Overload overload) { setUp(characterSet); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); if (overload == Overload.CHAR) { while (state.keepRunning()) { for (int ch = 0; ch < 65536; ++ch) { @@ -124,7 +124,7 @@ public class CharacterPerfTest { @Parameters(method = "getData") public void timeGetNumericValue(CharacterSet characterSet, Overload overload) { setUp(characterSet); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); if (overload == Overload.CHAR) { while (state.keepRunning()) { for (int ch = 0; ch < 65536; ++ch) { @@ -144,7 +144,7 @@ public class CharacterPerfTest { @Parameters(method = "getData") public void timeIsDigit(CharacterSet characterSet, Overload overload) { setUp(characterSet); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); if (overload == Overload.CHAR) { while (state.keepRunning()) { for (int ch = 0; ch < 65536; ++ch) { @@ -164,7 +164,7 @@ public class CharacterPerfTest { @Parameters(method = "getData") public void timeIsIdentifierIgnorable(CharacterSet characterSet, Overload overload) { setUp(characterSet); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); if (overload == Overload.CHAR) { while (state.keepRunning()) { for (int ch = 0; ch < 65536; ++ch) { @@ -184,7 +184,7 @@ public class CharacterPerfTest { @Parameters(method = "getData") public void timeIsJavaIdentifierPart(CharacterSet characterSet, Overload overload) { setUp(characterSet); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); if (overload == Overload.CHAR) { while (state.keepRunning()) { for (int ch = 0; ch < 65536; ++ch) { @@ -204,7 +204,7 @@ public class CharacterPerfTest { @Parameters(method = "getData") public void timeIsJavaIdentifierStart(CharacterSet characterSet, Overload overload) { setUp(characterSet); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); if (overload == Overload.CHAR) { while (state.keepRunning()) { for (int ch = 0; ch < 65536; ++ch) { @@ -224,7 +224,7 @@ public class CharacterPerfTest { @Parameters(method = "getData") public void timeIsLetter(CharacterSet characterSet, Overload overload) { setUp(characterSet); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); if (overload == Overload.CHAR) { while (state.keepRunning()) { for (int ch = 0; ch < 65536; ++ch) { @@ -244,7 +244,7 @@ public class CharacterPerfTest { @Parameters(method = "getData") public void timeIsLetterOrDigit(CharacterSet characterSet, Overload overload) { setUp(characterSet); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); if (overload == Overload.CHAR) { while (state.keepRunning()) { for (int ch = 0; ch < 65536; ++ch) { @@ -264,7 +264,7 @@ public class CharacterPerfTest { @Parameters(method = "getData") public void timeIsLowerCase(CharacterSet characterSet, Overload overload) { setUp(characterSet); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); if (overload == Overload.CHAR) { while (state.keepRunning()) { for (int ch = 0; ch < 65536; ++ch) { @@ -284,7 +284,7 @@ public class CharacterPerfTest { @Parameters(method = "getData") public void timeIsSpaceChar(CharacterSet characterSet, Overload overload) { setUp(characterSet); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); if (overload == Overload.CHAR) { while (state.keepRunning()) { for (int ch = 0; ch < 65536; ++ch) { @@ -304,7 +304,7 @@ public class CharacterPerfTest { @Parameters(method = "getData") public void timeIsUpperCase(CharacterSet characterSet, Overload overload) { setUp(characterSet); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); if (overload == Overload.CHAR) { while (state.keepRunning()) { for (int ch = 0; ch < 65536; ++ch) { @@ -324,7 +324,7 @@ public class CharacterPerfTest { @Parameters(method = "getData") public void timeIsWhitespace(CharacterSet characterSet, Overload overload) { setUp(characterSet); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); if (overload == Overload.CHAR) { while (state.keepRunning()) { for (int ch = 0; ch < 65536; ++ch) { @@ -344,7 +344,7 @@ public class CharacterPerfTest { @Parameters(method = "getData") public void timeToLowerCase(CharacterSet characterSet, Overload overload) { setUp(characterSet); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); if (overload == Overload.CHAR) { while (state.keepRunning()) { for (int ch = 0; ch < 65536; ++ch) { @@ -364,7 +364,7 @@ public class CharacterPerfTest { @Parameters(method = "getData") public void timeToUpperCase(CharacterSet characterSet, Overload overload) { setUp(characterSet); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); if (overload == Overload.CHAR) { while (state.keepRunning()) { for (int ch = 0; ch < 65536; ++ch) { diff --git a/apct-tests/perftests/core/src/android/libcore/regression/CharsetForNamePerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/CharsetForNamePerfTest.java index 4dd890ad2a4556bef14653c73251f5e1e2eb0c8a..858c101fc33e6a07b6933a4d8868f20da3b4d3ab 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/CharsetForNamePerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/CharsetForNamePerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; @@ -33,7 +33,7 @@ import java.nio.charset.Charset; @RunWith(JUnitParamsRunner.class) @LargeTest public class CharsetForNamePerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); public static String[] charsetNames() { return new String[] { @@ -52,7 +52,7 @@ public class CharsetForNamePerfTest { @Test @Parameters(method = "charsetNames") public void timeCharsetForName(String charsetName) throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Charset.forName(charsetName); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/CharsetPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/CharsetPerfTest.java index 3a71ce9692bd72890dd13e21290b5c2eeec4a491..a2fb7d7f83d8872e6703cf9e1d31609586f601e6 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/CharsetPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/CharsetPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; @@ -34,7 +34,7 @@ import java.util.Collection; @RunWith(JUnitParamsRunner.class) @LargeTest public class CharsetPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); public static Collection getData() { return Arrays.asList( @@ -91,7 +91,7 @@ public class CharsetPerfTest { @Parameters(method = "getData") public void time_new_String_BString(int length, String name) throws Exception { byte[] bytes = makeBytes(makeString(length)); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { new String(bytes, name); } @@ -101,7 +101,7 @@ public class CharsetPerfTest { @Parameters(method = "getData") public void time_new_String_BII(int length, String name) throws Exception { byte[] bytes = makeBytes(makeString(length)); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { new String(bytes, 0, bytes.length); } @@ -111,7 +111,7 @@ public class CharsetPerfTest { @Parameters(method = "getData") public void time_new_String_BIIString(int length, String name) throws Exception { byte[] bytes = makeBytes(makeString(length)); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { new String(bytes, 0, bytes.length, name); } @@ -121,7 +121,7 @@ public class CharsetPerfTest { @Parameters(method = "getData") public void time_String_getBytes(int length, String name) throws Exception { String string = makeString(length); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { string.getBytes(name); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/CharsetUtf8PerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/CharsetUtf8PerfTest.java index 6c30a163f5196daa32bc7e6dab6863222146b43e..2047444a7f52401750a225e2ae68f3f2403ebb64 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/CharsetUtf8PerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/CharsetUtf8PerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; import android.icu.lang.UCharacter; -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,7 +35,7 @@ import java.nio.charset.Charset; @RunWith(AndroidJUnit4.class) @LargeTest public class CharsetUtf8PerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); private void makeUnicodeRange(int startingCodePoint, int endingCodePoint) { StringBuilder builder = new StringBuilder(); @@ -46,7 +46,7 @@ public class CharsetUtf8PerfTest { } String str = builder.toString(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StringBuilder builder2 = new StringBuilder(); builder2.append(str); diff --git a/apct-tests/perftests/core/src/android/libcore/regression/ChecksumPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/ChecksumPerfTest.java index dcdfd371e7f667cdd1b8b8fa4bf9bcc557813efb..4ce8b41de403d82edd7903910a0fc808ac992aff 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/ChecksumPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/ChecksumPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -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; @@ -32,13 +32,13 @@ import java.util.zip.CRC32; @RunWith(AndroidJUnit4.class) @LargeTest public class ChecksumPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); @Test public void timeAdler_block() throws Exception { byte[] bytes = new byte[10000]; Adler32 adler = new Adler32(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { adler.update(bytes); } @@ -47,7 +47,7 @@ public class ChecksumPerfTest { @Test public void timeAdler_byte() throws Exception { Adler32 adler = new Adler32(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { adler.update(1); } @@ -57,7 +57,7 @@ public class ChecksumPerfTest { public void timeCrc_block() throws Exception { byte[] bytes = new byte[10000]; CRC32 crc = new CRC32(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { crc.update(bytes); } @@ -66,7 +66,7 @@ public class ChecksumPerfTest { @Test public void timeCrc_byte() throws Exception { CRC32 crc = new CRC32(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { crc.update(1); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/CipherInputStreamPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/CipherInputStreamPerfTest.java index 6c175b191429ae6fbbba0ec6e996f3f5602feee4..6a7ec1ad62e9fdb8fcab3f23f558c9e25aad071f 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/CipherInputStreamPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/CipherInputStreamPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -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,7 +41,7 @@ import javax.crypto.spec.IvParameterSpec; @RunWith(AndroidJUnit4.class) @LargeTest public class CipherInputStreamPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); private static final int DATA_SIZE = 1024 * 1024; private static final byte[] DATA = new byte[DATA_SIZE]; @@ -80,7 +80,7 @@ public class CipherInputStreamPerfTest { @Test public void timeEncrypt() throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mCipherEncrypt.init(Cipher.ENCRYPT_MODE, mKey, mSpec); InputStream is = new CipherInputStream(new ByteArrayInputStream(DATA), mCipherEncrypt); diff --git a/apct-tests/perftests/core/src/android/libcore/regression/CipherPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/CipherPerfTest.java index 136822ec70029b69c6e8815274967543898d3672..238c028fa0cf55a63d530916e956ef99eb397257 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/CipherPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/CipherPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; @@ -47,7 +47,7 @@ import javax.crypto.spec.IvParameterSpec; @RunWith(JUnitParamsRunner.class) @LargeTest public class CipherPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); public static Collection getCases() { int[] keySizes = new int[] {128, 192, 256}; @@ -180,7 +180,7 @@ public class CipherPerfTest { Mode mode, Padding padding, int keySize, int inputSize, Implementation implementation) throws Exception { setUp(mode, padding, keySize, implementation); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mCipherEncrypt.doFinal(DATA, 0, inputSize, mOutput); } @@ -192,7 +192,7 @@ public class CipherPerfTest { Mode mode, Padding padding, int keySize, int inputSize, Implementation implementation) throws Exception { setUp(mode, padding, keySize, implementation); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mCipherDecrypt.doFinal(DATA, 0, inputSize, mOutput); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/CollatorPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/CollatorPerfTest.java index 9efb7ce7c2d03fc2242a1d1925bd7bba4165de41..7e5566055fb4e06fd090c5a14076ee2fa16c2b1e 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/CollatorPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/CollatorPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -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,7 +33,7 @@ import java.util.Locale; @RunWith(AndroidJUnit4.class) @LargeTest public class CollatorPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); private static final RuleBasedCollator COLLATOR = (RuleBasedCollator) Collator.getInstance(Locale.US); @@ -41,7 +41,7 @@ public class CollatorPerfTest { @Test public void timeCollatorPrimary() { COLLATOR.setStrength(Collator.PRIMARY); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { COLLATOR.compare("abcde", "abcdf"); COLLATOR.compare("abcde", "abcde"); @@ -52,7 +52,7 @@ public class CollatorPerfTest { @Test public void timeCollatorSecondary() { COLLATOR.setStrength(Collator.SECONDARY); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { COLLATOR.compare("abcdÂ", "abcdÄ"); COLLATOR.compare("abcdÂ", "abcdÂ"); @@ -63,7 +63,7 @@ public class CollatorPerfTest { @Test public void timeCollatorTertiary() { COLLATOR.setStrength(Collator.TERTIARY); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { COLLATOR.compare("abcdE", "abcde"); COLLATOR.compare("abcde", "abcde"); @@ -74,7 +74,7 @@ public class CollatorPerfTest { @Test public void timeCollatorIdentical() { COLLATOR.setStrength(Collator.IDENTICAL); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { COLLATOR.compare("abcdȪ", "abcdȫ"); COLLATOR.compare("abcdȪ", "abcdȪ"); diff --git a/apct-tests/perftests/core/src/android/libcore/regression/CollectionsPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/CollectionsPerfTest.java index 4e5ceaf12403ee0ea49e856a2b8783f2cbd2cdfa..100798a7957bf6c9865c81ee4cbc08b16442feb9 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/CollectionsPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/CollectionsPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; @@ -40,7 +40,7 @@ import java.util.Vector; @RunWith(JUnitParamsRunner.class) @LargeTest public class CollectionsPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); public static Collection getData() { return Arrays.asList(new Object[][] {{4}, {16}, {64}, {256}, {1024}}); @@ -60,7 +60,7 @@ public class CollectionsPerfTest { @Parameters(method = "getData") public void timeSort_arrayList(int arrayListLength) throws Exception { List input = buildList(arrayListLength, ArrayList.class); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Collections.sort(input); } @@ -70,7 +70,7 @@ public class CollectionsPerfTest { @Parameters(method = "getData") public void timeSortWithComparator_arrayList(int arrayListLength) throws Exception { List input = buildList(arrayListLength, ArrayList.class); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Collections.sort(input, REVERSE); } @@ -80,7 +80,7 @@ public class CollectionsPerfTest { @Parameters(method = "getData") public void timeSort_vector(int arrayListLength) throws Exception { List input = buildList(arrayListLength, Vector.class); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Collections.sort(input); } @@ -90,7 +90,7 @@ public class CollectionsPerfTest { @Parameters(method = "getData") public void timeSortWithComparator_vector(int arrayListLength) throws Exception { List input = buildList(arrayListLength, Vector.class); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Collections.sort(input, REVERSE); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/DateFormatPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/DateFormatPerfTest.java index b0ccd9925d8336c8300ba9cb0b96de57568215c1..b6784a8d38670f77ea87eb09d703afca616c5c32 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/DateFormatPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/DateFormatPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -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,7 +33,7 @@ import java.util.Locale; @RunWith(AndroidJUnit4.class) @LargeTest public final class DateFormatPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); private Locale mLocale1; private Locale mLocale2; @@ -50,7 +50,7 @@ public final class DateFormatPerfTest { @Test public void timeGetDateTimeInstance() throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { DateFormat.getDateTimeInstance(); } @@ -58,7 +58,7 @@ public final class DateFormatPerfTest { @Test public void timeGetDateTimeInstance_multiple() throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, mLocale1); DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, mLocale2); diff --git a/apct-tests/perftests/core/src/android/libcore/regression/DecimalFormatPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/DecimalFormatPerfTest.java index 3a2f6fab54607f14c90e7b8742c321fdcf4decdc..52f98738481fbc36b21cb6629eb8f3eb0f07c9a5 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/DecimalFormatPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/DecimalFormatPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -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,7 +34,7 @@ import java.util.Locale; @RunWith(AndroidJUnit4.class) @LargeTest public class DecimalFormatPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); private static final String EXP_PATTERN = "##E0"; @@ -58,7 +58,7 @@ public class DecimalFormatPerfTest { public void formatWithGrouping(Object obj) { DF.setGroupingSize(3); DF.setGroupingUsed(true); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { DF.format(obj); } @@ -66,21 +66,21 @@ public class DecimalFormatPerfTest { public void format(String pattern, Object obj) { PATTERN_INSTANCE.applyPattern(pattern); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { PATTERN_INSTANCE.format(obj); } } public void format(Object obj) { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { DF.format(obj); } } public void formatToCharacterIterator(Object obj) { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { DF.formatToCharacterIterator(obj); } @@ -88,14 +88,14 @@ public class DecimalFormatPerfTest { public void formatCurrencyUS(Object obj) { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { DF_CURRENCY_US.format(obj); } } public void formatCurrencyFR(Object obj) { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { DF_CURRENCY_FR.format(obj); } @@ -213,7 +213,7 @@ public class DecimalFormatPerfTest { @Test public void time_instantiation() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { new DecimalFormat(); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/DecimalFormatSymbolsPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/DecimalFormatSymbolsPerfTest.java index 4bc550ebb9f124fb187d1609a0e8c67e2f40b4a3..6105420611074fc442e1751629997dbb3eb8b15c 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/DecimalFormatSymbolsPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/DecimalFormatSymbolsPerfTest.java @@ -15,8 +15,8 @@ */ package android.libcore.regression; -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; @@ -31,13 +31,13 @@ import java.util.Locale; @RunWith(AndroidJUnit4.class) @LargeTest public class DecimalFormatSymbolsPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); private static Locale sLocale = Locale.getDefault(Locale.Category.FORMAT); @Test public void time_instantiation() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { new DecimalFormatSymbols(sLocale); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/DefaultCharsetPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/DefaultCharsetPerfTest.java index 597447bef90e35dbee6c6df2e4b883f95681b82f..fae74a5e86208a6c1fbe1344d408f02238d00061 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/DefaultCharsetPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/DefaultCharsetPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -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; @@ -31,11 +31,11 @@ import java.nio.charset.Charset; @RunWith(AndroidJUnit4.class) @LargeTest public class DefaultCharsetPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); @Test public void time_defaultCharset() throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Charset.defaultCharset(); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/DnsPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/DnsPerfTest.java index b17d0f4194d8c94375cf701570c89757328fd207..2915363786f3a49ca823afc2f5046b4564e127ab 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/DnsPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/DnsPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -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; @@ -32,7 +32,7 @@ import java.net.UnknownHostException; @RunWith(AndroidJUnit4.class) @LargeTest public class DnsPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); @Test public void timeDns() throws Exception { @@ -53,7 +53,7 @@ public class DnsPerfTest { "www.cnn.com", "bad.host.mtv.corp.google.com", }; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); int i = 0; while (state.keepRunning()) { try { diff --git a/apct-tests/perftests/core/src/android/libcore/regression/DoPrivilegedPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/DoPrivilegedPerfTest.java index 4c8a8eaea8c62890260a5693a4f9ed6a4a9c7c3e..dd7e5cc1057b223bb74257865c2994a6b5d7250d 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/DoPrivilegedPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/DoPrivilegedPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -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; @@ -32,11 +32,11 @@ import java.security.PrivilegedAction; @RunWith(AndroidJUnit4.class) @LargeTest public class DoPrivilegedPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); @Test public void timeDirect() throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { String lineSeparator = System.getProperty("line.separator"); } @@ -44,7 +44,7 @@ public class DoPrivilegedPerfTest { @Test public void timeFastAndSlow() throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { String lineSeparator; if (System.getSecurityManager() == null) { @@ -61,7 +61,7 @@ public class DoPrivilegedPerfTest { @Test public void timeNewAction() throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { String lineSeparator = AccessController.doPrivileged(new PrivilegedAction() { public String run() { @@ -74,7 +74,7 @@ public class DoPrivilegedPerfTest { @Test public void timeReusedAction() throws Exception { final PrivilegedAction action = new ReusableAction("line.separator"); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { String lineSeparator = AccessController.doPrivileged(action); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/DoublePerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/DoublePerfTest.java index 4ff65b197947d435883d62f7a3f3cd306c93b98b..e034a47e79d211532579a7fd42bbd924a58aec62 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/DoublePerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/DoublePerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -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,7 +29,7 @@ import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) @LargeTest public class DoublePerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); private double mD = 1.2; private long mL = 4608083138725491507L; @@ -37,7 +37,7 @@ public class DoublePerfTest { @Test public void timeDoubleToLongBits() { long result = 123; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Double.doubleToLongBits(mD); } @@ -49,7 +49,7 @@ public class DoublePerfTest { @Test public void timeDoubleToRawLongBits() { long result = 123; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Double.doubleToRawLongBits(mD); } @@ -61,7 +61,7 @@ public class DoublePerfTest { @Test public void timeLongBitsToDouble() { double result = 123.0; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Double.longBitsToDouble(mL); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/EqualsHashCodePerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/EqualsHashCodePerfTest.java index aacdcee13e8d674188b5ba74ba0de12fb7c48cb9..fe1b599cc5ad1bd7c3f338de9d11d80ae34d91dd 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/EqualsHashCodePerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/EqualsHashCodePerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; @@ -37,7 +37,7 @@ import java.util.List; @RunWith(JUnitParamsRunner.class) @LargeTest public final class EqualsHashCodePerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); private enum Type { URI() { @@ -82,7 +82,7 @@ public final class EqualsHashCodePerfTest { mA2 = type.newInstance("https://mail.google.com/mail/u/0/?shva=1#inbox"); mB1 = type.newInstance("http://developer.android.com/reference/java/net/URI.html"); mB2 = type.newInstance("http://developer.android.com/reference/java/net/URI.html"); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mA1.equals(mB1); mA1.equals(mA2); @@ -95,7 +95,7 @@ public final class EqualsHashCodePerfTest { public void timeHashCode(Type type) throws Exception { mA1 = type.newInstance("https://mail.google.com/mail/u/0/?shva=1#inbox"); mB1 = type.newInstance("http://developer.android.com/reference/java/net/URI.html"); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mA1.hashCode(); mB1.hashCode(); @@ -112,7 +112,7 @@ public final class EqualsHashCodePerfTest { "http://developer.android.com/query?q=" + QUERY.substring(0, QUERY.length() - 3) + "%AF"); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mC1.equals(mC2); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/ExpensiveObjectsPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/ExpensiveObjectsPerfTest.java index 9a6864ea5f667746d6c933924910be18f0d30c4f..ecbfc7169945ad808ee25cdfb193bcc89d333573 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/ExpensiveObjectsPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/ExpensiveObjectsPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -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,11 +41,11 @@ import java.util.Locale; @RunWith(AndroidJUnit4.class) @LargeTest public class ExpensiveObjectsPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); @Test public void timeNewDateFormatTimeInstance() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { DateFormat df = DateFormat.getTimeInstance(DateFormat.SHORT); df.format(System.currentTimeMillis()); @@ -55,7 +55,7 @@ public class ExpensiveObjectsPerfTest { @Test(timeout = 900000) public void timeClonedDateFormatTimeInstance() { DateFormat df = DateFormat.getTimeInstance(DateFormat.SHORT); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { ((DateFormat) df.clone()).format(System.currentTimeMillis()); } @@ -64,7 +64,7 @@ public class ExpensiveObjectsPerfTest { @Test public void timeReusedDateFormatTimeInstance() { DateFormat df = DateFormat.getTimeInstance(DateFormat.SHORT); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { synchronized (df) { df.format(System.currentTimeMillis()); @@ -74,7 +74,7 @@ public class ExpensiveObjectsPerfTest { @Test(timeout = 900000) public void timeNewCollator() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Collator.getInstance(Locale.US); } @@ -83,7 +83,7 @@ public class ExpensiveObjectsPerfTest { @Test public void timeClonedCollator() { Collator c = Collator.getInstance(Locale.US); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { c.clone(); } @@ -91,7 +91,7 @@ public class ExpensiveObjectsPerfTest { @Test public void timeNewDateFormatSymbols() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { new DateFormatSymbols(Locale.US); } @@ -100,7 +100,7 @@ public class ExpensiveObjectsPerfTest { @Test public void timeClonedDateFormatSymbols() { DateFormatSymbols dfs = new DateFormatSymbols(Locale.US); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { dfs.clone(); } @@ -108,7 +108,7 @@ public class ExpensiveObjectsPerfTest { @Test public void timeNewDecimalFormatSymbols() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { new DecimalFormatSymbols(Locale.US); } @@ -117,7 +117,7 @@ public class ExpensiveObjectsPerfTest { @Test public void timeClonedDecimalFormatSymbols() { DecimalFormatSymbols dfs = new DecimalFormatSymbols(Locale.US); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { dfs.clone(); } @@ -125,7 +125,7 @@ public class ExpensiveObjectsPerfTest { @Test public void timeNewNumberFormat() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { NumberFormat.getInstance(Locale.US); } @@ -134,7 +134,7 @@ public class ExpensiveObjectsPerfTest { @Test public void timeClonedNumberFormat() { NumberFormat nf = NumberFormat.getInstance(Locale.US); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { nf.clone(); } @@ -142,7 +142,7 @@ public class ExpensiveObjectsPerfTest { @Test public void timeLongToString() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Long.toString(1024L); } @@ -151,7 +151,7 @@ public class ExpensiveObjectsPerfTest { @Test public void timeNumberFormatTrivialFormatDouble() { NumberFormat nf = NumberFormat.getInstance(Locale.US); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { nf.format(1024.0); } @@ -159,7 +159,7 @@ public class ExpensiveObjectsPerfTest { @Test public void timeNewSimpleDateFormat() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { new SimpleDateFormat(); } @@ -167,7 +167,7 @@ public class ExpensiveObjectsPerfTest { @Test public void timeNewGregorianCalendar() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { new GregorianCalendar(); } @@ -176,7 +176,7 @@ public class ExpensiveObjectsPerfTest { @Test public void timeClonedGregorianCalendar() { GregorianCalendar gc = new GregorianCalendar(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { gc.clone(); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/FilePerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/FilePerfTest.java index cef7e8c739d7fb19e08cd4821a6737295554238c..0c14d64c27a94dc6a2a7f8c84835896282f85485 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/FilePerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/FilePerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -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; @@ -31,11 +31,11 @@ import java.io.File; @RunWith(AndroidJUnit4.class) @LargeTest public final class FilePerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); @Test public void timeFileCreationWithEmptyChild() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { new File("/foo", "/"); } @@ -43,7 +43,7 @@ public final class FilePerfTest { @Test public void timeFileCreationWithNormalizationNecessary() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { new File("/foo//bar//baz//bag", "/baz/"); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/FloatPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/FloatPerfTest.java index 645c0235797051cc54527fdf99bac9317a7b38a1..7d7d83b3fdbf3645078c2252f1184f6f2cb2db07 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/FloatPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/FloatPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -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,7 +29,7 @@ import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) @LargeTest public class FloatPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); private float mFloat = 1.2f; private int mInt = 1067030938; @@ -37,7 +37,7 @@ public class FloatPerfTest { @Test public void timeFloatToIntBits() { int result = 123; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Float.floatToIntBits(mFloat); } @@ -49,7 +49,7 @@ public class FloatPerfTest { @Test public void timeFloatToRawIntBits() { int result = 123; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Float.floatToRawIntBits(mFloat); } @@ -61,7 +61,7 @@ public class FloatPerfTest { @Test public void timeIntBitsToFloat() { float result = 123.0f; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Float.intBitsToFloat(mInt); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/FormatterPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/FormatterPerfTest.java index cf76137d5ec3bf62b818222bfebc7cb6ea44e41b..08dda5314eacf491ed6e24844500e5bf3a68c879 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/FormatterPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/FormatterPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -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,11 +35,11 @@ import java.util.Locale; @RunWith(AndroidJUnit4.class) @LargeTest public class FormatterPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); @Test public void timeFormatter_NoFormatting() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Formatter f = new Formatter(); f.format("this is a reasonably short string that doesn't actually need any formatting"); @@ -48,7 +48,7 @@ public class FormatterPerfTest { @Test public void timeStringBuilder_NoFormatting() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StringBuilder sb = new StringBuilder(); sb.append("this is a reasonably short string that doesn't actually need formatting"); @@ -58,7 +58,7 @@ public class FormatterPerfTest { @Test public void timeFormatter_OneInt() { Integer value = Integer.valueOf(1024); // We're not trying to benchmark boxing here. - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Formatter f = new Formatter(); f.format("this is a reasonably short string that has an int %d in it", value); @@ -69,7 +69,7 @@ public class FormatterPerfTest { public void timeFormatter_OneIntArabic() { Locale arabic = new Locale("ar"); Integer value = Integer.valueOf(1024); // We're not trying to benchmark boxing here. - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Formatter f = new Formatter(); f.format(arabic, "this is a reasonably short string that has an int %d in it", value); @@ -78,7 +78,7 @@ public class FormatterPerfTest { @Test public void timeStringBuilder_OneInt() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StringBuilder sb = new StringBuilder(); sb.append("this is a reasonably short string that has an int "); @@ -90,7 +90,7 @@ public class FormatterPerfTest { @Test public void timeFormatter_OneHexInt() { Integer value = Integer.valueOf(1024); // We're not trying to benchmark boxing here. - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Formatter f = new Formatter(); f.format("this is a reasonably short string that has an int %x in it", value); @@ -99,7 +99,7 @@ public class FormatterPerfTest { @Test public void timeStringBuilder_OneHexInt() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StringBuilder sb = new StringBuilder(); sb.append("this is a reasonably short string that has an int "); @@ -111,7 +111,7 @@ public class FormatterPerfTest { @Test public void timeFormatter_OneFloat() { Float value = Float.valueOf(10.24f); // We're not trying to benchmark boxing here. - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Formatter f = new Formatter(); f.format("this is a reasonably short string that has a float %f in it", value); @@ -121,7 +121,7 @@ public class FormatterPerfTest { @Test public void timeFormatter_OneFloat_dot2f() { Float value = Float.valueOf(10.24f); // We're not trying to benchmark boxing here. - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Formatter f = new Formatter(); f.format("this is a reasonably short string that has a float %.2f in it", value); @@ -131,7 +131,7 @@ public class FormatterPerfTest { @Test public void timeFormatter_TwoFloats() { Float value = Float.valueOf(10.24f); // We're not trying to benchmark boxing here. - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Formatter f = new Formatter(); f.format("this is a short string that has two floats %f and %f in it", value, value); @@ -140,7 +140,7 @@ public class FormatterPerfTest { @Test public void timeStringBuilder_OneFloat() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StringBuilder sb = new StringBuilder(); sb.append("this is a reasonably short string that has a float "); @@ -151,7 +151,7 @@ public class FormatterPerfTest { @Test public void timeFormatter_OneString() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Formatter f = new Formatter(); f.format("this is a reasonably short string that has a string %s in it", "hello"); @@ -160,7 +160,7 @@ public class FormatterPerfTest { @Test public void timeStringBuilder_OneString() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StringBuilder sb = new StringBuilder(); sb.append("this is a reasonably short string that has a string "); diff --git a/apct-tests/perftests/core/src/android/libcore/regression/IdnPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/IdnPerfTest.java index 833575afe8dcfd332bfadac804f9d4a35011cbd4..a09ad809a6a219f431a213763d86c921871548c2 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/IdnPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/IdnPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -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; @@ -31,11 +31,11 @@ import java.net.IDN; @RunWith(AndroidJUnit4.class) @LargeTest public class IdnPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); @Test public void timeToUnicode() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { IDN.toASCII("fass.de"); IDN.toASCII("faß.de"); @@ -51,7 +51,7 @@ public class IdnPerfTest { @Test public void timeToAscii() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { IDN.toUnicode("xn--fss-qla.de"); IDN.toUnicode("xn--n00d.com"); diff --git a/apct-tests/perftests/core/src/android/libcore/regression/IntConstantDivisionPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/IntConstantDivisionPerfTest.java index 1c901c867fe794af76a09c63bb517f105b0886d5..be22814ef8f42af84698634c676ff4ae57aa20bf 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/IntConstantDivisionPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/IntConstantDivisionPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -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,12 +29,12 @@ import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) @LargeTest public class IntConstantDivisionPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); @Test public void timeDivideIntByConstant2() { int result = 1; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result /= 2; } @@ -43,7 +43,7 @@ public class IntConstantDivisionPerfTest { @Test public void timeDivideIntByConstant8() { int result = 1; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result /= 8; } @@ -52,7 +52,7 @@ public class IntConstantDivisionPerfTest { @Test public void timeDivideIntByConstant10() { int result = 1; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result /= 10; } @@ -61,7 +61,7 @@ public class IntConstantDivisionPerfTest { @Test public void timeDivideIntByConstant100() { int result = 1; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result /= 100; } @@ -70,7 +70,7 @@ public class IntConstantDivisionPerfTest { @Test public void timeDivideIntByConstant100_HandOptimized() { int result = 1; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = (int) ((0x51eb851fL * result) >>> 37); } @@ -79,7 +79,7 @@ public class IntConstantDivisionPerfTest { @Test public void timeDivideIntByConstant2048() { int result = 1; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result /= 2048; } @@ -89,7 +89,7 @@ public class IntConstantDivisionPerfTest { public void timeDivideIntByVariable2() { int result = 1; int factor = 2; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result /= factor; } @@ -99,7 +99,7 @@ public class IntConstantDivisionPerfTest { public void timeDivideIntByVariable10() { int result = 1; int factor = 10; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result /= factor; } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/IntConstantMultiplicationPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/IntConstantMultiplicationPerfTest.java index 3d3af4cdb04ced48cf8709e5c77844724d9c2d06..4337c903ecd6f788236713ad63c8bce7903b67b1 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/IntConstantMultiplicationPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/IntConstantMultiplicationPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -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,12 +29,12 @@ import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) @LargeTest public class IntConstantMultiplicationPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); @Test public void timeMultiplyIntByConstant6() { int result = 1; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result *= 6; } @@ -43,7 +43,7 @@ public class IntConstantMultiplicationPerfTest { @Test public void timeMultiplyIntByConstant7() { int result = 1; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result *= 7; } @@ -52,7 +52,7 @@ public class IntConstantMultiplicationPerfTest { @Test public void timeMultiplyIntByConstant8() { int result = 1; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result *= 8; } @@ -61,7 +61,7 @@ public class IntConstantMultiplicationPerfTest { @Test public void timeMultiplyIntByConstant8_Shift() { int result = 1; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result <<= 3; } @@ -70,7 +70,7 @@ public class IntConstantMultiplicationPerfTest { @Test public void timeMultiplyIntByConstant10() { int result = 1; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result *= 10; } @@ -79,7 +79,7 @@ public class IntConstantMultiplicationPerfTest { @Test public void timeMultiplyIntByConstant10_Shift() { int result = 1; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = (result + (result << 2)) << 1; } @@ -88,7 +88,7 @@ public class IntConstantMultiplicationPerfTest { @Test public void timeMultiplyIntByConstant2047() { int result = 1; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result *= 2047; } @@ -97,7 +97,7 @@ public class IntConstantMultiplicationPerfTest { @Test public void timeMultiplyIntByConstant2048() { int result = 1; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result *= 2048; } @@ -106,7 +106,7 @@ public class IntConstantMultiplicationPerfTest { @Test public void timeMultiplyIntByConstant2049() { int result = 1; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result *= 2049; } @@ -116,7 +116,7 @@ public class IntConstantMultiplicationPerfTest { public void timeMultiplyIntByVariable10() { int result = 1; int factor = 10; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result *= factor; } @@ -126,7 +126,7 @@ public class IntConstantMultiplicationPerfTest { 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/regression/IntConstantRemainderPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/IntConstantRemainderPerfTest.java index 7c86633accdc64b94b6c05de20dc5775c17046d0..1b6c5026e1f61734d811ad54aa0d355fbae754b9 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/IntConstantRemainderPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/IntConstantRemainderPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -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,12 +29,12 @@ import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) @LargeTest public class IntConstantRemainderPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); @Test public void timeRemainderIntByConstant2() { int result = 1; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result %= 2; } @@ -43,7 +43,7 @@ public class IntConstantRemainderPerfTest { @Test public void timeRemainderIntByConstant8() { int result = 1; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result %= 8; } @@ -52,7 +52,7 @@ public class IntConstantRemainderPerfTest { @Test public void timeRemainderIntByConstant10() { int result = 1; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result %= 10; } @@ -61,7 +61,7 @@ public class IntConstantRemainderPerfTest { @Test public void timeRemainderIntByConstant100() { int result = 1; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result %= 100; } @@ -70,7 +70,7 @@ public class IntConstantRemainderPerfTest { @Test public void timeRemainderIntByConstant2048() { int result = 1; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result %= 2048; } @@ -80,7 +80,7 @@ public class IntConstantRemainderPerfTest { public void timeRemainderIntByVariable2() { int result = 1; int factor = 2; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result %= factor; } @@ -90,7 +90,7 @@ public class IntConstantRemainderPerfTest { public void timeRemainderIntByVariable10() { int result = 1; int factor = 10; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result %= factor; } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/IntegerPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/IntegerPerfTest.java index e2a9dcc8f93d08ffe7b5b9a33aab0b610029faa1..170bb58c46ed1a0fb2ab44077cb29063f2d825a7 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/IntegerPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/IntegerPerfTest.java @@ -16,20 +16,20 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import org.junit.Rule; import org.junit.Test; public class IntegerPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); @Test public void timeLongSignumBranch() { int t = 0; int i = 0; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { t += signum1(-(++i)); t += signum1(0); @@ -41,7 +41,7 @@ public class IntegerPerfTest { public void timeLongSignumBranchFree() { int t = 0; int i = 0; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { t += signum2(-(++i)); t += signum2(0); @@ -61,7 +61,7 @@ public class IntegerPerfTest { public void timeLongBitCount_BitSet() { int t = 0; int i = 0; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { t += pop((long) ++i); } @@ -89,7 +89,7 @@ public class IntegerPerfTest { public void timeLongBitCount_2Int() { int t = 0; int i = 0; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { t += pop2((long) ++i); } @@ -105,7 +105,7 @@ public class IntegerPerfTest { public void timeLongBitCount_Long() { int t = 0; int i = 0; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { t += Long.bitCount((long) ++i); } @@ -140,7 +140,7 @@ public class IntegerPerfTest { public void timeNumberOfTrailingZerosHD() { int t = 0; int i = 0; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { t += numberOfTrailingZerosHD(++i); } @@ -150,7 +150,7 @@ public class IntegerPerfTest { public void timeNumberOfTrailingZerosOL() { int t = 0; int i = 0; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { t += numberOfTrailingZerosOL(++i); } @@ -163,7 +163,7 @@ public class IntegerPerfTest { "0", "1", "12", "123", "1234", "12345", "123456", "1234567", "12345678" }; int t = 0; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { for (int j = 0; j < intStrings.length; ++j) { t += Integer.valueOf(intStrings[j]); diff --git a/apct-tests/perftests/core/src/android/libcore/regression/IntegralToStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/IntegralToStringPerfTest.java index 669bfbfb2b8d31c2d7c17d099ce3a4f75267c51f..0aa854ecfa8009b98492c6f1bc53b99a9dca6b4f 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/IntegralToStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/IntegralToStringPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -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,7 +29,7 @@ import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) @LargeTest public class IntegralToStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); private static final int SMALL = 12; private static final int MEDIUM = 12345; @@ -37,7 +37,7 @@ public class IntegralToStringPerfTest { @Test public void time_IntegerToString_small() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Integer.toString(SMALL); } @@ -45,7 +45,7 @@ public class IntegralToStringPerfTest { @Test public void time_IntegerToString_medium() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Integer.toString(MEDIUM); } @@ -53,7 +53,7 @@ public class IntegralToStringPerfTest { @Test public void time_IntegerToString_large() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Integer.toString(LARGE); } @@ -61,7 +61,7 @@ public class IntegralToStringPerfTest { @Test public void time_IntegerToString2_small() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Integer.toString(SMALL, 2); } @@ -69,7 +69,7 @@ public class IntegralToStringPerfTest { @Test public void time_IntegerToString2_medium() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Integer.toString(MEDIUM, 2); } @@ -77,7 +77,7 @@ public class IntegralToStringPerfTest { @Test public void time_IntegerToString2_large() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Integer.toString(LARGE, 2); } @@ -85,7 +85,7 @@ public class IntegralToStringPerfTest { @Test public void time_IntegerToString10_small() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Integer.toString(SMALL, 10); } @@ -93,7 +93,7 @@ public class IntegralToStringPerfTest { @Test public void time_IntegerToString10_medium() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Integer.toString(MEDIUM, 10); } @@ -101,7 +101,7 @@ public class IntegralToStringPerfTest { @Test public void time_IntegerToString10_large() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Integer.toString(LARGE, 10); } @@ -109,7 +109,7 @@ public class IntegralToStringPerfTest { @Test public void time_IntegerToString16_small() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Integer.toString(SMALL, 16); } @@ -117,7 +117,7 @@ public class IntegralToStringPerfTest { @Test public void time_IntegerToString16_medium() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Integer.toString(MEDIUM, 16); } @@ -125,7 +125,7 @@ public class IntegralToStringPerfTest { @Test public void time_IntegerToString16_large() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Integer.toString(LARGE, 16); } @@ -133,7 +133,7 @@ public class IntegralToStringPerfTest { @Test public void time_IntegerToBinaryString_small() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Integer.toBinaryString(SMALL); } @@ -141,7 +141,7 @@ public class IntegralToStringPerfTest { @Test public void time_IntegerToBinaryString_medium() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Integer.toBinaryString(MEDIUM); } @@ -149,7 +149,7 @@ public class IntegralToStringPerfTest { @Test public void time_IntegerToBinaryString_large() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Integer.toBinaryString(LARGE); } @@ -157,7 +157,7 @@ public class IntegralToStringPerfTest { @Test public void time_IntegerToHexString_small() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Integer.toHexString(SMALL); } @@ -165,7 +165,7 @@ public class IntegralToStringPerfTest { @Test public void time_IntegerToHexString_medium() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Integer.toHexString(MEDIUM); } @@ -173,7 +173,7 @@ public class IntegralToStringPerfTest { @Test public void time_IntegerToHexString_large() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Integer.toHexString(LARGE); } @@ -181,7 +181,7 @@ public class IntegralToStringPerfTest { @Test public void time_StringBuilder_small() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { new StringBuilder().append(SMALL); } @@ -189,7 +189,7 @@ public class IntegralToStringPerfTest { @Test public void time_StringBuilder_medium() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { new StringBuilder().append(MEDIUM); } @@ -197,7 +197,7 @@ public class IntegralToStringPerfTest { @Test public void time_StringBuilder_large() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { new StringBuilder().append(LARGE); } @@ -205,7 +205,7 @@ public class IntegralToStringPerfTest { @Test public void time_Formatter_small() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { String.format("%d", SMALL); } @@ -213,7 +213,7 @@ public class IntegralToStringPerfTest { @Test public void time_Formatter_medium() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { String.format("%d", MEDIUM); } @@ -221,7 +221,7 @@ public class IntegralToStringPerfTest { @Test public void time_Formatter_large() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { String.format("%d", LARGE); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/KeyPairGeneratorPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/KeyPairGeneratorPerfTest.java index cda8512ad6af8940aca277aad017a5b6ef503e98..9b3d7a0447206dfb28e4a01ff0e968bdbe615ede 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/KeyPairGeneratorPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/KeyPairGeneratorPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -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,7 +36,7 @@ import java.util.Collection; @RunWith(JUnitParamsRunner.class) @LargeTest public class KeyPairGeneratorPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); public static Collection getData() { return Arrays.asList( @@ -78,7 +78,7 @@ public class KeyPairGeneratorPerfTest { @Parameters(method = "getData") public void time(Algorithm algorithm, Implementation implementation) throws Exception { setUp(algorithm, implementation); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { KeyPair keyPair = mGenerator.generateKeyPair(); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/LoopingBackwardsPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/LoopingBackwardsPerfTest.java index 8b062d390dbbcf45ab364c459fb7a96f26b23a0b..1a9e19aeb78dee7e7e7f302b3e13fb609d407919 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/LoopingBackwardsPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/LoopingBackwardsPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; @@ -39,7 +39,7 @@ import java.util.Collection; @RunWith(JUnitParamsRunner.class) @LargeTest public class LoopingBackwardsPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); public static Collection getData() { return Arrays.asList(new Object[][] {{2}, {20}, {2000}, {20000000}}); @@ -49,7 +49,7 @@ public class LoopingBackwardsPerfTest { @Parameters(method = "getData") public void timeForwards(int max) { int fake = 0; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { for (int j = 0; j < max; j++) { fake += j; @@ -61,7 +61,7 @@ public class LoopingBackwardsPerfTest { @Parameters(method = "getData") public void timeBackwards(int max) { int fake = 0; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { for (int j = max - 1; j >= 0; j--) { fake += j; diff --git a/apct-tests/perftests/core/src/android/libcore/regression/MathPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/MathPerfTest.java index bcf556c267167a82bc1410b3159a4732595d24f4..a8a704c09d6d713e926fa007eeb0ec3f839bdb1d 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/MathPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/MathPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -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,7 +33,7 @@ import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) @LargeTest public class MathPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); private final double mDouble = 1.2; private final float mFloat = 1.2f; @@ -48,7 +48,7 @@ public class MathPerfTest { @Test public void timeAbsD() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.abs(mDouble); } @@ -57,7 +57,7 @@ public class MathPerfTest { @Test public void timeAbsF() { float result = mFloat; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.abs(mFloat); } @@ -66,7 +66,7 @@ public class MathPerfTest { @Test public void timeAbsI() { int result = mInt; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.abs(mInt); } @@ -75,7 +75,7 @@ public class MathPerfTest { @Test public void timeAbsL() { long result = mLong; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.abs(mLong); } @@ -84,7 +84,7 @@ public class MathPerfTest { @Test public void timeAcos() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.acos(mDouble); } @@ -93,7 +93,7 @@ public class MathPerfTest { @Test public void timeAsin() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.asin(mDouble); } @@ -102,7 +102,7 @@ public class MathPerfTest { @Test public void timeAtan() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.atan(mDouble); } @@ -111,7 +111,7 @@ public class MathPerfTest { @Test public void timeAtan2() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.atan2(3, 4); } @@ -120,7 +120,7 @@ public class MathPerfTest { @Test public void timeCbrt() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.cbrt(mDouble); } @@ -129,7 +129,7 @@ public class MathPerfTest { @Test public void timeCeil() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.ceil(mDouble); } @@ -138,7 +138,7 @@ public class MathPerfTest { @Test public void timeCopySignD() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.copySign(mDouble, mDouble); } @@ -147,7 +147,7 @@ public class MathPerfTest { @Test public void timeCopySignF() { float result = mFloat; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.copySign(mFloat, mFloat); } @@ -156,7 +156,7 @@ public class MathPerfTest { @Test public void timeCopySignD_strict() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = StrictMath.copySign(mDouble, mDouble); } @@ -165,7 +165,7 @@ public class MathPerfTest { @Test public void timeCopySignF_strict() { float result = mFloat; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = StrictMath.copySign(mFloat, mFloat); } @@ -174,7 +174,7 @@ public class MathPerfTest { @Test public void timeCos() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.cos(mDouble); } @@ -183,7 +183,7 @@ public class MathPerfTest { @Test public void timeCosh() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.cosh(mDouble); } @@ -192,7 +192,7 @@ public class MathPerfTest { @Test public void timeExp() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.exp(mDouble); } @@ -201,7 +201,7 @@ public class MathPerfTest { @Test public void timeExpm1() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.expm1(mDouble); } @@ -210,7 +210,7 @@ public class MathPerfTest { @Test public void timeFloor() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.floor(mDouble); } @@ -219,7 +219,7 @@ public class MathPerfTest { @Test public void timeGetExponentD() { int result = mInt; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.getExponent(mDouble); } @@ -228,7 +228,7 @@ public class MathPerfTest { @Test public void timeGetExponentF() { int result = mInt; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.getExponent(mFloat); } @@ -237,7 +237,7 @@ public class MathPerfTest { @Test public void timeHypot() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.hypot(mDouble, mDouble); } @@ -246,7 +246,7 @@ public class MathPerfTest { @Test public void timeIEEEremainder() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.IEEEremainder(mDouble, mDouble); } @@ -255,7 +255,7 @@ public class MathPerfTest { @Test public void timeLog() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.log(mDouble); } @@ -264,7 +264,7 @@ public class MathPerfTest { @Test public void timeLog10() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.log10(mDouble); } @@ -273,7 +273,7 @@ public class MathPerfTest { @Test public void timeLog1p() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.log1p(mDouble); } @@ -282,7 +282,7 @@ public class MathPerfTest { @Test public void timeMaxD() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.max(mDouble, mDouble); } @@ -291,7 +291,7 @@ public class MathPerfTest { @Test public void timeMaxF() { float result = mFloat; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.max(mFloat, mFloat); } @@ -300,7 +300,7 @@ public class MathPerfTest { @Test public void timeMaxI() { int result = mInt; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.max(mInt, mInt); } @@ -309,7 +309,7 @@ public class MathPerfTest { @Test public void timeMaxL() { long result = mLong; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.max(mLong, mLong); } @@ -318,7 +318,7 @@ public class MathPerfTest { @Test public void timeMinD() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.min(mDouble, mDouble); } @@ -327,7 +327,7 @@ public class MathPerfTest { @Test public void timeMinF() { float result = mFloat; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.min(mFloat, mFloat); } @@ -336,7 +336,7 @@ public class MathPerfTest { @Test public void timeMinI() { int result = mInt; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.min(mInt, mInt); } @@ -345,7 +345,7 @@ public class MathPerfTest { @Test public void timeMinL() { long result = mLong; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.min(mLong, mLong); } @@ -354,7 +354,7 @@ public class MathPerfTest { @Test public void timeNextAfterD() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.nextAfter(mDouble, mDouble); } @@ -363,7 +363,7 @@ public class MathPerfTest { @Test public void timeNextAfterF() { float result = mFloat; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.nextAfter(mFloat, mFloat); } @@ -372,7 +372,7 @@ public class MathPerfTest { @Test public void timeNextUpD() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.nextUp(mDouble); } @@ -381,7 +381,7 @@ public class MathPerfTest { @Test public void timeNextUpF() { float result = mFloat; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.nextUp(mFloat); } @@ -390,7 +390,7 @@ public class MathPerfTest { @Test public void timePow() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.pow(mDouble, mDouble); } @@ -399,7 +399,7 @@ public class MathPerfTest { @Test public void timeRandom() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.random(); } @@ -408,7 +408,7 @@ public class MathPerfTest { @Test public void timeRint() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.rint(mDouble); } @@ -417,7 +417,7 @@ public class MathPerfTest { @Test public void timeRoundD() { long result = mLong; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.round(mDouble); } @@ -426,7 +426,7 @@ public class MathPerfTest { @Test public void timeRoundF() { int result = mInt; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.round(mFloat); } @@ -435,7 +435,7 @@ public class MathPerfTest { @Test public void timeScalbD() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.scalb(mDouble, 5); } @@ -444,7 +444,7 @@ public class MathPerfTest { @Test public void timeScalbF() { float result = mFloat; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.scalb(mFloat, 5); } @@ -453,7 +453,7 @@ public class MathPerfTest { @Test public void timeSignumD() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.signum(mDouble); } @@ -462,7 +462,7 @@ public class MathPerfTest { @Test public void timeSignumF() { float result = mFloat; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.signum(mFloat); } @@ -471,7 +471,7 @@ public class MathPerfTest { @Test public void timeSin() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.sin(mDouble); } @@ -480,7 +480,7 @@ public class MathPerfTest { @Test public void timeSinh() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.sinh(mDouble); } @@ -489,7 +489,7 @@ public class MathPerfTest { @Test public void timeSqrt() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.sqrt(mDouble); } @@ -498,7 +498,7 @@ public class MathPerfTest { @Test public void timeTan() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.tan(mDouble); } @@ -507,7 +507,7 @@ public class MathPerfTest { @Test public void timeTanh() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.tanh(mDouble); } @@ -516,7 +516,7 @@ public class MathPerfTest { @Test public void timeToDegrees() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.toDegrees(mDouble); } @@ -525,7 +525,7 @@ public class MathPerfTest { @Test public void timeToRadians() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.toRadians(mDouble); } @@ -534,7 +534,7 @@ public class MathPerfTest { @Test public void timeUlpD() { double result = mDouble; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.ulp(mDouble); } @@ -543,7 +543,7 @@ public class MathPerfTest { @Test public void timeUlpF() { float result = mFloat; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result = Math.ulp(mFloat); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/MessageDigestPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/MessageDigestPerfTest.java index 8325dae6779731373372cf467b7c2e2423b1f094..6da9666db23b07a5a98120b7f3d5169c250a3122 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/MessageDigestPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/MessageDigestPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -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,7 +36,7 @@ import java.util.Collection; @RunWith(JUnitParamsRunner.class) @LargeTest public class MessageDigestPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); public static Collection getData() { return Arrays.asList( @@ -97,7 +97,7 @@ public class MessageDigestPerfTest { @Test @Parameters(method = "getData") public void time(Algorithm algorithm) throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { MessageDigest digest = MessageDigest.getInstance(algorithm.toString(), mProvider); digest.update(DATA, 0, DATA_SIZE); @@ -108,7 +108,7 @@ public class MessageDigestPerfTest { @Test @Parameters(method = "getData") public void timeLargeArray(Algorithm algorithm) throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { MessageDigest digest = MessageDigest.getInstance(algorithm.toString(), mProvider); digest.update(LARGE_DATA, 0, LARGE_DATA_SIZE); @@ -119,7 +119,7 @@ public class MessageDigestPerfTest { @Test @Parameters(method = "getData") public void timeSmallChunkOfLargeArray(Algorithm algorithm) throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { MessageDigest digest = MessageDigest.getInstance(algorithm.toString(), mProvider); digest.update(LARGE_DATA, LARGE_DATA_SIZE / 2, DATA_SIZE); @@ -130,7 +130,7 @@ public class MessageDigestPerfTest { @Test @Parameters(method = "getData") public void timeSmallByteBuffer(Algorithm algorithm) throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { MessageDigest digest = MessageDigest.getInstance(algorithm.toString(), mProvider); SMALL_BUFFER.position(0); @@ -143,7 +143,7 @@ public class MessageDigestPerfTest { @Test @Parameters(method = "getData") public void timeSmallDirectByteBuffer(Algorithm algorithm) throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { MessageDigest digest = MessageDigest.getInstance(algorithm.toString(), mProvider); SMALL_DIRECT_BUFFER.position(0); @@ -156,7 +156,7 @@ public class MessageDigestPerfTest { @Test @Parameters(method = "getData") public void timeLargeByteBuffer(Algorithm algorithm) throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { MessageDigest digest = MessageDigest.getInstance(algorithm.toString(), mProvider); LARGE_BUFFER.position(0); @@ -169,7 +169,7 @@ public class MessageDigestPerfTest { @Test @Parameters(method = "getData") public void timeLargeDirectByteBuffer(Algorithm algorithm) throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { MessageDigest digest = MessageDigest.getInstance(algorithm.toString(), mProvider); LARGE_DIRECT_BUFFER.position(0); @@ -182,7 +182,7 @@ public class MessageDigestPerfTest { @Test @Parameters(method = "getData") public void timeSmallChunkOfLargeByteBuffer(Algorithm algorithm) throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { MessageDigest digest = MessageDigest.getInstance(algorithm.toString(), mProvider); LARGE_BUFFER.position(LARGE_BUFFER.capacity() / 2); @@ -195,7 +195,7 @@ public class MessageDigestPerfTest { @Test @Parameters(method = "getData") public void timeSmallChunkOfLargeDirectByteBuffer(Algorithm algorithm) throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { MessageDigest digest = MessageDigest.getInstance(algorithm.toString(), mProvider); LARGE_DIRECT_BUFFER.position(LARGE_DIRECT_BUFFER.capacity() / 2); diff --git a/apct-tests/perftests/core/src/android/libcore/regression/MutableIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/MutableIntPerfTest.java index 266d42cba6f04f0c6c1bc4779ecb8c94f4f23f6f..060d18fb3de39777e3be43754a0abea045b5a5ee 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/MutableIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/MutableIntPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; @@ -35,7 +35,7 @@ import java.util.concurrent.atomic.AtomicInteger; @RunWith(JUnitParamsRunner.class) @LargeTest public final class MutableIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); enum Kind { ARRAY() { @@ -105,21 +105,21 @@ public final class MutableIntPerfTest { @Test @Parameters(method = "getData") public void timeCreate(Kind kind) { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); kind.timeCreate(state); } @Test @Parameters(method = "getData") public void timeIncrement(Kind kind) { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); kind.timeIncrement(state); } @Test @Parameters(method = "getData") public void timeGet(Kind kind) { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); kind.timeGet(state); } } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/NumberFormatPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/NumberFormatPerfTest.java index c2f84fb71405e6947935e0134404bc14a7557e8a..7cb3b2283779fcc1bb14efadc73f4a5ba6535c7d 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/NumberFormatPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/NumberFormatPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -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; @@ -32,13 +32,13 @@ import java.util.Locale; @RunWith(AndroidJUnit4.class) @LargeTest public class NumberFormatPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); private static Locale sLocale = Locale.getDefault(Locale.Category.FORMAT); @Test public void time_instantiation() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { NumberFormat.getInstance(sLocale); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/NumberFormatTrivialFormatLongPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/NumberFormatTrivialFormatLongPerfTest.java index cdf0911c74ab589f45b364f6340760f14b31832f..272b45a3affe9a41d2a95274c3183156601208ba 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/NumberFormatTrivialFormatLongPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/NumberFormatTrivialFormatLongPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -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; @@ -36,12 +36,12 @@ import java.util.Locale; @LargeTest public class NumberFormatTrivialFormatLongPerfTest { @Rule - public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); @Test public void timeNumberFormatTrivialFormatLong() { NumberFormat nf = NumberFormat.getInstance(Locale.US); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { nf.format(1024L); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/PriorityQueuePerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/PriorityQueuePerfTest.java index 51f47bb60ac76ea9d1b98007a11d07fe2c9706ff..c3a09662fd1fd26a5bc6e52114c793e3c71c65e9 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/PriorityQueuePerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/PriorityQueuePerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; @@ -39,7 +39,7 @@ import java.util.Random; @RunWith(JUnitParamsRunner.class) @LargeTest public class PriorityQueuePerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); public static Collection getData() { return Arrays.asList( @@ -108,7 +108,7 @@ public class PriorityQueuePerfTest { // At most allow the queue to empty 10%. int resizingThreshold = queueSize / 10; int i = 0; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { // Reset queue every so often. This will be called more often for smaller // queueSizes, but since a copy is linear, it will also cost proportionally diff --git a/apct-tests/perftests/core/src/android/libcore/regression/PropertyAccessPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/PropertyAccessPerfTest.java index 1f20cae0c162f438ad70f418ec496a879c16d91c..2ac56bed191005d6dab578afea983cbf938e8e8c 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/PropertyAccessPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/PropertyAccessPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -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,7 +33,7 @@ import java.lang.reflect.Method; @RunWith(AndroidJUnit4.class) @LargeTest public final class PropertyAccessPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); private View mView = new View(); private Method mSetX; @@ -50,7 +50,7 @@ public final class PropertyAccessPerfTest { @Test public void timeDirectSetter() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mView.mSetX(0.1f); } @@ -58,7 +58,7 @@ public final class PropertyAccessPerfTest { @Test public void timeDirectFieldSet() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mView.mX = 0.1f; } @@ -66,7 +66,7 @@ public final class PropertyAccessPerfTest { @Test public void timeDirectSetterAndBomXing() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Float value = 0.1f; mView.mSetX(value); @@ -75,7 +75,7 @@ public final class PropertyAccessPerfTest { @Test public void timeDirectFieldSetAndBomXing() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Float value = 0.1f; mView.mX = value; @@ -84,7 +84,7 @@ public final class PropertyAccessPerfTest { @Test public void timeReflectionSetterAndTwoBomXes() throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mSetX.invoke(mView, 0.1f); } @@ -92,7 +92,7 @@ public final class PropertyAccessPerfTest { @Test public void timeReflectionSetterAndOneBomX() throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mArgsBomX[0] = 0.1f; mSetX.invoke(mView, mArgsBomX); @@ -101,7 +101,7 @@ public final class PropertyAccessPerfTest { @Test public void timeReflectionFieldSet() throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mX.setFloat(mView, 0.1f); } @@ -109,7 +109,7 @@ public final class PropertyAccessPerfTest { @Test public void timeGeneratedSetter() throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mGeneratedSetter.setFloat(mView, 0.1f); } @@ -117,7 +117,7 @@ public final class PropertyAccessPerfTest { @Test public void timeGeneratedFieldSet() throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mGeneratedField.setFloat(mView, 0.1f); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/ProviderPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/ProviderPerfTest.java index 0c16265fa6f7dee993a414e8ba0f983d154f0579..7ad0141c8471827848b20c558efab7ba829028e2 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/ProviderPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/ProviderPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -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 javax.crypto.Cipher; @RunWith(AndroidJUnit4.class) @LargeTest public class ProviderPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); @Test public void timeStableProviders() throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Cipher c = Cipher.getInstance("RSA"); } @@ -46,7 +46,7 @@ public class ProviderPerfTest { @Test public void timeWithNewProvider() throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Security.addProvider(new MockProvider()); try { diff --git a/apct-tests/perftests/core/src/android/libcore/regression/RandomPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/RandomPerfTest.java index 5f1bfc29129e6396ffc60ffec88bfec6fc4ae06a..c7b6cb5a190cb960eb4c48a5e66ea3754c5a6bc3 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/RandomPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/RandomPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -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; @@ -32,11 +32,11 @@ import java.util.Random; @RunWith(AndroidJUnit4.class) @LargeTest public class RandomPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); @Test public void timeNewRandom() throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Random rng = new Random(); rng.nextInt(); @@ -46,7 +46,7 @@ public class RandomPerfTest { @Test public void timeReusedRandom() throws Exception { Random rng = new Random(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { rng.nextInt(); } @@ -55,7 +55,7 @@ public class RandomPerfTest { @Test public void timeReusedSecureRandom() throws Exception { SecureRandom rng = new SecureRandom(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { rng.nextInt(); } @@ -63,7 +63,7 @@ public class RandomPerfTest { @Test public void timeNewSecureRandom() throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { SecureRandom rng = new SecureRandom(); rng.nextInt(); diff --git a/apct-tests/perftests/core/src/android/libcore/regression/RealToStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/RealToStringPerfTest.java index 008c94c5249264e67bfb7fdd21c6291fa3f755e5..44e5f227b00abb3c07ff20bebe838d3ba8c97982 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/RealToStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/RealToStringPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -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,7 +29,7 @@ import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) @LargeTest public class RealToStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); private static final float SMALL = -123.45f; private static final float MEDIUM = -123.45e8f; @@ -37,7 +37,7 @@ public class RealToStringPerfTest { @Test public void timeFloat_toString_NaN() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Float.toString(Float.NaN); } @@ -45,7 +45,7 @@ public class RealToStringPerfTest { @Test public void timeFloat_toString_NEGATIVE_INFINITY() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Float.toString(Float.NEGATIVE_INFINITY); } @@ -53,7 +53,7 @@ public class RealToStringPerfTest { @Test public void timeFloat_toString_POSITIVE_INFINITY() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Float.toString(Float.POSITIVE_INFINITY); } @@ -61,7 +61,7 @@ public class RealToStringPerfTest { @Test public void timeFloat_toString_zero() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Float.toString(0.0f); } @@ -69,7 +69,7 @@ public class RealToStringPerfTest { @Test public void timeFloat_toString_minusZero() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Float.toString(-0.0f); } @@ -77,7 +77,7 @@ public class RealToStringPerfTest { @Test public void timeFloat_toString_small() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Float.toString(SMALL); } @@ -85,7 +85,7 @@ public class RealToStringPerfTest { @Test public void timeFloat_toString_medium() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Float.toString(MEDIUM); } @@ -93,7 +93,7 @@ public class RealToStringPerfTest { @Test public void timeFloat_toString_large() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Float.toString(LARGE); } @@ -101,7 +101,7 @@ public class RealToStringPerfTest { @Test public void timeStringBuilder_small() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { new StringBuilder().append(SMALL); } @@ -109,7 +109,7 @@ public class RealToStringPerfTest { @Test public void timeStringBuilder_medium() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { new StringBuilder().append(MEDIUM); } @@ -117,7 +117,7 @@ public class RealToStringPerfTest { @Test public void timeStringBuilder_large() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { new StringBuilder().append(LARGE); } @@ -125,7 +125,7 @@ public class RealToStringPerfTest { @Test public void timeFormatter_small() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { String.format("%f", SMALL); } @@ -133,7 +133,7 @@ public class RealToStringPerfTest { @Test public void timeFormatter_medium() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { String.format("%f", MEDIUM); } @@ -141,7 +141,7 @@ public class RealToStringPerfTest { @Test public void timeFormatter_large() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { String.format("%f", LARGE); } @@ -149,7 +149,7 @@ public class RealToStringPerfTest { @Test public void timeFormatter_dot2f_small() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { String.format("%.2f", SMALL); } @@ -157,7 +157,7 @@ public class RealToStringPerfTest { @Test public void timeFormatter_dot2f_medium() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { String.format("%.2f", MEDIUM); } @@ -165,7 +165,7 @@ public class RealToStringPerfTest { @Test public void timeFormatter_dot2f_large() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { String.format("%.2f", LARGE); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/ReflectionPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/ReflectionPerfTest.java index 45b623d740eefba47f19aa03ab0dcbc92ab0ff6c..6e00b10838a6c574dbd68397f15f09498e15ddcb 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/ReflectionPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/ReflectionPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -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,12 +33,12 @@ import java.lang.reflect.Method; @RunWith(AndroidJUnit4.class) @LargeTest public class ReflectionPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); @Test public void timeObject_getClass() throws Exception { C c = new C(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { c.getClass(); } @@ -47,7 +47,7 @@ public class ReflectionPerfTest { @Test public void timeClass_getField() throws Exception { Class klass = C.class; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { klass.getField("f"); } @@ -56,7 +56,7 @@ public class ReflectionPerfTest { @Test public void timeClass_getDeclaredField() throws Exception { Class klass = C.class; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { klass.getDeclaredField("f"); } @@ -65,7 +65,7 @@ public class ReflectionPerfTest { @Test public void timeClass_getConstructor() throws Exception { Class klass = C.class; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { klass.getConstructor(); } @@ -75,7 +75,7 @@ public class ReflectionPerfTest { public void timeClass_newInstance() throws Exception { Class klass = C.class; Constructor constructor = klass.getConstructor(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { constructor.newInstance(); } @@ -84,7 +84,7 @@ public class ReflectionPerfTest { @Test public void timeClass_getMethod() throws Exception { Class klass = C.class; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { klass.getMethod("m"); } @@ -93,7 +93,7 @@ public class ReflectionPerfTest { @Test public void timeClass_getDeclaredMethod() throws Exception { Class klass = C.class; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { klass.getDeclaredMethod("m"); } @@ -104,7 +104,7 @@ public class ReflectionPerfTest { Class klass = C.class; Field f = klass.getDeclaredField("f"); C instance = new C(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { f.setInt(instance, 1); } @@ -115,7 +115,7 @@ public class ReflectionPerfTest { Class klass = C.class; Field f = klass.getDeclaredField("f"); C instance = new C(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { f.getInt(instance); } @@ -126,7 +126,7 @@ public class ReflectionPerfTest { Class klass = C.class; Method m = klass.getDeclaredMethod("m"); C instance = new C(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { m.invoke(instance); } @@ -136,7 +136,7 @@ public class ReflectionPerfTest { public void timeMethod_invokeStaticV() throws Exception { Class klass = C.class; Method m = klass.getDeclaredMethod("sm"); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { m.invoke(null); } @@ -147,7 +147,7 @@ public class ReflectionPerfTest { Class klass = C.class; Method m = klass.getDeclaredMethod("setField", int.class); C instance = new C(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { m.invoke(instance, 1); } @@ -159,7 +159,7 @@ public class ReflectionPerfTest { Method m = klass.getDeclaredMethod("setField", int.class); C instance = new C(); Integer one = Integer.valueOf(1); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { m.invoke(instance, one); } @@ -169,7 +169,7 @@ public class ReflectionPerfTest { public void timeMethod_invokeStaticI() throws Exception { Class klass = C.class; Method m = klass.getDeclaredMethod("setStaticField", int.class); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { m.invoke(null, 1); } @@ -180,7 +180,7 @@ public class ReflectionPerfTest { Class klass = C.class; Method m = klass.getDeclaredMethod("setStaticField", int.class); Integer one = Integer.valueOf(1); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { m.invoke(null, one); } @@ -189,7 +189,7 @@ public class ReflectionPerfTest { @Test public void timeRegularMethodInvocation() throws Exception { C instance = new C(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { instance.setField(1); } @@ -197,7 +197,7 @@ public class ReflectionPerfTest { @Test public void timeRegularConstructor() throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { new C(); } @@ -206,7 +206,7 @@ public class ReflectionPerfTest { @Test public void timeClass_classNewInstance() throws Exception { Class klass = C.class; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { klass.newInstance(); } @@ -216,7 +216,7 @@ public class ReflectionPerfTest { public void timeClass_isInstance() throws Exception { D d = new D(); Class klass = IC.class; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { klass.isInstance(d); } @@ -224,7 +224,7 @@ public class ReflectionPerfTest { @Test public void timeGetInstanceField() throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { // TODO: Write a test script that generates both the classes we're // reflecting on and the test case for each of its fields. @@ -234,7 +234,7 @@ public class ReflectionPerfTest { @Test public void timeGetStaticField() throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { R.class.getField("WEEK_NUMBER_COLOR"); } @@ -242,7 +242,7 @@ public class ReflectionPerfTest { @Test public void timeGetInterfaceStaticField() throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { F.class.getField("SF"); } @@ -250,7 +250,7 @@ public class ReflectionPerfTest { @Test public void timeGetSuperClassField() throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { G.class.getField("f"); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/SSLLoopbackPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/SSLLoopbackPerfTest.java index da69f9fc9fcf57f6057fc4446556fe3a3e133502..5a9b5c36d0d3c51c325ff417d5b41850c46bb340 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/SSLLoopbackPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/SSLLoopbackPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -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,11 +35,11 @@ import javax.net.ssl.SSLSocket; @RunWith(AndroidJUnit4.class) @LargeTest public class SSLLoopbackPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); @Test public void time() throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { TestSSLContext context = TestSSLContext.create(TestKeyStore.getClient(), TestKeyStore.getServer()); diff --git a/apct-tests/perftests/core/src/android/libcore/regression/SSLSocketFactoryPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/SSLSocketFactoryPerfTest.java index 9f2c312f33ee3ab8913251bb711ec59de9a5177a..6d48cf26c971d41a63913c782871ccdd7825ac56 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/SSLSocketFactoryPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/SSLSocketFactoryPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -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; @@ -31,11 +31,11 @@ import javax.net.ssl.SSLSocketFactory; @RunWith(AndroidJUnit4.class) @LargeTest public class SSLSocketFactoryPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); @Test public void time() throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { SSLSocketFactory.getDefault(); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/SchemePrefixPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/SchemePrefixPerfTest.java index 7c60c05ef6794c10628af49c0399d40f0e6ce6cc..86416291f26d7fdd2a78a8fdff820be643355f42 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/SchemePrefixPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/SchemePrefixPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; @@ -37,7 +37,7 @@ import java.util.regex.Pattern; @RunWith(JUnitParamsRunner.class) @LargeTest public final class SchemePrefixPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); enum Strategy { JAVA() { @@ -94,7 +94,7 @@ public final class SchemePrefixPerfTest { @Test @Parameters(method = "getData") public void timeSchemePrefix(Strategy strategy) { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { strategy.execute("http://android.com"); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/SerializationPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/SerializationPerfTest.java index 181298305cb5648034954e7db434ce08bac51c33..afd1191a07fa44d388e925d8eeec1003f0c71f5b 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/SerializationPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/SerializationPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -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; @@ -37,7 +37,7 @@ import java.util.ArrayList; @RunWith(AndroidJUnit4.class) @LargeTest public class SerializationPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); private static byte[] bytes(Object o) throws Exception { ByteArrayOutputStream baos = new ByteArrayOutputStream(1024); @@ -110,7 +110,7 @@ public class SerializationPerfTest { public void timeWriteNoObjects() throws Exception { ByteArrayOutputStream baos = new ByteArrayOutputStream(1024); ObjectOutputStream out = new ObjectOutputStream(baos); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { out.reset(); baos.reset(); @@ -121,7 +121,7 @@ public class SerializationPerfTest { private void readSingleObject(Object object) throws Exception { byte[] bytes = bytes(object); ByteArrayInputStream bais = new ByteArrayInputStream(bytes); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { ObjectInputStream in = new ObjectInputStream(bais); in.readObject(); @@ -133,7 +133,7 @@ public class SerializationPerfTest { private void writeSingleObject(Object o) throws Exception { ByteArrayOutputStream baos = new ByteArrayOutputStream(1024); ObjectOutputStream out = new ObjectOutputStream(baos); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { out.writeObject(o); out.reset(); diff --git a/apct-tests/perftests/core/src/android/libcore/regression/SignaturePerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/SignaturePerfTest.java index 34e9bfb84813bd8afb4f637eef2bcc6efb728a7a..6c261332aa99b16d8dd363071126e8b08d55ff73 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/SignaturePerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/SignaturePerfTest.java @@ -15,8 +15,8 @@ */ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; @@ -41,7 +41,7 @@ import java.util.Map; @RunWith(JUnitParamsRunner.class) @LargeTest public class SignaturePerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); public static Collection getData() { return Arrays.asList( @@ -117,7 +117,7 @@ public class SignaturePerfTest { @Parameters(method = "getData") public void timeSign(Algorithm algorithm, Implementation implementation) throws Exception { setUp(algorithm); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Signature signer; switch (implementation) { @@ -140,7 +140,7 @@ public class SignaturePerfTest { @Parameters(method = "getData") public void timeVerify(Algorithm algorithm, Implementation implementation) throws Exception { setUp(algorithm); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Signature verifier; switch (implementation) { diff --git a/apct-tests/perftests/core/src/android/libcore/regression/SimpleDateFormatPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/SimpleDateFormatPerfTest.java index 2fe67985d205c904347f88b1f0697f50e4026dd4..274b51f6fae460f7241a9227b3fd670f779e4eb2 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/SimpleDateFormatPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/SimpleDateFormatPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -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; @@ -37,11 +37,11 @@ import java.util.Date; @RunWith(AndroidJUnit4.class) @LargeTest public class SimpleDateFormatPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); @Test public void time_createFormatWithTimeZone() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd z"); } @@ -50,7 +50,7 @@ public class SimpleDateFormatPerfTest { @Test public void time_parseWithTimeZoneShort() throws ParseException { SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd z"); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { sdf.parse("2000.01.01 PST"); } @@ -59,7 +59,7 @@ public class SimpleDateFormatPerfTest { @Test public void time_parseWithTimeZoneLong() throws ParseException { SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd zzzz"); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { sdf.parse("2000.01.01 Pacific Standard Time"); } @@ -68,7 +68,7 @@ public class SimpleDateFormatPerfTest { @Test public void time_parseWithoutTimeZone() throws ParseException { SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd"); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { sdf.parse("2000.01.01"); } @@ -76,7 +76,7 @@ public class SimpleDateFormatPerfTest { @Test public void time_createAndParseWithTimeZoneShort() throws ParseException { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd z"); sdf.parse("2000.01.01 PST"); @@ -85,7 +85,7 @@ public class SimpleDateFormatPerfTest { @Test public void time_createAndParseWithTimeZoneLong() throws ParseException { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd zzzz"); sdf.parse("2000.01.01 Pacific Standard Time"); @@ -95,7 +95,7 @@ public class SimpleDateFormatPerfTest { @Test public void time_formatWithTimeZoneShort() { SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd z"); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { sdf.format(new Date()); } @@ -104,7 +104,7 @@ public class SimpleDateFormatPerfTest { @Test public void time_formatWithTimeZoneLong() { SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd zzzz"); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { sdf.format(new Date()); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/StrictMathPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/StrictMathPerfTest.java index fbe3cefff7760bb279c3f049549c1db7ffdd6758..b4c427beac659d7f4bd7ae2c9ac398f9db1122fc 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/StrictMathPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/StrictMathPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -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,7 +33,7 @@ import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) @LargeTest public class StrictMathPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); private final double mDouble = 1.2; private final float mFloat = 1.2f; @@ -74,7 +74,7 @@ public class StrictMathPerfTest { @Test public void timeAbsD() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.abs(mDouble); } @@ -82,7 +82,7 @@ public class StrictMathPerfTest { @Test public void timeAbsF() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.abs(mFloat); } @@ -90,7 +90,7 @@ public class StrictMathPerfTest { @Test public void timeAbsI() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.abs(mInt); } @@ -98,7 +98,7 @@ public class StrictMathPerfTest { @Test public void timeAbsL() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.abs(mLong); } @@ -106,7 +106,7 @@ public class StrictMathPerfTest { @Test public void timeAcos() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.acos(mDouble); } @@ -114,7 +114,7 @@ public class StrictMathPerfTest { @Test public void timeAsin() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.asin(mDouble); } @@ -122,7 +122,7 @@ public class StrictMathPerfTest { @Test public void timeAtan() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.atan(mDouble); } @@ -130,7 +130,7 @@ public class StrictMathPerfTest { @Test public void timeAtan2() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.atan2(3, 4); } @@ -138,7 +138,7 @@ public class StrictMathPerfTest { @Test public void timeCbrt() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.cbrt(mDouble); } @@ -146,7 +146,7 @@ public class StrictMathPerfTest { @Test public void timeCeilOverInterestingValues() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { for (int i = 0; i < CEIL_DOUBLES.length; ++i) { StrictMath.ceil(CEIL_DOUBLES[i]); @@ -156,7 +156,7 @@ public class StrictMathPerfTest { @Test public void timeCopySignD() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.copySign(mDouble, mDouble); } @@ -164,7 +164,7 @@ public class StrictMathPerfTest { @Test public void timeCopySignF() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.copySign(mFloat, mFloat); } @@ -172,7 +172,7 @@ public class StrictMathPerfTest { @Test public void timeCos() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.cos(mDouble); } @@ -180,7 +180,7 @@ public class StrictMathPerfTest { @Test public void timeCosh() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.cosh(mDouble); } @@ -188,7 +188,7 @@ public class StrictMathPerfTest { @Test public void timeExp() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.exp(mDouble); } @@ -196,7 +196,7 @@ public class StrictMathPerfTest { @Test public void timeExpm1() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.expm1(mDouble); } @@ -204,7 +204,7 @@ public class StrictMathPerfTest { @Test public void timeFloorOverInterestingValues() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { for (int i = 0; i < FLOOR_DOUBLES.length; ++i) { StrictMath.floor(FLOOR_DOUBLES[i]); @@ -214,7 +214,7 @@ public class StrictMathPerfTest { @Test public void timeGetExponentD() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.getExponent(mDouble); } @@ -222,7 +222,7 @@ public class StrictMathPerfTest { @Test public void timeGetExponentF() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.getExponent(mFloat); } @@ -230,7 +230,7 @@ public class StrictMathPerfTest { @Test public void timeHypot() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.hypot(mDouble, mDouble); } @@ -238,7 +238,7 @@ public class StrictMathPerfTest { @Test public void timeIEEEremainder() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.IEEEremainder(mDouble, mDouble); } @@ -246,7 +246,7 @@ public class StrictMathPerfTest { @Test public void timeLog() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.log(mDouble); } @@ -254,7 +254,7 @@ public class StrictMathPerfTest { @Test public void timeLog10() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.log10(mDouble); } @@ -262,7 +262,7 @@ public class StrictMathPerfTest { @Test public void timeLog1p() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.log1p(mDouble); } @@ -270,7 +270,7 @@ public class StrictMathPerfTest { @Test public void timeMaxD() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.max(mDouble, mDouble); } @@ -278,7 +278,7 @@ public class StrictMathPerfTest { @Test public void timeMaxF() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.max(mFloat, mFloat); } @@ -286,7 +286,7 @@ public class StrictMathPerfTest { @Test public void timeMaxI() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.max(mInt, mInt); } @@ -294,7 +294,7 @@ public class StrictMathPerfTest { @Test public void timeMaxL() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.max(mLong, mLong); } @@ -302,7 +302,7 @@ public class StrictMathPerfTest { @Test public void timeMinD() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.min(mDouble, mDouble); } @@ -310,7 +310,7 @@ public class StrictMathPerfTest { @Test public void timeMinF() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.min(mFloat, mFloat); } @@ -318,7 +318,7 @@ public class StrictMathPerfTest { @Test public void timeMinI() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.min(mInt, mInt); } @@ -326,7 +326,7 @@ public class StrictMathPerfTest { @Test public void timeMinL() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.min(mLong, mLong); } @@ -334,7 +334,7 @@ public class StrictMathPerfTest { @Test public void timeNextAfterD() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.nextAfter(mDouble, mDouble); } @@ -342,7 +342,7 @@ public class StrictMathPerfTest { @Test public void timeNextAfterF() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.nextAfter(mFloat, mFloat); } @@ -350,7 +350,7 @@ public class StrictMathPerfTest { @Test public void timeNextUpD() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.nextUp(mDouble); } @@ -358,7 +358,7 @@ public class StrictMathPerfTest { @Test public void timeNextUpF() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.nextUp(mFloat); } @@ -366,7 +366,7 @@ public class StrictMathPerfTest { @Test public void timePow() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.pow(mDouble, mDouble); } @@ -374,7 +374,7 @@ public class StrictMathPerfTest { @Test public void timeRandom() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.random(); } @@ -382,7 +382,7 @@ public class StrictMathPerfTest { @Test public void timeRint() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.rint(mDouble); } @@ -390,7 +390,7 @@ public class StrictMathPerfTest { @Test public void timeRoundD() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.round(mDouble); } @@ -398,7 +398,7 @@ public class StrictMathPerfTest { @Test public void timeRoundF() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.round(mFloat); } @@ -406,7 +406,7 @@ public class StrictMathPerfTest { @Test public void timeScalbD() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.scalb(mDouble, 5); } @@ -414,7 +414,7 @@ public class StrictMathPerfTest { @Test public void timeScalbF() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.scalb(mFloat, 5); } @@ -422,7 +422,7 @@ public class StrictMathPerfTest { @Test public void timeSignumD() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.signum(mDouble); } @@ -430,7 +430,7 @@ public class StrictMathPerfTest { @Test public void timeSignumF() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.signum(mFloat); } @@ -438,7 +438,7 @@ public class StrictMathPerfTest { @Test public void timeSin() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.sin(mDouble); } @@ -446,7 +446,7 @@ public class StrictMathPerfTest { @Test public void timeSinh() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.sinh(mDouble); } @@ -454,7 +454,7 @@ public class StrictMathPerfTest { @Test public void timeSqrt() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.sqrt(mDouble); } @@ -462,7 +462,7 @@ public class StrictMathPerfTest { @Test public void timeTan() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.tan(mDouble); } @@ -470,7 +470,7 @@ public class StrictMathPerfTest { @Test public void timeTanh() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.tanh(mDouble); } @@ -478,7 +478,7 @@ public class StrictMathPerfTest { @Test public void timeToDegrees() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.toDegrees(mDouble); } @@ -486,7 +486,7 @@ public class StrictMathPerfTest { @Test public void timeToRadians() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.toRadians(mDouble); } @@ -494,7 +494,7 @@ public class StrictMathPerfTest { @Test public void timeUlpD() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.ulp(mDouble); } @@ -502,7 +502,7 @@ public class StrictMathPerfTest { @Test public void timeUlpF() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StrictMath.ulp(mFloat); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/StringBuilderPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/StringBuilderPerfTest.java index 0155154037dfeaab4894259d8735b5436ffc282f..2235cc5611a4155524d9bbbc3cca009d67c6e7a7 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/StringBuilderPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/StringBuilderPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -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,13 @@ import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) @LargeTest public class StringBuilderPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); public int mLength = 100; @Test public void timeAppendBoolean() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StringBuilder sb = new StringBuilder(); for (int j = 0; j < mLength; ++j) { @@ -47,7 +47,7 @@ public class StringBuilderPerfTest { @Test public void timeAppendChar() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StringBuilder sb = new StringBuilder(); for (int j = 0; j < mLength; ++j) { @@ -59,7 +59,7 @@ public class StringBuilderPerfTest { @Test public void timeAppendCharArray() { char[] chars = "chars".toCharArray(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StringBuilder sb = new StringBuilder(); for (int j = 0; j < mLength; ++j) { @@ -71,7 +71,7 @@ public class StringBuilderPerfTest { @Test public void timeAppendCharSequence() { CharSequence cs = "chars"; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StringBuilder sb = new StringBuilder(); for (int j = 0; j < mLength; ++j) { @@ -83,7 +83,7 @@ public class StringBuilderPerfTest { @Test public void timeAppendSubCharSequence() { CharSequence cs = "chars"; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StringBuilder sb = new StringBuilder(); for (int j = 0; j < mLength; ++j) { @@ -95,7 +95,7 @@ public class StringBuilderPerfTest { @Test public void timeAppendDouble() { double d = 1.2; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StringBuilder sb = new StringBuilder(); for (int j = 0; j < mLength; ++j) { @@ -107,7 +107,7 @@ public class StringBuilderPerfTest { @Test public void timeAppendFloat() { float f = 1.2f; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StringBuilder sb = new StringBuilder(); for (int j = 0; j < mLength; ++j) { @@ -119,7 +119,7 @@ public class StringBuilderPerfTest { @Test public void timeAppendInt() { int n = 123; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StringBuilder sb = new StringBuilder(); for (int j = 0; j < mLength; ++j) { @@ -131,7 +131,7 @@ public class StringBuilderPerfTest { @Test public void timeAppendLong() { long l = 123; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StringBuilder sb = new StringBuilder(); for (int j = 0; j < mLength; ++j) { @@ -150,7 +150,7 @@ public class StringBuilderPerfTest { return "constant"; } }; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StringBuilder sb = new StringBuilder(); for (int j = 0; j < mLength; ++j) { @@ -162,7 +162,7 @@ public class StringBuilderPerfTest { @Test public void timeAppendString() { String s = "chars"; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { StringBuilder sb = new StringBuilder(); for (int j = 0; j < mLength; ++j) { diff --git a/apct-tests/perftests/core/src/android/libcore/regression/StringEqualsPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/StringEqualsPerfTest.java index 55337452611b2f621f6da3067188af890faed7ab..9ab50005e62abc3a7dc2613bc41ac08369c0bbb1 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/StringEqualsPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/StringEqualsPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -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 @@ import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) @LargeTest public class StringEqualsPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); private final String mLong1 = "Ahead-of-time compilation is possible as the compiler may just convert an instruction" @@ -226,7 +226,7 @@ public class StringEqualsPerfTest { // Benchmark cases of String.equals(null) @Test public void timeEqualsNull() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { for (int i = 0; i < mMediumStrings.length; i++) { mMediumStrings[i][0].equals(null); @@ -237,7 +237,7 @@ public class StringEqualsPerfTest { // Benchmark cases with very short (<5 character) Strings @Test public void timeEqualsShort() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { for (int i = 0; i < mShortStrings.length; i++) { mShortStrings[i][0].equals(mShortStrings[i][1]); @@ -248,7 +248,7 @@ public class StringEqualsPerfTest { // Benchmark cases with medium length (10-15 character) Strings @Test public void timeEqualsMedium() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { for (int i = 0; i < mMediumStrings.length; i++) { mMediumStrings[i][0].equals(mMediumStrings[i][1]); @@ -259,7 +259,7 @@ public class StringEqualsPerfTest { // Benchmark cases with long (>100 character) Strings @Test public void timeEqualsLong() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { for (int i = 0; i < mLongStrings.length; i++) { mLongStrings[i][0].equals(mLongStrings[i][1]); @@ -270,7 +270,7 @@ public class StringEqualsPerfTest { // Benchmark cases with very long (>1000 character) Strings @Test public void timeEqualsVeryLong() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { for (int i = 0; i < mVeryLongStrings.length; i++) { mVeryLongStrings[i][0].equals(mVeryLongStrings[i][1]); @@ -281,7 +281,7 @@ public class StringEqualsPerfTest { // Benchmark cases with non-word aligned Strings @Test public void timeEqualsNonWordAligned() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { for (int i = 0; i < mNonalignedStrings.length; i++) { mNonalignedStrings[i][0].equals(mNonalignedStrings[i][1]); @@ -292,7 +292,7 @@ public class StringEqualsPerfTest { // Benchmark cases with slight differences in the endings @Test public void timeEqualsEnd() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { for (int i = 0; i < mEndStrings.length; i++) { mEndStrings[i][0].equals(mEndStrings[i][1]); @@ -303,7 +303,7 @@ public class StringEqualsPerfTest { // Benchmark cases of comparing a string to a non-string object @Test public void timeEqualsNonString() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { for (int i = 0; i < mMediumStrings.length; i++) { mMediumStrings[i][0].equals(mObjects[i]); diff --git a/apct-tests/perftests/core/src/android/libcore/regression/StringIsEmptyPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/StringIsEmptyPerfTest.java index a5662b0a33bdcf3ec28df85dc2a0016660c43b92..b1e749cc538c8490b1449810d17a389fccbee144 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/StringIsEmptyPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/StringIsEmptyPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -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,12 +29,12 @@ import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) @LargeTest public class StringIsEmptyPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); @Test public void timeIsEmpty_NonEmpty() { boolean result = true; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result &= !("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx".isEmpty()); } @@ -44,7 +44,7 @@ public class StringIsEmptyPerfTest { @Test public void timeIsEmpty_Empty() { boolean result = true; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result &= ("".isEmpty()); } @@ -54,7 +54,7 @@ public class StringIsEmptyPerfTest { @Test public void timeLengthEqualsZero() { boolean result = true; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result &= !("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx".length() == 0); } @@ -64,7 +64,7 @@ public class StringIsEmptyPerfTest { @Test public void timeEqualsEmpty() { boolean result = true; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { result &= !"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx".equals(""); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/StringLengthPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/StringLengthPerfTest.java index 41e64f2810c3b28847539285f3be1880d041abf7..9e5759171a6fd4300f46401f3c86db337253961c 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/StringLengthPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/StringLengthPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -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,12 +29,12 @@ import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) @LargeTest public class StringLengthPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); @Test public void timeLength() { int length = 0; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { length = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx".length(); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/StringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/StringPerfTest.java index 2cd2a0976451b6084913c6b1c49a3e44d0c053da..a80514c72e95de80ff7e7d679efa9b51741e61cf 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/StringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/StringPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; @@ -34,7 +34,7 @@ import java.util.Collection; @RunWith(JUnitParamsRunner.class) @LargeTest public class StringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); enum StringLengths { EMPTY(""), @@ -69,7 +69,7 @@ public class StringPerfTest { @Test @Parameters(method = "getData") public void timeHashCode(StringLengths stringLengths) { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { stringLengths.mValue.hashCode(); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/StringReplaceAllPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/StringReplaceAllPerfTest.java index 219dccf6901b0f7f2a2990ac6ba399e5780b6a13..78ae3952719b6c1cd7f0081c672be8a7b5294530 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/StringReplaceAllPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/StringReplaceAllPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; @@ -34,7 +34,7 @@ import java.util.Collection; @RunWith(JUnitParamsRunner.class) @LargeTest public class StringReplaceAllPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); // NOTE: These estimates of MOVEABLE / NON_MOVEABLE are based on a knowledge of // ART implementation details. They make a difference here because JNI calls related @@ -86,7 +86,7 @@ public class StringReplaceAllPerfTest { @Test @Parameters(method = "getData") public void timeReplaceAllTrivialPatternNonExistent(StringLengths stringLengths) { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { stringLengths.mValue.replaceAll("fish", "0"); } @@ -95,7 +95,7 @@ public class StringReplaceAllPerfTest { @Test @Parameters(method = "getData") public void timeReplaceTrivialPatternAllRepeated(StringLengths stringLengths) { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { stringLengths.mValue.replaceAll("jklm", "0"); } @@ -104,7 +104,7 @@ public class StringReplaceAllPerfTest { @Test @Parameters(method = "getData") public void timeReplaceAllTrivialPatternSingleOccurrence(StringLengths stringLengths) { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { stringLengths.mValue.replaceAll("qrst", "0"); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/StringReplacePerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/StringReplacePerfTest.java index d6fef5ed84e7830e019160b1c6968746650ae332..73911c71c351fdbb9824d6b5977938c23686c710 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/StringReplacePerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/StringReplacePerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; @@ -34,7 +34,7 @@ import java.util.Collection; @RunWith(JUnitParamsRunner.class) @LargeTest public class StringReplacePerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); enum StringLengths { EMPTY(""), @@ -80,7 +80,7 @@ public class StringReplacePerfTest { @Test @Parameters(method = "getData") public void timeReplaceCharNonExistent(StringLengths stringLengths) { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { stringLengths.mValue.replace('z', '0'); } @@ -89,7 +89,7 @@ public class StringReplacePerfTest { @Test @Parameters(method = "getData") public void timeReplaceCharRepeated(StringLengths stringLengths) { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { stringLengths.mValue.replace('a', '0'); } @@ -98,7 +98,7 @@ public class StringReplacePerfTest { @Test @Parameters(method = "getData") public void timeReplaceSingleChar(StringLengths stringLengths) { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { stringLengths.mValue.replace('q', '0'); } @@ -107,7 +107,7 @@ public class StringReplacePerfTest { @Test @Parameters(method = "getData") public void timeReplaceSequenceNonExistent(StringLengths stringLengths) { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { stringLengths.mValue.replace("fish", "0"); } @@ -116,7 +116,7 @@ public class StringReplacePerfTest { @Test @Parameters(method = "getData") public void timeReplaceSequenceRepeated(StringLengths stringLengths) { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { stringLengths.mValue.replace("jklm", "0"); } @@ -125,7 +125,7 @@ public class StringReplacePerfTest { @Test @Parameters(method = "getData") public void timeReplaceSingleSequence(StringLengths stringLengths) { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { stringLengths.mValue.replace("qrst", "0"); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/StringSplitPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/StringSplitPerfTest.java index 9d0ec2f368c9ba0fcf500ffd64b5416399c78d83..1539271c2b3c76346e79280534c2cba2af56924c 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/StringSplitPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/StringSplitPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -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; @@ -31,11 +31,11 @@ import java.util.regex.Pattern; @RunWith(AndroidJUnit4.class) @LargeTest public class StringSplitPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); @Test public void timeStringSplitComma() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { "this,is,a,simple,example".split(","); } @@ -43,7 +43,7 @@ public class StringSplitPerfTest { @Test public void timeStringSplitLiteralDot() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { "this.is.a.simple.example".split("\\."); } @@ -51,7 +51,7 @@ public class StringSplitPerfTest { @Test public void timeStringSplitNewline() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { "this\nis\na\nsimple\nexample\n".split("\n"); } @@ -60,7 +60,7 @@ public class StringSplitPerfTest { @Test public void timePatternSplitComma() { Pattern p = Pattern.compile(","); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { p.split("this,is,a,simple,example"); } @@ -69,7 +69,7 @@ public class StringSplitPerfTest { @Test public void timePatternSplitLiteralDot() { Pattern p = Pattern.compile("\\."); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { p.split("this.is.a.simple.example"); } @@ -77,7 +77,7 @@ public class StringSplitPerfTest { @Test public void timeStringSplitHard() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { "this,is,a,harder,example".split("[,]"); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/StringToBytesPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/StringToBytesPerfTest.java index 11950b70ab3d133e3bd0142a586154256602e29f..0d5e62b4268c791fbc15dc01a5e4169a94462a61 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/StringToBytesPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/StringToBytesPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; @@ -35,7 +35,7 @@ import java.util.Collection; @RunWith(JUnitParamsRunner.class) @LargeTest public class StringToBytesPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); enum StringLengths { EMPTY(""), @@ -89,7 +89,7 @@ public class StringToBytesPerfTest { @Test @Parameters(method = "getData") public void timeGetBytesUtf8(StringLengths stringLengths) { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { stringLengths.mValue.getBytes(StandardCharsets.UTF_8); } @@ -98,7 +98,7 @@ public class StringToBytesPerfTest { @Test @Parameters(method = "getData") public void timeGetBytesIso88591(StringLengths stringLengths) { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { stringLengths.mValue.getBytes(StandardCharsets.ISO_8859_1); } @@ -107,7 +107,7 @@ public class StringToBytesPerfTest { @Test @Parameters(method = "getData") public void timeGetBytesAscii(StringLengths stringLengths) { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { stringLengths.mValue.getBytes(StandardCharsets.US_ASCII); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/StringToRealPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/StringToRealPerfTest.java index 4b27a16538abcdfa936a0e5a1138fa4199dbb923..ecdf809f1610b2240379467cb9272e1bbbcecff9 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/StringToRealPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/StringToRealPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; @@ -34,7 +34,7 @@ import java.util.Collection; @RunWith(JUnitParamsRunner.class) @LargeTest public class StringToRealPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); public static Collection getData() { return Arrays.asList( @@ -53,7 +53,7 @@ public class StringToRealPerfTest { @Test @Parameters(method = "getData") public void timeFloat_parseFloat(String string) { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Float.parseFloat(string); } @@ -62,7 +62,7 @@ public class StringToRealPerfTest { @Test @Parameters(method = "getData") public void timeDouble_parseDouble(String string) { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Double.parseDouble(string); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/ThreadLocalPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/ThreadLocalPerfTest.java index 0ab012dc2871911f881c3435a75464ae52c4b12f..2b2a6b5727deea5325b2fed9ae37b519ef27286b 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/ThreadLocalPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/ThreadLocalPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -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,7 +29,7 @@ import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) @LargeTest public class ThreadLocalPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); private static final ThreadLocal BUFFER = new ThreadLocal() { @@ -41,7 +41,7 @@ public class ThreadLocalPerfTest { @Test public void timeThreadLocal_get() { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { BUFFER.get(); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/TimeZonePerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/TimeZonePerfTest.java index ddf410eccbcbcc009ae5c13e56efc6b113283140..6eb8fccf5b2a3a7123c3ed050fa685ace0682b89 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/TimeZonePerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/TimeZonePerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -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; @@ -31,11 +31,11 @@ import java.util.TimeZone; @RunWith(AndroidJUnit4.class) @LargeTest public class TimeZonePerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); @Test public void timeTimeZone_getDefault() throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { TimeZone.getDefault(); } @@ -43,7 +43,7 @@ public class TimeZonePerfTest { @Test public void timeTimeZone_getTimeZoneUTC() throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { TimeZone.getTimeZone("UTC"); } @@ -52,7 +52,7 @@ public class TimeZonePerfTest { @Test public void timeTimeZone_getTimeZone_default() throws Exception { String defaultId = TimeZone.getDefault().getID(); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { TimeZone.getTimeZone(defaultId); } @@ -61,7 +61,7 @@ public class TimeZonePerfTest { // A time zone with relatively few transitions. @Test public void timeTimeZone_getTimeZone_America_Caracas() throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { TimeZone.getTimeZone("America/Caracas"); } @@ -70,7 +70,7 @@ public class TimeZonePerfTest { // A time zone with a lot of transitions. @Test public void timeTimeZone_getTimeZone_America_Santiago() throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { TimeZone.getTimeZone("America/Santiago"); } @@ -78,7 +78,7 @@ public class TimeZonePerfTest { @Test public void timeTimeZone_getTimeZone_GMT_plus_10() throws Exception { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { TimeZone.getTimeZone("GMT+10"); } diff --git a/apct-tests/perftests/core/src/android/libcore/regression/XMLEntitiesPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/XMLEntitiesPerfTest.java index a38763b6ffad5f0c58ffc68a9935a8f73924c35f..288c646ec67d9ea547f2b1d301e1afbdc558890e 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/XMLEntitiesPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/XMLEntitiesPerfTest.java @@ -16,8 +16,8 @@ package android.libcore.regression; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; import androidx.test.filters.LargeTest; @@ -42,7 +42,7 @@ import javax.xml.parsers.DocumentBuilderFactory; @RunWith(JUnitParamsRunner.class) @LargeTest public final class XMLEntitiesPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); public static Collection getData() { return Arrays.asList( @@ -85,7 +85,7 @@ public final class XMLEntitiesPerfTest { @Parameters(method = "getData") public void timeXmlParser(int length, float entityFraction) throws Exception { setUp(length, entityFraction); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { XmlPullParser parser = mXmlPullParserFactory.newPullParser(); parser.setInput(new StringReader(mXml)); @@ -99,7 +99,7 @@ public final class XMLEntitiesPerfTest { @Parameters(method = "getData") public void timeDocumentBuilder(int length, float entityFraction) throws Exception { setUp(length, entityFraction); - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { DocumentBuilder documentBuilder = mDocumentBuilderFactory.newDocumentBuilder(); documentBuilder.parse(new InputSource(new StringReader(mXml))); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetFieldLittleEndianIntPerfTest.java index 4076c9d18e57b4e750d2b4e1559ddeb0cef88540..003c957d894fe0b400cb43b8f15ef843a3066a11 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetFieldLittleEndianIntPerfTest.java @@ -13,30 +13,25 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; -import java.lang.invoke.MethodHandles; -import java.lang.invoke.VarHandle; - import java.lang.reflect.Field; @RunWith(AndroidJUnit4.class) @LargeTest public class ReflectGetFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); Field mField; int mValue; @@ -47,7 +42,7 @@ public class ReflectGetFieldLittleEndianIntPerfTest { @Test public void run() throws Throwable { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mField.getInt(this); x = (int) mField.getInt(this); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetFieldLittleEndianStringPerfTest.java index 2c65dd4a90f3cb63f1356cc3b87c3ad5353b17db..4f216181d5e3627afe24a24083e780673f98159a 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetFieldLittleEndianStringPerfTest.java @@ -13,30 +13,25 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; -import java.lang.invoke.MethodHandles; -import java.lang.invoke.VarHandle; - import java.lang.reflect.Field; @RunWith(AndroidJUnit4.class) @LargeTest public class ReflectGetFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); Field mField; String mValue; @@ -47,7 +42,7 @@ public class ReflectGetFieldLittleEndianStringPerfTest { @Test public void run() throws Throwable { String x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (String) mField.get(this); x = (String) mField.get(this); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetStaticFieldLittleEndianIntPerfTest.java index dcd25db01f18b2be12fcf1007e0c84413fe5ec4e..210014ad3f6e885db539f66ac8215aac327ee624 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetStaticFieldLittleEndianIntPerfTest.java @@ -13,30 +13,25 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; -import java.lang.invoke.MethodHandles; -import java.lang.invoke.VarHandle; - import java.lang.reflect.Field; @RunWith(AndroidJUnit4.class) @LargeTest public class ReflectGetStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); Field mField; static int sValue; @@ -47,7 +42,7 @@ public class ReflectGetStaticFieldLittleEndianIntPerfTest { @Test public void run() throws Throwable { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mField.getInt(null); x = (int) mField.getInt(null); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetStaticFieldLittleEndianStringPerfTest.java index c938a4cda5a0ac5c60fa5e4f94904b183b91f7c1..22c68273bf1280c444d839b971915980eac960c1 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetStaticFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetStaticFieldLittleEndianStringPerfTest.java @@ -13,30 +13,25 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; -import java.lang.invoke.MethodHandles; -import java.lang.invoke.VarHandle; - import java.lang.reflect.Field; @RunWith(AndroidJUnit4.class) @LargeTest public class ReflectGetStaticFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); Field mField; static String sValue; @@ -47,7 +42,7 @@ public class ReflectGetStaticFieldLittleEndianStringPerfTest { @Test public void run() throws Throwable { String x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (String) mField.get(null); x = (String) mField.get(null); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetFieldLittleEndianIntPerfTest.java index 618e1b5f5b41ebd6cbaaac544b1d69db6d46ed81..5b391091253b33cd79f7da0ccaf1166f4913b1e8 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetFieldLittleEndianIntPerfTest.java @@ -13,30 +13,25 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; -import java.lang.invoke.MethodHandles; -import java.lang.invoke.VarHandle; - import java.lang.reflect.Field; @RunWith(AndroidJUnit4.class) @LargeTest public class ReflectSetFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); Field mField; int mValue; @@ -46,7 +41,7 @@ public class ReflectSetFieldLittleEndianIntPerfTest { @Test public void run() throws Throwable { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mField.setInt(this, 42); mField.setInt(this, 42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetFieldLittleEndianStringPerfTest.java index 8c2e3ca8d586c23d7a1240301d95f9b8ef1f3286..883e8a76586b298bcc8bc81c2e39b72106a960ed 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetFieldLittleEndianStringPerfTest.java @@ -13,30 +13,25 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; -import java.lang.invoke.MethodHandles; -import java.lang.invoke.VarHandle; - import java.lang.reflect.Field; @RunWith(AndroidJUnit4.class) @LargeTest public class ReflectSetFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); Field mField; String mValue; @@ -46,7 +41,7 @@ public class ReflectSetFieldLittleEndianStringPerfTest { @Test public void run() throws Throwable { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mField.set(this, "qwerty"); mField.set(this, "qwerty"); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetStaticFieldLittleEndianIntPerfTest.java index e888cc68d471b0bab6b53884e9cb03bc46eba47f..50bc85c3128063f88620020e13064acab756d6f5 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetStaticFieldLittleEndianIntPerfTest.java @@ -13,30 +13,25 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; -import java.lang.invoke.MethodHandles; -import java.lang.invoke.VarHandle; - import java.lang.reflect.Field; @RunWith(AndroidJUnit4.class) @LargeTest public class ReflectSetStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); Field mField; static int sValue; @@ -46,7 +41,7 @@ public class ReflectSetStaticFieldLittleEndianIntPerfTest { @Test public void run() throws Throwable { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mField.setInt(null, 42); mField.setInt(null, 42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetStaticFieldLittleEndianStringPerfTest.java index 7016611a1b1d8e92c4088ba170df873375d76e79..13fa2bf7d230903f23681e21fab5985bccb6b269 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetStaticFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetStaticFieldLittleEndianStringPerfTest.java @@ -13,30 +13,25 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; -import java.lang.invoke.MethodHandles; -import java.lang.invoke.VarHandle; - import java.lang.reflect.Field; @RunWith(AndroidJUnit4.class) @LargeTest public class ReflectSetStaticFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); Field mField; static String sValue; @@ -46,7 +41,7 @@ public class ReflectSetStaticFieldLittleEndianStringPerfTest { @Test public void run() throws Throwable { - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mField.set(null, "qwerty"); mField.set(null, "qwerty"); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireFieldLittleEndianIntPerfTest.java index 65c82cca87be56d2c32ab5bf158288773b40e3ac..85c9bae9a9d920ca1b68640674e2c35cfc585501 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleCompareandexchangeAcquireFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; int mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleCompareandexchangeAcquireFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.compareAndExchangeAcquire(this, mField, ~42); x = (int) mVh.compareAndExchangeAcquire(this, mField, 42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireFieldLittleEndianStringPerfTest.java index a350b61da20b9b8b288382b68458e540d2334142..2b8f430440f574b1359bb70631f4a7480b00e372 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireFieldLittleEndianStringPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleCompareandexchangeAcquireFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; String mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleCompareandexchangeAcquireFieldLittleEndianStringPerfTest { @Test public void run() { String x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (String) mVh.compareAndExchangeAcquire(this, mField, null); x = (String) mVh.compareAndExchangeAcquire(this, mField, "qwerty"); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireStaticFieldLittleEndianIntPerfTest.java index 34f596eea6aa0c382ca1f36b57868b7fe577830b..246fa43d0dca8836440bfc9cc276cbb4271b2e40 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireStaticFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleCompareandexchangeAcquireStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; static int sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleCompareandexchangeAcquireStaticFieldLittleEndianIntPerfTes @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.compareAndExchangeAcquire(sField, ~42); x = (int) mVh.compareAndExchangeAcquire(sField, 42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireStaticFieldLittleEndianStringPerfTest.java index 2216d7b2a507e5743a17ad41d2f1be36cc2bdba7..d12ffae25c5e58305db20d2c99dfdf6c884b2925 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireStaticFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireStaticFieldLittleEndianStringPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,19 +32,20 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleCompareandexchangeAcquireStaticFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; static String sField = FIELD_VALUE; VarHandle mVh; - public VarHandleCompareandexchangeAcquireStaticFieldLittleEndianStringPerfTest() throws Throwable { + public VarHandleCompareandexchangeAcquireStaticFieldLittleEndianStringPerfTest() + throws Throwable { mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", String.class); } @Test public void run() { String x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (String) mVh.compareAndExchangeAcquire(sField, null); x = (String) mVh.compareAndExchangeAcquire(sField, "qwerty"); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeFieldLittleEndianIntPerfTest.java index bda551fd90690785fb787914ff10c25da962c9ce..5ced1157cb73223a5c7de75cb064981271752991 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleCompareandexchangeFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; int mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleCompareandexchangeFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.compareAndExchange(this, mField, ~42); x = (int) mVh.compareAndExchange(this, mField, 42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeFieldLittleEndianStringPerfTest.java index f4d7893a64c21fc238ff219652ff7a74005569a9..b955d506fe856e3a30191837803671e796b5c06d 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeFieldLittleEndianStringPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleCompareandexchangeFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; String mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleCompareandexchangeFieldLittleEndianStringPerfTest { @Test public void run() { String x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (String) mVh.compareAndExchange(this, mField, null); x = (String) mVh.compareAndExchange(this, mField, "qwerty"); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseFieldLittleEndianIntPerfTest.java index f4380870f7fc091eea0325721da91babaa1d8329..601ff3461f5bcca4eb834ab5f35b45246af01901 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleCompareandexchangeReleaseFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; int mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleCompareandexchangeReleaseFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.compareAndExchangeRelease(this, mField, ~42); x = (int) mVh.compareAndExchangeRelease(this, mField, 42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseFieldLittleEndianStringPerfTest.java index 78df5c0eaf070032d7e5cd71b098f611f5641da8..0e567f9568e6fda60a9ed6e9f5f6cae3da9fe35e 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseFieldLittleEndianStringPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleCompareandexchangeReleaseFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; String mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleCompareandexchangeReleaseFieldLittleEndianStringPerfTest { @Test public void run() { String x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (String) mVh.compareAndExchangeRelease(this, mField, null); x = (String) mVh.compareAndExchangeRelease(this, mField, "qwerty"); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseStaticFieldLittleEndianIntPerfTest.java index f45cc6247fc00eab0a670bced450d68897c50bb7..6be287006f42e5fbd17fa9929898cd490c873d3c 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseStaticFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleCompareandexchangeReleaseStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; static int sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleCompareandexchangeReleaseStaticFieldLittleEndianIntPerfTes @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.compareAndExchangeRelease(sField, ~42); x = (int) mVh.compareAndExchangeRelease(sField, 42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseStaticFieldLittleEndianStringPerfTest.java index 08aa7e254dcb19f0981acb50dd9dd9b06f535f4b..84c186bd24e6544d01436cc45f7cbabc98cf77d7 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseStaticFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseStaticFieldLittleEndianStringPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,19 +32,20 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleCompareandexchangeReleaseStaticFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; static String sField = FIELD_VALUE; VarHandle mVh; - public VarHandleCompareandexchangeReleaseStaticFieldLittleEndianStringPerfTest() throws Throwable { + public VarHandleCompareandexchangeReleaseStaticFieldLittleEndianStringPerfTest() + throws Throwable { mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", String.class); } @Test public void run() { String x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (String) mVh.compareAndExchangeRelease(sField, null); x = (String) mVh.compareAndExchangeRelease(sField, "qwerty"); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeStaticFieldLittleEndianIntPerfTest.java index 5d4b2e0978f379679fd0a06ec3554b910fb92fc8..b093234b2bc56a6c5cc78cf12a9ea17226d069c5 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeStaticFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleCompareandexchangeStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; static int sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleCompareandexchangeStaticFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.compareAndExchange(sField, ~42); x = (int) mVh.compareAndExchange(sField, 42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeStaticFieldLittleEndianStringPerfTest.java index ba4f2c8a8d7d11c9d6621ca0ed9f61567af6acea..0d2037b4ab27b294105a542e2264ad945a156203 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeStaticFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeStaticFieldLittleEndianStringPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleCompareandexchangeStaticFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; static String sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleCompareandexchangeStaticFieldLittleEndianStringPerfTest { @Test public void run() { String x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (String) mVh.compareAndExchange(sField, null); x = (String) mVh.compareAndExchange(sField, "qwerty"); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetFieldLittleEndianIntPerfTest.java index 7fca4504b2c69edb91d03575e7cb373cbc2329d4..ee31973c308aefcfbccc4ce5f7a9f374557410b2 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleCompareandsetFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; int mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleCompareandsetFieldLittleEndianIntPerfTest { @Test public void run() { boolean success; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { success = mVh.compareAndSet(this, mField, ~42); success = mVh.compareAndSet(this, mField, 42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetFieldLittleEndianStringPerfTest.java index 7eb7ac02651757f470de5afabc908d9085485f50..0571fefe2a434ea0287fca14cc2e8d41f67f858d 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetFieldLittleEndianStringPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleCompareandsetFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; String mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleCompareandsetFieldLittleEndianStringPerfTest { @Test public void run() { boolean success; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { success = mVh.compareAndSet(this, mField, null); success = mVh.compareAndSet(this, mField, "qwerty"); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetStaticFieldLittleEndianIntPerfTest.java index ddfd407eda11005e03fd83d788a47ab7d618815f..f619dabdd50ac49c595617648d698785daf96b68 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetStaticFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleCompareandsetStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; static int sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleCompareandsetStaticFieldLittleEndianIntPerfTest { @Test public void run() { boolean success; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { success = mVh.compareAndSet(sField, ~42); success = mVh.compareAndSet(sField, 42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetStaticFieldLittleEndianStringPerfTest.java index f1f39681dce0909147895e5465d1fc79398f5f26..fc443fa362bc803d99079c6e4656d13446dce402 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetStaticFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetStaticFieldLittleEndianStringPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleCompareandsetStaticFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; static String sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleCompareandsetStaticFieldLittleEndianStringPerfTest { @Test public void run() { boolean success; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { success = mVh.compareAndSet(sField, null); success = mVh.compareAndSet(sField, "qwerty"); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireFieldLittleEndianIntPerfTest.java index 09127c4eed7b291d0af442015af6bd2473d15672..bf3d58b68692ecac8a633b4bd0abbb333430f7fe 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireFieldLittleEndianIntPerfTest.java @@ -13,16 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetAcquireFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; int mField = FIELD_VALUE; VarHandle mVh; @@ -54,7 +53,7 @@ public class VarHandleGetAcquireFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getAcquire(this); x = (int) mVh.getAcquire(this); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireFieldLittleEndianStringPerfTest.java index 87be4a66aa5264d1962f7216fd03943ed74da187..1f4bc31f24c658daa78c609415e7481aff905156 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireFieldLittleEndianStringPerfTest.java @@ -13,16 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetAcquireFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; String mField = FIELD_VALUE; VarHandle mVh; @@ -54,7 +53,7 @@ public class VarHandleGetAcquireFieldLittleEndianStringPerfTest { @Test public void run() { String x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (String) mVh.getAcquire(this); x = (String) mVh.getAcquire(this); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireStaticFieldLittleEndianIntPerfTest.java index 5d5fc110cbaf15ccb05bbb32e3a991cbfa9c1a2d..2085552e91dd73f69f199cb31345a69870be5fc6 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireStaticFieldLittleEndianIntPerfTest.java @@ -13,16 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetAcquireStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; static int sField = FIELD_VALUE; VarHandle mVh; @@ -54,7 +53,7 @@ public class VarHandleGetAcquireStaticFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getAcquire(); x = (int) mVh.getAcquire(); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireStaticFieldLittleEndianStringPerfTest.java index c7034b80a008fcbdf50e848e1fdbab93264a6aab..d9c7d7b7695ef40d2feb5e0c04d3f74d662afc95 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireStaticFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireStaticFieldLittleEndianStringPerfTest.java @@ -13,16 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetAcquireStaticFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; static String sField = FIELD_VALUE; VarHandle mVh; @@ -54,7 +53,7 @@ public class VarHandleGetAcquireStaticFieldLittleEndianStringPerfTest { @Test public void run() { String x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (String) mVh.getAcquire(); x = (String) mVh.getAcquire(); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetArrayLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetArrayLittleEndianIntPerfTest.java index f22865b01009d49af5c5148c3c5a16bc6c6c5d58..acd2533a38e4d5039a780b79c2ca14f608b99985 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetArrayLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetArrayLittleEndianIntPerfTest.java @@ -13,16 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -34,9 +33,9 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetArrayLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int ELEMENT_VALUE = 42; - int[] mArray = { ELEMENT_VALUE }; + int[] mArray = {ELEMENT_VALUE}; VarHandle mVh; public VarHandleGetArrayLittleEndianIntPerfTest() throws Throwable { @@ -55,7 +54,7 @@ public class VarHandleGetArrayLittleEndianIntPerfTest { public void run() { int[] a = mArray; int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.get(a, 0); x = (int) mVh.get(a, 0); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetArrayLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetArrayLittleEndianStringPerfTest.java index fdb9e84fa847486a248233535cafdbe7a6985027..de9944a8c274f9eb98a42e27450fa7c3012afa19 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetArrayLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetArrayLittleEndianStringPerfTest.java @@ -13,16 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -34,9 +33,9 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetArrayLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String ELEMENT_VALUE = "qwerty"; - String[] mArray = { ELEMENT_VALUE }; + String[] mArray = {ELEMENT_VALUE}; VarHandle mVh; public VarHandleGetArrayLittleEndianStringPerfTest() throws Throwable { @@ -55,7 +54,7 @@ public class VarHandleGetArrayLittleEndianStringPerfTest { public void run() { String[] a = mArray; String x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (String) mVh.get(a, 0); x = (String) mVh.get(a, 0); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetByteArrayViewBigEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetByteArrayViewBigEndianIntPerfTest.java index 347b0cf4effbd9da9f287bf558920d5bdf7d424c..a8639292cbb3162a0e53967710cb3513a727d33c 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetByteArrayViewBigEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetByteArrayViewBigEndianIntPerfTest.java @@ -13,16 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -30,22 +29,22 @@ import org.junit.runner.RunWith; import java.lang.invoke.MethodHandles; import java.lang.invoke.VarHandle; - -import java.util.Arrays; import java.nio.ByteOrder; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetByteArrayViewBigEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int VALUE = 42; - byte[] mArray1 = { (byte) (VALUE >> 24), (byte) (VALUE >> 16), (byte) (VALUE >> 8), (byte) VALUE }; - byte[] mArray2 = { (byte) (-1 >> 24), (byte) (-1 >> 16), (byte) (-1 >> 8), (byte) VALUE }; + byte[] mArray1 = { + (byte) (VALUE >> 24), (byte) (VALUE >> 16), (byte) (VALUE >> 8), (byte) VALUE + }; + byte[] mArray2 = {(byte) (-1 >> 24), (byte) (-1 >> 16), (byte) (-1 >> 8), (byte) VALUE}; VarHandle mVh; public VarHandleGetByteArrayViewBigEndianIntPerfTest() throws Throwable { mVh = MethodHandles.byteArrayViewVarHandle(int[].class, ByteOrder.BIG_ENDIAN); - } + } @Before public void setup() { @@ -59,7 +58,7 @@ public class VarHandleGetByteArrayViewBigEndianIntPerfTest { public void run() { byte[] a = mArray1; int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.get(a, 0); x = (int) mVh.get(a, 0); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetByteArrayViewLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetByteArrayViewLittleEndianIntPerfTest.java index dedc94f278bfd8286d38d5fed946820147eaa5e1..4999b9bf68506948f3c2a9cf12ebc268a8429f01 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetByteArrayViewLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetByteArrayViewLittleEndianIntPerfTest.java @@ -13,16 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -30,22 +29,22 @@ import org.junit.runner.RunWith; import java.lang.invoke.MethodHandles; import java.lang.invoke.VarHandle; - -import java.util.Arrays; import java.nio.ByteOrder; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetByteArrayViewLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int VALUE = 42; - byte[] mArray1 = { (byte) VALUE, (byte) (VALUE >> 8), (byte) (VALUE >> 16), (byte) (VALUE >> 24) }; - byte[] mArray2 = { (byte) VALUE, (byte) (-1 >> 8), (byte) (-1 >> 16), (byte) (-1 >> 24) }; + byte[] mArray1 = { + (byte) VALUE, (byte) (VALUE >> 8), (byte) (VALUE >> 16), (byte) (VALUE >> 24) + }; + byte[] mArray2 = {(byte) VALUE, (byte) (-1 >> 8), (byte) (-1 >> 16), (byte) (-1 >> 24)}; VarHandle mVh; public VarHandleGetByteArrayViewLittleEndianIntPerfTest() throws Throwable { mVh = MethodHandles.byteArrayViewVarHandle(int[].class, ByteOrder.LITTLE_ENDIAN); - } + } @Before public void setup() { @@ -59,7 +58,7 @@ public class VarHandleGetByteArrayViewLittleEndianIntPerfTest { public void run() { byte[] a = mArray1; int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.get(a, 0); x = (int) mVh.get(a, 0); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetFieldLittleEndianIntPerfTest.java index 3f0f624dfccb2ad7c45841eee0ae773636ea0e2a..ee80a6f72c930c78889b2522467603a160428e81 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetFieldLittleEndianIntPerfTest.java @@ -13,16 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; int mField = FIELD_VALUE; VarHandle mVh; @@ -54,7 +53,7 @@ public class VarHandleGetFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.get(this); x = (int) mVh.get(this); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetFieldLittleEndianStringPerfTest.java index 9db6328ea4c59a12d48765551bc1ece3f4dd86f5..ec29f7a33b39d4d1ac21c57c67e94aeed8809ea3 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetFieldLittleEndianStringPerfTest.java @@ -13,16 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; String mField = FIELD_VALUE; VarHandle mVh; @@ -54,7 +53,7 @@ public class VarHandleGetFieldLittleEndianStringPerfTest { @Test public void run() { String x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (String) mVh.get(this); x = (String) mVh.get(this); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueFieldLittleEndianIntPerfTest.java index 17b74a8d807ec708d30e2854bc13c37c46cbcfa4..ee6a669f2f839cacc2d19b69462902d3274352c1 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueFieldLittleEndianIntPerfTest.java @@ -13,16 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetOpaqueFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; int mField = FIELD_VALUE; VarHandle mVh; @@ -54,7 +53,7 @@ public class VarHandleGetOpaqueFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getOpaque(this); x = (int) mVh.getOpaque(this); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueFieldLittleEndianStringPerfTest.java index 5df13800365b6558fe643be6c62abd1318f4aaaa..1702b84e703b3399fe99af8d4cc509cca1eff42f 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueFieldLittleEndianStringPerfTest.java @@ -13,16 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetOpaqueFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; String mField = FIELD_VALUE; VarHandle mVh; @@ -54,7 +53,7 @@ public class VarHandleGetOpaqueFieldLittleEndianStringPerfTest { @Test public void run() { String x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (String) mVh.getOpaque(this); x = (String) mVh.getOpaque(this); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueStaticFieldLittleEndianIntPerfTest.java index f656ef23962593b30dcbc1af7bc9ad6fc93ad676..514ddb9c4b1196b9994d4ada9b154443573db66e 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueStaticFieldLittleEndianIntPerfTest.java @@ -13,16 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetOpaqueStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; static int sField = FIELD_VALUE; VarHandle mVh; @@ -54,7 +53,7 @@ public class VarHandleGetOpaqueStaticFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getOpaque(); x = (int) mVh.getOpaque(); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueStaticFieldLittleEndianStringPerfTest.java index 1087df3d11c559cc416dc9781d10c7c785595df3..fbcee6906bd7300790b44b68b45f1758618f4db0 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueStaticFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueStaticFieldLittleEndianStringPerfTest.java @@ -13,16 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetOpaqueStaticFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; static String sField = FIELD_VALUE; VarHandle mVh; @@ -54,7 +53,7 @@ public class VarHandleGetOpaqueStaticFieldLittleEndianStringPerfTest { @Test public void run() { String x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (String) mVh.getOpaque(); x = (String) mVh.getOpaque(); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetStaticFieldLittleEndianIntPerfTest.java index 004345187c968a516f71e7a220aa17afc26a7d81..2c5658810b05f89ead052dc4dd2808b3d23d7e48 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetStaticFieldLittleEndianIntPerfTest.java @@ -13,16 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; static int sField = FIELD_VALUE; VarHandle mVh; @@ -54,7 +53,7 @@ public class VarHandleGetStaticFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.get(); x = (int) mVh.get(); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetStaticFieldLittleEndianStringPerfTest.java index 0162637f7a64463103ecd4aa36cf51ee6a2f98e1..8fce69e620339b64854eee38919480b23235dc2d 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetStaticFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetStaticFieldLittleEndianStringPerfTest.java @@ -13,16 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetStaticFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; static String sField = FIELD_VALUE; VarHandle mVh; @@ -54,7 +53,7 @@ public class VarHandleGetStaticFieldLittleEndianStringPerfTest { @Test public void run() { String x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (String) mVh.get(); x = (String) mVh.get(); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileFieldLittleEndianIntPerfTest.java index b0c4631574e8aa0ba56179ef99fe8911cc5ed23f..ef530607bb56bee741a4a1f8abeccb6b84e9f678 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileFieldLittleEndianIntPerfTest.java @@ -13,16 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetVolatileFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; int mField = FIELD_VALUE; VarHandle mVh; @@ -54,7 +53,7 @@ public class VarHandleGetVolatileFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getVolatile(this); x = (int) mVh.getVolatile(this); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileFieldLittleEndianStringPerfTest.java index 5cbbc08521adc0c9b5aa2a0d6ff382f47d4a46b5..64c08983a06330b5b6a04e966caaa5bf0b805815 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileFieldLittleEndianStringPerfTest.java @@ -13,16 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetVolatileFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; String mField = FIELD_VALUE; VarHandle mVh; @@ -54,7 +53,7 @@ public class VarHandleGetVolatileFieldLittleEndianStringPerfTest { @Test public void run() { String x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (String) mVh.getVolatile(this); x = (String) mVh.getVolatile(this); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileStaticFieldLittleEndianIntPerfTest.java index 368ae69ab8f5f963e51ccf0874036f7f78d0ef27..939100c47c0568a60503a55923ec95f689453adf 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileStaticFieldLittleEndianIntPerfTest.java @@ -13,16 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetVolatileStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; static int sField = FIELD_VALUE; VarHandle mVh; @@ -54,7 +53,7 @@ public class VarHandleGetVolatileStaticFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getVolatile(); x = (int) mVh.getVolatile(); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileStaticFieldLittleEndianStringPerfTest.java index 3387a8da60c1acc0f8388f338bc2d396e2e2e994..728b1995ff52259458aa747b3121e105c135256c 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileStaticFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileStaticFieldLittleEndianStringPerfTest.java @@ -13,16 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetVolatileStaticFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; static String sField = FIELD_VALUE; VarHandle mVh; @@ -54,7 +53,7 @@ public class VarHandleGetVolatileStaticFieldLittleEndianStringPerfTest { @Test public void run() { String x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (String) mVh.getVolatile(); x = (String) mVh.getVolatile(); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireFieldLittleEndianFloatPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireFieldLittleEndianFloatPerfTest.java index 781e04f6b818b4a35fd4266f8364cbb40e281979..bf5ef99ff4569835c6082af896e13c39dfa9aea9 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireFieldLittleEndianFloatPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireFieldLittleEndianFloatPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandaddAcquireFieldLittleEndianFloatPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final float FIELD_VALUE = 3.14f; float mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandaddAcquireFieldLittleEndianFloatPerfTest { @Test public void run() { float x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (float) mVh.getAndAddAcquire(this, 2.17f); x = (float) mVh.getAndAddAcquire(this, 2.17f); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireFieldLittleEndianIntPerfTest.java index 97f29ba38bc1cce86d319fb5b214caaecb9a3281..d15705e9106dde83d77788a413d62557f0f03d9d 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandaddAcquireFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; int mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandaddAcquireFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getAndAddAcquire(this, ~42); x = (int) mVh.getAndAddAcquire(this, ~42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireStaticFieldLittleEndianFloatPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireStaticFieldLittleEndianFloatPerfTest.java index e108f7f4edbcbc4c583b3f405464aaaa3b4fc6e6..222a60da35502ad8eb1a2e333d221a69b0058796 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireStaticFieldLittleEndianFloatPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireStaticFieldLittleEndianFloatPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandaddAcquireStaticFieldLittleEndianFloatPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final float FIELD_VALUE = 3.14f; static float sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandaddAcquireStaticFieldLittleEndianFloatPerfTest { @Test public void run() { float x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (float) mVh.getAndAddAcquire(2.17f); x = (float) mVh.getAndAddAcquire(2.17f); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireStaticFieldLittleEndianIntPerfTest.java index d0ae322987f3fd86b2c68c7f30f8a2ce61f47ef6..7436476b5329b2312fc5e9dc2c62d9fcd809d3cb 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireStaticFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandaddAcquireStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; static int sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandaddAcquireStaticFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getAndAddAcquire(~42); x = (int) mVh.getAndAddAcquire(~42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddFieldLittleEndianFloatPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddFieldLittleEndianFloatPerfTest.java index 1b80c4064741313ab30b7f5db48383fce78a9385..cca97f42e4b7d5d6f3336bc85314801d99003b74 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddFieldLittleEndianFloatPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddFieldLittleEndianFloatPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandaddFieldLittleEndianFloatPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final float FIELD_VALUE = 3.14f; float mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandaddFieldLittleEndianFloatPerfTest { @Test public void run() { float x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (float) mVh.getAndAdd(this, 2.17f); x = (float) mVh.getAndAdd(this, 2.17f); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddFieldLittleEndianIntPerfTest.java index edacf181149b8e9302cecb3c896ee39a5b14500b..170ee7313891eb29924c63c79a21ecccce122529 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandaddFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; int mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandaddFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getAndAdd(this, ~42); x = (int) mVh.getAndAdd(this, ~42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseFieldLittleEndianFloatPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseFieldLittleEndianFloatPerfTest.java index 0e86b0d6f76bbf8b09d0fdf105f2e07d2821571f..184f796ad61cd26e1d7be0295477cdcf544edcb4 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseFieldLittleEndianFloatPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseFieldLittleEndianFloatPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandaddReleaseFieldLittleEndianFloatPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final float FIELD_VALUE = 3.14f; float mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandaddReleaseFieldLittleEndianFloatPerfTest { @Test public void run() { float x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (float) mVh.getAndAddRelease(this, 2.17f); x = (float) mVh.getAndAddRelease(this, 2.17f); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseFieldLittleEndianIntPerfTest.java index 83446ff85b9abe4ff59fba7df4da3ee65e20e18b..7e75c44089ff8aa1ec164f2c8003744cc2db9cbe 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandaddReleaseFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; int mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandaddReleaseFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getAndAddRelease(this, ~42); x = (int) mVh.getAndAddRelease(this, ~42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseStaticFieldLittleEndianFloatPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseStaticFieldLittleEndianFloatPerfTest.java index c1f1e6f44c809c3c3fc643fcdd447f07cb2dca78..39c386b645d8db8fe1fb5e8bb46d27f6dba1f38c 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseStaticFieldLittleEndianFloatPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseStaticFieldLittleEndianFloatPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandaddReleaseStaticFieldLittleEndianFloatPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final float FIELD_VALUE = 3.14f; static float sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandaddReleaseStaticFieldLittleEndianFloatPerfTest { @Test public void run() { float x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (float) mVh.getAndAddRelease(2.17f); x = (float) mVh.getAndAddRelease(2.17f); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseStaticFieldLittleEndianIntPerfTest.java index 1b154a1576222af2339a9f06c280b949ede6a43f..04ab5310655c38149fb27a3b5f97cd6d9f346213 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseStaticFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandaddReleaseStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; static int sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandaddReleaseStaticFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getAndAddRelease(~42); x = (int) mVh.getAndAddRelease(~42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddStaticFieldLittleEndianFloatPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddStaticFieldLittleEndianFloatPerfTest.java index 7de128d7a5a538f06302d62e9798629462b484df..b71351fca81cb476a762f00202f109e6d9123b9a 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddStaticFieldLittleEndianFloatPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddStaticFieldLittleEndianFloatPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandaddStaticFieldLittleEndianFloatPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final float FIELD_VALUE = 3.14f; static float sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandaddStaticFieldLittleEndianFloatPerfTest { @Test public void run() { float x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (float) mVh.getAndAdd(2.17f); x = (float) mVh.getAndAdd(2.17f); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddStaticFieldLittleEndianIntPerfTest.java index c9a0926db637a89dbc695ee3d0486feef823dbdd..e3955c0518900383d8445419958670cec8b6c3bd 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddStaticFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandaddStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; static int sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandaddStaticFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getAndAdd(~42); x = (int) mVh.getAndAdd(~42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndAcquireFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndAcquireFieldLittleEndianIntPerfTest.java index fd9d9b13e9b2877376ae95e84e489ce11105d644..adf05a6befb1beb4eb83f14ab6ce031ba04562e4 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndAcquireFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndAcquireFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandbitwiseAndAcquireFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; int mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandbitwiseAndAcquireFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getAndBitwiseAndAcquire(this, ~42); x = (int) mVh.getAndBitwiseAndAcquire(this, ~42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndAcquireStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndAcquireStaticFieldLittleEndianIntPerfTest.java index c3c367f80c26861c502f06fb43e0ac43523185cc..4d657d9a351175041664d4aafd4538f6ac1647f0 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndAcquireStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndAcquireStaticFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandbitwiseAndAcquireStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; static int sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandbitwiseAndAcquireStaticFieldLittleEndianIntPerfTest @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getAndBitwiseAndAcquire(~42); x = (int) mVh.getAndBitwiseAndAcquire(~42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndFieldLittleEndianIntPerfTest.java index e073d28a820fe524bc1ad580a5b95d1d50c7d5e3..dc641741691751e5932fe116363e07b3d2a1c730 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandbitwiseAndFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; int mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandbitwiseAndFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getAndBitwiseAnd(this, ~42); x = (int) mVh.getAndBitwiseAnd(this, ~42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndReleaseFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndReleaseFieldLittleEndianIntPerfTest.java index ca78f5ac53ec75298a714db4e773d0bd722812c7..25d5631308ef74d5f69247998407b3e163b5eac8 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndReleaseFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndReleaseFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandbitwiseAndReleaseFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; int mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandbitwiseAndReleaseFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getAndBitwiseAndRelease(this, ~42); x = (int) mVh.getAndBitwiseAndRelease(this, ~42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndReleaseStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndReleaseStaticFieldLittleEndianIntPerfTest.java index 599f1866969554f1fcb26ee02ae3abb617f019bd..de2d5489dbcc5d9b5b0ebc394306bf344ece4ffe 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndReleaseStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndReleaseStaticFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandbitwiseAndReleaseStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; static int sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandbitwiseAndReleaseStaticFieldLittleEndianIntPerfTest @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getAndBitwiseAndRelease(~42); x = (int) mVh.getAndBitwiseAndRelease(~42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndStaticFieldLittleEndianIntPerfTest.java index 71fc0ae081967cfcd92c96a57df4697fa0dba76c..36544c6f8f50fe654f255cd08ff948535ab3805f 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndStaticFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandbitwiseAndStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; static int sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandbitwiseAndStaticFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getAndBitwiseAnd(~42); x = (int) mVh.getAndBitwiseAnd(~42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrAcquireFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrAcquireFieldLittleEndianIntPerfTest.java index 8fc4eabbaccc7da04b9c2db98650e87241532ad8..fb36d0cb495f9871634f29ed218f9e161a640ef1 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrAcquireFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrAcquireFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandbitwiseOrAcquireFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; int mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandbitwiseOrAcquireFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getAndBitwiseOrAcquire(this, ~42); x = (int) mVh.getAndBitwiseOrAcquire(this, ~42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrAcquireStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrAcquireStaticFieldLittleEndianIntPerfTest.java index 33689533d565227c75863e03f199eaff18000a87..4194b12a4a6e6fc3a0390e5950920d8d7b224437 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrAcquireStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrAcquireStaticFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandbitwiseOrAcquireStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; static int sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandbitwiseOrAcquireStaticFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getAndBitwiseOrAcquire(~42); x = (int) mVh.getAndBitwiseOrAcquire(~42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrFieldLittleEndianIntPerfTest.java index 583a3a029059b2d860733922f8223b5d65b1bb9b..355c6e823803eba792454f3d1276be2456a99941 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandbitwiseOrFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; int mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandbitwiseOrFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getAndBitwiseOr(this, ~42); x = (int) mVh.getAndBitwiseOr(this, ~42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrReleaseFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrReleaseFieldLittleEndianIntPerfTest.java index 1592fa6b9a8c084fa07f8267819c98fe725a85d7..401079d0bece3b30a3852eb57e63e5443380292d 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrReleaseFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrReleaseFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandbitwiseOrReleaseFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; int mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandbitwiseOrReleaseFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getAndBitwiseOrRelease(this, ~42); x = (int) mVh.getAndBitwiseOrRelease(this, ~42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrReleaseStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrReleaseStaticFieldLittleEndianIntPerfTest.java index d496083416a36860b8fbe8b5078a36d5606d3e6d..322dcbf7453e4c78caaf18cfba0b58ac06930b78 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrReleaseStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrReleaseStaticFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandbitwiseOrReleaseStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; static int sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandbitwiseOrReleaseStaticFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getAndBitwiseOrRelease(~42); x = (int) mVh.getAndBitwiseOrRelease(~42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrStaticFieldLittleEndianIntPerfTest.java index 87276a59169996c39a6f0542d59bf394aeb52140..c98281416012b3f05556a5f712f823cd00e11e24 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrStaticFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandbitwiseOrStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; static int sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandbitwiseOrStaticFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getAndBitwiseOr(~42); x = (int) mVh.getAndBitwiseOr(~42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorAcquireFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorAcquireFieldLittleEndianIntPerfTest.java index f7a372fc806fdaa3246a55165c7f4fc768e4ed99..0b1cb32528ffea89b05d3b6172424336ffff52bc 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorAcquireFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorAcquireFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandbitwiseXorAcquireFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; int mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandbitwiseXorAcquireFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getAndBitwiseXorAcquire(this, ~42); x = (int) mVh.getAndBitwiseXorAcquire(this, ~42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorAcquireStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorAcquireStaticFieldLittleEndianIntPerfTest.java index 22726fcaa151ec6daf24462f0ac1eda11df6a640..47370720178247774bd16d7bb12345d9ed2c6662 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorAcquireStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorAcquireStaticFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandbitwiseXorAcquireStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; static int sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandbitwiseXorAcquireStaticFieldLittleEndianIntPerfTest @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getAndBitwiseXorAcquire(~42); x = (int) mVh.getAndBitwiseXorAcquire(~42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorFieldLittleEndianIntPerfTest.java index d071d6ead1efe3c4096625e38967c54236236425..204cd70b2f9e1eb5995272dac8ca34e7ed865877 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandbitwiseXorFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; int mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandbitwiseXorFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getAndBitwiseXor(this, ~42); x = (int) mVh.getAndBitwiseXor(this, ~42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorReleaseFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorReleaseFieldLittleEndianIntPerfTest.java index be2aa9cf61b41d4d0527387d75e991284d0ff1f4..b3ffed7de91a6c5da42e14d6b94f1ea9fe8bc7d2 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorReleaseFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorReleaseFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandbitwiseXorReleaseFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; int mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandbitwiseXorReleaseFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getAndBitwiseXorRelease(this, ~42); x = (int) mVh.getAndBitwiseXorRelease(this, ~42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorReleaseStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorReleaseStaticFieldLittleEndianIntPerfTest.java index b0a7dcf2e7d3f28d653153c8429fc057282a29f7..d0ab8de4502d8858ff6d560cc5fe7ff49b6d70f7 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorReleaseStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorReleaseStaticFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandbitwiseXorReleaseStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; static int sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandbitwiseXorReleaseStaticFieldLittleEndianIntPerfTest @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getAndBitwiseXorRelease(~42); x = (int) mVh.getAndBitwiseXorRelease(~42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorStaticFieldLittleEndianIntPerfTest.java index c5f99deff29cd9815858b46eba953057624cc540..b378b684114eab352ff27b4f16218f1df9b3a14b 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorStaticFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandbitwiseXorStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; static int sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandbitwiseXorStaticFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getAndBitwiseXor(~42); x = (int) mVh.getAndBitwiseXor(~42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireFieldLittleEndianIntPerfTest.java index 572e0c8dc57b398d3e53a9f0bd0411ac45b9807c..c7c66fe20513123b1eceb7b6f8224eb124522d6d 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandsetAcquireFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; int mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandsetAcquireFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getAndSetAcquire(this, ~42); x = (int) mVh.getAndSetAcquire(this, ~42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireFieldLittleEndianStringPerfTest.java index 09be6d9d32044571ab24be2b6aa0e1889ef788cf..98d6bd71c610896c2d22579f27a14284541aad66 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireFieldLittleEndianStringPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandsetAcquireFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; String mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandsetAcquireFieldLittleEndianStringPerfTest { @Test public void run() { String x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (String) mVh.getAndSetAcquire(this, null); x = (String) mVh.getAndSetAcquire(this, null); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireStaticFieldLittleEndianIntPerfTest.java index 4e0554a541b2a7686049d2d3611ccf461b0e8948..206358f21c1d5dfe16e817d5ec68c29eea6631a6 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireStaticFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandsetAcquireStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; static int sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandsetAcquireStaticFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getAndSetAcquire(~42); x = (int) mVh.getAndSetAcquire(~42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireStaticFieldLittleEndianStringPerfTest.java index 5491522b0122334d717bcd2ba0069e88ab44c5ec..0532e73c9d66215ef6e00fef6f36b16909267069 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireStaticFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireStaticFieldLittleEndianStringPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandsetAcquireStaticFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; static String sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandsetAcquireStaticFieldLittleEndianStringPerfTest { @Test public void run() { String x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (String) mVh.getAndSetAcquire(null); x = (String) mVh.getAndSetAcquire(null); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetFieldLittleEndianIntPerfTest.java index a9303c6cff57d439e4d09dcc5e3d94764e4e5707..f192d7153fce438415b52c003e6f814d719d88f9 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandsetFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; int mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandsetFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getAndSet(this, ~42); x = (int) mVh.getAndSet(this, ~42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetFieldLittleEndianStringPerfTest.java index bd4703f6a5d62af3db79348ed37e659b593fd9ce..0a8909c6c7b5d79567d7fd8d726ffc48994d95bb 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetFieldLittleEndianStringPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandsetFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; String mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandsetFieldLittleEndianStringPerfTest { @Test public void run() { String x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (String) mVh.getAndSet(this, null); x = (String) mVh.getAndSet(this, null); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseFieldLittleEndianIntPerfTest.java index d9aee0037a0c8ca31080e503c85b390ff3d4c11b..bfcb0f410256610c8edd73abea925d54dc4a6cc8 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandsetReleaseFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; int mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandsetReleaseFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getAndSetRelease(this, ~42); x = (int) mVh.getAndSetRelease(this, ~42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseFieldLittleEndianStringPerfTest.java index 2c79ca2634b32d75443a12c1098ec0773b3aaef7..c6b0509d619bd917f9378ce75a206c5391fd519f 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseFieldLittleEndianStringPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandsetReleaseFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; String mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandsetReleaseFieldLittleEndianStringPerfTest { @Test public void run() { String x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (String) mVh.getAndSetRelease(this, null); x = (String) mVh.getAndSetRelease(this, null); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseStaticFieldLittleEndianIntPerfTest.java index ceff81634f6253040bb0be5fec28166bcfc0c0b0..45a01eda2fd54e78f2a5ffe311b8d53c69d618da 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseStaticFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandsetReleaseStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; static int sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandsetReleaseStaticFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getAndSetRelease(~42); x = (int) mVh.getAndSetRelease(~42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseStaticFieldLittleEndianStringPerfTest.java index 9b83504b94d669391f687a236e1f21abbb454709..30472811d5d657751bf0595115d6b8c4b9f59fad 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseStaticFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseStaticFieldLittleEndianStringPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandsetReleaseStaticFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; static String sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandsetReleaseStaticFieldLittleEndianStringPerfTest { @Test public void run() { String x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (String) mVh.getAndSetRelease(null); x = (String) mVh.getAndSetRelease(null); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetStaticFieldLittleEndianIntPerfTest.java index 638da6fd37b67b00dfe1f24e5ad0b9fb87a86a9b..6f1f1a01603986b2043c5d3a749639154b099af8 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetStaticFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandsetStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; static int sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandsetStaticFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (int) mVh.getAndSet(~42); x = (int) mVh.getAndSet(~42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetStaticFieldLittleEndianStringPerfTest.java index 25d411417fb81bf8dac09af2f891e510e4d789a4..c4d279f37a4cf56595d8c65d8ef9fdda27b33767 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetStaticFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetStaticFieldLittleEndianStringPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetandsetStaticFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; static String sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleGetandsetStaticFieldLittleEndianStringPerfTest { @Test public void run() { String x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { x = (String) mVh.getAndSet(null); x = (String) mVh.getAndSet(null); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetArrayLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetArrayLittleEndianIntPerfTest.java index 64ea9f32b6989a3f6ec56822cd49a7bd0e3640e9..c4f600593067982b7fc1507221827d65be380cab 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetArrayLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetArrayLittleEndianIntPerfTest.java @@ -13,17 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,9 +33,9 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleSetArrayLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int ELEMENT_VALUE = 42; - int[] mArray = { ELEMENT_VALUE }; + int[] mArray = {ELEMENT_VALUE}; VarHandle mVh; public VarHandleSetArrayLittleEndianIntPerfTest() throws Throwable { @@ -54,7 +53,7 @@ public class VarHandleSetArrayLittleEndianIntPerfTest { public void run() { int[] a = mArray; int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mVh.set(a, 0, ~42); mVh.set(a, 0, ~42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetArrayLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetArrayLittleEndianStringPerfTest.java index 989d682f1b9f1f59fbed74dd279ca03fa7b6a802..a6858c261eb0d6c31751df4022ecfe8401f7f19f 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetArrayLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetArrayLittleEndianStringPerfTest.java @@ -13,17 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,9 +33,9 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleSetArrayLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String ELEMENT_VALUE = "qwerty"; - String[] mArray = { ELEMENT_VALUE }; + String[] mArray = {ELEMENT_VALUE}; VarHandle mVh; public VarHandleSetArrayLittleEndianStringPerfTest() throws Throwable { @@ -54,7 +53,7 @@ public class VarHandleSetArrayLittleEndianStringPerfTest { public void run() { String[] a = mArray; String x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mVh.set(a, 0, null); mVh.set(a, 0, null); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetByteArrayViewBigEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetByteArrayViewBigEndianIntPerfTest.java index 9d6d6b8c096319aa16975bce4a2ebd73c4b7414d..a994cbeaf02c0f38d718ee102156c02e59d20046 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetByteArrayViewBigEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetByteArrayViewBigEndianIntPerfTest.java @@ -13,52 +13,59 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import java.lang.invoke.MethodHandles; import java.lang.invoke.VarHandle; - -import java.util.Arrays; import java.nio.ByteOrder; +import java.util.Arrays; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleSetByteArrayViewBigEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int VALUE = 42; - byte[] mArray1 = { (byte) (VALUE >> 24), (byte) (VALUE >> 16), (byte) (VALUE >> 8), (byte) VALUE }; - byte[] mArray2 = { (byte) (-1 >> 24), (byte) (-1 >> 16), (byte) (-1 >> 8), (byte) VALUE }; + byte[] mArray1 = { + (byte) (VALUE >> 24), (byte) (VALUE >> 16), (byte) (VALUE >> 8), (byte) VALUE + }; + byte[] mArray2 = {(byte) (-1 >> 24), (byte) (-1 >> 16), (byte) (-1 >> 8), (byte) VALUE}; VarHandle mVh; public VarHandleSetByteArrayViewBigEndianIntPerfTest() throws Throwable { mVh = MethodHandles.byteArrayViewVarHandle(int[].class, ByteOrder.BIG_ENDIAN); - } + } @After public void teardown() { if (!Arrays.equals(mArray2, mArray1)) { - throw new RuntimeException("array has unexpected values: " + - mArray2[0] + " " + mArray2[1] + " " + mArray2[2] + " " + mArray2[3]); + throw new RuntimeException( + "array has unexpected values: " + + mArray2[0] + + " " + + mArray2[1] + + " " + + mArray2[2] + + " " + + mArray2[3]); } } @Test public void run() { byte[] a = mArray2; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mVh.set(a, 0, VALUE); mVh.set(a, 0, VALUE); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetByteArrayViewLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetByteArrayViewLittleEndianIntPerfTest.java index e8c3fa3cd01b9a3d60873f9a576cf5a7446ceb94..65412ec84aa46e8af1238fc512e3bdd36fd9e03b 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetByteArrayViewLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetByteArrayViewLittleEndianIntPerfTest.java @@ -13,52 +13,59 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import java.lang.invoke.MethodHandles; import java.lang.invoke.VarHandle; - -import java.util.Arrays; import java.nio.ByteOrder; +import java.util.Arrays; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleSetByteArrayViewLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int VALUE = 42; - byte[] mArray1 = { (byte) VALUE, (byte) (VALUE >> 8), (byte) (VALUE >> 16), (byte) (VALUE >> 24) }; - byte[] mArray2 = { (byte) VALUE, (byte) (-1 >> 8), (byte) (-1 >> 16), (byte) (-1 >> 24) }; + byte[] mArray1 = { + (byte) VALUE, (byte) (VALUE >> 8), (byte) (VALUE >> 16), (byte) (VALUE >> 24) + }; + byte[] mArray2 = {(byte) VALUE, (byte) (-1 >> 8), (byte) (-1 >> 16), (byte) (-1 >> 24)}; VarHandle mVh; public VarHandleSetByteArrayViewLittleEndianIntPerfTest() throws Throwable { mVh = MethodHandles.byteArrayViewVarHandle(int[].class, ByteOrder.LITTLE_ENDIAN); - } + } @After public void teardown() { if (!Arrays.equals(mArray2, mArray1)) { - throw new RuntimeException("array has unexpected values: " + - mArray2[0] + " " + mArray2[1] + " " + mArray2[2] + " " + mArray2[3]); + throw new RuntimeException( + "array has unexpected values: " + + mArray2[0] + + " " + + mArray2[1] + + " " + + mArray2[2] + + " " + + mArray2[3]); } } @Test public void run() { byte[] a = mArray2; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mVh.set(a, 0, VALUE); mVh.set(a, 0, VALUE); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetFieldLittleEndianIntPerfTest.java index 08294c06d4382dbdf3ea0d3622e2ffe7e5741f74..573b0ff277cc3d02499530875f1b6ec1a3fb7fcc 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetFieldLittleEndianIntPerfTest.java @@ -13,17 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleSetFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; int mField = FIELD_VALUE; VarHandle mVh; @@ -53,7 +52,7 @@ public class VarHandleSetFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mVh.set(this, FIELD_VALUE); mVh.set(this, FIELD_VALUE); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetFieldLittleEndianStringPerfTest.java index 1e8a5bfd2a53d2a23f537285c9059b1dfd484240..fe3c0fc04a84547cb1971fc6942006c90e39bd0e 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetFieldLittleEndianStringPerfTest.java @@ -13,17 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleSetFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; String mField = FIELD_VALUE; VarHandle mVh; @@ -53,7 +52,7 @@ public class VarHandleSetFieldLittleEndianStringPerfTest { @Test public void run() { String x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mVh.set(this, FIELD_VALUE); mVh.set(this, FIELD_VALUE); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueFieldLittleEndianIntPerfTest.java index 2e5fb1815b4bffbd809703f7029112c38173e352..f398899880ce4318b4db0d99b0dbd365e60c8206 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueFieldLittleEndianIntPerfTest.java @@ -13,17 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleSetOpaqueFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; int mField = FIELD_VALUE; VarHandle mVh; @@ -53,7 +52,7 @@ public class VarHandleSetOpaqueFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mVh.setOpaque(this, FIELD_VALUE); mVh.setOpaque(this, FIELD_VALUE); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueFieldLittleEndianStringPerfTest.java index 86a771f75b73e2460a2cf448e09e1fb3ac09c71e..74931205fd3e1a426a47e79e93722c5e792a15db 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueFieldLittleEndianStringPerfTest.java @@ -13,17 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleSetOpaqueFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; String mField = FIELD_VALUE; VarHandle mVh; @@ -53,7 +52,7 @@ public class VarHandleSetOpaqueFieldLittleEndianStringPerfTest { @Test public void run() { String x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mVh.setOpaque(this, FIELD_VALUE); mVh.setOpaque(this, FIELD_VALUE); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueStaticFieldLittleEndianIntPerfTest.java index 903b31003510896dadcb6c7fbdea10906d3e5998..5e7326985c9d0de70d041af2b32292ee37e95da2 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueStaticFieldLittleEndianIntPerfTest.java @@ -13,17 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleSetOpaqueStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; static int sField = FIELD_VALUE; VarHandle mVh; @@ -53,7 +52,7 @@ public class VarHandleSetOpaqueStaticFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mVh.setOpaque(FIELD_VALUE); mVh.setOpaque(FIELD_VALUE); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueStaticFieldLittleEndianStringPerfTest.java index 63cf7d25d0fd3de3445baf1c5b563d4bc5ca96fb..9a217d1fd142591566ea57272b5fd08a52990e57 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueStaticFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueStaticFieldLittleEndianStringPerfTest.java @@ -13,17 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleSetOpaqueStaticFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; static String sField = FIELD_VALUE; VarHandle mVh; @@ -53,7 +52,7 @@ public class VarHandleSetOpaqueStaticFieldLittleEndianStringPerfTest { @Test public void run() { String x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mVh.setOpaque(FIELD_VALUE); mVh.setOpaque(FIELD_VALUE); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseFieldLittleEndianIntPerfTest.java index d1a358dc662ebf2278829aaa42e556428ce012ef..1ce2270ecc58fd6577dd84504bce699d7f22d35c 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseFieldLittleEndianIntPerfTest.java @@ -13,17 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleSetReleaseFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; int mField = FIELD_VALUE; VarHandle mVh; @@ -53,7 +52,7 @@ public class VarHandleSetReleaseFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mVh.setRelease(this, FIELD_VALUE); mVh.setRelease(this, FIELD_VALUE); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseFieldLittleEndianStringPerfTest.java index b658324696857adaa710c861a3e88de5e4bfbbac..ed84528fe8690699013c2a17811fc036a0aaf752 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseFieldLittleEndianStringPerfTest.java @@ -13,17 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleSetReleaseFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; String mField = FIELD_VALUE; VarHandle mVh; @@ -53,7 +52,7 @@ public class VarHandleSetReleaseFieldLittleEndianStringPerfTest { @Test public void run() { String x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mVh.setRelease(this, FIELD_VALUE); mVh.setRelease(this, FIELD_VALUE); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseStaticFieldLittleEndianIntPerfTest.java index 47cb77959f2e6a9e60918e1810860eab0274983c..aeb96404a223eeb21196a2073e4102a132d326cf 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseStaticFieldLittleEndianIntPerfTest.java @@ -13,17 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleSetReleaseStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; static int sField = FIELD_VALUE; VarHandle mVh; @@ -53,7 +52,7 @@ public class VarHandleSetReleaseStaticFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mVh.setRelease(FIELD_VALUE); mVh.setRelease(FIELD_VALUE); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseStaticFieldLittleEndianStringPerfTest.java index e48374e2224a3a4195d3b7b6f9a1d4002f5d8ede..8959a0c3d50ca01b350224b9d67b91ef8f8afb3e 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseStaticFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseStaticFieldLittleEndianStringPerfTest.java @@ -13,17 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleSetReleaseStaticFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; static String sField = FIELD_VALUE; VarHandle mVh; @@ -53,7 +52,7 @@ public class VarHandleSetReleaseStaticFieldLittleEndianStringPerfTest { @Test public void run() { String x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mVh.setRelease(FIELD_VALUE); mVh.setRelease(FIELD_VALUE); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetStaticFieldLittleEndianIntPerfTest.java index 0470d67180c9e3e2d205d311ab35088877056e06..400772231d48ed079a0fdb9ab2eb9c7b0aacb75a 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetStaticFieldLittleEndianIntPerfTest.java @@ -13,17 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleSetStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; static int sField = FIELD_VALUE; VarHandle mVh; @@ -53,7 +52,7 @@ public class VarHandleSetStaticFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mVh.set(FIELD_VALUE); mVh.set(FIELD_VALUE); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetStaticFieldLittleEndianStringPerfTest.java index 00abb0bab6bb4a69ff86ce378756fd14cd53f9e5..732315862eb2bf1775969852d022694f61d440a6 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetStaticFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetStaticFieldLittleEndianStringPerfTest.java @@ -13,17 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleSetStaticFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; static String sField = FIELD_VALUE; VarHandle mVh; @@ -53,7 +52,7 @@ public class VarHandleSetStaticFieldLittleEndianStringPerfTest { @Test public void run() { String x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mVh.set(FIELD_VALUE); mVh.set(FIELD_VALUE); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileFieldLittleEndianIntPerfTest.java index c66b23b199388387eec93fadb8647a43f0b25944..f4119c28b826780c20fde79e83970b07e64f8b4d 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileFieldLittleEndianIntPerfTest.java @@ -13,17 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleSetVolatileFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; int mField = FIELD_VALUE; VarHandle mVh; @@ -53,7 +52,7 @@ public class VarHandleSetVolatileFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mVh.setVolatile(this, FIELD_VALUE); mVh.setVolatile(this, FIELD_VALUE); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileFieldLittleEndianStringPerfTest.java index 1b364504d1d5d2d7c2152c8103c68e1e4ee4d015..9b9c2612fe2574c9982886aeba5fc2b4c7bbcc11 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileFieldLittleEndianStringPerfTest.java @@ -13,17 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleSetVolatileFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; String mField = FIELD_VALUE; VarHandle mVh; @@ -53,7 +52,7 @@ public class VarHandleSetVolatileFieldLittleEndianStringPerfTest { @Test public void run() { String x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mVh.setVolatile(this, FIELD_VALUE); mVh.setVolatile(this, FIELD_VALUE); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileStaticFieldLittleEndianIntPerfTest.java index 75f927494f88b34070871787533be040bd479581..f125384706ca88b101001aa72cba4580bfaaa69f 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileStaticFieldLittleEndianIntPerfTest.java @@ -13,17 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleSetVolatileStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; static int sField = FIELD_VALUE; VarHandle mVh; @@ -53,7 +52,7 @@ public class VarHandleSetVolatileStaticFieldLittleEndianIntPerfTest { @Test public void run() { int x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mVh.setVolatile(FIELD_VALUE); mVh.setVolatile(FIELD_VALUE); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileStaticFieldLittleEndianStringPerfTest.java index 8289d4fdc0aa6b4cc93ca4ae1c40320d94be93cf..2ad605d83d0416bba8ec0b624962b6a271256224 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileStaticFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileStaticFieldLittleEndianStringPerfTest.java @@ -13,17 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleSetVolatileStaticFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; static String sField = FIELD_VALUE; VarHandle mVh; @@ -53,7 +52,7 @@ public class VarHandleSetVolatileStaticFieldLittleEndianStringPerfTest { @Test public void run() { String x; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mVh.setVolatile(FIELD_VALUE); mVh.setVolatile(FIELD_VALUE); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireFieldLittleEndianIntPerfTest.java index 9fac8427eacf898479f65ca878c176353357b49b..5ef3bf00204b49d46d0a24a41f3c143f3312591c 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleWeakcompareandsetAcquireFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; int mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleWeakcompareandsetAcquireFieldLittleEndianIntPerfTest { @Test public void run() { boolean success; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { success = mVh.weakCompareAndSetAcquire(this, mField, ~42); success = mVh.weakCompareAndSetAcquire(this, mField, 42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireFieldLittleEndianStringPerfTest.java index 2f601273076ee11055313bfe27ffe4af2ee54d69..0c4ed66fc6b7f128ecb8a70192b6d1938c6b2e10 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireFieldLittleEndianStringPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleWeakcompareandsetAcquireFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; String mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleWeakcompareandsetAcquireFieldLittleEndianStringPerfTest { @Test public void run() { boolean success; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { success = mVh.weakCompareAndSetAcquire(this, mField, null); success = mVh.weakCompareAndSetAcquire(this, mField, "qwerty"); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireStaticFieldLittleEndianIntPerfTest.java index 4efbd3e506373414ab1c40d569797a281e71a584..db6bd2429e26da99abfe1cdc5b1e1a460ecbed51 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireStaticFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleWeakcompareandsetAcquireStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; static int sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleWeakcompareandsetAcquireStaticFieldLittleEndianIntPerfTest @Test public void run() { boolean success; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { success = mVh.weakCompareAndSetAcquire(sField, ~42); success = mVh.weakCompareAndSetAcquire(sField, 42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireStaticFieldLittleEndianStringPerfTest.java index 099640c624e12473bf14839455de8b75cb22d80f..d2b0bf76158f9acae37a5d0579dabab0492df244 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireStaticFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireStaticFieldLittleEndianStringPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,19 +32,20 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleWeakcompareandsetAcquireStaticFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; static String sField = FIELD_VALUE; VarHandle mVh; - public VarHandleWeakcompareandsetAcquireStaticFieldLittleEndianStringPerfTest() throws Throwable { + public VarHandleWeakcompareandsetAcquireStaticFieldLittleEndianStringPerfTest() + throws Throwable { mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", String.class); } @Test public void run() { boolean success; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { success = mVh.weakCompareAndSetAcquire(sField, null); success = mVh.weakCompareAndSetAcquire(sField, "qwerty"); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetFieldLittleEndianIntPerfTest.java index ce8f0f0ac2693e90d04483847d13c0ce4a23128a..3cd5ae6533b634c7f16bf2d544e17ae057ab6e79 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleWeakcompareandsetFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; int mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleWeakcompareandsetFieldLittleEndianIntPerfTest { @Test public void run() { boolean success; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { success = mVh.weakCompareAndSet(this, mField, ~42); success = mVh.weakCompareAndSet(this, mField, 42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetFieldLittleEndianStringPerfTest.java index c4119dc5411b0f41c8549a806437c875c95477b3..6ddfc25deca950be140b1dfd86fb8b089d82f099 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetFieldLittleEndianStringPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleWeakcompareandsetFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; String mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleWeakcompareandsetFieldLittleEndianStringPerfTest { @Test public void run() { boolean success; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { success = mVh.weakCompareAndSet(this, mField, null); success = mVh.weakCompareAndSet(this, mField, "qwerty"); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainFieldLittleEndianIntPerfTest.java index abd981c78f41f955f8e2a8c868059f5e2d6475b2..375f0bc08027da35ab8df5020ce2fa0a16c974ce 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleWeakcompareandsetPlainFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; int mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleWeakcompareandsetPlainFieldLittleEndianIntPerfTest { @Test public void run() { boolean success; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { success = mVh.weakCompareAndSetPlain(this, mField, ~42); success = mVh.weakCompareAndSetPlain(this, mField, 42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainFieldLittleEndianStringPerfTest.java index c71e65f77983dd074ae2cf796c3304428178f0b7..7e2492ace1dd48bc16f3acc02cebff219d73f7aa 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainFieldLittleEndianStringPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleWeakcompareandsetPlainFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; String mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleWeakcompareandsetPlainFieldLittleEndianStringPerfTest { @Test public void run() { boolean success; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { success = mVh.weakCompareAndSetPlain(this, mField, null); success = mVh.weakCompareAndSetPlain(this, mField, "qwerty"); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainStaticFieldLittleEndianIntPerfTest.java index f3c8f3ac065630abd37cd4e8d7b651e913522115..190118c551e656dad68a34dda357856702c9da04 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainStaticFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleWeakcompareandsetPlainStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; static int sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleWeakcompareandsetPlainStaticFieldLittleEndianIntPerfTest { @Test public void run() { boolean success; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { success = mVh.weakCompareAndSetPlain(sField, ~42); success = mVh.weakCompareAndSetPlain(sField, 42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainStaticFieldLittleEndianStringPerfTest.java index 5c943a46cedcab7dd85e72fa24508c9cf89146bc..484ba1b88183e66f71eecb0da4b9570cccc9e7ca 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainStaticFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainStaticFieldLittleEndianStringPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleWeakcompareandsetPlainStaticFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; static String sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleWeakcompareandsetPlainStaticFieldLittleEndianStringPerfTes @Test public void run() { boolean success; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { success = mVh.weakCompareAndSetPlain(sField, null); success = mVh.weakCompareAndSetPlain(sField, "qwerty"); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseFieldLittleEndianIntPerfTest.java index 1755a15aae76ef86a81444ee32c9bd91c89aef69..80e4e153a41fd42d5d28edc5d9a3f6cb448089bc 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleWeakcompareandsetReleaseFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; int mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleWeakcompareandsetReleaseFieldLittleEndianIntPerfTest { @Test public void run() { boolean success; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { success = mVh.weakCompareAndSetRelease(this, mField, ~42); success = mVh.weakCompareAndSetRelease(this, mField, 42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseFieldLittleEndianStringPerfTest.java index 77175b007af9d4a9ac05336f8f97788141c49b61..fa26c59304f9e128c46c9119757d04ab2b0c7aa1 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseFieldLittleEndianStringPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleWeakcompareandsetReleaseFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; String mField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleWeakcompareandsetReleaseFieldLittleEndianStringPerfTest { @Test public void run() { boolean success; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { success = mVh.weakCompareAndSetRelease(this, mField, null); success = mVh.weakCompareAndSetRelease(this, mField, "qwerty"); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseStaticFieldLittleEndianIntPerfTest.java index 985519e890aff80d195d466ab072f5e094134a14..16bf2a208870c325a4c35c53b1094bc935442931 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseStaticFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleWeakcompareandsetReleaseStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; static int sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleWeakcompareandsetReleaseStaticFieldLittleEndianIntPerfTest @Test public void run() { boolean success; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { success = mVh.weakCompareAndSetRelease(sField, ~42); success = mVh.weakCompareAndSetRelease(sField, 42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseStaticFieldLittleEndianStringPerfTest.java index 69e6ca7cce9cd9346b09d312c13ca47ae1fc1164..e1716dede024d4197af95bc426b4528523cce50a 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseStaticFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseStaticFieldLittleEndianStringPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,19 +32,20 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleWeakcompareandsetReleaseStaticFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; static String sField = FIELD_VALUE; VarHandle mVh; - public VarHandleWeakcompareandsetReleaseStaticFieldLittleEndianStringPerfTest() throws Throwable { + public VarHandleWeakcompareandsetReleaseStaticFieldLittleEndianStringPerfTest() + throws Throwable { mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", String.class); } @Test public void run() { boolean success; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { success = mVh.weakCompareAndSetRelease(sField, null); success = mVh.weakCompareAndSetRelease(sField, "qwerty"); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetStaticFieldLittleEndianIntPerfTest.java index 88df5ff6034116caae8d0cf6786ef4d740aa8404..dc6f2adfe951300fdeb96e9c9f934d1317164075 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetStaticFieldLittleEndianIntPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetStaticFieldLittleEndianIntPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleWeakcompareandsetStaticFieldLittleEndianIntPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final int FIELD_VALUE = 42; static int sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleWeakcompareandsetStaticFieldLittleEndianIntPerfTest { @Test public void run() { boolean success; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { success = mVh.weakCompareAndSet(sField, ~42); success = mVh.weakCompareAndSet(sField, 42); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetStaticFieldLittleEndianStringPerfTest.java index c296f66814a40fcbebdab2534042cc8402cd87af..d1096c629ed8ba7323994ba3a3c9a6f02e4ff3d9 100644 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetStaticFieldLittleEndianStringPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetStaticFieldLittleEndianStringPerfTest.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // This file is generated by generate_java.py do not directly modify! +// This file is generated by generate_java.py do not directly modify! package android.libcore.varhandles; -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; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleWeakcompareandsetStaticFieldLittleEndianStringPerfTest { - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final String FIELD_VALUE = "qwerty"; static String sField = FIELD_VALUE; VarHandle mVh; @@ -46,7 +44,7 @@ public class VarHandleWeakcompareandsetStaticFieldLittleEndianStringPerfTest { @Test public void run() { boolean success; - final BenchmarkState state = mBenchmarkRule.getState(); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { success = mVh.weakCompareAndSet(sField, null); success = mVh.weakCompareAndSet(sField, "qwerty"); diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/generate_java.py b/apct-tests/perftests/core/src/android/libcore/varhandles/generate_java.py index a43569a13813e65d4abb184c26d568e7f7a46ff6..4b4bc605a6c35fe6927ab6d280481f3da5c599ed 100755 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/generate_java.py +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/generate_java.py @@ -42,7 +42,7 @@ def to_camel_case(word): return ''.join(c for c in word.title() if not c == '_') -LOOP ="final BenchmarkState state = mBenchmarkRule.getState();\n while (state.keepRunning())" +LOOP ="BenchmarkState state = mPerfStatusReporter.getBenchmarkState();\n while (state.keepRunning())" class Benchmark: def __init__(self, code, static, vartype, flavour, klass, method, memloc, @@ -158,10 +158,10 @@ BANNER = """/* VH_IMPORTS = """ package android.libcore.varhandles; -import androidx.benchmark.BenchmarkState; -import androidx.benchmark.junit4.BenchmarkRule; +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; -import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; import org.junit.After; @@ -179,7 +179,7 @@ VH_START = BANNER + VH_IMPORTS + """ @RunWith(AndroidJUnit4.class) @LargeTest public class {name} {{ - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final {vartype} FIELD_VALUE = {value1}; {static_kwd}{vartype} {static_prefix}Field = FIELD_VALUE; VarHandle mVh; @@ -273,7 +273,7 @@ VH_START_ARRAY = BANNER + VH_IMPORTS + """ @RunWith(AndroidJUnit4.class) @LargeTest public class {name} {{ - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final {vartype} ELEMENT_VALUE = {value1}; {vartype}[] mArray = {{ ELEMENT_VALUE }}; VarHandle mVh; @@ -324,7 +324,7 @@ import java.nio.ByteOrder; @RunWith(AndroidJUnit4.class) @LargeTest public class {name} {{ - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); static final {vartype} VALUE = {value1}; byte[] mArray1 = {value1_byte_array}; byte[] mArray2 = {value2_byte_array}; @@ -375,7 +375,7 @@ import java.lang.reflect.Field; @RunWith(AndroidJUnit4.class) @LargeTest public class {name} {{ - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); Field mField; {static_kwd}{vartype} {static_prefix}Value; @@ -407,7 +407,7 @@ import jdk.internal.misc.Unsafe; @RunWith(AndroidJUnit4.class) @LargeTest public class {name} {{ - @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); long mOffset; public {static_kwd}{vartype} {static_prefix}Value = {value1}; diff --git a/apct-tests/perftests/healthconnect/Android.bp b/apct-tests/perftests/healthconnect/Android.bp index c38a24ee05d226af47d5647c21e485b162062183..072010e90fae412dc36b6ff7a1d831d73ae874a1 100644 --- a/apct-tests/perftests/healthconnect/Android.bp +++ b/apct-tests/perftests/healthconnect/Android.bp @@ -37,7 +37,7 @@ android_test { "collector-device-lib-platform", ], - libs: ["android.test.base"], + libs: ["android.test.base.stubs.system"], platform_apis: true, test_suites: ["device-tests"], data: [":perfetto_artifacts"], diff --git a/apct-tests/perftests/packagemanager/Android.bp b/apct-tests/perftests/packagemanager/Android.bp index 02fc12cde04bf946046b731092c6099e1e6f4a69..b2626911ea1e92db42b0e838f6456aca2c33ee80 100644 --- a/apct-tests/perftests/packagemanager/Android.bp +++ b/apct-tests/perftests/packagemanager/Android.bp @@ -28,7 +28,7 @@ android_test { "services.core", ], - libs: ["android.test.base"], + libs: ["android.test.base.stubs.system"], platform_apis: true, diff --git a/apct-tests/perftests/permission/Android.bp b/apct-tests/perftests/permission/Android.bp index bc8e7696440a49ba320c96be8fa4388d105b89d5..f4c7fbbf6593eea19cca9ce5a957fb03a445959f 100644 --- a/apct-tests/perftests/permission/Android.bp +++ b/apct-tests/perftests/permission/Android.bp @@ -43,7 +43,7 @@ android_test { "cts-install-lib-java", ], - libs: ["android.test.base"], + libs: ["android.test.base.stubs.system"], platform_apis: true, diff --git a/apct-tests/perftests/settingsprovider/Android.bp b/apct-tests/perftests/settingsprovider/Android.bp index e4aa14cd8a77afcd532447c0096698bf1d0ac01a..382803900507a811a8069889aa4404e08eaa5ed9 100644 --- a/apct-tests/perftests/settingsprovider/Android.bp +++ b/apct-tests/perftests/settingsprovider/Android.bp @@ -28,7 +28,7 @@ android_test { "services.core", ], - libs: ["android.test.base"], + libs: ["android.test.base.stubs.system"], platform_apis: true, diff --git a/apex/blobstore/OWNERS b/apex/blobstore/OWNERS index a53bbeaa8601517b62fc2e7d4991d73a2a867c1a..676cbc7eb2a3f6c5c0763fed083146ede442b2e6 100644 --- a/apex/blobstore/OWNERS +++ b/apex/blobstore/OWNERS @@ -1,2 +1,5 @@ +# Bug component: 25692 +set noparent + sudheersai@google.com -yamasani@google.com +yamasani@google.com #{LAST_RESORT_SUGGESTION} diff --git a/apex/jobscheduler/framework/aconfig/job.aconfig b/apex/jobscheduler/framework/aconfig/job.aconfig index 80db264d0f4423aeb260ff60d3f886fdd06974ef..5f5507587f7273c78c1facd03e952f9dac688c8e 100644 --- a/apex/jobscheduler/framework/aconfig/job.aconfig +++ b/apex/jobscheduler/framework/aconfig/job.aconfig @@ -23,3 +23,10 @@ flag { description: "Introduce a new RUN_BACKUP_JOBS permission and exemption logic allowing for longer running jobs for apps whose primary purpose is to backup or sync content." bug: "318731461" } + +flag { + name: "cleanup_empty_jobs" + namespace: "backstage_power" + description: "Enables automatic cancellation of jobs due to leaked JobParameters, reducing unnecessary battery drain and improving system efficiency. This includes logging and traces for better issue diagnosis." + bug: "349688611" +} diff --git a/apex/jobscheduler/framework/java/android/app/job/IJobCallback.aidl b/apex/jobscheduler/framework/java/android/app/job/IJobCallback.aidl index 96494ec28204b5dd4ffdaa94b924f03025572b4c..11d17ca749b73f01fce7336a92e959d8aa9339fe 100644 --- a/apex/jobscheduler/framework/java/android/app/job/IJobCallback.aidl +++ b/apex/jobscheduler/framework/java/android/app/job/IJobCallback.aidl @@ -85,6 +85,14 @@ interface IJobCallback { */ @UnsupportedAppUsage void jobFinished(int jobId, boolean reschedule); + + /* + * Inform JobScheduler to force finish this job because the client has lost + * the job handle. jobFinished can no longer be called from the client. + * @param jobId Unique integer used to identify this job + */ + void forceJobFinished(int jobId); + /* * Inform JobScheduler of a change in the estimated transfer payload. * diff --git a/apex/jobscheduler/framework/java/android/app/job/JobParameters.java b/apex/jobscheduler/framework/java/android/app/job/JobParameters.java index e833bb95a3026071506bd7251ea22a377e2b5565..52a761f8d4867420e49643d8f47c0ac524be2f9f 100644 --- a/apex/jobscheduler/framework/java/android/app/job/JobParameters.java +++ b/apex/jobscheduler/framework/java/android/app/job/JobParameters.java @@ -34,15 +34,21 @@ import android.os.Parcel; import android.os.Parcelable; import android.os.PersistableBundle; import android.os.RemoteException; +import android.system.SystemCleaner; +import android.util.Log; + +import com.android.internal.annotations.VisibleForTesting; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; +import java.lang.ref.Cleaner; /** * Contains the parameters used to configure/identify your job. You do not create this object * yourself, instead it is handed in to your application by the System. */ public class JobParameters implements Parcelable { + private static final String TAG = "JobParameters"; /** @hide */ public static final int INTERNAL_STOP_REASON_UNKNOWN = -1; @@ -306,6 +312,10 @@ public class JobParameters implements Parcelable { private int mStopReason = STOP_REASON_UNDEFINED; private int mInternalStopReason = INTERNAL_STOP_REASON_UNKNOWN; private String debugStopReason; // Human readable stop reason for debugging. + @Nullable + private JobCleanupCallback mJobCleanupCallback; + @Nullable + private Cleaner.Cleanable mCleanable; /** @hide */ public JobParameters(IBinder callback, String namespace, int jobId, PersistableBundle extras, @@ -326,6 +336,8 @@ public class JobParameters implements Parcelable { this.mTriggeredContentAuthorities = triggeredContentAuthorities; this.mNetwork = network; this.mJobNamespace = namespace; + this.mJobCleanupCallback = null; + this.mCleanable = null; } /** @@ -597,6 +609,8 @@ public class JobParameters implements Parcelable { mStopReason = in.readInt(); mInternalStopReason = in.readInt(); debugStopReason = in.readString(); + mJobCleanupCallback = null; + mCleanable = null; } /** @hide */ @@ -612,6 +626,54 @@ public class JobParameters implements Parcelable { this.debugStopReason = debugStopReason; } + /** @hide */ + public void initCleaner(JobCleanupCallback jobCleanupCallback) { + mJobCleanupCallback = jobCleanupCallback; + mCleanable = SystemCleaner.cleaner().register(this, mJobCleanupCallback); + } + + /** + * Lazy initialize the cleaner and enable it + * + * @hide + */ + public void enableCleaner() { + if (mJobCleanupCallback == null) { + initCleaner(new JobCleanupCallback(IJobCallback.Stub.asInterface(callback), jobId)); + } + mJobCleanupCallback.enableCleaner(); + } + + /** + * Disable the cleaner from running and unregister it + * + * @hide + */ + public void disableCleaner() { + if (mJobCleanupCallback != null) { + mJobCleanupCallback.disableCleaner(); + if (mCleanable != null) { + mCleanable.clean(); + mCleanable = null; + } + mJobCleanupCallback = null; + } + } + + /** @hide */ + @VisibleForTesting + @Nullable + public Cleaner.Cleanable getCleanable() { + return mCleanable; + } + + /** @hide */ + @VisibleForTesting + @Nullable + public JobCleanupCallback getJobCleanupCallback() { + return mJobCleanupCallback; + } + @Override public int describeContents() { return 0; @@ -647,6 +709,67 @@ public class JobParameters implements Parcelable { dest.writeString(debugStopReason); } + /** + * JobCleanupCallback is used track JobParameters leak. If the job is started + * and jobFinish is not called at the time of garbage collection of JobParameters + * instance, it is considered a job leak. Force finish the job. + * + * @hide + */ + public static class JobCleanupCallback implements Runnable { + private final IJobCallback mCallback; + private final int mJobId; + private boolean mIsCleanerEnabled; + + public JobCleanupCallback( + IJobCallback callback, + int jobId) { + mCallback = callback; + mJobId = jobId; + mIsCleanerEnabled = false; + } + + /** + * Check if the cleaner is enabled + * + * @hide + */ + public boolean isCleanerEnabled() { + return mIsCleanerEnabled; + } + + /** + * Enable the cleaner to detect JobParameter leak + * + * @hide + */ + public void enableCleaner() { + mIsCleanerEnabled = true; + } + + /** + * Disable the cleaner from running. + * + * @hide + */ + public void disableCleaner() { + mIsCleanerEnabled = false; + } + + /** @hide */ + @Override + public void run() { + if (!isCleanerEnabled()) { + return; + } + try { + mCallback.forceJobFinished(mJobId); + } catch (Exception e) { + Log.wtf(TAG, "Could not destroy running job", e); + } + } + } + public static final @android.annotation.NonNull Creator CREATOR = new Creator() { @Override public JobParameters createFromParcel(Parcel in) { diff --git a/apex/jobscheduler/framework/java/android/app/job/JobServiceEngine.java b/apex/jobscheduler/framework/java/android/app/job/JobServiceEngine.java index 79d87edff9b2c2de86f1832df4253c0a887b839e..5f80c52388b4920a478b8787862d9da1950422ad 100644 --- a/apex/jobscheduler/framework/java/android/app/job/JobServiceEngine.java +++ b/apex/jobscheduler/framework/java/android/app/job/JobServiceEngine.java @@ -165,7 +165,13 @@ public abstract class JobServiceEngine { case MSG_EXECUTE_JOB: { final JobParameters params = (JobParameters) msg.obj; try { + if (Flags.cleanupEmptyJobs()) { + params.enableCleaner(); + } boolean workOngoing = JobServiceEngine.this.onStartJob(params); + if (Flags.cleanupEmptyJobs() && !workOngoing) { + params.disableCleaner(); + } ackStartMessage(params, workOngoing); } catch (Exception e) { Log.e(TAG, "Error while executing job: " + params.getJobId()); @@ -190,6 +196,9 @@ public abstract class JobServiceEngine { IJobCallback callback = params.getCallback(); if (callback != null) { try { + if (Flags.cleanupEmptyJobs()) { + params.disableCleaner(); + } callback.jobFinished(params.getJobId(), needsReschedule); } catch (RemoteException e) { Log.e(TAG, "Error reporting job finish to system: binder has gone" + diff --git a/apex/jobscheduler/service/java/com/android/server/job/JobServiceContext.java b/apex/jobscheduler/service/java/com/android/server/job/JobServiceContext.java index be8e304a8101b9f97c27bae30de31d2d8463c5fa..ee246d84997fe9fb43e4cf6228d368c5771dcac9 100644 --- a/apex/jobscheduler/service/java/com/android/server/job/JobServiceContext.java +++ b/apex/jobscheduler/service/java/com/android/server/job/JobServiceContext.java @@ -129,6 +129,8 @@ public final class JobServiceContext implements ServiceConnection { private static final String[] VERB_STRINGS = { "VERB_BINDING", "VERB_STARTING", "VERB_EXECUTING", "VERB_STOPPING", "VERB_FINISHED" }; + private static final String TRACE_JOB_FORCE_FINISHED_PREFIX = "forceJobFinished:"; + private static final String TRACE_JOB_FORCE_FINISHED_DELIMITER = "#"; // States that a job occupies while interacting with the client. static final int VERB_BINDING = 0; @@ -291,6 +293,11 @@ public final class JobServiceContext implements ServiceConnection { doJobFinished(this, jobId, reschedule); } + @Override + public void forceJobFinished(int jobId) { + doForceJobFinished(this, jobId); + } + @Override public void updateEstimatedNetworkBytes(int jobId, JobWorkItem item, long downloadBytes, long uploadBytes) { @@ -762,6 +769,35 @@ public final class JobServiceContext implements ServiceConnection { } } + /** + * This method just adds traces to evaluate jobs that leak jobparameters at the client. + * It does not stop the job. + */ + void doForceJobFinished(JobCallback cb, int jobId) { + final long ident = Binder.clearCallingIdentity(); + try { + final JobStatus executing; + synchronized (mLock) { + // not the current job, presumably it has finished in some way already + if (!verifyCallerLocked(cb)) { + return; + } + + executing = getRunningJobLocked(); + } + if (executing != null && jobId == executing.getJobId()) { + final StringBuilder stateSuffix = new StringBuilder(); + stateSuffix.append(TRACE_JOB_FORCE_FINISHED_PREFIX); + stateSuffix.append(executing.getBatteryName()); + stateSuffix.append(TRACE_JOB_FORCE_FINISHED_DELIMITER); + stateSuffix.append(executing.getJobId()); + Trace.instant(Trace.TRACE_TAG_POWER, stateSuffix.toString()); + } + } finally { + Binder.restoreCallingIdentity(ident); + } + } + private void doAcknowledgeGetTransferredDownloadBytesMessage(JobCallback cb, int jobId, int workId, @BytesLong long transferredBytes) { // TODO(255393346): Make sure apps call this appropriately and monitor for abuse diff --git a/apex/jobscheduler/service/java/com/android/server/job/TEST_MAPPING b/apex/jobscheduler/service/java/com/android/server/job/TEST_MAPPING index 16c2fd4b73c3b3fdc3515e17b5ae2496cafc371f..a0bf78f281278bc449eec5b53463d0d027ec84c1 100644 --- a/apex/jobscheduler/service/java/com/android/server/job/TEST_MAPPING +++ b/apex/jobscheduler/service/java/com/android/server/job/TEST_MAPPING @@ -25,10 +25,7 @@ ] }, { - "name": "FrameworksServicesTests", - "options": [ - {"include-filter": "com.android.server.job"} - ] + "name": "FrameworksServicesTests_com_android_server_job" }, { "name": "CtsHostsideNetworkPolicyTests", diff --git a/apex/jobscheduler/service/java/com/android/server/usage/TEST_MAPPING b/apex/jobscheduler/service/java/com/android/server/usage/TEST_MAPPING index 52670a2570d344724bcd27485e3cea49905ef9cd..f56c14da8f23b8f908908538276d05af9bd08548 100644 --- a/apex/jobscheduler/service/java/com/android/server/usage/TEST_MAPPING +++ b/apex/jobscheduler/service/java/com/android/server/usage/TEST_MAPPING @@ -10,14 +10,10 @@ ] }, { - "name": "CtsBRSTestCases", - "options": [ - {"exclude-annotation": "androidx.test.filters.FlakyTest"}, - {"exclude-annotation": "org.junit.Ignore"} - ] + "name": "CtsBRSTestCases" }, { - "name": "FrameworksServicesTests_com_android_server_usage_Presubmit" + "name": "FrameworksServicesTests_com_android_server_usage" } ], "postsubmit": [ @@ -25,10 +21,7 @@ "name": "CtsUsageStatsTestCases" }, { - "name": "FrameworksServicesTests", - "options": [ - {"include-filter": "com.android.server.usage"} - ] + "name": "FrameworksServicesTests_com_android_server_usage" } ] } diff --git a/boot/hiddenapi/hiddenapi-unsupported.txt b/boot/hiddenapi/hiddenapi-unsupported.txt index adcc3df2d7fe6763df2eb0b90e8b3066856b7ef8..70e5a68745bc5900d76a9c1f358c08e2e1cafd40 100644 --- a/boot/hiddenapi/hiddenapi-unsupported.txt +++ b/boot/hiddenapi/hiddenapi-unsupported.txt @@ -183,7 +183,6 @@ Landroid/view/autofill/IAutoFillManager$Stub$Proxy;->(Landroid/os/IBinder; Landroid/view/autofill/IAutoFillManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/view/autofill/IAutoFillManager; Landroid/view/IAppTransitionAnimationSpecsFuture$Stub;->()V Landroid/view/IDockedStackListener$Stub;->()V -Landroid/view/IRecentsAnimationRunner$Stub;->()V Landroid/view/IRemoteAnimationRunner$Stub;->()V Landroid/view/IRotationWatcher$Stub;->()V Landroid/view/IWindow$Stub;->()V diff --git a/cmds/screencap/Android.bp b/cmds/screencap/Android.bp index c009c1f5b08b89ac198379614d0d33c7f0f879e4..16026eca2980847123f256c2fcbf2aaec1147c52 100644 --- a/cmds/screencap/Android.bp +++ b/cmds/screencap/Android.bp @@ -17,6 +17,7 @@ cc_binary { "libutils", "libbinder", "libjnigraphics", + "libhwui", "libui", "libgui", ], diff --git a/cmds/screencap/screencap.cpp b/cmds/screencap/screencap.cpp index 01b20f4a52674ae26f7cee37ef7b676f6af06adf..12de82a462632dd59da4c49522681474b0c7fc3d 100644 --- a/cmds/screencap/screencap.cpp +++ b/cmds/screencap/screencap.cpp @@ -15,36 +15,28 @@ */ #include +#include #include #include #include -#include -#include #include -#include -#include -#include - -#include -#include -#include -#include - -#include - -#include - #include #include +#include #include #include #include - +#include +#include +#include +#include +#include +#include +#include +#include #include #include -#include - using namespace android; #define COLORSPACE_UNKNOWN 0 @@ -85,11 +77,12 @@ enum { }; } -static const struct option LONG_OPTIONS[] = { - {"png", no_argument, nullptr, 'p'}, - {"help", no_argument, nullptr, 'h'}, - {"hint-for-seamless", no_argument, nullptr, LongOpts::HintForSeamless}, - {0, 0, 0, 0}}; +static const struct option LONG_OPTIONS[] = {{"png", no_argument, nullptr, 'p'}, + {"jpeg", no_argument, nullptr, 'j'}, + {"help", no_argument, nullptr, 'h'}, + {"hint-for-seamless", no_argument, nullptr, + LongOpts::HintForSeamless}, + {0, 0, 0, 0}}; static int32_t flinger2bitmapFormat(PixelFormat f) { @@ -170,10 +163,11 @@ status_t capture(const DisplayId displayId, return 0; } -status_t saveImage(const char* fn, bool png, const ScreenCaptureResults& captureResults) { +status_t saveImage(const char* fn, std::optional format, + const ScreenCaptureResults& captureResults) { void* base = nullptr; ui::Dataspace dataspace = captureResults.capturedDataspace; - sp buffer = captureResults.buffer; + const sp& buffer = captureResults.buffer; status_t result = buffer->lock(GraphicBuffer::USAGE_SW_READ_OFTEN, &base); @@ -188,22 +182,48 @@ status_t saveImage(const char* fn, bool png, const ScreenCaptureResults& capture return 1; } + void* gainmapBase = nullptr; + sp gainmap = captureResults.optionalGainMap; + + if (gainmap) { + result = gainmap->lock(GraphicBuffer::USAGE_SW_READ_OFTEN, &gainmapBase); + if (gainmapBase == nullptr || result != NO_ERROR) { + fprintf(stderr, "Failed to capture gainmap with error code (%d)\n", result); + gainmapBase = nullptr; + // Fall-through: just don't attempt to write the gainmap + } + } + int fd = -1; if (fn == nullptr) { fd = dup(STDOUT_FILENO); if (fd == -1) { fprintf(stderr, "Error writing to stdout. (%s)\n", strerror(errno)); + if (gainmapBase) { + gainmap->unlock(); + } + + if (base) { + buffer->unlock(); + } return 1; } } else { fd = open(fn, O_WRONLY | O_CREAT | O_TRUNC, 0664); if (fd == -1) { fprintf(stderr, "Error opening file: %s (%s)\n", fn, strerror(errno)); + if (gainmapBase) { + gainmap->unlock(); + } + + if (base) { + buffer->unlock(); + } return 1; } } - if (png) { + if (format) { AndroidBitmapInfo info; info.format = flinger2bitmapFormat(buffer->getPixelFormat()); info.flags = ANDROID_BITMAP_FLAGS_ALPHA_PREMUL; @@ -211,16 +231,31 @@ status_t saveImage(const char* fn, bool png, const ScreenCaptureResults& capture info.height = buffer->getHeight(); info.stride = buffer->getStride() * bytesPerPixel(buffer->getPixelFormat()); - int result = AndroidBitmap_compress(&info, static_cast(dataspace), base, - ANDROID_BITMAP_COMPRESS_FORMAT_PNG, 100, &fd, + int result; + + if (gainmapBase) { + result = ABitmap_compressWithGainmap(&info, static_cast(dataspace), base, + gainmapBase, captureResults.hdrSdrRatio, *format, + 100, &fd, + [](void* fdPtr, const void* data, + size_t size) -> bool { + int bytesWritten = + write(*static_cast(fdPtr), data, + size); + return bytesWritten == size; + }); + } else { + result = AndroidBitmap_compress(&info, static_cast(dataspace), base, *format, + 100, &fd, [](void* fdPtr, const void* data, size_t size) -> bool { int bytesWritten = write(*static_cast(fdPtr), data, size); return bytesWritten == size; }); + } if (result != ANDROID_BITMAP_RESULT_SUCCESS) { - fprintf(stderr, "Failed to compress PNG (error code: %d)\n", result); + fprintf(stderr, "Failed to compress (error code: %d)\n", result); } if (fn != NULL) { @@ -245,6 +280,14 @@ status_t saveImage(const char* fn, bool png, const ScreenCaptureResults& capture } close(fd); + if (gainmapBase) { + gainmap->unlock(); + } + + if (base) { + buffer->unlock(); + } + return 0; } @@ -262,13 +305,17 @@ int main(int argc, char** argv) gui::CaptureArgs captureArgs; const char* pname = argv[0]; bool png = false; + bool jpeg = false; bool all = false; int c; - while ((c = getopt_long(argc, argv, "aphd:", LONG_OPTIONS, nullptr)) != -1) { + while ((c = getopt_long(argc, argv, "apjhd:", LONG_OPTIONS, nullptr)) != -1) { switch (c) { case 'p': png = true; break; + case 'j': + jpeg = true; + break; case 'd': { errno = 0; char* end = nullptr; @@ -325,6 +372,14 @@ int main(int argc, char** argv) baseName = filename.substr(0, filename.size()-4); suffix = ".png"; png = true; + } else if (filename.ends_with(".jpeg")) { + baseName = filename.substr(0, filename.size() - 5); + suffix = ".jpeg"; + jpeg = true; + } else if (filename.ends_with(".jpg")) { + baseName = filename.substr(0, filename.size() - 4); + suffix = ".jpg"; + jpeg = true; } else { baseName = filename; } @@ -350,6 +405,20 @@ int main(int argc, char** argv) } } + if (png && jpeg) { + fprintf(stderr, "Ambiguous file type"); + return 1; + } + + std::optional format = std::nullopt; + + if (png) { + format = ANDROID_BITMAP_COMPRESS_FORMAT_PNG; + } else if (jpeg) { + format = ANDROID_BITMAP_COMPRESS_FORMAT_JPEG; + captureArgs.attachGainmap = true; + } + // setThreadPoolMaxThreadCount(0) actually tells the kernel it's // not allowed to spawn any additional threads, but we still spawn // a binder thread from userspace when we call startThreadPool(). @@ -385,7 +454,7 @@ int main(int argc, char** argv) if (!filename.empty()) { fn = filename.c_str(); } - if (const status_t saveImageStatus = saveImage(fn, png, result) != 0) { + if (const status_t saveImageStatus = saveImage(fn, format, result) != 0) { fprintf(stderr, "Saving image failed.\n"); return saveImageStatus; } diff --git a/cmds/uiautomator/library/Android.bp b/cmds/uiautomator/library/Android.bp index cd1fb9a0f047cf068d3de386abdc39e8875f1960..966bf13adfe464f21c3bd9e7a15849eec264945f 100644 --- a/cmds/uiautomator/library/Android.bp +++ b/cmds/uiautomator/library/Android.bp @@ -71,7 +71,7 @@ java_library_static { ":uiautomator-stubs", ], libs: [ - "android.test.runner", + "android.test.runner.stubs.system", "junit", ], java_version: "1.8", @@ -84,8 +84,8 @@ java_library_static { "testrunner-src/**/*.java", ], libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", ], static_libs: [ "junit", diff --git a/core/api/current.txt b/core/api/current.txt index 5e8febebee0ea06e4c7c08b1e9db5954a9d1f152..520c7d1d02f203abc21db71c728a1608df40eec0 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -6396,6 +6396,7 @@ package android.app { method public android.graphics.drawable.Icon getLargeIcon(); method @Nullable public android.content.LocusId getLocusId(); method public CharSequence getSettingsText(); + method @FlaggedApi("android.app.api_rich_ongoing") @Nullable public String getShortCriticalText(); method public String getShortcutId(); method public android.graphics.drawable.Icon getSmallIcon(); method public String getSortKey(); @@ -6719,6 +6720,7 @@ package android.app { method @NonNull public android.app.Notification.Builder setPublicVersion(android.app.Notification); method @NonNull public android.app.Notification.Builder setRemoteInputHistory(CharSequence[]); method @NonNull public android.app.Notification.Builder setSettingsText(CharSequence); + method @FlaggedApi("android.app.api_rich_ongoing") @NonNull public android.app.Notification.Builder setShortCriticalText(@Nullable String); method @NonNull public android.app.Notification.Builder setShortcutId(String); method @NonNull public android.app.Notification.Builder setShowWhen(boolean); method @NonNull public android.app.Notification.Builder setSmallIcon(@DrawableRes int); @@ -19168,7 +19170,7 @@ package android.hardware.camera2 { method @NonNull public java.util.List> getAvailableCaptureRequestKeys(); method @NonNull public java.util.List> getAvailableCaptureResultKeys(); method public java.util.List> getAvailablePhysicalCameraRequestKeys(); - method @FlaggedApi("com.android.internal.camera.flags.feature_combination_query") @NonNull public java.util.List> getAvailableSessionCharacteristicsKeys(); + method @NonNull public java.util.List> getAvailableSessionCharacteristicsKeys(); method public java.util.List> getAvailableSessionKeys(); method @NonNull public java.util.List> getKeys(); method @NonNull public java.util.List> getKeysNeedingPermission(); @@ -19211,7 +19213,7 @@ package android.hardware.camera2 { field @FlaggedApi("com.android.internal.camera.flags.camera_manual_flash_strength_control") @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key FLASH_TORCH_STRENGTH_MAX_LEVEL; field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key HOT_PIXEL_AVAILABLE_HOT_PIXEL_MODES; field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key INFO_DEVICE_STATE_SENSOR_ORIENTATION_MAP; - field @FlaggedApi("com.android.internal.camera.flags.feature_combination_query") @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key INFO_SESSION_CONFIGURATION_QUERY_VERSION; + field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key INFO_SESSION_CONFIGURATION_QUERY_VERSION; field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key INFO_SUPPORTED_HARDWARE_LEVEL; field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key INFO_VERSION; field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key JPEG_AVAILABLE_THUMBNAIL_SIZES; @@ -20081,14 +20083,14 @@ package android.hardware.camera2.params { public final class ExtensionSessionConfiguration { ctor public ExtensionSessionConfiguration(int, @NonNull java.util.List, @NonNull java.util.concurrent.Executor, @NonNull android.hardware.camera2.CameraExtensionSession.StateCallback); - method @FlaggedApi("com.android.internal.camera.flags.extension_10_bit") public void clearColorSpace(); - method @FlaggedApi("com.android.internal.camera.flags.extension_10_bit") @Nullable public android.graphics.ColorSpace getColorSpace(); + method public void clearColorSpace(); + method @Nullable public android.graphics.ColorSpace getColorSpace(); method @NonNull public java.util.concurrent.Executor getExecutor(); method public int getExtension(); method @NonNull public java.util.List getOutputConfigurations(); method @Nullable public android.hardware.camera2.params.OutputConfiguration getPostviewOutputConfiguration(); method @NonNull public android.hardware.camera2.CameraExtensionSession.StateCallback getStateCallback(); - method @FlaggedApi("com.android.internal.camera.flags.extension_10_bit") public void setColorSpace(@NonNull android.graphics.ColorSpace.Named); + method public void setColorSpace(@NonNull android.graphics.ColorSpace.Named); method public void setPostviewOutputConfiguration(@Nullable android.hardware.camera2.params.OutputConfiguration); } @@ -32771,6 +32773,7 @@ package android.os { field @NonNull public static final String RELEASE_OR_PREVIEW_DISPLAY; field @Deprecated public static final String SDK; field public static final int SDK_INT; + field @FlaggedApi("android.sdk.major_minor_versioning_scheme") public static final int SDK_MINOR_INT; field public static final String SECURITY_PATCH; } @@ -34265,9 +34268,14 @@ package android.os { method public final int areAllEffectsSupported(@NonNull int...); method public final boolean areAllPrimitivesSupported(@NonNull int...); method @NonNull public int[] areEffectsSupported(@NonNull int...); + method @FlaggedApi("android.os.vibrator.normalized_pwle_effects") public boolean areEnvelopeEffectsSupported(); method @NonNull public boolean[] arePrimitivesSupported(@NonNull int...); method @RequiresPermission(android.Manifest.permission.VIBRATE) public abstract void cancel(); method public int getId(); + method @FlaggedApi("android.os.vibrator.normalized_pwle_effects") public int getMaxEnvelopeEffectControlPointDurationMillis(); + method @FlaggedApi("android.os.vibrator.normalized_pwle_effects") public int getMaxEnvelopeEffectDurationMillis(); + method @FlaggedApi("android.os.vibrator.normalized_pwle_effects") public int getMaxEnvelopeEffectSize(); + method @FlaggedApi("android.os.vibrator.normalized_pwle_effects") public int getMinEnvelopeEffectControlPointDurationMillis(); method @NonNull public int[] getPrimitiveDurations(@NonNull int...); method public float getQFactor(); method public float getResonantFrequency(); @@ -36924,6 +36932,19 @@ package android.provider { field public static final String CONTENT_DIRECTORY = "data"; } + @FlaggedApi("android.provider.new_default_account_api_enabled") public static final class ContactsContract.RawContacts.DefaultAccountAndState { + ctor public ContactsContract.RawContacts.DefaultAccountAndState(int, @Nullable android.accounts.Account); + method @Nullable public android.accounts.Account getCloudAccount(); + method public int getState(); + method @NonNull public static android.provider.ContactsContract.RawContacts.DefaultAccountAndState ofCloud(@NonNull android.accounts.Account); + method @NonNull public static android.provider.ContactsContract.RawContacts.DefaultAccountAndState ofLocal(); + method @NonNull public static android.provider.ContactsContract.RawContacts.DefaultAccountAndState ofNotSet(); + field public static final int DEFAULT_ACCOUNT_STATE_CLOUD = 3; // 0x3 + field public static final int DEFAULT_ACCOUNT_STATE_INVALID = 0; // 0x0 + field public static final int DEFAULT_ACCOUNT_STATE_LOCAL = 2; // 0x2 + field public static final int DEFAULT_ACCOUNT_STATE_NOT_SET = 1; // 0x1 + } + public static final class ContactsContract.RawContacts.DisplayPhoto { field public static final String CONTENT_DIRECTORY = "display_photo"; } @@ -44066,6 +44087,7 @@ package android.telephony { } public static final class CarrierConfigManager.Gps { + field @FlaggedApi("android.location.flags.enable_ni_supl_message_injection_by_carrier_config") public static final String KEY_ENABLE_NI_SUPL_MESSAGE_INJECTION_BOOL = "gps.enable_ni_supl_message_injection_bool"; field public static final String KEY_PERSIST_LPP_MODE_BOOL = "gps.persist_lpp_mode_bool"; field public static final String KEY_PREFIX = "gps."; } @@ -50785,6 +50807,7 @@ package android.view { method public android.view.Display.HdrCapabilities getHdrCapabilities(); method public float getHdrSdrRatio(); method @Deprecated public int getHeight(); + method @FlaggedApi("com.android.server.display.feature.flags.highest_hdr_sdr_ratio_api") public float getHighestHdrSdrRatio(); method @Deprecated public void getMetrics(android.util.DisplayMetrics); method public android.view.Display.Mode getMode(); method public String getName(); diff --git a/core/api/module-lib-current.txt b/core/api/module-lib-current.txt index df707d18a8270ae926396e4e54c9cbf0225f4a58..1e94c2fc219c83e280b9ee990dbe4a1e3ad40ba3 100644 --- a/core/api/module-lib-current.txt +++ b/core/api/module-lib-current.txt @@ -673,8 +673,8 @@ package android.webkit { method @Nullable public android.content.pm.PackageInfo getCurrentWebViewPackage(); method @Nullable public String getCurrentWebViewPackageName(); method @FlaggedApi("android.webkit.update_service_v2") @NonNull public android.webkit.WebViewProviderInfo getDefaultWebViewPackage(); - method @Nullable public static android.webkit.WebViewUpdateManager getInstance(); - method @NonNull @RequiresPermission(allOf={android.Manifest.permission.INTERACT_ACROSS_USERS, android.Manifest.permission.QUERY_ALL_PACKAGES}) public android.webkit.WebViewProviderInfo[] getValidWebViewPackages(); + method @NonNull public static android.webkit.WebViewUpdateManager getInstance(); + method @NonNull @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS) public android.webkit.WebViewProviderInfo[] getValidWebViewPackages(); method @NonNull public android.webkit.WebViewProviderResponse waitForAndGetProvider(); } diff --git a/core/api/system-current.txt b/core/api/system-current.txt index 60dc52b655d69ec6d5753c0950a9dfef3f24d177..9c807afb06a8cf2699cc6f8a1fe1739c8c3cb36a 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -4972,12 +4972,12 @@ package android.hardware.camera2.extension { @FlaggedApi("com.android.internal.camera.flags.concert_mode") public final class CameraOutputSurface { ctor @FlaggedApi("com.android.internal.camera.flags.concert_mode") public CameraOutputSurface(@NonNull android.view.Surface, @NonNull android.util.Size); - method @FlaggedApi("com.android.internal.camera.flags.extension_10_bit") public int getColorSpace(); - method @FlaggedApi("com.android.internal.camera.flags.extension_10_bit") public long getDynamicRangeProfile(); + method public int getColorSpace(); + method public long getDynamicRangeProfile(); method @FlaggedApi("com.android.internal.camera.flags.concert_mode") public int getImageFormat(); method @FlaggedApi("com.android.internal.camera.flags.concert_mode") @NonNull public android.util.Size getSize(); method @FlaggedApi("com.android.internal.camera.flags.concert_mode") @NonNull public android.view.Surface getSurface(); - method @FlaggedApi("com.android.internal.camera.flags.extension_10_bit") public void setDynamicRangeProfile(long); + method public void setDynamicRangeProfile(long); } @FlaggedApi("com.android.internal.camera.flags.concert_mode") public class CharacteristicsMap { @@ -4987,7 +4987,7 @@ package android.hardware.camera2.extension { @FlaggedApi("com.android.internal.camera.flags.concert_mode") public class ExtensionConfiguration { ctor @FlaggedApi("com.android.internal.camera.flags.concert_mode") public ExtensionConfiguration(int, int, @NonNull java.util.List, @Nullable android.hardware.camera2.CaptureRequest); - method @FlaggedApi("com.android.internal.camera.flags.extension_10_bit") public void setColorSpace(int); + method public void setColorSpace(int); } @FlaggedApi("com.android.internal.camera.flags.concert_mode") public class ExtensionOutputConfiguration { @@ -10561,6 +10561,7 @@ package android.nfc.cardemulation { method @FlaggedApi("android.nfc.nfc_observe_mode") public boolean shouldDefaultToObserveMode(); method @FlaggedApi("android.nfc.enable_nfc_mainline") public void writeToParcel(@NonNull android.os.Parcel, int); field @FlaggedApi("android.nfc.enable_nfc_mainline") @NonNull public static final android.os.Parcelable.Creator CREATOR; + field @FlaggedApi("android.permission.flags.wallet_role_icon_property_enabled") public static final String PROPERTY_WALLET_PREFERRED_BANNER_AND_LABEL = "android.nfc.cardemulation.PROPERTY_WALLET_PREFERRED_BANNER_AND_LABEL"; } @FlaggedApi("android.nfc.enable_nfc_mainline") public final class NfcFServiceInfo implements android.os.Parcelable { @@ -18155,9 +18156,17 @@ package android.view { field public static final int DISPLAY_IME_POLICY_LOCAL = 0; // 0x0 } + @FlaggedApi("android.companion.virtualdevice.flags.status_bar_and_insets") public static class WindowManager.InsetsParams { + ctor public WindowManager.InsetsParams(int); + method @Nullable public android.graphics.Insets getInsetsSize(); + method public int getType(); + method @NonNull public android.view.WindowManager.InsetsParams setInsetsSize(@Nullable android.graphics.Insets); + } + public static class WindowManager.LayoutParams extends android.view.ViewGroup.LayoutParams implements android.os.Parcelable { method public final long getUserActivityTimeout(); method public boolean isSystemApplicationOverlay(); + method @FlaggedApi("android.companion.virtualdevice.flags.status_bar_and_insets") public void setInsetsParams(@NonNull java.util.List); method @RequiresPermission(android.Manifest.permission.SYSTEM_APPLICATION_OVERLAY) public void setSystemApplicationOverlay(boolean); method public final void setUserActivityTimeout(long); field @RequiresPermission(android.Manifest.permission.HIDE_NON_SYSTEM_OVERLAY_WINDOWS) public static final int SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS = 524288; // 0x80000 @@ -18760,7 +18769,7 @@ package android.webkit { public final class WebViewUpdateService { method public static android.webkit.WebViewProviderInfo[] getAllWebViewPackages(); method public static String getCurrentWebViewPackageName(); - method public static android.webkit.WebViewProviderInfo[] getValidWebViewPackages(); + method @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS) public static android.webkit.WebViewProviderInfo[] getValidWebViewPackages(); } } diff --git a/core/api/test-current.txt b/core/api/test-current.txt index 4fc70769a3b12e69545e69dedeb0dd13d446a6d0..caf699280e08786d91ef8ad53018a8cef1cc769f 100644 --- a/core/api/test-current.txt +++ b/core/api/test-current.txt @@ -2321,7 +2321,7 @@ package android.os { } public final class BugreportParams { - field @FlaggedApi("android.os.bugreport_mode_max_value") public static final int BUGREPORT_MODE_MAX_VALUE = 7; // 0x7 + field public static final int BUGREPORT_MODE_MAX_VALUE = 7; // 0x7 } public class Build { diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java index b83be6b86d04eedd58c704065c20d4f8b1709837..7273e64846c02a88b18a4d525a26deab95459f98 100644 --- a/core/java/android/app/ActivityManager.java +++ b/core/java/android/app/ActivityManager.java @@ -88,6 +88,7 @@ import android.util.Size; import android.view.WindowInsetsController.Appearance; import android.window.TaskSnapshot; +import com.android.internal.annotations.GuardedBy; import com.android.internal.app.LocalePicker; import com.android.internal.app.procstats.ProcessStats; import com.android.internal.os.RoSystemProperties; @@ -238,6 +239,22 @@ public class ActivityManager { private static final RateLimitingCache> mErrorProcessesCache = new RateLimitingCache<>(10, 2); + /** Rate-Limiting cache that allows no more than 100 calls to the service per second. */ + @GuardedBy("mMemoryInfoCache") + private static final RateLimitingCache mMemoryInfoCache = + new RateLimitingCache<>(10); + /** Used to store cached results for rate-limited calls to getMemoryInfo(). */ + @GuardedBy("mMemoryInfoCache") + private static final MemoryInfo mRateLimitedMemInfo = new MemoryInfo(); + + /** Rate-Limiting cache that allows no more than 200 calls to the service per second. */ + @GuardedBy("mMyMemoryStateCache") + private static final RateLimitingCache mMyMemoryStateCache = + new RateLimitingCache<>(10, 2); + /** Used to store cached results for rate-limited calls to getMyMemoryState(). */ + @GuardedBy("mMyMemoryStateCache") + private static final RunningAppProcessInfo mRateLimitedMemState = new RunningAppProcessInfo(); + /** * Query handler for mGetCurrentUserIdCache - returns a cached value of the current foreground * user id if the backstage_power/android.app.cache_get_current_user_id flag is enabled. @@ -3510,6 +3527,19 @@ public class ActivityManager { foregroundAppThreshold = source.readLong(); } + /** @hide */ + public void copyTo(MemoryInfo other) { + other.advertisedMem = advertisedMem; + other.availMem = availMem; + other.totalMem = totalMem; + other.threshold = threshold; + other.lowMemory = lowMemory; + other.hiddenAppThreshold = hiddenAppThreshold; + other.secondaryServerThreshold = secondaryServerThreshold; + other.visibleAppThreshold = visibleAppThreshold; + other.foregroundAppThreshold = foregroundAppThreshold; + } + public static final @android.annotation.NonNull Creator CREATOR = new Creator() { public MemoryInfo createFromParcel(Parcel source) { @@ -3536,6 +3566,20 @@ public class ActivityManager { * manage its memory. */ public void getMemoryInfo(MemoryInfo outInfo) { + if (Flags.rateLimitGetMemoryInfo()) { + synchronized (mMemoryInfoCache) { + mMemoryInfoCache.get(() -> { + getMemoryInfoInternal(mRateLimitedMemInfo); + return mRateLimitedMemInfo; + }); + mRateLimitedMemInfo.copyTo(outInfo); + } + } else { + getMemoryInfoInternal(outInfo); + } + } + + private void getMemoryInfoInternal(MemoryInfo outInfo) { try { getService().getMemoryInfo(outInfo); } catch (RemoteException e) { @@ -4187,6 +4231,23 @@ public class ActivityManager { lastActivityTime = source.readLong(); } + /** + * Note: only fields that are updated in ProcessList.fillInProcMemInfoLOSP() are copied. + * @hide + */ + public void copyTo(RunningAppProcessInfo other) { + other.pid = pid; + other.uid = uid; + other.flags = flags; + other.lastTrimLevel = lastTrimLevel; + other.importance = importance; + other.lru = lru; + other.importanceReasonCode = importanceReasonCode; + other.processState = processState; + other.isFocused = isFocused; + other.lastActivityTime = lastActivityTime; + } + public static final @android.annotation.NonNull Creator CREATOR = new Creator() { public RunningAppProcessInfo createFromParcel(Parcel source) { @@ -4818,7 +4879,21 @@ public class ActivityManager { * {@link RunningAppProcessInfo#lru}, and * {@link RunningAppProcessInfo#importanceReasonCode}. */ - static public void getMyMemoryState(RunningAppProcessInfo outState) { + public static void getMyMemoryState(RunningAppProcessInfo outState) { + if (Flags.rateLimitGetMyMemoryState()) { + synchronized (mMyMemoryStateCache) { + mMyMemoryStateCache.get(() -> { + getMyMemoryStateInternal(mRateLimitedMemState); + return mRateLimitedMemState; + }); + mRateLimitedMemState.copyTo(outState); + } + } else { + getMyMemoryStateInternal(outState); + } + } + + private static void getMyMemoryStateInternal(RunningAppProcessInfo outState) { try { getService().getMyMemoryState(outState); } catch (RemoteException e) { diff --git a/core/java/android/app/CameraCompatTaskInfo.java b/core/java/android/app/CameraCompatTaskInfo.java index 53eddbee6b032b09cd74f658a07cc9cfa792ec8c..432a0da15a47289f040b04c7ece9be1f8749fcb1 100644 --- a/core/java/android/app/CameraCompatTaskInfo.java +++ b/core/java/android/app/CameraCompatTaskInfo.java @@ -36,20 +36,36 @@ public class CameraCompatTaskInfo implements Parcelable { public static final int CAMERA_COMPAT_FREEFORM_NONE = 0; /** - * The value to use when portrait camera compat treatment should be applied to a windowed task. + * The value to use when camera compat treatment should be applied to an activity requesting + * portrait orientation, while a device is in landscape. Applies only to freeform tasks. */ - public static final int CAMERA_COMPAT_FREEFORM_PORTRAIT = 1; + public static final int CAMERA_COMPAT_FREEFORM_PORTRAIT_DEVICE_IN_LANDSCAPE = 1; /** - * The value to use when landscape camera compat treatment should be applied to a windowed task. + * The value to use when camera compat treatment should be applied to an activity requesting + * landscape orientation, while a device is in landscape. Applies only to freeform tasks. */ - public static final int CAMERA_COMPAT_FREEFORM_LANDSCAPE = 2; + public static final int CAMERA_COMPAT_FREEFORM_LANDSCAPE_DEVICE_IN_LANDSCAPE = 2; + + /** + * The value to use when camera compat treatment should be applied to an activity requesting + * portrait orientation, while a device is in portrait. Applies only to freeform tasks. + */ + public static final int CAMERA_COMPAT_FREEFORM_PORTRAIT_DEVICE_IN_PORTRAIT = 3; + + /** + * The value to use when camera compat treatment should be applied to an activity requesting + * landscape orientation, while a device is in portrait. Applies only to freeform tasks. + */ + public static final int CAMERA_COMPAT_FREEFORM_LANDSCAPE_DEVICE_IN_PORTRAIT = 4; @Retention(RetentionPolicy.SOURCE) @IntDef(prefix = { "CAMERA_COMPAT_FREEFORM_" }, value = { CAMERA_COMPAT_FREEFORM_NONE, - CAMERA_COMPAT_FREEFORM_PORTRAIT, - CAMERA_COMPAT_FREEFORM_LANDSCAPE, + CAMERA_COMPAT_FREEFORM_PORTRAIT_DEVICE_IN_LANDSCAPE, + CAMERA_COMPAT_FREEFORM_LANDSCAPE_DEVICE_IN_LANDSCAPE, + CAMERA_COMPAT_FREEFORM_PORTRAIT_DEVICE_IN_PORTRAIT, + CAMERA_COMPAT_FREEFORM_LANDSCAPE_DEVICE_IN_PORTRAIT, }) public @interface FreeformCameraCompatMode {} @@ -143,8 +159,14 @@ public class CameraCompatTaskInfo implements Parcelable { @FreeformCameraCompatMode int freeformCameraCompatMode) { return switch (freeformCameraCompatMode) { case CAMERA_COMPAT_FREEFORM_NONE -> "inactive"; - case CAMERA_COMPAT_FREEFORM_PORTRAIT -> "portrait"; - case CAMERA_COMPAT_FREEFORM_LANDSCAPE -> "landscape"; + case CAMERA_COMPAT_FREEFORM_PORTRAIT_DEVICE_IN_LANDSCAPE -> + "app-portrait-device-landscape"; + case CAMERA_COMPAT_FREEFORM_LANDSCAPE_DEVICE_IN_LANDSCAPE -> + "app-landscape-device-landscape"; + case CAMERA_COMPAT_FREEFORM_PORTRAIT_DEVICE_IN_PORTRAIT -> + "app-portrait-device-portrait"; + case CAMERA_COMPAT_FREEFORM_LANDSCAPE_DEVICE_IN_PORTRAIT -> + "app-landscape-device-portrait"; default -> throw new AssertionError( "Unexpected camera compat mode: " + freeformCameraCompatMode); }; diff --git a/core/java/android/app/Instrumentation.java b/core/java/android/app/Instrumentation.java index 45852c7d338a91f91d6715bacdebb13a0c571db8..93a9489849affb36d4933e495de2892d3a093ae0 100644 --- a/core/java/android/app/Instrumentation.java +++ b/core/java/android/app/Instrumentation.java @@ -2408,9 +2408,9 @@ public class Instrumentation { * @hide */ @android.ravenwood.annotation.RavenwoodKeep - public final void basicInit(Context context) { - mInstrContext = context; - mAppContext = context; + public final void basicInit(Context instrContext, Context appContext) { + mInstrContext = instrContext; + mAppContext = appContext; } /** @hide */ diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java index 7a36fbb55dc42c1bdc3f97b5bd9614183fd424b5..81d2c890ee31ed9ac66567ede6ac1cf504c23b7a 100644 --- a/core/java/android/app/Notification.java +++ b/core/java/android/app/Notification.java @@ -1280,6 +1280,15 @@ public class Notification implements Parcelable */ public static final String EXTRA_BIG_TEXT = "android.bigText"; + /** + * {@link #extras} key: very short text summarizing the most critical information contained in + * the notification. + * + * @hide + */ + @FlaggedApi(Flags.FLAG_API_RICH_ONGOING) + public static final String EXTRA_SHORT_CRITICAL_TEXT = "android.shortCriticalText"; + /** * {@link #extras} key: this is the resource ID of the notification's main small icon, as * supplied to {@link Builder#setSmallIcon(int)}. @@ -4050,6 +4059,17 @@ public class Notification implements Parcelable return String.join("|", defaultStrings); } + + /** + * Returns the very short text summarizing the most critical information contained in the + * notification, or null if this field was not set. + */ + @Nullable + @FlaggedApi(Flags.FLAG_API_RICH_ONGOING) + public String getShortCriticalText() { + return extras.getString(EXTRA_SHORT_CRITICAL_TEXT); + } + /** * @hide */ @@ -4990,6 +5010,18 @@ public class Notification implements Parcelable return this; } + /** + * Sets a very short string summarizing the most critical information contained in the + * notification. Suggested max length is 5 characters, and there is no guarantee how much or + * how little of this text will be shown. + */ + @FlaggedApi(Flags.FLAG_API_RICH_ONGOING) + @NonNull + public Builder setShortCriticalText(@Nullable String shortCriticalText) { + mN.extras.putString(EXTRA_SHORT_CRITICAL_TEXT, shortCriticalText); + return this; + } + /** * Set the progress this notification represents. * diff --git a/core/java/android/app/NotificationChannel.java b/core/java/android/app/NotificationChannel.java index 1b29b7a294df54cc19d9ba73b28d62ecb649a89a..4a2b016456f7af7a3dfe51db05656d4054100abd 100644 --- a/core/java/android/app/NotificationChannel.java +++ b/core/java/android/app/NotificationChannel.java @@ -55,7 +55,9 @@ import java.io.IOException; import java.io.PrintWriter; import java.io.StringReader; import java.io.StringWriter; +import java.util.ArrayList; import java.util.Arrays; +import java.util.List; import java.util.Objects; /** @@ -100,6 +102,11 @@ public final class NotificationChannel implements Parcelable { @FlaggedApi(android.service.notification.Flags.FLAG_NOTIFICATION_CLASSIFICATION) public static final String RECS_ID = "android.app.recs"; + /** @hide */ + @FlaggedApi(android.service.notification.Flags.FLAG_NOTIFICATION_CLASSIFICATION) + public static final ArrayList SYSTEM_RESERVED_IDS = new ArrayList<>( + List.of(NEWS_ID, SOCIAL_MEDIA_ID, PROMOTIONS_ID, RECS_ID)); + /** * The formatter used by the system to create an id for notification * channels when it automatically creates conversation channels on behalf of an app. The format @@ -761,14 +768,22 @@ public final class NotificationChannel implements Parcelable { this.mVibrationEnabled = effect != null; this.mVibrationEffect = effect; if (Flags.notifChannelCropVibrationEffects() && effect != null) { - // Try converting to a vibration pattern and trimming that array. If not convertible - // to a pattern directly, try trimming the vibration effect if possible and storing - // that version instead. long[] pattern = effect.computeCreateWaveformOffOnTimingsOrNull(); if (pattern != null) { - setVibrationPattern(pattern); + // If this effect has an equivalent pattern, AND the pattern needs to be truncated + // due to being too long, we delegate to setVibrationPattern to re-generate the + // effect as well. Otherwise, we use the effect (already set above) and converted + // pattern directly. + if (pattern.length > MAX_VIBRATION_LENGTH) { + setVibrationPattern(pattern); + } else { + this.mVibrationPattern = pattern; + } } else { + // If not convertible to a pattern directly, try trimming the vibration effect if + // possible and storing that version instead. this.mVibrationEffect = getTrimmedVibrationEffect(mVibrationEffect); + this.mVibrationPattern = null; } } else { this.mVibrationPattern = diff --git a/core/java/android/app/SystemServiceRegistry.java b/core/java/android/app/SystemServiceRegistry.java index e44e7768724efd57306159b074fbb0e503bde80b..337939fd2388cca1ed688ae5172d97f7e73f174c 100644 --- a/core/java/android/app/SystemServiceRegistry.java +++ b/core/java/android/app/SystemServiceRegistry.java @@ -104,6 +104,7 @@ import android.debug.IAdbManager; import android.devicelock.DeviceLockFrameworkInitializer; import android.graphics.fonts.FontManager; import android.hardware.ConsumerIrManager; +import android.hardware.ISensorPrivacyManager; import android.hardware.ISerialManager; import android.hardware.SensorManager; import android.hardware.SensorPrivacyManager; @@ -592,6 +593,11 @@ public final class SystemServiceRegistry { @Override public TextServicesManager createService(ContextImpl ctx) throws ServiceNotFoundException { + if (ctx.getPackageManager().hasSystemFeature(PackageManager.FEATURE_WATCH) + && ServiceManager.getService(Context.TEXT_SERVICES_MANAGER_SERVICE) == null + && android.server.Flags.removeTextService()) { + return null; + } return TextServicesManager.createInstance(ctx); }}); @@ -707,8 +713,12 @@ public final class SystemServiceRegistry { registerService(Context.SENSOR_PRIVACY_SERVICE, SensorPrivacyManager.class, new CachedServiceFetcher() { @Override - public SensorPrivacyManager createService(ContextImpl ctx) { - return SensorPrivacyManager.getInstance(ctx); + public SensorPrivacyManager createService(ContextImpl ctx) + throws ServiceNotFoundException { + IBinder b = ServiceManager.getServiceOrThrow( + Context.SENSOR_PRIVACY_SERVICE); + return SensorPrivacyManager.getInstance( + ctx, ISensorPrivacyManager.Stub.asInterface(b)); }}); registerService(Context.STATUS_BAR_SERVICE, StatusBarManager.class, @@ -1882,6 +1892,12 @@ public final class SystemServiceRegistry { return null; } break; + case Context.TEXT_SERVICES_MANAGER_SERVICE: + if (android.server.Flags.removeTextService() + && hasSystemFeatureOpportunistic(ctx, PackageManager.FEATURE_WATCH)) { + return null; + } + break; } Slog.wtf(TAG, "Manager wrapper not available: " + name); return null; diff --git a/core/java/android/app/activity_manager.aconfig b/core/java/android/app/activity_manager.aconfig index 4d61f418af10eee24a7a341cadc20e087d4ef046..38bd576d607a18a4adaf0b54bcca5b09de7a902c 100644 --- a/core/java/android/app/activity_manager.aconfig +++ b/core/java/android/app/activity_manager.aconfig @@ -125,3 +125,25 @@ flag { purpose: PURPOSE_BUGFIX } } + +flag { + namespace: "backstage_power" + name: "rate_limit_get_memory_info" + description: "Rate limit calls to getMemoryInfo using a cache" + is_fixed_read_only: true + bug: "364312431" + metadata { + purpose: PURPOSE_BUGFIX + } +} + +flag { + namespace: "backstage_power" + name: "rate_limit_get_my_memory_state" + description: "Rate limit calls to getMyMemoryState using a cache" + is_fixed_read_only: true + bug: "365182205" + metadata { + purpose: PURPOSE_BUGFIX + } +} diff --git a/core/java/android/app/admin/DeviceAdminReceiver.java b/core/java/android/app/admin/DeviceAdminReceiver.java index c7b0be7553c2c4c3ef61c3a60e87fb2c525b3276..46567c4401110622be28c6d1b6324f791a038c54 100644 --- a/core/java/android/app/admin/DeviceAdminReceiver.java +++ b/core/java/android/app/admin/DeviceAdminReceiver.java @@ -1107,7 +1107,7 @@ public class DeviceAdminReceiver extends BroadcastReceiver { /** * Called to notify the state of operations that can be unsafe to execute has changed. * - *

Note:/b> notice that the operation safety state might change between the time this + *

Note: notice that the operation safety state might change between the time this * callback is received and the operation's method on {@link DevicePolicyManager} is called, so * calls to the latter could still throw a {@link UnsafeStateException} even when this method * is called with {@code isSafe} as {@code true} diff --git a/core/java/android/app/admin/flags/flags.aconfig b/core/java/android/app/admin/flags/flags.aconfig index 8e08a95dad704b0c2b5d07ec76b9b383e68ef1d8..081dfe60d28c13f910fc0ea2694543219857ddbb 100644 --- a/core/java/android/app/admin/flags/flags.aconfig +++ b/core/java/android/app/admin/flags/flags.aconfig @@ -151,6 +151,16 @@ flag { bug: "323001115" } +flag { + name: "fix_race_condition_in_tie_profile_lock" + namespace: "enterprise" + description: "Fix race condition in tieProfileLockIfNecessary()" + bug: "355905501" + metadata { + purpose: PURPOSE_BUGFIX + } +} + flag { name: "quiet_mode_credential_bug_fix" namespace: "enterprise" diff --git a/core/java/android/app/appfunctions/AppFunctionRuntimeMetadata.java b/core/java/android/app/appfunctions/AppFunctionRuntimeMetadata.java index c4bfae98e33d70204d83ba22b3de33b9bf7fb531..f5c5a11f45fbcb03d693b347193d7933a6b9e8e0 100644 --- a/core/java/android/app/appfunctions/AppFunctionRuntimeMetadata.java +++ b/core/java/android/app/appfunctions/AppFunctionRuntimeMetadata.java @@ -61,6 +61,20 @@ public class AppFunctionRuntimeMetadata extends GenericDocument { return RUNTIME_SCHEMA_TYPE + RUNTIME_SCHEMA_TYPE_SEPARATOR + Objects.requireNonNull(pkg); } + /** Returns the package name from the runtime metadata schema name. */ + @NonNull + public static String getPackageNameFromSchema(String metadataSchemaType) { + String[] split = metadataSchemaType.split(RUNTIME_SCHEMA_TYPE_SEPARATOR); + if (split.length > 2) { + throw new IllegalArgumentException( + "Invalid schema type: " + metadataSchemaType + " for app function runtime"); + } + if (split.length < 2) { + return APP_FUNCTION_INDEXER_PACKAGE; + } + return split[1]; + } + /** Returns the document id for an app function's runtime metadata. */ public static String getDocumentIdForAppFunction( @NonNull String pkg, @NonNull String functionId) { diff --git a/core/java/android/app/appfunctions/AppFunctionStaticMetadataHelper.java b/core/java/android/app/appfunctions/AppFunctionStaticMetadataHelper.java index 926cc9a3642c7edeb206d0106771391502fb34a4..a23f842e6eeb18974fdf68d53b0d481041aa190d 100644 --- a/core/java/android/app/appfunctions/AppFunctionStaticMetadataHelper.java +++ b/core/java/android/app/appfunctions/AppFunctionStaticMetadataHelper.java @@ -37,8 +37,12 @@ import java.util.Objects; public class AppFunctionStaticMetadataHelper { public static final String STATIC_SCHEMA_TYPE = "AppFunctionStaticMetadata"; public static final String STATIC_PROPERTY_ENABLED_BY_DEFAULT = "enabledByDefault"; + public static final String STATIC_PROPERTY_RESTRICT_CALLERS_WITH_EXECUTE_APP_FUNCTIONS = + "restrictCallersWithExecuteAppFunctions"; public static final String APP_FUNCTION_STATIC_NAMESPACE = "app_functions"; + public static final String PROPERTY_FUNCTION_ID = "functionId"; + public static final String PROPERTY_PACKAGE_NAME = "packageName"; // These are constants that has to be kept the same with {@code // com.android.server.appsearch.appsindexer.appsearchtypes.AppSearchHelper}. diff --git a/core/java/android/app/jank/flags.aconfig b/core/java/android/app/jank/flags.aconfig new file mode 100644 index 0000000000000000000000000000000000000000..5657f7ee5194263ec8a9ea37843cb0a476becf35 --- /dev/null +++ b/core/java/android/app/jank/flags.aconfig @@ -0,0 +1,16 @@ +package: "android.app.jank" +container: "system" + +flag { + name: "detailed_app_jank_metrics_api" + namespace: "system_performance" + description: "Control the API portion of Detailed Application Jank Metrics" + bug: "366264614" +} + +flag { + name: "detailed_app_jank_metrics_logging_enabled" + namespace: "system_performance" + description: "Controls whether the system will log frame metrics related to app jank" + bug: "366265225" +} \ No newline at end of file diff --git a/core/java/android/companion/virtual/flags/flags.aconfig b/core/java/android/companion/virtual/flags/flags.aconfig index 748260bc8d5fd85f09eb5a433cb6e8ce8fae918f..e9fa3e15fe0502bb3ff0ffd34c478f437c2b8a3a 100644 --- a/core/java/android/companion/virtual/flags/flags.aconfig +++ b/core/java/android/companion/virtual/flags/flags.aconfig @@ -43,6 +43,7 @@ flag { name: "virtual_display_insets" description: "APIs for specifying virtual display insets (via cutout)" bug: "350007135" + is_exported: true } flag { @@ -88,6 +89,7 @@ flag { name: "virtual_display_rotation_api" description: "API for on-demand rotation of virtual displays" bug: "291748430" + is_exported: true } flag { @@ -110,6 +112,7 @@ flag { name: "device_aware_display_power" description: "Device awareness in power and display APIs" bug: "285020111" + is_exported: true } flag { @@ -125,4 +128,12 @@ flag { namespace: "virtual_devices" description: "Allow for status bar and insets on virtual devices" bug: "350007866" + is_exported: true +} + +flag { + namespace: "virtual_devices" + name: "camera_timestamp_from_surface" + description: "Pass the surface timestamp to the capture result" + bug: "351341245" } diff --git a/core/java/android/content/UriRelativeFilterGroup.java b/core/java/android/content/UriRelativeFilterGroup.java index 0e49b4fe427a2c984c231c5c9860323592dfb13d..07aeb26216b15c970af244940607e9016bdf61fe 100644 --- a/core/java/android/content/UriRelativeFilterGroup.java +++ b/core/java/android/content/UriRelativeFilterGroup.java @@ -63,6 +63,7 @@ import java.util.Objects; */ @FlaggedApi(Flags.FLAG_RELATIVE_REFERENCE_INTENT_FILTERS) public final class UriRelativeFilterGroup { + private static final String TAG = "UriRelativeFilterGroup"; private static final String ALLOW_STR = "allow"; private static final String URI_RELATIVE_FILTER_GROUP_STR = "uriRelativeFilterGroup"; @@ -233,9 +234,16 @@ public final class UriRelativeFilterGroup { final int n = mUriRelativeFilters.size(); if (n > 0) { dest.writeInt(n); + int i = 0; Iterator it = mUriRelativeFilters.iterator(); while (it.hasNext()) { it.next().writeToParcel(dest, flags); + i++; + } + if (i != n) { + Log.e(TAG, "UriRelativeFilters was unexpectedly" + + " modified while writing to parcel. Expected " + + n + " but found " + i + " filters", new Exception()); } } else { dest.writeInt(0); diff --git a/core/java/android/content/pm/LauncherActivityInfo.java b/core/java/android/content/pm/LauncherActivityInfo.java index cb3455b266cd7665cb2d75e4a9ebf24f22e4cbb0..bb91a37825e65628a36cf21f27f03d4833e64c60 100644 --- a/core/java/android/content/pm/LauncherActivityInfo.java +++ b/core/java/android/content/pm/LauncherActivityInfo.java @@ -43,9 +43,11 @@ public class LauncherActivityInfo { private final PackageManager mPm; private final LauncherActivityInfoInternal mInternal; - private static final UnicodeSet TRIMMABLE_CHARACTERS = + private static final UnicodeSet INVISIBLE_CHARACTERS = new UnicodeSet("[[:White_Space:][:Default_Ignorable_Code_Point:][:gc=Cc:]]", /* ignoreWhitespace= */ false).freeze(); + // Only allow 3 consecutive invisible characters in the prefix of the string. + private static final int PREFIX_CONSECUTIVE_INVISIBLE_CHARACTERS_MAXIMUM = 3; /** * Create a launchable activity object for a given ResolveInfo and user. @@ -93,17 +95,21 @@ public class LauncherActivityInfo { return getActivityInfo().loadLabel(mPm); } - CharSequence label = trim(getActivityInfo().loadLabel(mPm)); - // If the trimmed label is empty, use application's label instead - if (TextUtils.isEmpty(label)) { - label = trim(getApplicationInfo().loadLabel(mPm)); - // If the trimmed label is still empty, use package name instead - if (TextUtils.isEmpty(label)) { - label = getComponentName().getPackageName(); - } + CharSequence label = getActivityInfo().loadLabel(mPm).toString().trim(); + // If the activity label is visible to the user, return the original activity label + if (isVisible(label)) { + return label; } - // TODO: Go through LauncherAppsService - return label; + + // Use application label instead + label = getApplicationInfo().loadLabel(mPm).toString().trim(); + // If the application label is visible to the user, return the original application label + if (isVisible(label)) { + return label; + } + + // Use package name instead + return getComponentName().getPackageName(); } /** @@ -207,147 +213,75 @@ public class LauncherActivityInfo { } /** - * If the {@code ch} is trimmable, return {@code true}. Otherwise, return - * {@code false}. If the count of the code points of {@code ch} doesn't - * equal 1, return {@code false}. + * Check whether the {@code sequence} is visible to the user or not. + *

+ * Return {@code false} when one of these conditions are satisfied: + * 1. The {@code sequence} starts with at least consecutive three invisible characters. + * 2. The sequence is composed of the invisible characters and non-glyph characters. *

- * There are two types of the trimmable characters. - * 1. The character is one of the Default_Ignorable_Code_Point in + * Invisible character is one of the Default_Ignorable_Code_Point in * * DerivedCoreProperties.txt, the White_Space in PropList.txt * or category Cc. *

- * 2. The character is not supported in the current system font. + * Non-glyph character means the character is not supported in the current system font. * {@link android.graphics.Paint#hasGlyph(String)} *

* - */ - private static boolean isTrimmable(@NonNull Paint paint, @NonNull CharSequence ch) { - Objects.requireNonNull(paint); - Objects.requireNonNull(ch); - - // if ch is empty or it is not a character (i,e, the count of code - // point doesn't equal one), return false - if (TextUtils.isEmpty(ch) - || Character.codePointCount(ch, /* beginIndex= */ 0, ch.length()) != 1) { - return false; - } - - // Return true for the cases as below: - // 1. The character is in the TRIMMABLE_CHARACTERS set - // 2. The character is not supported in the system font - return TRIMMABLE_CHARACTERS.contains(ch) || !paint.hasGlyph(ch.toString()); - } - - /** - * If the {@code sequence} has some leading trimmable characters, creates a new copy - * and removes the trimmable characters from the copy. Otherwise the given - * {@code sequence} is returned as it is. Use {@link #isTrimmable(Paint, CharSequence)} - * to determine whether the character is trimmable or not. - * - * @return the trimmed string or the original string that has no - * leading trimmable characters. - * @see #isTrimmable(Paint, CharSequence) - * @see #trim(CharSequence) - * @see #trimEnd(CharSequence) - * * @hide */ @VisibleForTesting - @NonNull - public static CharSequence trimStart(@NonNull CharSequence sequence) { + public static boolean isVisible(@NonNull CharSequence sequence) { Objects.requireNonNull(sequence); - if (TextUtils.isEmpty(sequence)) { - return sequence; + return false; } final Paint paint = new Paint(); - int trimCount = 0; + int invisibleCharCount = 0; + int notSupportedCharCount = 0; final int[] codePoints = sequence.codePoints().toArray(); for (int i = 0, length = codePoints.length; i < length; i++) { String ch = new String(new int[]{codePoints[i]}, /* offset= */ 0, /* count= */ 1); - if (!isTrimmable(paint, ch)) { - break; - } - trimCount += ch.length(); - } - if (trimCount == 0) { - return sequence; - } - return sequence.subSequence(trimCount, sequence.length()); - } - /** - * If the {@code sequence} has some trailing trimmable characters, creates a new copy - * and removes the trimmable characters from the copy. Otherwise the given - * {@code sequence} is returned as it is. Use {@link #isTrimmable(Paint, CharSequence)} - * to determine whether the character is trimmable or not. - * - * @return the trimmed sequence or the original sequence that has no - * trailing trimmable characters. - * @see #isTrimmable(Paint, CharSequence) - * @see #trimStart(CharSequence) - * @see #trim(CharSequence) - * - * @hide - */ - @VisibleForTesting - @NonNull - public static CharSequence trimEnd(@NonNull CharSequence sequence) { - Objects.requireNonNull(sequence); - - if (TextUtils.isEmpty(sequence)) { - return sequence; - } - - final Paint paint = new Paint(); - int trimCount = 0; - final int[] codePoints = sequence.codePoints().toArray(); - for (int i = codePoints.length - 1; i >= 0; i--) { - String ch = new String(new int[]{codePoints[i]}, /* offset= */ 0, /* count= */ 1); - if (!isTrimmable(paint, ch)) { - break; + // The check steps: + // 1. If the character is contained in INVISIBLE_CHARACTERS, invisibleCharCount++. + // 1.1 Check whether the invisibleCharCount is larger or equal to + // PREFIX_INVISIBLE_CHARACTERS_MAXIMUM when notSupportedCharCount is zero. + // It means that there are three consecutive invisible characters at the + // start of the string, return false. + // Otherwise, continue. + // 2. If the character is not supported on the system: + // notSupportedCharCount++, continue + // 3. If it does not continue or return on the above two cases, it means the + // character is visible and supported on the system, break. + // After going through the whole string, if the sum of invisibleCharCount + // and notSupportedCharCount is smaller than the length of the string, it + // means the string has the other visible characters, return true. + // Otherwise, return false. + if (INVISIBLE_CHARACTERS.contains(ch)) { + invisibleCharCount++; + // If there are three successive invisible characters at the start of the + // string, it is hard to visible to the user. + if (notSupportedCharCount == 0 + && invisibleCharCount >= PREFIX_CONSECUTIVE_INVISIBLE_CHARACTERS_MAXIMUM) { + return false; + } + continue; } - trimCount += ch.length(); - } - - if (trimCount == 0) { - return sequence; - } - return sequence.subSequence(0, sequence.length() - trimCount); - } - /** - * If the {@code sequence} has some leading or trailing trimmable characters, creates - * a new copy and removes the trimmable characters from the copy. Otherwise the given - * {@code sequence} is returned as it is. Use {@link #isTrimmable(Paint, CharSequence)} - * to determine whether the character is trimmable or not. - * - * @return the trimmed sequence or the original sequence that has no leading or - * trailing trimmable characters. - * @see #isTrimmable(Paint, CharSequence) - * @see #trimStart(CharSequence) - * @see #trimEnd(CharSequence) - * - * @hide - */ - @VisibleForTesting - @NonNull - public static CharSequence trim(@NonNull CharSequence sequence) { - Objects.requireNonNull(sequence); - - if (TextUtils.isEmpty(sequence)) { - return sequence; - } - - CharSequence result = trimStart(sequence); - if (TextUtils.isEmpty(result)) { - return result; + // The character is not supported on the system, but it may not be an invisible + // character. E.g. tofu (a rectangle). + if (!paint.hasGlyph(ch)) { + notSupportedCharCount++; + continue; + } + // The character is visible and supported on the system, break the for loop + break; } - return trimEnd(result); + return (invisibleCharCount + notSupportedCharCount < codePoints.length); } } diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java index 8c56a9d443ab1960db6b97aaf1039fcc44f4bdd9..fb2655c771c4035b03af5c33a87ce4a8981981d4 100644 --- a/core/java/android/content/pm/PackageManager.java +++ b/core/java/android/content/pm/PackageManager.java @@ -8842,11 +8842,14 @@ public abstract class PackageManager { try { ParsedPackage pp = parser2.parsePackage(apkFile, parserFlags, false); + pp.hideAsFinal(); return PackageInfoCommonUtils.generate(pp, flagsBits, UserHandle.myUserId()); } catch (PackageParserException e) { Log.w(TAG, "Failure to parse package archive apkFile= " +apkFile); return null; + } finally { + parser2.close(); } } diff --git a/core/java/android/content/pm/flags.aconfig b/core/java/android/content/pm/flags.aconfig index 7c2edd7bbc1762939f07de31a1a02261d6141ee3..139ff65b4d86130d3ab81b803162a6d9fc83ef49 100644 --- a/core/java/android/content/pm/flags.aconfig +++ b/core/java/android/content/pm/flags.aconfig @@ -285,4 +285,12 @@ flag { namespace: "package_manager_service" description: "Feature flag to enable the feature to retrieve package info without installation with a file descriptor." bug: "340879905" +} + +flag { + name: "get_packages_from_launcher_apps" + namespace: "package_manager_service" + description: "Feature flag to provide the new methods within launcher apps class to get packages." + bug: "363324203" + is_fixed_read_only: true } \ No newline at end of file diff --git a/core/java/android/database/sqlite/SQLiteClosable.java b/core/java/android/database/sqlite/SQLiteClosable.java index 8eb512a2cbc6e687867d2b93861b416a431cacd8..806c386bf9a75b36797397d598768741caa64dc7 100644 --- a/core/java/android/database/sqlite/SQLiteClosable.java +++ b/core/java/android/database/sqlite/SQLiteClosable.java @@ -30,6 +30,20 @@ public abstract class SQLiteClosable implements Closeable { @UnsupportedAppUsage private int mReferenceCount = 1; + /** + * True if the instance should record when it was closed. Tracking closure can be expensive, + * so it is best reserved for subclasses that have long lifetimes. + * @hide + */ + protected boolean mTrackClosure = false; + + /** + * The caller that finally released this instance. If this is not null, it is supplied as the + * cause to the IllegalStateException that is thrown when the object is reopened. Subclasses + * are responsible for populating this field, if they wish to use it. + */ + private Throwable mClosedBy = null; + /** * Called when the last reference to the object was released by * a call to {@link #releaseReference()} or {@link #close()}. @@ -57,7 +71,7 @@ public abstract class SQLiteClosable implements Closeable { synchronized(this) { if (mReferenceCount <= 0) { throw new IllegalStateException( - "attempt to re-open an already-closed object: " + this); + "attempt to re-open an already-closed object: " + this, mClosedBy); } mReferenceCount++; } @@ -108,5 +122,11 @@ public abstract class SQLiteClosable implements Closeable { */ public void close() { releaseReference(); + synchronized (this) { + if (mTrackClosure && (mClosedBy == null)) { + String name = getClass().getName(); + mClosedBy = new Exception("closed by " + name + ".close()").fillInStackTrace(); + } + } } } diff --git a/core/java/android/database/sqlite/SQLiteConnectionPool.java b/core/java/android/database/sqlite/SQLiteConnectionPool.java index 15d7d6675c8e2ccb2df89a717169d4634bea8e0d..505905f5aa16ca2a67a66cf36a5eb0248987a79d 100644 --- a/core/java/android/database/sqlite/SQLiteConnectionPool.java +++ b/core/java/android/database/sqlite/SQLiteConnectionPool.java @@ -96,6 +96,10 @@ public final class SQLiteConnectionPool implements Closeable { private boolean mIsOpen; private int mNextConnectionId; + // Record the caller that explicitly closed the database. + @GuardedBy("mLock") + private Throwable mClosedBy; + private ConnectionWaiter mConnectionWaiterPool; private ConnectionWaiter mConnectionWaiterQueue; @@ -265,6 +269,7 @@ public final class SQLiteConnectionPool implements Closeable { throwIfClosedLocked(); mIsOpen = false; + mClosedBy = new Exception("SQLiteConnectionPool.close()").fillInStackTrace(); closeAvailableConnectionsAndLogExceptionsLocked(); @@ -1101,7 +1106,7 @@ public final class SQLiteConnectionPool implements Closeable { private void throwIfClosedLocked() { if (!mIsOpen) { throw new IllegalStateException("Cannot perform this operation " - + "because the connection pool has been closed."); + + "because the connection pool has been closed.", mClosedBy); } } diff --git a/core/java/android/database/sqlite/SQLiteDatabase.java b/core/java/android/database/sqlite/SQLiteDatabase.java index f54be00c9e69e2811603595bc0cd95539943c551..8bff624451e75e98a472be969346330c689e10b3 100644 --- a/core/java/android/database/sqlite/SQLiteDatabase.java +++ b/core/java/android/database/sqlite/SQLiteDatabase.java @@ -236,15 +236,21 @@ public final class SQLiteDatabase extends SQLiteClosable { * * {@more} Note that the value of this flag is 0, so it is the default. */ - public static final int OPEN_READWRITE = 0x00000000; // update native code if changing + // LINT.IfChange + public static final int OPEN_READWRITE = 0x00000000; + // LINT.ThenChange(/core/jni/android_database_SQLiteConnection.cpp) /** * Open flag: Flag for {@link #openDatabase} to open the database for reading only. * This is the only reliable way to open a database if the disk may be full. */ - public static final int OPEN_READONLY = 0x00000001; // update native code if changing + // LINT.IfChange + public static final int OPEN_READONLY = 0x00000001; + // LINT.ThenChange(/core/jni/android_database_SQLiteConnection.cpp) - private static final int OPEN_READ_MASK = 0x00000001; // update native code if changing + // LINT.IfChange + private static final int OPEN_READ_MASK = 0x00000001; + // LINT.ThenChange(/core/jni/android_database_SQLiteConnection.cpp) /** * Open flag: Flag for {@link #openDatabase} to open the database without support for @@ -254,13 +260,31 @@ public final class SQLiteDatabase extends SQLiteClosable { * You must be consistent when using this flag to use the setting the database was * created with. If this is set, {@link #setLocale} will do nothing. */ - public static final int NO_LOCALIZED_COLLATORS = 0x00000010; // update native code if changing + // LINT.IfChange + public static final int NO_LOCALIZED_COLLATORS = 0x00000010; + // LINT.ThenChange(/core/jni/android_database_SQLiteConnection.cpp) + + /** + * Open flag: Flag for {@link #openDatabase} to open a database, disallowing double-quoted + * strings. + * + * This causes sqlite to reject SQL statements with double-quoted string literals. String + * literals must be enclosed in single quotes; double-quotes are reserved for identifiers like + * column names. + * See https://www.sqlite.org/quirks.html#double_quoted_string_literals_are_accepted + * @hide + */ + // LINT.IfChange + public static final int NO_DOUBLE_QUOTED_STRS = 0x00000020; + // LINT.ThenChange(/core/jni/android_database_SQLiteConnection.cpp) /** * Open flag: Flag for {@link #openDatabase} to create the database file if it does not * already exist. */ - public static final int CREATE_IF_NECESSARY = 0x10000000; // update native code if changing + // LINT.IfChange + public static final int CREATE_IF_NECESSARY = 0x10000000; + // LINT.ThenChange(/core/jni/android_database_SQLiteConnection.cpp) /** * Open flag: Flag for {@link #openDatabase} to open the database file with @@ -464,6 +488,7 @@ public final class SQLiteDatabase extends SQLiteClosable { @Nullable CursorFactory cursorFactory, @Nullable DatabaseErrorHandler errorHandler, int lookasideSlotSize, int lookasideSlotCount, long idleConnectionTimeoutMs, @Nullable String journalMode, @Nullable String syncMode) { + mTrackClosure = true; mCursorFactory = cursorFactory; mErrorHandler = errorHandler != null ? errorHandler : new DefaultDatabaseErrorHandler(); mConfigurationLocked = new SQLiteDatabaseConfiguration(path, openFlags); @@ -490,6 +515,9 @@ public final class SQLiteDatabase extends SQLiteClosable { if (SQLiteCompatibilityWalFlags.isLegacyCompatibilityWalEnabled()) { mConfigurationLocked.openFlags |= ENABLE_LEGACY_COMPATIBILITY_WAL; } + if (SQLiteDebug.NoPreloadHolder.NO_DOUBLE_QUOTED_STRS) { + mConfigurationLocked.openFlags |= NO_DOUBLE_QUOTED_STRS; + } mConfigurationLocked.journalMode = journalMode; mConfigurationLocked.syncMode = syncMode; } @@ -3275,6 +3303,7 @@ public final class SQLiteDatabase extends SQLiteClosable { OPEN_READONLY, CREATE_IF_NECESSARY, NO_LOCALIZED_COLLATORS, + NO_DOUBLE_QUOTED_STRS, ENABLE_WRITE_AHEAD_LOGGING }) @Retention(RetentionPolicy.SOURCE) diff --git a/core/java/android/database/sqlite/SQLiteDebug.java b/core/java/android/database/sqlite/SQLiteDebug.java index 93d74b1fbdff5b5ce9b2211fc51746dcba668408..b648e053eea0d9c3b26c8df543df94c1791b68b0 100644 --- a/core/java/android/database/sqlite/SQLiteDebug.java +++ b/core/java/android/database/sqlite/SQLiteDebug.java @@ -66,7 +66,6 @@ public final class SQLiteDebug { public static final boolean DEBUG_SQL_TIME = Log.isLoggable("SQLiteTime", Log.VERBOSE); - /** * True to enable database performance testing instrumentation. */ @@ -83,6 +82,15 @@ public final class SQLiteDebug { */ public static final boolean DEBUG_LOG_DETAILED = Build.IS_DEBUGGABLE && SystemProperties.getBoolean("db.log.detailed", false); + + /** + * Whether to accept double-quoted strings in SQL statements. Double-quoted strings are a + * syntax error but are accepted by sqlite in compatibility mode (the default). If the + * property is set to true, double-quoted strings will be treated by sqlite as a syntax + * error. + */ + public static final boolean NO_DOUBLE_QUOTED_STRS = + SystemProperties.getBoolean("debug.sqlite.no_double_quoted_strs", false); } private SQLiteDebug() { diff --git a/core/java/android/hardware/SensorPrivacyManager.java b/core/java/android/hardware/SensorPrivacyManager.java index 4cdaaddd05bf1db3d23b6d2e0c9f13c61e8e246e..a4c0e87c965b8dfe6a07a3112911472571c3b2f1 100644 --- a/core/java/android/hardware/SensorPrivacyManager.java +++ b/core/java/android/hardware/SensorPrivacyManager.java @@ -797,7 +797,7 @@ public final class SensorPrivacyManager { public void setSensorPrivacy(@Sensors.Sensor int sensor, boolean enable) { setSensorPrivacy(resolveSourceFromCurrentContext(), sensor, enable, - UserHandle.USER_CURRENT); + mContext.getUserId()); } private @Sources.Source int resolveSourceFromCurrentContext() { @@ -837,6 +837,8 @@ public final class SensorPrivacyManager { @RequiresPermission(Manifest.permission.MANAGE_SENSOR_PRIVACY) public void setSensorPrivacy(@Sources.Source int source, @Sensors.Sensor int sensor, boolean enable) { + // TODO(b/348510106): Replace USER_CURRENT with Context user and fix any tests that may be + // affected. setSensorPrivacy(source, sensor, enable, UserHandle.USER_CURRENT); } @@ -894,7 +896,7 @@ public final class SensorPrivacyManager { @RequiresPermission(Manifest.permission.MANAGE_SENSOR_PRIVACY) public void setSensorPrivacyForProfileGroup(@Sources.Source int source, @Sensors.Sensor int sensor, boolean enable) { - setSensorPrivacyForProfileGroup(source , sensor, enable, UserHandle.USER_CURRENT); + setSensorPrivacyForProfileGroup(source , sensor, enable, mContext.getUserId()); } /** @@ -950,7 +952,7 @@ public final class SensorPrivacyManager { @RequiresPermission(Manifest.permission.MANAGE_SENSOR_PRIVACY) public void suppressSensorPrivacyReminders(int sensor, boolean suppress) { - suppressSensorPrivacyReminders(sensor, suppress, UserHandle.USER_CURRENT); + suppressSensorPrivacyReminders(sensor, suppress, mContext.getUserId()); } /** diff --git a/core/java/android/hardware/biometrics/BiometricConstants.java b/core/java/android/hardware/biometrics/BiometricConstants.java index 8975191b54c19f19dce60f093f7d9c1a1e843a4c..9355937b09633a8ac534d4c68c2798b96e5f3bf5 100644 --- a/core/java/android/hardware/biometrics/BiometricConstants.java +++ b/core/java/android/hardware/biometrics/BiometricConstants.java @@ -169,6 +169,12 @@ public interface BiometricConstants { */ int BIOMETRIC_ERROR_MANDATORY_NOT_ACTIVE = 20; + /** + * Biometrics is not allowed to verify in apps. + * @hide + */ + int BIOMETRIC_ERROR_NOT_ENABLED_FOR_APPS = 21; + /** * This constant is only used by SystemUI. It notifies SystemUI that authentication was paused * because the authentication attempt was unsuccessful. diff --git a/core/java/android/hardware/biometrics/BiometricManager.java b/core/java/android/hardware/biometrics/BiometricManager.java index 9bc46b9f382a80f42e319183fee8de495fd97876..a4f7485fcaa5f60241eeead91ffd5a6bcc508c28 100644 --- a/core/java/android/hardware/biometrics/BiometricManager.java +++ b/core/java/android/hardware/biometrics/BiometricManager.java @@ -93,6 +93,13 @@ public class BiometricManager { public static final int BIOMETRIC_ERROR_MANDATORY_NOT_ACTIVE = BiometricConstants.BIOMETRIC_ERROR_MANDATORY_NOT_ACTIVE; + /** + * Biometrics is not allowed to verify in apps. + * @hide + */ + public static final int BIOMETRIC_ERROR_NOT_ENABLED_FOR_APPS = + BiometricConstants.BIOMETRIC_ERROR_NOT_ENABLED_FOR_APPS; + /** * A security vulnerability has been discovered and the sensor is unavailable until a * security update has addressed this issue. This error can be received if for example, diff --git a/core/java/android/hardware/camera2/CameraCharacteristics.java b/core/java/android/hardware/camera2/CameraCharacteristics.java index 056ca93159dd32fc2a7513ba921e887f3887f412..7a8a16f4b98adbdad280b833e7223227ba9e9ecf 100644 --- a/core/java/android/hardware/camera2/CameraCharacteristics.java +++ b/core/java/android/hardware/camera2/CameraCharacteristics.java @@ -567,7 +567,6 @@ public final class CameraCharacteristics extends CameraMetadata> getAvailableSessionCharacteristicsKeys() { if (mAvailableSessionCharacteristicsKeys != null) { return mAvailableSessionCharacteristicsKeys; @@ -5210,7 +5209,6 @@ public final class CameraCharacteristics extends CameraMetadata INFO_SESSION_CONFIGURATION_QUERY_VERSION = new Key("android.info.sessionConfigurationQueryVersion", int.class); diff --git a/core/java/android/hardware/camera2/CameraManager.java b/core/java/android/hardware/camera2/CameraManager.java index 6a7ee7fcb26a8a3ae4b65f0350863aa0a538c4cf..d40b2e342fbbad9e429efd32967efe37fb7c8b76 100644 --- a/core/java/android/hardware/camera2/CameraManager.java +++ b/core/java/android/hardware/camera2/CameraManager.java @@ -29,6 +29,7 @@ import android.annotation.SystemApi; import android.annotation.SystemService; import android.annotation.TestApi; import android.app.ActivityManager; +import android.app.CameraCompatTaskInfo; import android.app.TaskInfo; import android.app.compat.CompatChanges; import android.companion.virtual.VirtualDeviceManager; @@ -1586,12 +1587,13 @@ public final class CameraManager { context.getSystemService(ActivityManager.class); for (ActivityManager.AppTask appTask : activityManager.getAppTasks()) { final TaskInfo taskInfo = appTask.getTaskInfo(); - if (taskInfo.appCompatTaskInfo.cameraCompatTaskInfo.freeformCameraCompatMode - != 0 + final int freeformCameraCompatMode = + taskInfo.appCompatTaskInfo.cameraCompatTaskInfo.freeformCameraCompatMode; + if (freeformCameraCompatMode != 0 && taskInfo.topActivity != null && taskInfo.topActivity.getPackageName().equals(packageName)) { // WindowManager has requested rotation override. - return ICameraService.ROTATION_OVERRIDE_ROTATION_ONLY; + return getRotationOverrideForCompatFreeform(freeformCameraCompatMode); } } } @@ -1613,6 +1615,19 @@ public final class CameraManager { : ICameraService.ROTATION_OVERRIDE_NONE; } + private static int getRotationOverrideForCompatFreeform( + @CameraCompatTaskInfo.FreeformCameraCompatMode int freeformCameraCompatMode) { + // Only rotate-and-crop if the app and device orientations do not match. + if (freeformCameraCompatMode + == CameraCompatTaskInfo.CAMERA_COMPAT_FREEFORM_LANDSCAPE_DEVICE_IN_PORTRAIT + || freeformCameraCompatMode + == CameraCompatTaskInfo.CAMERA_COMPAT_FREEFORM_PORTRAIT_DEVICE_IN_LANDSCAPE) { + return ICameraService.ROTATION_OVERRIDE_ROTATION_ONLY; + } else { + return ICameraService.ROTATION_OVERRIDE_NONE; + } + } + /** * @hide */ diff --git a/core/java/android/hardware/camera2/extension/CameraOutputSurface.java b/core/java/android/hardware/camera2/extension/CameraOutputSurface.java index 001b79499b1a3de7a9a20fad2602bbf4879a250c..32139b8e314b838aaf0a66bf8508e8ada057a0fa 100644 --- a/core/java/android/hardware/camera2/extension/CameraOutputSurface.java +++ b/core/java/android/hardware/camera2/extension/CameraOutputSurface.java @@ -107,7 +107,6 @@ public final class CameraOutputSurface { * {@link android.hardware.camera2.params.DynamicRangeProfiles.STANDARD} * unless specified by CameraOutputSurface.setDynamicRangeProfile. */ - @FlaggedApi(Flags.FLAG_EXTENSION_10_BIT) public @DynamicRangeProfiles.Profile long getDynamicRangeProfile() { return mOutputSurface.dynamicRangeProfile; } @@ -118,7 +117,6 @@ public final class CameraOutputSurface { * unless specified by CameraOutputSurface.setColorSpace. */ @SuppressLint("MethodNameUnits") - @FlaggedApi(Flags.FLAG_EXTENSION_10_BIT) public int getColorSpace() { return mOutputSurface.colorSpace; } @@ -128,7 +126,6 @@ public final class CameraOutputSurface { * will be {@link android.hardware.camera2.params.DynamicRangeProfiles.STANDARD} * unless explicitly set using this method. */ - @FlaggedApi(Flags.FLAG_EXTENSION_10_BIT) public void setDynamicRangeProfile( @DynamicRangeProfiles.Profile long dynamicRangeProfile) { mOutputSurface.dynamicRangeProfile = dynamicRangeProfile; diff --git a/core/java/android/hardware/camera2/extension/ExtensionConfiguration.java b/core/java/android/hardware/camera2/extension/ExtensionConfiguration.java index 84b7a7fc1349c87745875ce0195c754b14e78a36..32de1ce8f0d69d038c26cb3f4b97ff60db0d2968 100644 --- a/core/java/android/hardware/camera2/extension/ExtensionConfiguration.java +++ b/core/java/android/hardware/camera2/extension/ExtensionConfiguration.java @@ -83,7 +83,6 @@ public class ExtensionConfiguration { * The default will be -1, indicating an unspecified ColorSpace, * unless explicitly set using this method. */ - @FlaggedApi(Flags.FLAG_EXTENSION_10_BIT) public void setColorSpace(int colorSpace) { mColorSpace = colorSpace; } @@ -98,11 +97,7 @@ public class ExtensionConfiguration { ret.sessionTemplateId = mSessionTemplateId; ret.sessionType = mSessionType; ret.outputConfigs = new ArrayList<>(mOutputs.size()); - if (Flags.extension10Bit()) { - ret.colorSpace = mColorSpace; - } else { - ret.colorSpace = ColorSpaceProfiles.UNSPECIFIED; - } + ret.colorSpace = mColorSpace; for (ExtensionOutputConfiguration outputConfig : mOutputs) { ret.outputConfigs.add(outputConfig.getOutputConfig()); } diff --git a/core/java/android/hardware/camera2/extension/ExtensionOutputConfiguration.java b/core/java/android/hardware/camera2/extension/ExtensionOutputConfiguration.java index 3a67d6192f5e8ac0b9dafb2a4516ae48901ea13f..8a47430e7eb429b6121e7ac1fe40986ac30d8ba1 100644 --- a/core/java/android/hardware/camera2/extension/ExtensionOutputConfiguration.java +++ b/core/java/android/hardware/camera2/extension/ExtensionOutputConfiguration.java @@ -80,11 +80,7 @@ public class ExtensionOutputConfiguration { config.outputId = new OutputConfigId(); config.outputId.id = mOutputConfigId; config.surfaceGroupId = mSurfaceGroupId; - if (Flags.extension10Bit()) { - config.dynamicRangeProfile = surface.getDynamicRangeProfile(); - } else { - config.dynamicRangeProfile = DynamicRangeProfiles.STANDARD; - } + config.dynamicRangeProfile = surface.getDynamicRangeProfile(); } @Nullable CameraOutputConfig getOutputConfig() { diff --git a/core/java/android/hardware/camera2/impl/CameraAdvancedExtensionSessionImpl.java b/core/java/android/hardware/camera2/impl/CameraAdvancedExtensionSessionImpl.java index 2e1e90c78f3aa75771cceb1506fae0531a95a0f8..323712d817afaf6929c64f5d14f91177a4e2e403 100644 --- a/core/java/android/hardware/camera2/impl/CameraAdvancedExtensionSessionImpl.java +++ b/core/java/android/hardware/camera2/impl/CameraAdvancedExtensionSessionImpl.java @@ -148,7 +148,7 @@ public final class CameraAdvancedExtensionSessionImpl extends CameraExtensionSes for (OutputConfiguration c : config.getOutputConfigurations()) { if (c.getDynamicRangeProfile() != DynamicRangeProfiles.STANDARD) { - if (Flags.extension10Bit() && Flags.cameraExtensionsCharacteristicsGet()) { + if (Flags.cameraExtensionsCharacteristicsGet()) { DynamicRangeProfiles dynamicProfiles = extensionChars.get( config.getExtension(), CameraCharacteristics.REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES); @@ -190,9 +190,7 @@ public final class CameraAdvancedExtensionSessionImpl extends CameraExtensionSes new IntArray(CameraExtensionUtils.SUPPORTED_CAPTURE_OUTPUT_FORMATS.length); supportedCaptureOutputFormats.addAll( CameraExtensionUtils.SUPPORTED_CAPTURE_OUTPUT_FORMATS); - if (Flags.extension10Bit()) { - supportedCaptureOutputFormats.add(ImageFormat.YCBCR_P010); - } + supportedCaptureOutputFormats.add(ImageFormat.YCBCR_P010); for (int format : supportedCaptureOutputFormats.toArray()) { List supportedSizes = extensionChars.getExtensionSupportedSizes( config.getExtension(), format); @@ -359,23 +357,21 @@ public final class CameraAdvancedExtensionSessionImpl extends CameraExtensionSes cameraOutput.setTimestampBase(OutputConfiguration.TIMESTAMP_BASE_SENSOR); cameraOutput.setReadoutTimestampEnabled(false); cameraOutput.setPhysicalCameraId(output.physicalCameraId); - if (Flags.extension10Bit()) { - boolean validDynamicRangeProfile = false; - for (long profile = DynamicRangeProfiles.STANDARD; - profile < DynamicRangeProfiles.PUBLIC_MAX; profile <<= 1) { - if (output.dynamicRangeProfile == profile) { - validDynamicRangeProfile = true; - break; - } - } - if (validDynamicRangeProfile) { - cameraOutput.setDynamicRangeProfile(output.dynamicRangeProfile); - } else { - Log.e(TAG, "Extension configured dynamic range profile " - + output.dynamicRangeProfile - + " is not valid, using default DynamicRangeProfile.STANDARD"); + boolean validDynamicRangeProfile = false; + for (long profile = DynamicRangeProfiles.STANDARD; + profile < DynamicRangeProfiles.PUBLIC_MAX; profile <<= 1) { + if (output.dynamicRangeProfile == profile) { + validDynamicRangeProfile = true; + break; } } + if (validDynamicRangeProfile) { + cameraOutput.setDynamicRangeProfile(output.dynamicRangeProfile); + } else { + Log.e(TAG, "Extension configured dynamic range profile " + + output.dynamicRangeProfile + + " is not valid, using default DynamicRangeProfile.STANDARD"); + } outputList.add(cameraOutput); mCameraConfigMap.put(cameraOutput.getSurface(), output); } @@ -390,15 +386,13 @@ public final class CameraAdvancedExtensionSessionImpl extends CameraExtensionSes SessionConfiguration sessionConfiguration = new SessionConfiguration(sessionType, outputList, new CameraExtensionUtils.HandlerExecutor(mHandler), new SessionStateHandler()); - if (Flags.extension10Bit()) { - if (sessionConfig.colorSpace >= 0 - && sessionConfig.colorSpace < ColorSpace.Named.values().length) { - sessionConfiguration.setColorSpace( - ColorSpace.Named.values()[sessionConfig.colorSpace]); - } else { - Log.e(TAG, "Extension configured color space " + sessionConfig.colorSpace - + " is not valid, using default unspecified color space"); - } + if (sessionConfig.colorSpace >= 0 + && sessionConfig.colorSpace < ColorSpace.Named.values().length) { + sessionConfiguration.setColorSpace( + ColorSpace.Named.values()[sessionConfig.colorSpace]); + } else { + Log.e(TAG, "Extension configured color space " + sessionConfig.colorSpace + + " is not valid, using default unspecified color space"); } if ((sessionConfig.sessionParameter != null) && (!sessionConfig.sessionParameter.isEmpty())) { @@ -459,16 +453,11 @@ public final class CameraAdvancedExtensionSessionImpl extends CameraExtensionSes ret.size.height = surfaceSize.getHeight(); ret.imageFormat = SurfaceUtils.getSurfaceFormat(s); - if (Flags.extension10Bit()) { - ret.dynamicRangeProfile = o.getDynamicRangeProfile(); - ColorSpace colorSpace = o.getColorSpace(); - if (colorSpace != null) { - ret.colorSpace = colorSpace.getId(); - } else { - ret.colorSpace = ColorSpaceProfiles.UNSPECIFIED; - } + ret.dynamicRangeProfile = o.getDynamicRangeProfile(); + ColorSpace colorSpace = o.getColorSpace(); + if (colorSpace != null) { + ret.colorSpace = colorSpace.getId(); } else { - ret.dynamicRangeProfile = DynamicRangeProfiles.STANDARD; ret.colorSpace = ColorSpaceProfiles.UNSPECIFIED; } } else { diff --git a/core/java/android/hardware/camera2/impl/CameraDeviceImpl.java b/core/java/android/hardware/camera2/impl/CameraDeviceImpl.java index c7dba6c8389532c63e4a226993ce70412ea08eed..84072585d7f027a5fd7521d83404b1f39d28c6c9 100644 --- a/core/java/android/hardware/camera2/impl/CameraDeviceImpl.java +++ b/core/java/android/hardware/camera2/impl/CameraDeviceImpl.java @@ -364,16 +364,11 @@ public class CameraDeviceImpl extends CameraDevice throw new IllegalArgumentException("Null argument given"); } mCameraId = cameraId; - if (Flags.singleThreadExecutor()) { - mDeviceCallback = new ClientStateCallback(executor, callback); - if (Flags.singleThreadExecutorNaming()) { - mDeviceExecutor = Executors.newSingleThreadExecutor(sThreadFactory); - } else { - mDeviceExecutor = Executors.newSingleThreadExecutor(); - } + mDeviceCallback = new ClientStateCallback(executor, callback); + if (Flags.singleThreadExecutorNaming()) { + mDeviceExecutor = Executors.newSingleThreadExecutor(sThreadFactory); } else { - mDeviceCallback = callback; - mDeviceExecutor = executor; + mDeviceExecutor = Executors.newSingleThreadExecutor(); } mCharacteristics = characteristics; mCameraManager = manager; diff --git a/core/java/android/hardware/camera2/impl/CameraExtensionJpegProcessor.java b/core/java/android/hardware/camera2/impl/CameraExtensionJpegProcessor.java index a10e2505758ecb931fbb85dd9a9f59555979103b..ab4ff72bb9525d225b3763e009346f9cd852d735 100644 --- a/core/java/android/hardware/camera2/impl/CameraExtensionJpegProcessor.java +++ b/core/java/android/hardware/camera2/impl/CameraExtensionJpegProcessor.java @@ -208,10 +208,6 @@ public class CameraExtensionJpegProcessor implements ICaptureProcessorImpl { } public void onOutputSurface(Surface surface, int format) throws RemoteException { - if (!Flags.extension10Bit() && format != ImageFormat.JPEG) { - Log.e(TAG, "Unsupported output format: " + format); - return; - } CameraExtensionUtils.SurfaceInfo surfaceInfo = CameraExtensionUtils.querySurface(surface); mCaptureFormat = surfaceInfo.mFormat; mOutputSurface = surface; @@ -221,10 +217,6 @@ public class CameraExtensionJpegProcessor implements ICaptureProcessorImpl { public void onPostviewOutputSurface(Surface surface) throws RemoteException { CameraExtensionUtils.SurfaceInfo postviewSurfaceInfo = CameraExtensionUtils.querySurface(surface); - if (!Flags.extension10Bit() && postviewSurfaceInfo.mFormat != ImageFormat.JPEG) { - Log.e(TAG, "Unsupported output format: " + postviewSurfaceInfo.mFormat); - return; - } mPostviewFormat = postviewSurfaceInfo.mFormat; mPostviewOutputSurface = surface; initializePostviewPipeline(); @@ -240,10 +232,6 @@ public class CameraExtensionJpegProcessor implements ICaptureProcessorImpl { } public void onImageFormatUpdate(int format) throws RemoteException { - if (!Flags.extension10Bit() && format != ImageFormat.YUV_420_888) { - Log.e(TAG, "Unsupported input format: " + format); - return; - } mFormat = format; initializePipeline(); } @@ -251,7 +239,7 @@ public class CameraExtensionJpegProcessor implements ICaptureProcessorImpl { private void initializePipeline() throws RemoteException { if ((mFormat != -1) && (mOutputSurface != null) && (mResolution != null) && (mYuvReader == null)) { - if (Flags.extension10Bit() && mCaptureFormat == ImageFormat.YUV_420_888) { + if (mCaptureFormat == ImageFormat.YUV_420_888) { // For the case when postview is JPEG and capture is YUV mProcessor.onOutputSurface(mOutputSurface, mCaptureFormat); } else { @@ -274,7 +262,7 @@ public class CameraExtensionJpegProcessor implements ICaptureProcessorImpl { private void initializePostviewPipeline() throws RemoteException { if ((mFormat != -1) && (mPostviewOutputSurface != null) && (mPostviewResolution != null) && (mPostviewYuvReader == null)) { - if (Flags.extension10Bit() && mPostviewFormat == ImageFormat.YUV_420_888) { + if (mPostviewFormat == ImageFormat.YUV_420_888) { // For the case when postview is YUV and capture is JPEG mProcessor.onPostviewOutputSurface(mPostviewOutputSurface); } else { diff --git a/core/java/android/hardware/camera2/impl/CameraExtensionSessionImpl.java b/core/java/android/hardware/camera2/impl/CameraExtensionSessionImpl.java index a4ae398782b4eafc766ecd0c8a664a84a609eedb..ce1609dec4e6affb5044200f4f5f71d842f1bcd9 100644 --- a/core/java/android/hardware/camera2/impl/CameraExtensionSessionImpl.java +++ b/core/java/android/hardware/camera2/impl/CameraExtensionSessionImpl.java @@ -190,9 +190,7 @@ public final class CameraExtensionSessionImpl extends CameraExtensionSession { new IntArray(CameraExtensionUtils.SUPPORTED_CAPTURE_OUTPUT_FORMATS.length); supportedCaptureOutputFormats.addAll( CameraExtensionUtils.SUPPORTED_CAPTURE_OUTPUT_FORMATS); - if (Flags.extension10Bit()) { - supportedCaptureOutputFormats.add(ImageFormat.YCBCR_P010); - } + supportedCaptureOutputFormats.add(ImageFormat.YCBCR_P010); for (int format : supportedCaptureOutputFormats.toArray()) { List supportedSizes = extensionChars.getExtensionSupportedSizes( config.getExtension(), format); @@ -401,7 +399,7 @@ public final class CameraExtensionSessionImpl extends CameraExtensionSession { if (surfaceInfo.mFormat == ImageFormat.JPEG) { mImageJpegProcessor = new CameraExtensionJpegProcessor(mImageProcessor); mImageProcessor = mImageJpegProcessor; - } else if (Flags.extension10Bit() && mClientPostviewSurface != null) { + } else if (mClientPostviewSurface != null) { // Handles case when postview is JPEG and capture is YUV CameraExtensionUtils.SurfaceInfo postviewSurfaceInfo = CameraExtensionUtils.querySurface(mClientPostviewSurface); diff --git a/core/java/android/hardware/camera2/impl/CameraExtensionUtils.java b/core/java/android/hardware/camera2/impl/CameraExtensionUtils.java index 40f047732c06f6c3480fdb86e70f90faf572fb8b..f91d277d571f3c605a8b9fd0b8b790cced886d16 100644 --- a/core/java/android/hardware/camera2/impl/CameraExtensionUtils.java +++ b/core/java/android/hardware/camera2/impl/CameraExtensionUtils.java @@ -113,32 +113,13 @@ public final class CameraExtensionUtils { SurfaceInfo surfaceInfo = querySurface(outputConfig.getSurface()); - if (Flags.extension10Bit()) { - Size postviewSize = new Size(surfaceInfo.mWidth, surfaceInfo.mHeight); - if (supportedPostviewSizes.get(surfaceInfo.mFormat) - .contains(postviewSize)) { - return outputConfig.getSurface(); - } else { - throw new IllegalArgumentException("Postview size not supported!"); - } + Size postviewSize = new Size(surfaceInfo.mWidth, surfaceInfo.mHeight); + if (supportedPostviewSizes.get(surfaceInfo.mFormat) + .contains(postviewSize)) { + return outputConfig.getSurface(); } else { - if (surfaceInfo.mFormat == captureFormat) { - if (supportedPostviewSizes.containsKey(captureFormat)) { - Size postviewSize = new Size(surfaceInfo.mWidth, surfaceInfo.mHeight); - if (supportedPostviewSizes.get(surfaceInfo.mFormat) - .contains(postviewSize)) { - return outputConfig.getSurface(); - } else { - throw new IllegalArgumentException("Postview size not supported!"); - } - } - } else { - throw new IllegalArgumentException("Postview format should be equivalent to " - + " the capture format!"); - } + throw new IllegalArgumentException("Postview size not supported!"); } - - return null; } public static Surface getBurstCaptureSurface( @@ -148,9 +129,7 @@ public final class CameraExtensionUtils { new IntArray(CameraExtensionUtils.SUPPORTED_CAPTURE_OUTPUT_FORMATS.length); supportedCaptureOutputFormats.addAll( CameraExtensionUtils.SUPPORTED_CAPTURE_OUTPUT_FORMATS); - if (Flags.extension10Bit()) { - supportedCaptureOutputFormats.add(ImageFormat.YCBCR_P010); - } + supportedCaptureOutputFormats.add(ImageFormat.YCBCR_P010); for (OutputConfiguration config : outputConfigs) { SurfaceInfo surfaceInfo = querySurface(config.getSurface()); for (int supportedFormat : supportedCaptureOutputFormats.toArray()) { diff --git a/core/java/android/hardware/camera2/params/ExtensionSessionConfiguration.java b/core/java/android/hardware/camera2/params/ExtensionSessionConfiguration.java index bf3f59fc748066859dd418f20ca54b39a8109a31..73f4ff48025960ccbd6c9fb8dc09ceb15022b861 100644 --- a/core/java/android/hardware/camera2/params/ExtensionSessionConfiguration.java +++ b/core/java/android/hardware/camera2/params/ExtensionSessionConfiguration.java @@ -136,7 +136,6 @@ public final class ExtensionSessionConfiguration { * or the color space implied by the dataSpace passed into an {@link ImageReader}'s * constructor.

*/ - @FlaggedApi(Flags.FLAG_EXTENSION_10_BIT) public void setColorSpace(@NonNull ColorSpace.Named colorSpace) { mColorSpace = colorSpace.ordinal(); for (OutputConfiguration outputConfiguration : mOutputs) { @@ -150,7 +149,6 @@ public final class ExtensionSessionConfiguration { /** * Clear the color space, such that the default color space will be used. */ - @FlaggedApi(Flags.FLAG_EXTENSION_10_BIT) public void clearColorSpace() { mColorSpace = ColorSpaceProfiles.UNSPECIFIED; for (OutputConfiguration outputConfiguration : mOutputs) { @@ -167,7 +165,6 @@ public final class ExtensionSessionConfiguration { * @return the currently set color space, or null * if not set */ - @FlaggedApi(Flags.FLAG_EXTENSION_10_BIT) @SuppressLint("MethodNameUnits") public @Nullable ColorSpace getColorSpace() { if (mColorSpace != ColorSpaceProfiles.UNSPECIFIED) { diff --git a/core/java/android/hardware/display/DisplayManagerGlobal.java b/core/java/android/hardware/display/DisplayManagerGlobal.java index 85e33a8b4496edc0fa6e31a3933f011f7ab3dd00..9612a53be96e8d69bb02dc38cb4f864e131530c1 100644 --- a/core/java/android/hardware/display/DisplayManagerGlobal.java +++ b/core/java/android/hardware/display/DisplayManagerGlobal.java @@ -21,6 +21,7 @@ import static android.hardware.display.DisplayManager.EventsMask; import static android.view.Display.HdrCapabilities.HdrType; import android.Manifest; +import android.annotation.FlaggedApi; import android.annotation.FloatRange; import android.annotation.IntDef; import android.annotation.NonNull; @@ -1231,6 +1232,20 @@ public final class DisplayManagerGlobal { } } + /** + * @param displayId The ID of the display + * @return The highest HDR/SDR ratio of the ratios defined in Display Device Config. If no + * HDR/SDR map is defined, this always returns 1. + */ + @FlaggedApi(com.android.server.display.feature.flags.Flags.FLAG_HIGHEST_HDR_SDR_RATIO_API) + public float getHighestHdrSdrRatio(int displayId) { + try { + return mDm.getHighestHdrSdrRatio(displayId); + } catch (RemoteException ex) { + throw ex.rethrowFromSystemServer(); + } + } + /** * @see DisplayManager#getDozeBrightnessSensorValueToBrightness */ diff --git a/core/java/android/hardware/display/IDisplayManager.aidl b/core/java/android/hardware/display/IDisplayManager.aidl index f3c21e9f7a435cef78d194f5f5963ecba34c62d2..aa1539f697224e31658344dff8b35b84c317ab02 100644 --- a/core/java/android/hardware/display/IDisplayManager.aidl +++ b/core/java/android/hardware/display/IDisplayManager.aidl @@ -247,6 +247,9 @@ interface IDisplayManager { @EnforcePermission("RESTRICT_DISPLAY_MODES") void requestDisplayModes(in IBinder token, int displayId, in @nullable int[] modeIds); + // Get the highest defined HDR/SDR ratio for a display. + float getHighestHdrSdrRatio(int displayId); + // Get the mapping between the doze brightness sensor values and brightness values @EnforcePermission("CONTROL_DISPLAY_BRIGHTNESS") float[] getDozeBrightnessSensorValueToBrightness(int displayId); diff --git a/core/java/android/hardware/fingerprint/FingerprintSensorConfigurations.java b/core/java/android/hardware/fingerprint/FingerprintSensorConfigurations.java index 43c0da9bd8edcc2a964a66ae0cdf40bb6d94ef2f..48c5887d80d09907156d3e57df39602db02c59f0 100644 --- a/core/java/android/hardware/fingerprint/FingerprintSensorConfigurations.java +++ b/core/java/android/hardware/fingerprint/FingerprintSensorConfigurations.java @@ -23,12 +23,14 @@ import android.annotation.Nullable; import android.content.Context; import android.hardware.biometrics.fingerprint.IFingerprint; import android.hardware.biometrics.fingerprint.SensorProps; +import android.hardware.biometrics.fingerprint.virtualhal.IVirtualHal; import android.os.Binder; import android.os.Parcel; import android.os.Parcelable; import android.os.RemoteException; import android.os.ServiceManager; import android.util.Log; +import android.util.Slog; import java.util.ArrayList; import java.util.HashMap; @@ -162,6 +164,43 @@ public class FingerprintSensorConfigurations implements Parcelable { dest.writeMap(mSensorPropsMap); } + + /** + * Remap fqName of VHAL because the `virtual` instance is registered + * with IVirtulalHal now (IFingerprint previously) + * @param fqName fqName to be translated + * @return real fqName + */ + public static String remapFqName(String fqName) { + if (!fqName.contains(IFingerprint.DESCRIPTOR + "/virtual")) { + return fqName; //no remap needed for real hardware HAL + } else { + //new Vhal instance name + return fqName.replace("IFingerprint", "virtualhal.IVirtualHal"); + } + } + + /** + * @param fqName aidl interface instance name + * @return aidl interface + */ + public static IFingerprint getIFingerprint(String fqName) { + if (fqName.contains("virtual")) { + String fqNameMapped = remapFqName(fqName); + Slog.i(TAG, "getIFingerprint fqName is mapped: " + fqName + "->" + fqNameMapped); + try { + IVirtualHal vhal = IVirtualHal.Stub.asInterface( + Binder.allowBlocking(ServiceManager.waitForService(fqNameMapped))); + return vhal.getFingerprintHal(); + } catch (RemoteException e) { + Slog.e(TAG, "Remote exception in vhal.getFingerprintHal() call" + fqNameMapped); + } + } + + return IFingerprint.Stub.asInterface( + Binder.allowBlocking(ServiceManager.waitForDeclaredService(fqName))); + } + /** * Returns fingerprint sensor props for the HAL {@param instance}. */ @@ -176,8 +215,7 @@ public class FingerprintSensorConfigurations implements Parcelable { try { final String fqName = IFingerprint.DESCRIPTOR + "/" + instance; - final IFingerprint fp = IFingerprint.Stub.asInterface(Binder.allowBlocking( - ServiceManager.waitForDeclaredService(fqName))); + final IFingerprint fp = getIFingerprint(fqName); if (fp != null) { props = fp.getSensorProps(); } else { diff --git a/core/java/android/hardware/input/AidlKeyGestureEvent.aidl b/core/java/android/hardware/input/AidlKeyGestureEvent.aidl new file mode 100644 index 0000000000000000000000000000000000000000..7cf8795085e32b0887010c2434ccb006d6c0d60e --- /dev/null +++ b/core/java/android/hardware/input/AidlKeyGestureEvent.aidl @@ -0,0 +1,29 @@ +/* + * Copyright 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 android.hardware.input; + +/** @hide */ +@JavaDerive(equals=true) +parcelable AidlKeyGestureEvent { + int deviceId; + int[] keycodes; + int modifierState; + int gestureType; + int action; + int displayId; + int flags; +} diff --git a/core/java/android/hardware/input/IInputManager.aidl b/core/java/android/hardware/input/IInputManager.aidl index 2d96bbaae901f6bf4204a7caa769ad74335c8815..102f56e4672b79929f743a14f6c897b4bfb345f6 100644 --- a/core/java/android/hardware/input/IInputManager.aidl +++ b/core/java/android/hardware/input/IInputManager.aidl @@ -26,6 +26,7 @@ import android.hardware.input.IInputDeviceBatteryState; import android.hardware.input.IKeyboardBacklightListener; import android.hardware.input.IKeyboardBacklightState; import android.hardware.input.IKeyGestureEventListener; +import android.hardware.input.IKeyGestureHandler; import android.hardware.input.IStickyModifierStateListener; import android.hardware.input.ITabletModeChangedListener; import android.hardware.input.KeyboardLayoutSelectionResult; @@ -250,4 +251,14 @@ interface IInputManager { @JavaPassthrough(annotation="@android.annotation.RequiresPermission(value = " + "android.Manifest.permission.MANAGE_KEY_GESTURES)") void unregisterKeyGestureEventListener(IKeyGestureEventListener listener); + + @PermissionManuallyEnforced + @JavaPassthrough(annotation="@android.annotation.RequiresPermission(value = " + + "android.Manifest.permission.MANAGE_KEY_GESTURES)") + void registerKeyGestureHandler(IKeyGestureHandler handler); + + @PermissionManuallyEnforced + @JavaPassthrough(annotation="@android.annotation.RequiresPermission(value = " + + "android.Manifest.permission.MANAGE_KEY_GESTURES)") + void unregisterKeyGestureHandler(IKeyGestureHandler handler); } diff --git a/core/java/android/hardware/input/IKeyGestureEventListener.aidl b/core/java/android/hardware/input/IKeyGestureEventListener.aidl index 2c430f1a1c9debf888a9ff8ab11745c99d7d8778..6b5f83758a1195dcfd7ef71f665d4056bfae9a15 100644 --- a/core/java/android/hardware/input/IKeyGestureEventListener.aidl +++ b/core/java/android/hardware/input/IKeyGestureEventListener.aidl @@ -16,11 +16,13 @@ package android.hardware.input; +import android.hardware.input.AidlKeyGestureEvent; + /** @hide */ oneway interface IKeyGestureEventListener { /** * Called when a key gesture event occurs. */ - void onKeyGestureEvent(int deviceId, in int[] keycodes, int modifierState, int shortcut); + void onKeyGestureEvent(in AidlKeyGestureEvent event); } diff --git a/core/java/android/hardware/input/IKeyGestureHandler.aidl b/core/java/android/hardware/input/IKeyGestureHandler.aidl new file mode 100644 index 0000000000000000000000000000000000000000..509b9482154e9630c8d076b4d70f4717cfb41527 --- /dev/null +++ b/core/java/android/hardware/input/IKeyGestureHandler.aidl @@ -0,0 +1,42 @@ +/* + * Copyright 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 android.hardware.input; + +import android.hardware.input.AidlKeyGestureEvent; +import android.os.IBinder; + +/** @hide */ +interface IKeyGestureHandler { + + /** + * Called when a key gesture starts, ends, or is cancelled. If a handler returns {@code true}, + * it means they intend to handle the full gesture and should handle all the events pertaining + * to that gesture. + */ + boolean handleKeyGesture(in AidlKeyGestureEvent event, in IBinder focusedToken); + + /** + * Called to know if a particular gesture type is supported by the handler. + * + * TODO(b/358569822): Remove this call to reduce the binder calls to single call for + * handleKeyGesture. For this we need to remove dependency of multi-key gestures to identify if + * a key gesture is supported on first relevant key down. + * Also, for now we prioritize handlers in the system server process above external handlers to + * reduce IPC binder calls. + */ + boolean isKeyGestureSupported(int gestureType); +} diff --git a/core/java/android/hardware/input/InputManager.java b/core/java/android/hardware/input/InputManager.java index 04cfcd880f522f65d08cfb82cb54ec10c83551d3..22728f7a5ad3fd96dbf0ac2a0380fba01ae08eef 100644 --- a/core/java/android/hardware/input/InputManager.java +++ b/core/java/android/hardware/input/InputManager.java @@ -1405,6 +1405,33 @@ public final class InputManager { mGlobal.unregisterKeyGestureEventListener(listener); } + /** + * Registers a key gesture event handler for {@link KeyGestureEvent} handling. + * + * @param handler the {@link KeyGestureEventHandler} + * @throws IllegalArgumentException if {@code handler} has already been registered previously. + * @throws NullPointerException if {@code handler} or {@code executor} is null. + * @hide + * @see #unregisterKeyGestureEventHandler(KeyGestureEventHandler) + */ + @RequiresPermission(Manifest.permission.MANAGE_KEY_GESTURES) + public void registerKeyGestureEventHandler(@NonNull KeyGestureEventHandler handler) + throws IllegalArgumentException { + mGlobal.registerKeyGestureEventHandler(handler); + } + + /** + * Unregisters a previously added key gesture event handler. + * + * @param handler the {@link KeyGestureEventHandler} + * @hide + * @see #registerKeyGestureEventHandler(KeyGestureEventHandler) + */ + @RequiresPermission(Manifest.permission.MANAGE_KEY_GESTURES) + public void unregisterKeyGestureEventHandler(@NonNull KeyGestureEventHandler handler) { + mGlobal.unregisterKeyGestureEventHandler(handler); + } + /** * A callback used to be notified about battery state changes for an input device. The * {@link #onBatteryStateChanged(int, long, BatteryState)} method will be called once after the @@ -1522,4 +1549,35 @@ public final class InputManager { */ void onKeyGestureEvent(@NonNull KeyGestureEvent event); } + + /** + * A callback used to notify about key gesture event start, complete and cancel. Unlike + * {@see KeyGestureEventListener} which is to listen to successfully handled key gestures, this + * interface allows system components to register handler for handling key gestures. + * + * @see #registerKeyGestureEventHandler(KeyGestureEventHandler) + * @see #unregisterKeyGestureEventHandler(KeyGestureEventHandler) + * + *

NOTE: All callbacks will occur on system main and input threads, so the caller needs + * to move time-consuming operations to appropriate handler threads. + * @hide + */ + public interface KeyGestureEventHandler { + /** + * Called when a key gesture event starts, is completed, or is cancelled. If a handler + * returns {@code true}, it implies that the handler intends to handle the key gesture and + * only this handler will receive the future events for this key gesture. + * + * @param event the gesture event + */ + boolean handleKeyGestureEvent(@NonNull KeyGestureEvent event, + @Nullable IBinder focusedToken); + + /** + * Called to identify if a particular gesture is of interest to a handler. + * + * NOTE: If no active handler supports certain gestures, the gestures will not be captured. + */ + boolean isKeyGestureSupported(@KeyGestureEvent.KeyGestureType int gestureType); + } } diff --git a/core/java/android/hardware/input/InputManagerGlobal.java b/core/java/android/hardware/input/InputManagerGlobal.java index 2a362381a0035c4b45c60bb3dcb2651fa05bae0f..5c11346df1c302b03a955702337190f0a0a518ff 100644 --- a/core/java/android/hardware/input/InputManagerGlobal.java +++ b/core/java/android/hardware/input/InputManagerGlobal.java @@ -25,6 +25,7 @@ import android.hardware.BatteryState; import android.hardware.SensorManager; import android.hardware.input.InputManager.InputDeviceBatteryListener; import android.hardware.input.InputManager.InputDeviceListener; +import android.hardware.input.InputManager.KeyGestureEventHandler; import android.hardware.input.InputManager.KeyGestureEventListener; import android.hardware.input.InputManager.KeyboardBacklightListener; import android.hardware.input.InputManager.OnTabletModeChangedListener; @@ -119,6 +120,14 @@ public final class InputManagerGlobal { @Nullable private IKeyGestureEventListener mKeyGestureEventListener; + private final Object mKeyGestureEventHandlerLock = new Object(); + @GuardedBy("mKeyGestureEventHandlerLock") + @Nullable + private ArrayList mKeyGestureEventHandlers; + @GuardedBy("mKeyGestureEventHandlerLock") + @Nullable + private IKeyGestureHandler mKeyGestureHandler; + // InputDeviceSensorManager gets notified synchronously from the binder thread when input // devices change, so it must be synchronized with the input device listeners. @GuardedBy("mInputDeviceListeners") @@ -1080,18 +1089,14 @@ public final class InputManagerGlobal { } private class LocalKeyGestureEventListener extends IKeyGestureEventListener.Stub { - @Override - public void onKeyGestureEvent(int deviceId, int[] keycodes, int modifierState, - int gestureType) { + public void onKeyGestureEvent(@NonNull AidlKeyGestureEvent ev) { synchronized (mKeyGestureEventListenerLock) { if (mKeyGestureEventListeners == null) return; final int numListeners = mKeyGestureEventListeners.size(); + final KeyGestureEvent event = new KeyGestureEvent(ev); for (int i = 0; i < numListeners; i++) { - mKeyGestureEventListeners.get(i) - .onKeyGestureEvent( - new KeyGestureEvent(deviceId, keycodes, modifierState, - gestureType)); + mKeyGestureEventListeners.get(i).onKeyGestureEvent(event); } } } @@ -1154,6 +1159,96 @@ public final class InputManagerGlobal { } } + private class LocalKeyGestureHandler extends IKeyGestureHandler.Stub { + @Override + public boolean handleKeyGesture(@NonNull AidlKeyGestureEvent ev, IBinder focusedToken) { + synchronized (mKeyGestureEventHandlerLock) { + if (mKeyGestureEventHandlers == null) { + return false; + } + final int numHandlers = mKeyGestureEventHandlers.size(); + final KeyGestureEvent event = new KeyGestureEvent(ev); + for (int i = 0; i < numHandlers; i++) { + KeyGestureEventHandler handler = mKeyGestureEventHandlers.get(i); + if (handler.handleKeyGestureEvent(event, focusedToken)) { + return true; + } + } + } + return false; + } + + @Override + public boolean isKeyGestureSupported(@KeyGestureEvent.KeyGestureType int gestureType) { + synchronized (mKeyGestureEventHandlerLock) { + if (mKeyGestureEventHandlers == null) { + return false; + } + final int numHandlers = mKeyGestureEventHandlers.size(); + for (int i = 0; i < numHandlers; i++) { + KeyGestureEventHandler handler = mKeyGestureEventHandlers.get(i); + if (handler.isKeyGestureSupported(gestureType)) { + return true; + } + } + } + return false; + } + } + + /** + * @see InputManager#registerKeyGestureEventHandler(KeyGestureEventHandler) + */ + @RequiresPermission(Manifest.permission.MANAGE_KEY_GESTURES) + void registerKeyGestureEventHandler(@NonNull KeyGestureEventHandler handler) + throws IllegalArgumentException { + Objects.requireNonNull(handler, "handler should not be null"); + + synchronized (mKeyGestureEventHandlerLock) { + if (mKeyGestureHandler == null) { + mKeyGestureEventHandlers = new ArrayList<>(); + mKeyGestureHandler = new LocalKeyGestureHandler(); + + try { + mIm.registerKeyGestureHandler(mKeyGestureHandler); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } + final int numHandlers = mKeyGestureEventHandlers.size(); + for (int i = 0; i < numHandlers; i++) { + if (mKeyGestureEventHandlers.get(i) == handler) { + throw new IllegalArgumentException("Handler has already been registered!"); + } + } + mKeyGestureEventHandlers.add(handler); + } + } + + /** + * @see InputManager#unregisterKeyGestureEventHandler(KeyGestureEventHandler) + */ + @RequiresPermission(Manifest.permission.MANAGE_KEY_GESTURES) + void unregisterKeyGestureEventHandler(@NonNull KeyGestureEventHandler handler) { + Objects.requireNonNull(handler, "handler should not be null"); + + synchronized (mKeyGestureEventHandlerLock) { + if (mKeyGestureEventHandlers == null) { + return; + } + mKeyGestureEventHandlers.removeIf(existingHandler -> existingHandler == handler); + if (mKeyGestureEventHandlers.isEmpty()) { + try { + mIm.unregisterKeyGestureHandler(mKeyGestureHandler); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + mKeyGestureEventHandlers = null; + mKeyGestureHandler = null; + } + } + } + /** * TODO(b/330517633): Cleanup the unsupported API */ diff --git a/core/java/android/hardware/input/KeyGestureEvent.java b/core/java/android/hardware/input/KeyGestureEvent.java index 7a8dd3395d21ce1639846f0fb7a34f7076f5f1ae..c7ebc63a3d159db198e0904967dc17eff0a6dbff 100644 --- a/core/java/android/hardware/input/KeyGestureEvent.java +++ b/core/java/android/hardware/input/KeyGestureEvent.java @@ -19,8 +19,11 @@ package android.hardware.input; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; +import android.view.Display; +import android.view.KeyCharacterMap; -import com.android.internal.util.DataClass; +import com.android.internal.annotations.VisibleForTesting; +import com.android.internal.util.AnnotationValidations; import com.android.internal.util.FrameworkStatsLog; import java.lang.annotation.Retention; @@ -31,501 +34,511 @@ import java.lang.annotation.RetentionPolicy; * * @hide */ -@DataClass(genToString = true, genEqualsHashCode = true) -public class KeyGestureEvent { +public final class KeyGestureEvent { - private final int mDeviceId; @NonNull - private final int[] mKeycodes; - private final int mModifierState; - @KeyGestureType - private final int mKeyGestureType; - - - public static final int KEY_GESTURE_TYPE_UNSPECIFIED = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__UNSPECIFIED; - public static final int KEY_GESTURE_TYPE_HOME = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__HOME; - public static final int KEY_GESTURE_TYPE_RECENT_APPS = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__RECENT_APPS; - public static final int KEY_GESTURE_TYPE_BACK = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__BACK; - public static final int KEY_GESTURE_TYPE_APP_SWITCH = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__APP_SWITCH; - public static final int KEY_GESTURE_TYPE_LAUNCH_ASSISTANT = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_ASSISTANT; - public static final int KEY_GESTURE_TYPE_LAUNCH_VOICE_ASSISTANT = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_VOICE_ASSISTANT; - public static final int KEY_GESTURE_TYPE_LAUNCH_SYSTEM_SETTINGS = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_SYSTEM_SETTINGS; - public static final int KEY_GESTURE_TYPE_TOGGLE_NOTIFICATION_PANEL = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__TOGGLE_NOTIFICATION_PANEL; - public static final int KEY_GESTURE_TYPE_TOGGLE_TASKBAR = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__TOGGLE_TASKBAR; - public static final int KEY_GESTURE_TYPE_TAKE_SCREENSHOT = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__TAKE_SCREENSHOT; - public static final int KEY_GESTURE_TYPE_OPEN_SHORTCUT_HELPER = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__OPEN_SHORTCUT_HELPER; - public static final int KEY_GESTURE_TYPE_BRIGHTNESS_UP = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__BRIGHTNESS_UP; - public static final int KEY_GESTURE_TYPE_BRIGHTNESS_DOWN = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__BRIGHTNESS_DOWN; - public static final int KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_UP = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__KEYBOARD_BACKLIGHT_UP; - public static final int KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_DOWN = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__KEYBOARD_BACKLIGHT_DOWN; - public static final int KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_TOGGLE = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__KEYBOARD_BACKLIGHT_TOGGLE; - public static final int KEY_GESTURE_TYPE_VOLUME_UP = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__VOLUME_UP; - public static final int KEY_GESTURE_TYPE_VOLUME_DOWN = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__VOLUME_DOWN; - public static final int KEY_GESTURE_TYPE_VOLUME_MUTE = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__VOLUME_MUTE; - public static final int KEY_GESTURE_TYPE_ALL_APPS = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__ALL_APPS; - public static final int KEY_GESTURE_TYPE_LAUNCH_SEARCH = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_SEARCH; - public static final int KEY_GESTURE_TYPE_LANGUAGE_SWITCH = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LANGUAGE_SWITCH; - public static final int KEY_GESTURE_TYPE_ACCESSIBILITY_ALL_APPS = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__ACCESSIBILITY_ALL_APPS; - public static final int KEY_GESTURE_TYPE_TOGGLE_CAPS_LOCK = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__TOGGLE_CAPS_LOCK; - public static final int KEY_GESTURE_TYPE_SYSTEM_MUTE = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__SYSTEM_MUTE; - public static final int KEY_GESTURE_TYPE_SPLIT_SCREEN_NAVIGATION = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__SPLIT_SCREEN_NAVIGATION; - public static final int KEY_GESTURE_TYPE_CHANGE_SPLITSCREEN_FOCUS = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__CHANGE_SPLITSCREEN_FOCUS; - public static final int KEY_GESTURE_TYPE_TRIGGER_BUG_REPORT = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__TRIGGER_BUG_REPORT; - public static final int KEY_GESTURE_TYPE_LOCK_SCREEN = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LOCK_SCREEN; - public static final int KEY_GESTURE_TYPE_OPEN_NOTES = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__OPEN_NOTES; - public static final int KEY_GESTURE_TYPE_TOGGLE_POWER = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__TOGGLE_POWER; - public static final int KEY_GESTURE_TYPE_SYSTEM_NAVIGATION = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__SYSTEM_NAVIGATION; - public static final int KEY_GESTURE_TYPE_SLEEP = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__SLEEP; - public static final int KEY_GESTURE_TYPE_WAKEUP = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__WAKEUP; - public static final int KEY_GESTURE_TYPE_MEDIA_KEY = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__MEDIA_KEY; - public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_BROWSER = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_BROWSER; - public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_EMAIL = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_EMAIL; - public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CONTACTS = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_CONTACTS; - public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALENDAR = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_CALENDAR; - public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALCULATOR = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_CALCULATOR; - public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MUSIC = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_MUSIC; - public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MAPS = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_MAPS; - public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MESSAGING = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_MESSAGING; - public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_GALLERY = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_GALLERY; - public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FILES = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_FILES; - public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_WEATHER = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_WEATHER; - public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FITNESS = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_FITNESS; - public static final int KEY_GESTURE_TYPE_LAUNCH_APPLICATION_BY_PACKAGE_NAME = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_APPLICATION_BY_PACKAGE_NAME; - public static final int KEY_GESTURE_TYPE_DESKTOP_MODE = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__DESKTOP_MODE; - public static final int KEY_GESTURE_TYPE_MULTI_WINDOW_NAVIGATION = - FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__MULTI_WINDOW_NAVIGATION; - - - - // Code below generated by codegen v1.0.23. - // - // DO NOT MODIFY! - // CHECKSTYLE:OFF Generated code - // - // To regenerate run: - // $ codegen $ANDROID_BUILD_TOP/frameworks/base/core/java/android/hardware/input/KeyGestureEvent.java - // - // To exclude the generated code from IntelliJ auto-formatting enable (one-time): - // Settings > Editor > Code Style > Formatter Control - //@formatter:off - + private AidlKeyGestureEvent mKeyGestureEvent; + + public static final int KEY_GESTURE_TYPE_UNSPECIFIED = 0; + public static final int KEY_GESTURE_TYPE_HOME = 1; + public static final int KEY_GESTURE_TYPE_RECENT_APPS = 2; + public static final int KEY_GESTURE_TYPE_BACK = 3; + public static final int KEY_GESTURE_TYPE_APP_SWITCH = 4; + public static final int KEY_GESTURE_TYPE_LAUNCH_ASSISTANT = 5; + public static final int KEY_GESTURE_TYPE_LAUNCH_VOICE_ASSISTANT = 6; + public static final int KEY_GESTURE_TYPE_LAUNCH_SYSTEM_SETTINGS = 7; + public static final int KEY_GESTURE_TYPE_TOGGLE_NOTIFICATION_PANEL = 8; + public static final int KEY_GESTURE_TYPE_TOGGLE_TASKBAR = 9; + public static final int KEY_GESTURE_TYPE_TAKE_SCREENSHOT = 10; + public static final int KEY_GESTURE_TYPE_OPEN_SHORTCUT_HELPER = 11; + public static final int KEY_GESTURE_TYPE_BRIGHTNESS_UP = 12; + public static final int KEY_GESTURE_TYPE_BRIGHTNESS_DOWN = 13; + public static final int KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_UP = 14; + public static final int KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_DOWN = 15; + public static final int KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_TOGGLE = 16; + public static final int KEY_GESTURE_TYPE_VOLUME_UP = 17; + public static final int KEY_GESTURE_TYPE_VOLUME_DOWN = 18; + public static final int KEY_GESTURE_TYPE_VOLUME_MUTE = 19; + public static final int KEY_GESTURE_TYPE_ALL_APPS = 20; + public static final int KEY_GESTURE_TYPE_LAUNCH_SEARCH = 21; + public static final int KEY_GESTURE_TYPE_LANGUAGE_SWITCH = 22; + public static final int KEY_GESTURE_TYPE_ACCESSIBILITY_ALL_APPS = 23; + public static final int KEY_GESTURE_TYPE_TOGGLE_CAPS_LOCK = 24; + public static final int KEY_GESTURE_TYPE_SYSTEM_MUTE = 25; + public static final int KEY_GESTURE_TYPE_SPLIT_SCREEN_NAVIGATION = 26; + public static final int KEY_GESTURE_TYPE_CHANGE_SPLITSCREEN_FOCUS = 27; + public static final int KEY_GESTURE_TYPE_TRIGGER_BUG_REPORT = 28; + public static final int KEY_GESTURE_TYPE_LOCK_SCREEN = 29; + public static final int KEY_GESTURE_TYPE_OPEN_NOTES = 30; + public static final int KEY_GESTURE_TYPE_TOGGLE_POWER = 31; + public static final int KEY_GESTURE_TYPE_SYSTEM_NAVIGATION = 32; + public static final int KEY_GESTURE_TYPE_SLEEP = 33; + public static final int KEY_GESTURE_TYPE_WAKEUP = 34; + public static final int KEY_GESTURE_TYPE_MEDIA_KEY = 35; + public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_BROWSER = 36; + public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_EMAIL = 37; + public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CONTACTS = 38; + public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALENDAR = 39; + public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALCULATOR = 40; + public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MUSIC = 41; + public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MAPS = 42; + public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MESSAGING = 43; + public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_GALLERY = 44; + public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FILES = 45; + public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_WEATHER = 46; + public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FITNESS = 47; + public static final int KEY_GESTURE_TYPE_LAUNCH_APPLICATION_BY_PACKAGE_NAME = 48; + public static final int KEY_GESTURE_TYPE_DESKTOP_MODE = 49; + public static final int KEY_GESTURE_TYPE_MULTI_WINDOW_NAVIGATION = 50; + + public static final int FLAG_CANCELLED = 1; + + // NOTE: Valid KeyGestureEvent streams: + // - GESTURE_START -> GESTURE_CANCEL + // - GESTURE_START -> GESTURE_COMPLETE + // - GESTURE_COMPLETE + + /** Key gesture started (e.g. Key down of the relevant key) */ + public static final int ACTION_GESTURE_START = 1; + /** Key gesture completed (e.g. Key up of the relevant key) */ + public static final int ACTION_GESTURE_COMPLETE = 2; @IntDef(prefix = "KEY_GESTURE_TYPE_", value = { - KEY_GESTURE_TYPE_UNSPECIFIED, - KEY_GESTURE_TYPE_HOME, - KEY_GESTURE_TYPE_RECENT_APPS, - KEY_GESTURE_TYPE_BACK, - KEY_GESTURE_TYPE_APP_SWITCH, - KEY_GESTURE_TYPE_LAUNCH_ASSISTANT, - KEY_GESTURE_TYPE_LAUNCH_VOICE_ASSISTANT, - KEY_GESTURE_TYPE_LAUNCH_SYSTEM_SETTINGS, - KEY_GESTURE_TYPE_TOGGLE_NOTIFICATION_PANEL, - KEY_GESTURE_TYPE_TOGGLE_TASKBAR, - KEY_GESTURE_TYPE_TAKE_SCREENSHOT, - KEY_GESTURE_TYPE_OPEN_SHORTCUT_HELPER, - KEY_GESTURE_TYPE_BRIGHTNESS_UP, - KEY_GESTURE_TYPE_BRIGHTNESS_DOWN, - KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_UP, - KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_DOWN, - KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_TOGGLE, - KEY_GESTURE_TYPE_VOLUME_UP, - KEY_GESTURE_TYPE_VOLUME_DOWN, - KEY_GESTURE_TYPE_VOLUME_MUTE, - KEY_GESTURE_TYPE_ALL_APPS, - KEY_GESTURE_TYPE_LAUNCH_SEARCH, - KEY_GESTURE_TYPE_LANGUAGE_SWITCH, - KEY_GESTURE_TYPE_ACCESSIBILITY_ALL_APPS, - KEY_GESTURE_TYPE_TOGGLE_CAPS_LOCK, - KEY_GESTURE_TYPE_SYSTEM_MUTE, - KEY_GESTURE_TYPE_SPLIT_SCREEN_NAVIGATION, - KEY_GESTURE_TYPE_CHANGE_SPLITSCREEN_FOCUS, - KEY_GESTURE_TYPE_TRIGGER_BUG_REPORT, - KEY_GESTURE_TYPE_LOCK_SCREEN, - KEY_GESTURE_TYPE_OPEN_NOTES, - KEY_GESTURE_TYPE_TOGGLE_POWER, - KEY_GESTURE_TYPE_SYSTEM_NAVIGATION, - KEY_GESTURE_TYPE_SLEEP, - KEY_GESTURE_TYPE_WAKEUP, - KEY_GESTURE_TYPE_MEDIA_KEY, - KEY_GESTURE_TYPE_LAUNCH_DEFAULT_BROWSER, - KEY_GESTURE_TYPE_LAUNCH_DEFAULT_EMAIL, - KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CONTACTS, - KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALENDAR, - KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALCULATOR, - KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MUSIC, - KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MAPS, - KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MESSAGING, - KEY_GESTURE_TYPE_LAUNCH_DEFAULT_GALLERY, - KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FILES, - KEY_GESTURE_TYPE_LAUNCH_DEFAULT_WEATHER, - KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FITNESS, - KEY_GESTURE_TYPE_LAUNCH_APPLICATION_BY_PACKAGE_NAME, - KEY_GESTURE_TYPE_DESKTOP_MODE, - KEY_GESTURE_TYPE_MULTI_WINDOW_NAVIGATION + KEY_GESTURE_TYPE_UNSPECIFIED, + KEY_GESTURE_TYPE_HOME, + KEY_GESTURE_TYPE_RECENT_APPS, + KEY_GESTURE_TYPE_BACK, + KEY_GESTURE_TYPE_APP_SWITCH, + KEY_GESTURE_TYPE_LAUNCH_ASSISTANT, + KEY_GESTURE_TYPE_LAUNCH_VOICE_ASSISTANT, + KEY_GESTURE_TYPE_LAUNCH_SYSTEM_SETTINGS, + KEY_GESTURE_TYPE_TOGGLE_NOTIFICATION_PANEL, + KEY_GESTURE_TYPE_TOGGLE_TASKBAR, + KEY_GESTURE_TYPE_TAKE_SCREENSHOT, + KEY_GESTURE_TYPE_OPEN_SHORTCUT_HELPER, + KEY_GESTURE_TYPE_BRIGHTNESS_UP, + KEY_GESTURE_TYPE_BRIGHTNESS_DOWN, + KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_UP, + KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_DOWN, + KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_TOGGLE, + KEY_GESTURE_TYPE_VOLUME_UP, + KEY_GESTURE_TYPE_VOLUME_DOWN, + KEY_GESTURE_TYPE_VOLUME_MUTE, + KEY_GESTURE_TYPE_ALL_APPS, + KEY_GESTURE_TYPE_LAUNCH_SEARCH, + KEY_GESTURE_TYPE_LANGUAGE_SWITCH, + KEY_GESTURE_TYPE_ACCESSIBILITY_ALL_APPS, + KEY_GESTURE_TYPE_TOGGLE_CAPS_LOCK, + KEY_GESTURE_TYPE_SYSTEM_MUTE, + KEY_GESTURE_TYPE_SPLIT_SCREEN_NAVIGATION, + KEY_GESTURE_TYPE_CHANGE_SPLITSCREEN_FOCUS, + KEY_GESTURE_TYPE_TRIGGER_BUG_REPORT, + KEY_GESTURE_TYPE_LOCK_SCREEN, + KEY_GESTURE_TYPE_OPEN_NOTES, + KEY_GESTURE_TYPE_TOGGLE_POWER, + KEY_GESTURE_TYPE_SYSTEM_NAVIGATION, + KEY_GESTURE_TYPE_SLEEP, + KEY_GESTURE_TYPE_WAKEUP, + KEY_GESTURE_TYPE_MEDIA_KEY, + KEY_GESTURE_TYPE_LAUNCH_DEFAULT_BROWSER, + KEY_GESTURE_TYPE_LAUNCH_DEFAULT_EMAIL, + KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CONTACTS, + KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALENDAR, + KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALCULATOR, + KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MUSIC, + KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MAPS, + KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MESSAGING, + KEY_GESTURE_TYPE_LAUNCH_DEFAULT_GALLERY, + KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FILES, + KEY_GESTURE_TYPE_LAUNCH_DEFAULT_WEATHER, + KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FITNESS, + KEY_GESTURE_TYPE_LAUNCH_APPLICATION_BY_PACKAGE_NAME, + KEY_GESTURE_TYPE_DESKTOP_MODE, + KEY_GESTURE_TYPE_MULTI_WINDOW_NAVIGATION, }) @Retention(RetentionPolicy.SOURCE) - @DataClass.Generated.Member - public @interface KeyGestureType {} + public @interface KeyGestureType { + } + + public KeyGestureEvent(@NonNull AidlKeyGestureEvent keyGestureEvent) { + this.mKeyGestureEvent = keyGestureEvent; + } + + /** + * Key gesture event builder used to create a KeyGestureEvent for tests in Java. + * + * @hide + */ + public static class Builder { + private int mDeviceId = KeyCharacterMap.VIRTUAL_KEYBOARD; + private int[] mKeycodes = new int[0]; + private int mModifierState = 0; + @KeyGestureType + private int mKeyGestureType = KeyGestureEvent.KEY_GESTURE_TYPE_UNSPECIFIED; + private int mAction = KeyGestureEvent.ACTION_GESTURE_COMPLETE; + private int mDisplayId = Display.DEFAULT_DISPLAY; + private int mFlags = 0; + + /** + * @see KeyGestureEvent#getDeviceId() + */ + public Builder setDeviceId(int deviceId) { + mDeviceId = deviceId; + return this; + } + + /** + * @see KeyGestureEvent#getKeycodes() + */ + public Builder setKeycodes(@NonNull int[] keycodes) { + mKeycodes = keycodes; + return this; + } + + /** + * @see KeyGestureEvent#getModifierState() + */ + public Builder setModifierState(int modifierState) { + mModifierState = modifierState; + return this; + } + + /** + * @see KeyGestureEvent#getKeyGestureType() + */ + public Builder setKeyGestureType(@KeyGestureEvent.KeyGestureType int keyGestureType) { + mKeyGestureType = keyGestureType; + return this; + } + + /** + * @see KeyGestureEvent#getAction() + */ + public Builder setAction(int action) { + mAction = action; + return this; + } + + /** + * @see KeyGestureEvent#getDisplayId() + */ + public Builder setDisplayId(int displayId) { + mDisplayId = displayId; + return this; + } + + /** + * @see KeyGestureEvent#getFlags() + */ + public Builder setFlags(int flags) { + mFlags = flags; + return this; + } + + /** + * Build {@link KeyGestureEvent} + */ + public KeyGestureEvent build() { + AidlKeyGestureEvent event = new AidlKeyGestureEvent(); + event.deviceId = mDeviceId; + event.keycodes = mKeycodes; + event.modifierState = mModifierState; + event.gestureType = mKeyGestureType; + event.action = mAction; + event.displayId = mDisplayId; + event.flags = mFlags; + return new KeyGestureEvent(event); + } + } + + public int getDeviceId() { + return mKeyGestureEvent.deviceId; + } + + public @NonNull int[] getKeycodes() { + return mKeyGestureEvent.keycodes; + } + + public int getModifierState() { + return mKeyGestureEvent.modifierState; + } + + public @KeyGestureType int getKeyGestureType() { + return mKeyGestureEvent.gestureType; + } + + public int getAction() { + return mKeyGestureEvent.action; + } + + public int getDisplayId() { + return mKeyGestureEvent.displayId; + } - @DataClass.Generated.Member - public static String keyGestureTypeToString(@KeyGestureType int value) { + public int getFlags() { + return mKeyGestureEvent.flags; + } + + public boolean isCancelled() { + return (mKeyGestureEvent.flags & FLAG_CANCELLED) != 0; + } + + @Override + public String toString() { + return "KeyGestureEvent { " + + "deviceId = " + mKeyGestureEvent.deviceId + ", " + + "keycodes = " + java.util.Arrays.toString(mKeyGestureEvent.keycodes) + ", " + + "modifierState = " + mKeyGestureEvent.modifierState + ", " + + "keyGestureType = " + keyGestureTypeToString(mKeyGestureEvent.gestureType) + ", " + + "action = " + mKeyGestureEvent.action + ", " + + "displayId = " + mKeyGestureEvent.displayId + ", " + + "flags = " + mKeyGestureEvent.flags + + " }"; + } + + @Override + public boolean equals(@Nullable Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + KeyGestureEvent that = (KeyGestureEvent) o; + return mKeyGestureEvent.deviceId == that.mKeyGestureEvent.deviceId + && java.util.Arrays.equals(mKeyGestureEvent.keycodes, that.mKeyGestureEvent.keycodes) + && mKeyGestureEvent.modifierState == that.mKeyGestureEvent.modifierState + && mKeyGestureEvent.gestureType == that.mKeyGestureEvent.gestureType + && mKeyGestureEvent.action == that.mKeyGestureEvent.action + && mKeyGestureEvent.displayId == that.mKeyGestureEvent.displayId + && mKeyGestureEvent.flags == that.mKeyGestureEvent.flags; + } + + @Override + public int hashCode() { + int _hash = 1; + _hash = 31 * _hash + mKeyGestureEvent.deviceId; + _hash = 31 * _hash + java.util.Arrays.hashCode(mKeyGestureEvent.keycodes); + _hash = 31 * _hash + mKeyGestureEvent.modifierState; + _hash = 31 * _hash + mKeyGestureEvent.gestureType; + _hash = 31 * _hash + mKeyGestureEvent.action; + _hash = 31 * _hash + mKeyGestureEvent.displayId; + _hash = 31 * _hash + mKeyGestureEvent.flags; + return _hash; + } + + /** + * Convert KeyGestureEvent type to corresponding log event got KeyboardSystemsEvent + */ + public static int keyGestureTypeToLogEvent(@KeyGestureType int value) { switch (value) { - case KEY_GESTURE_TYPE_UNSPECIFIED: - return "KEY_GESTURE_TYPE_UNSPECIFIED"; case KEY_GESTURE_TYPE_HOME: - return "KEY_GESTURE_TYPE_HOME"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__HOME; case KEY_GESTURE_TYPE_RECENT_APPS: - return "KEY_GESTURE_TYPE_RECENT_APPS"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__RECENT_APPS; case KEY_GESTURE_TYPE_BACK: - return "KEY_GESTURE_TYPE_BACK"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__BACK; case KEY_GESTURE_TYPE_APP_SWITCH: - return "KEY_GESTURE_TYPE_APP_SWITCH"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__APP_SWITCH; case KEY_GESTURE_TYPE_LAUNCH_ASSISTANT: - return "KEY_GESTURE_TYPE_LAUNCH_ASSISTANT"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_ASSISTANT; case KEY_GESTURE_TYPE_LAUNCH_VOICE_ASSISTANT: - return "KEY_GESTURE_TYPE_LAUNCH_VOICE_ASSISTANT"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_VOICE_ASSISTANT; case KEY_GESTURE_TYPE_LAUNCH_SYSTEM_SETTINGS: - return "KEY_GESTURE_TYPE_LAUNCH_SYSTEM_SETTINGS"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_SYSTEM_SETTINGS; case KEY_GESTURE_TYPE_TOGGLE_NOTIFICATION_PANEL: - return "KEY_GESTURE_TYPE_TOGGLE_NOTIFICATION_PANEL"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__TOGGLE_NOTIFICATION_PANEL; case KEY_GESTURE_TYPE_TOGGLE_TASKBAR: - return "KEY_GESTURE_TYPE_TOGGLE_TASKBAR"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__TOGGLE_TASKBAR; case KEY_GESTURE_TYPE_TAKE_SCREENSHOT: - return "KEY_GESTURE_TYPE_TAKE_SCREENSHOT"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__TAKE_SCREENSHOT; case KEY_GESTURE_TYPE_OPEN_SHORTCUT_HELPER: - return "KEY_GESTURE_TYPE_OPEN_SHORTCUT_HELPER"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__OPEN_SHORTCUT_HELPER; case KEY_GESTURE_TYPE_BRIGHTNESS_UP: - return "KEY_GESTURE_TYPE_BRIGHTNESS_UP"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__BRIGHTNESS_UP; case KEY_GESTURE_TYPE_BRIGHTNESS_DOWN: - return "KEY_GESTURE_TYPE_BRIGHTNESS_DOWN"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__BRIGHTNESS_DOWN; case KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_UP: - return "KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_UP"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__KEYBOARD_BACKLIGHT_UP; case KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_DOWN: - return "KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_DOWN"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__KEYBOARD_BACKLIGHT_DOWN; case KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_TOGGLE: - return "KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_TOGGLE"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__KEYBOARD_BACKLIGHT_TOGGLE; case KEY_GESTURE_TYPE_VOLUME_UP: - return "KEY_GESTURE_TYPE_VOLUME_UP"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__VOLUME_UP; case KEY_GESTURE_TYPE_VOLUME_DOWN: - return "KEY_GESTURE_TYPE_VOLUME_DOWN"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__VOLUME_DOWN; case KEY_GESTURE_TYPE_VOLUME_MUTE: - return "KEY_GESTURE_TYPE_VOLUME_MUTE"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__VOLUME_MUTE; case KEY_GESTURE_TYPE_ALL_APPS: - return "KEY_GESTURE_TYPE_ALL_APPS"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__ALL_APPS; case KEY_GESTURE_TYPE_LAUNCH_SEARCH: - return "KEY_GESTURE_TYPE_LAUNCH_SEARCH"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_SEARCH; case KEY_GESTURE_TYPE_LANGUAGE_SWITCH: - return "KEY_GESTURE_TYPE_LANGUAGE_SWITCH"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LANGUAGE_SWITCH; case KEY_GESTURE_TYPE_ACCESSIBILITY_ALL_APPS: - return "KEY_GESTURE_TYPE_ACCESSIBILITY_ALL_APPS"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__ACCESSIBILITY_ALL_APPS; case KEY_GESTURE_TYPE_TOGGLE_CAPS_LOCK: - return "KEY_GESTURE_TYPE_TOGGLE_CAPS_LOCK"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__TOGGLE_CAPS_LOCK; case KEY_GESTURE_TYPE_SYSTEM_MUTE: - return "KEY_GESTURE_TYPE_SYSTEM_MUTE"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__SYSTEM_MUTE; case KEY_GESTURE_TYPE_SPLIT_SCREEN_NAVIGATION: - return "KEY_GESTURE_TYPE_SPLIT_SCREEN_NAVIGATION"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__SPLIT_SCREEN_NAVIGATION; case KEY_GESTURE_TYPE_CHANGE_SPLITSCREEN_FOCUS: - return "KEY_GESTURE_TYPE_CHANGE_SPLITSCREEN_FOCUS"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__CHANGE_SPLITSCREEN_FOCUS; case KEY_GESTURE_TYPE_TRIGGER_BUG_REPORT: - return "KEY_GESTURE_TYPE_TRIGGER_BUG_REPORT"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__TRIGGER_BUG_REPORT; case KEY_GESTURE_TYPE_LOCK_SCREEN: - return "KEY_GESTURE_TYPE_LOCK_SCREEN"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LOCK_SCREEN; case KEY_GESTURE_TYPE_OPEN_NOTES: - return "KEY_GESTURE_TYPE_OPEN_NOTES"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__OPEN_NOTES; case KEY_GESTURE_TYPE_TOGGLE_POWER: - return "KEY_GESTURE_TYPE_TOGGLE_POWER"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__TOGGLE_POWER; case KEY_GESTURE_TYPE_SYSTEM_NAVIGATION: - return "KEY_GESTURE_TYPE_SYSTEM_NAVIGATION"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__SYSTEM_NAVIGATION; case KEY_GESTURE_TYPE_SLEEP: - return "KEY_GESTURE_TYPE_SLEEP"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__SLEEP; case KEY_GESTURE_TYPE_WAKEUP: - return "KEY_GESTURE_TYPE_WAKEUP"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__WAKEUP; case KEY_GESTURE_TYPE_MEDIA_KEY: - return "KEY_GESTURE_TYPE_MEDIA_KEY"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__MEDIA_KEY; case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_BROWSER: - return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_BROWSER"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_BROWSER; case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_EMAIL: - return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_EMAIL"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_EMAIL; case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CONTACTS: - return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CONTACTS"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_CONTACTS; case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALENDAR: - return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALENDAR"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_CALENDAR; case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALCULATOR: - return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALCULATOR"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_CALCULATOR; case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MUSIC: - return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MUSIC"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_MUSIC; case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MAPS: - return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MAPS"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_MAPS; case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MESSAGING: - return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MESSAGING"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_MESSAGING; case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_GALLERY: - return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_GALLERY"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_GALLERY; case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FILES: - return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FILES"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_FILES; case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_WEATHER: - return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_WEATHER"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_WEATHER; case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FITNESS: - return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FITNESS"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_FITNESS; case KEY_GESTURE_TYPE_LAUNCH_APPLICATION_BY_PACKAGE_NAME: - return "KEY_GESTURE_TYPE_LAUNCH_APPLICATION_BY_PACKAGE_NAME"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_APPLICATION_BY_PACKAGE_NAME; case KEY_GESTURE_TYPE_DESKTOP_MODE: - return "KEY_GESTURE_TYPE_DESKTOP_MODE"; + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__DESKTOP_MODE; case KEY_GESTURE_TYPE_MULTI_WINDOW_NAVIGATION: - return "KEY_GESTURE_TYPE_MULTI_WINDOW_NAVIGATION"; - default: return Integer.toHexString(value); + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__MULTI_WINDOW_NAVIGATION; + default: + return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__UNSPECIFIED; } } - @DataClass.Generated.Member - public KeyGestureEvent( - int deviceId, - @NonNull int[] keycodes, - int modifierState, - @KeyGestureType int keyGestureType) { - this.mDeviceId = deviceId; - this.mKeycodes = keycodes; - com.android.internal.util.AnnotationValidations.validate( - NonNull.class, null, mKeycodes); - this.mModifierState = modifierState; - this.mKeyGestureType = keyGestureType; - - if (!(mKeyGestureType == KEY_GESTURE_TYPE_UNSPECIFIED) - && !(mKeyGestureType == KEY_GESTURE_TYPE_HOME) - && !(mKeyGestureType == KEY_GESTURE_TYPE_RECENT_APPS) - && !(mKeyGestureType == KEY_GESTURE_TYPE_BACK) - && !(mKeyGestureType == KEY_GESTURE_TYPE_APP_SWITCH) - && !(mKeyGestureType == KEY_GESTURE_TYPE_LAUNCH_ASSISTANT) - && !(mKeyGestureType == KEY_GESTURE_TYPE_LAUNCH_VOICE_ASSISTANT) - && !(mKeyGestureType == KEY_GESTURE_TYPE_LAUNCH_SYSTEM_SETTINGS) - && !(mKeyGestureType == KEY_GESTURE_TYPE_TOGGLE_NOTIFICATION_PANEL) - && !(mKeyGestureType == KEY_GESTURE_TYPE_TOGGLE_TASKBAR) - && !(mKeyGestureType == KEY_GESTURE_TYPE_TAKE_SCREENSHOT) - && !(mKeyGestureType == KEY_GESTURE_TYPE_OPEN_SHORTCUT_HELPER) - && !(mKeyGestureType == KEY_GESTURE_TYPE_BRIGHTNESS_UP) - && !(mKeyGestureType == KEY_GESTURE_TYPE_BRIGHTNESS_DOWN) - && !(mKeyGestureType == KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_UP) - && !(mKeyGestureType == KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_DOWN) - && !(mKeyGestureType == KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_TOGGLE) - && !(mKeyGestureType == KEY_GESTURE_TYPE_VOLUME_UP) - && !(mKeyGestureType == KEY_GESTURE_TYPE_VOLUME_DOWN) - && !(mKeyGestureType == KEY_GESTURE_TYPE_VOLUME_MUTE) - && !(mKeyGestureType == KEY_GESTURE_TYPE_ALL_APPS) - && !(mKeyGestureType == KEY_GESTURE_TYPE_LAUNCH_SEARCH) - && !(mKeyGestureType == KEY_GESTURE_TYPE_LANGUAGE_SWITCH) - && !(mKeyGestureType == KEY_GESTURE_TYPE_ACCESSIBILITY_ALL_APPS) - && !(mKeyGestureType == KEY_GESTURE_TYPE_TOGGLE_CAPS_LOCK) - && !(mKeyGestureType == KEY_GESTURE_TYPE_SYSTEM_MUTE) - && !(mKeyGestureType == KEY_GESTURE_TYPE_SPLIT_SCREEN_NAVIGATION) - && !(mKeyGestureType == KEY_GESTURE_TYPE_CHANGE_SPLITSCREEN_FOCUS) - && !(mKeyGestureType == KEY_GESTURE_TYPE_TRIGGER_BUG_REPORT) - && !(mKeyGestureType == KEY_GESTURE_TYPE_LOCK_SCREEN) - && !(mKeyGestureType == KEY_GESTURE_TYPE_OPEN_NOTES) - && !(mKeyGestureType == KEY_GESTURE_TYPE_TOGGLE_POWER) - && !(mKeyGestureType == KEY_GESTURE_TYPE_SYSTEM_NAVIGATION) - && !(mKeyGestureType == KEY_GESTURE_TYPE_SLEEP) - && !(mKeyGestureType == KEY_GESTURE_TYPE_WAKEUP) - && !(mKeyGestureType == KEY_GESTURE_TYPE_MEDIA_KEY) - && !(mKeyGestureType == KEY_GESTURE_TYPE_LAUNCH_DEFAULT_BROWSER) - && !(mKeyGestureType == KEY_GESTURE_TYPE_LAUNCH_DEFAULT_EMAIL) - && !(mKeyGestureType == KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CONTACTS) - && !(mKeyGestureType == KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALENDAR) - && !(mKeyGestureType == KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALCULATOR) - && !(mKeyGestureType == KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MUSIC) - && !(mKeyGestureType == KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MAPS) - && !(mKeyGestureType == KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MESSAGING) - && !(mKeyGestureType == KEY_GESTURE_TYPE_LAUNCH_DEFAULT_GALLERY) - && !(mKeyGestureType == KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FILES) - && !(mKeyGestureType == KEY_GESTURE_TYPE_LAUNCH_DEFAULT_WEATHER) - && !(mKeyGestureType == KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FITNESS) - && !(mKeyGestureType == KEY_GESTURE_TYPE_LAUNCH_APPLICATION_BY_PACKAGE_NAME) - && !(mKeyGestureType == KEY_GESTURE_TYPE_DESKTOP_MODE) - && !(mKeyGestureType == KEY_GESTURE_TYPE_MULTI_WINDOW_NAVIGATION)) { - throw new java.lang.IllegalArgumentException( - "keyGestureType was " + mKeyGestureType + " but must be one of: " - + "KEY_GESTURE_TYPE_UNSPECIFIED(" + KEY_GESTURE_TYPE_UNSPECIFIED + "), " - + "KEY_GESTURE_TYPE_HOME(" + KEY_GESTURE_TYPE_HOME + "), " - + "KEY_GESTURE_TYPE_RECENT_APPS(" + KEY_GESTURE_TYPE_RECENT_APPS + "), " - + "KEY_GESTURE_TYPE_BACK(" + KEY_GESTURE_TYPE_BACK + "), " - + "KEY_GESTURE_TYPE_APP_SWITCH(" + KEY_GESTURE_TYPE_APP_SWITCH + "), " - + "KEY_GESTURE_TYPE_LAUNCH_ASSISTANT(" + KEY_GESTURE_TYPE_LAUNCH_ASSISTANT + "), " - + "KEY_GESTURE_TYPE_LAUNCH_VOICE_ASSISTANT(" + KEY_GESTURE_TYPE_LAUNCH_VOICE_ASSISTANT + "), " - + "KEY_GESTURE_TYPE_LAUNCH_SYSTEM_SETTINGS(" + KEY_GESTURE_TYPE_LAUNCH_SYSTEM_SETTINGS + "), " - + "KEY_GESTURE_TYPE_TOGGLE_NOTIFICATION_PANEL(" + KEY_GESTURE_TYPE_TOGGLE_NOTIFICATION_PANEL + "), " - + "KEY_GESTURE_TYPE_TOGGLE_TASKBAR(" + KEY_GESTURE_TYPE_TOGGLE_TASKBAR + "), " - + "KEY_GESTURE_TYPE_TAKE_SCREENSHOT(" + KEY_GESTURE_TYPE_TAKE_SCREENSHOT + "), " - + "KEY_GESTURE_TYPE_OPEN_SHORTCUT_HELPER(" + KEY_GESTURE_TYPE_OPEN_SHORTCUT_HELPER + "), " - + "KEY_GESTURE_TYPE_BRIGHTNESS_UP(" + KEY_GESTURE_TYPE_BRIGHTNESS_UP + "), " - + "KEY_GESTURE_TYPE_BRIGHTNESS_DOWN(" + KEY_GESTURE_TYPE_BRIGHTNESS_DOWN + "), " - + "KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_UP(" + KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_UP + "), " - + "KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_DOWN(" + KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_DOWN + "), " - + "KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_TOGGLE(" + KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_TOGGLE + "), " - + "KEY_GESTURE_TYPE_VOLUME_UP(" + KEY_GESTURE_TYPE_VOLUME_UP + "), " - + "KEY_GESTURE_TYPE_VOLUME_DOWN(" + KEY_GESTURE_TYPE_VOLUME_DOWN + "), " - + "KEY_GESTURE_TYPE_VOLUME_MUTE(" + KEY_GESTURE_TYPE_VOLUME_MUTE + "), " - + "KEY_GESTURE_TYPE_ALL_APPS(" + KEY_GESTURE_TYPE_ALL_APPS + "), " - + "KEY_GESTURE_TYPE_LAUNCH_SEARCH(" + KEY_GESTURE_TYPE_LAUNCH_SEARCH + "), " - + "KEY_GESTURE_TYPE_LANGUAGE_SWITCH(" + KEY_GESTURE_TYPE_LANGUAGE_SWITCH + "), " - + "KEY_GESTURE_TYPE_ACCESSIBILITY_ALL_APPS(" + KEY_GESTURE_TYPE_ACCESSIBILITY_ALL_APPS + "), " - + "KEY_GESTURE_TYPE_TOGGLE_CAPS_LOCK(" + KEY_GESTURE_TYPE_TOGGLE_CAPS_LOCK + "), " - + "KEY_GESTURE_TYPE_SYSTEM_MUTE(" + KEY_GESTURE_TYPE_SYSTEM_MUTE + "), " - + "KEY_GESTURE_TYPE_SPLIT_SCREEN_NAVIGATION(" + KEY_GESTURE_TYPE_SPLIT_SCREEN_NAVIGATION + "), " - + "KEY_GESTURE_TYPE_CHANGE_SPLITSCREEN_FOCUS(" + KEY_GESTURE_TYPE_CHANGE_SPLITSCREEN_FOCUS + "), " - + "KEY_GESTURE_TYPE_TRIGGER_BUG_REPORT(" + KEY_GESTURE_TYPE_TRIGGER_BUG_REPORT + "), " - + "KEY_GESTURE_TYPE_LOCK_SCREEN(" + KEY_GESTURE_TYPE_LOCK_SCREEN + "), " - + "KEY_GESTURE_TYPE_OPEN_NOTES(" + KEY_GESTURE_TYPE_OPEN_NOTES + "), " - + "KEY_GESTURE_TYPE_TOGGLE_POWER(" + KEY_GESTURE_TYPE_TOGGLE_POWER + "), " - + "KEY_GESTURE_TYPE_SYSTEM_NAVIGATION(" + KEY_GESTURE_TYPE_SYSTEM_NAVIGATION + "), " - + "KEY_GESTURE_TYPE_SLEEP(" + KEY_GESTURE_TYPE_SLEEP + "), " - + "KEY_GESTURE_TYPE_WAKEUP(" + KEY_GESTURE_TYPE_WAKEUP + "), " - + "KEY_GESTURE_TYPE_MEDIA_KEY(" + KEY_GESTURE_TYPE_MEDIA_KEY + "), " - + "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_BROWSER(" + KEY_GESTURE_TYPE_LAUNCH_DEFAULT_BROWSER + "), " - + "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_EMAIL(" + KEY_GESTURE_TYPE_LAUNCH_DEFAULT_EMAIL + "), " - + "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CONTACTS(" + KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CONTACTS + "), " - + "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALENDAR(" + KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALENDAR + "), " - + "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALCULATOR(" + KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALCULATOR + "), " - + "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MUSIC(" + KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MUSIC + "), " - + "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MAPS(" + KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MAPS + "), " - + "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MESSAGING(" + KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MESSAGING + "), " - + "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_GALLERY(" + KEY_GESTURE_TYPE_LAUNCH_DEFAULT_GALLERY + "), " - + "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FILES(" + KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FILES + "), " - + "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_WEATHER(" + KEY_GESTURE_TYPE_LAUNCH_DEFAULT_WEATHER + "), " - + "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FITNESS(" + KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FITNESS + "), " - + "KEY_GESTURE_TYPE_LAUNCH_APPLICATION_BY_PACKAGE_NAME(" + KEY_GESTURE_TYPE_LAUNCH_APPLICATION_BY_PACKAGE_NAME + "), " - + "KEY_GESTURE_TYPE_DESKTOP_MODE(" + KEY_GESTURE_TYPE_DESKTOP_MODE + "), " - + "KEY_GESTURE_TYPE_MULTI_WINDOW_NAVIGATION(" + KEY_GESTURE_TYPE_MULTI_WINDOW_NAVIGATION + ")"); + private static String keyGestureTypeToString(@KeyGestureType int value) { + switch (value) { + case KEY_GESTURE_TYPE_UNSPECIFIED: + return "KEY_GESTURE_TYPE_UNSPECIFIED"; + case KEY_GESTURE_TYPE_HOME: + return "KEY_GESTURE_TYPE_HOME"; + case KEY_GESTURE_TYPE_RECENT_APPS: + return "KEY_GESTURE_TYPE_RECENT_APPS"; + case KEY_GESTURE_TYPE_BACK: + return "KEY_GESTURE_TYPE_BACK"; + case KEY_GESTURE_TYPE_APP_SWITCH: + return "KEY_GESTURE_TYPE_APP_SWITCH"; + case KEY_GESTURE_TYPE_LAUNCH_ASSISTANT: + return "KEY_GESTURE_TYPE_LAUNCH_ASSISTANT"; + case KEY_GESTURE_TYPE_LAUNCH_VOICE_ASSISTANT: + return "KEY_GESTURE_TYPE_LAUNCH_VOICE_ASSISTANT"; + case KEY_GESTURE_TYPE_LAUNCH_SYSTEM_SETTINGS: + return "KEY_GESTURE_TYPE_LAUNCH_SYSTEM_SETTINGS"; + case KEY_GESTURE_TYPE_TOGGLE_NOTIFICATION_PANEL: + return "KEY_GESTURE_TYPE_TOGGLE_NOTIFICATION_PANEL"; + case KEY_GESTURE_TYPE_TOGGLE_TASKBAR: + return "KEY_GESTURE_TYPE_TOGGLE_TASKBAR"; + case KEY_GESTURE_TYPE_TAKE_SCREENSHOT: + return "KEY_GESTURE_TYPE_TAKE_SCREENSHOT"; + case KEY_GESTURE_TYPE_OPEN_SHORTCUT_HELPER: + return "KEY_GESTURE_TYPE_OPEN_SHORTCUT_HELPER"; + case KEY_GESTURE_TYPE_BRIGHTNESS_UP: + return "KEY_GESTURE_TYPE_BRIGHTNESS_UP"; + case KEY_GESTURE_TYPE_BRIGHTNESS_DOWN: + return "KEY_GESTURE_TYPE_BRIGHTNESS_DOWN"; + case KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_UP: + return "KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_UP"; + case KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_DOWN: + return "KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_DOWN"; + case KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_TOGGLE: + return "KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_TOGGLE"; + case KEY_GESTURE_TYPE_VOLUME_UP: + return "KEY_GESTURE_TYPE_VOLUME_UP"; + case KEY_GESTURE_TYPE_VOLUME_DOWN: + return "KEY_GESTURE_TYPE_VOLUME_DOWN"; + case KEY_GESTURE_TYPE_VOLUME_MUTE: + return "KEY_GESTURE_TYPE_VOLUME_MUTE"; + case KEY_GESTURE_TYPE_ALL_APPS: + return "KEY_GESTURE_TYPE_ALL_APPS"; + case KEY_GESTURE_TYPE_LAUNCH_SEARCH: + return "KEY_GESTURE_TYPE_LAUNCH_SEARCH"; + case KEY_GESTURE_TYPE_LANGUAGE_SWITCH: + return "KEY_GESTURE_TYPE_LANGUAGE_SWITCH"; + case KEY_GESTURE_TYPE_ACCESSIBILITY_ALL_APPS: + return "KEY_GESTURE_TYPE_ACCESSIBILITY_ALL_APPS"; + case KEY_GESTURE_TYPE_TOGGLE_CAPS_LOCK: + return "KEY_GESTURE_TYPE_TOGGLE_CAPS_LOCK"; + case KEY_GESTURE_TYPE_SYSTEM_MUTE: + return "KEY_GESTURE_TYPE_SYSTEM_MUTE"; + case KEY_GESTURE_TYPE_SPLIT_SCREEN_NAVIGATION: + return "KEY_GESTURE_TYPE_SPLIT_SCREEN_NAVIGATION"; + case KEY_GESTURE_TYPE_CHANGE_SPLITSCREEN_FOCUS: + return "KEY_GESTURE_TYPE_CHANGE_SPLITSCREEN_FOCUS"; + case KEY_GESTURE_TYPE_TRIGGER_BUG_REPORT: + return "KEY_GESTURE_TYPE_TRIGGER_BUG_REPORT"; + case KEY_GESTURE_TYPE_LOCK_SCREEN: + return "KEY_GESTURE_TYPE_LOCK_SCREEN"; + case KEY_GESTURE_TYPE_OPEN_NOTES: + return "KEY_GESTURE_TYPE_OPEN_NOTES"; + case KEY_GESTURE_TYPE_TOGGLE_POWER: + return "KEY_GESTURE_TYPE_TOGGLE_POWER"; + case KEY_GESTURE_TYPE_SYSTEM_NAVIGATION: + return "KEY_GESTURE_TYPE_SYSTEM_NAVIGATION"; + case KEY_GESTURE_TYPE_SLEEP: + return "KEY_GESTURE_TYPE_SLEEP"; + case KEY_GESTURE_TYPE_WAKEUP: + return "KEY_GESTURE_TYPE_WAKEUP"; + case KEY_GESTURE_TYPE_MEDIA_KEY: + return "KEY_GESTURE_TYPE_MEDIA_KEY"; + case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_BROWSER: + return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_BROWSER"; + case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_EMAIL: + return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_EMAIL"; + case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CONTACTS: + return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CONTACTS"; + case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALENDAR: + return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALENDAR"; + case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALCULATOR: + return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALCULATOR"; + case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MUSIC: + return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MUSIC"; + case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MAPS: + return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MAPS"; + case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MESSAGING: + return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MESSAGING"; + case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_GALLERY: + return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_GALLERY"; + case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FILES: + return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FILES"; + case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_WEATHER: + return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_WEATHER"; + case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FITNESS: + return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FITNESS"; + case KEY_GESTURE_TYPE_LAUNCH_APPLICATION_BY_PACKAGE_NAME: + return "KEY_GESTURE_TYPE_LAUNCH_APPLICATION_BY_PACKAGE_NAME"; + case KEY_GESTURE_TYPE_DESKTOP_MODE: + return "KEY_GESTURE_TYPE_DESKTOP_MODE"; + case KEY_GESTURE_TYPE_MULTI_WINDOW_NAVIGATION: + return "KEY_GESTURE_TYPE_MULTI_WINDOW_NAVIGATION"; + default: + return Integer.toHexString(value); } - - - // onConstructed(); // You can define this method to get a callback - } - - @DataClass.Generated.Member - public int getDeviceId() { - return mDeviceId; } - - @DataClass.Generated.Member - public @NonNull int[] getKeycodes() { - return mKeycodes; - } - - @DataClass.Generated.Member - public int getModifierState() { - return mModifierState; - } - - @DataClass.Generated.Member - public @KeyGestureType int getKeyGestureType() { - return mKeyGestureType; - } - - @Override - @DataClass.Generated.Member - public String toString() { - // You can override field toString logic by defining methods like: - // String fieldNameToString() { ... } - - return "KeyGestureEvent { " + - "deviceId = " + mDeviceId + ", " + - "keycodes = " + java.util.Arrays.toString(mKeycodes) + ", " + - "modifierState = " + mModifierState + ", " + - "keyGestureType = " + keyGestureTypeToString(mKeyGestureType) + - " }"; - } - - @Override - @DataClass.Generated.Member - public boolean equals(@Nullable Object o) { - // You can override field equality logic by defining either of the methods like: - // boolean fieldNameEquals(KeyGestureEvent other) { ... } - // boolean fieldNameEquals(FieldType otherValue) { ... } - - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - @SuppressWarnings("unchecked") - KeyGestureEvent that = (KeyGestureEvent) o; - //noinspection PointlessBooleanExpression - return true - && mDeviceId == that.mDeviceId - && java.util.Arrays.equals(mKeycodes, that.mKeycodes) - && mModifierState == that.mModifierState - && mKeyGestureType == that.mKeyGestureType; - } - - @Override - @DataClass.Generated.Member - public int hashCode() { - // You can override field hashCode logic by defining methods like: - // int fieldNameHashCode() { ... } - - int _hash = 1; - _hash = 31 * _hash + mDeviceId; - _hash = 31 * _hash + java.util.Arrays.hashCode(mKeycodes); - _hash = 31 * _hash + mModifierState; - _hash = 31 * _hash + mKeyGestureType; - return _hash; - } - - @DataClass.Generated( - time = 1723409092192L, - codegenVersion = "1.0.23", - sourceFile = "frameworks/base/core/java/android/hardware/input/KeyGestureEvent.java", - inputSignatures = "private final int mDeviceId\nprivate final @android.annotation.NonNull int[] mKeycodes\nprivate final int mModifierState\nprivate final @android.hardware.input.KeyGestureEvent.KeyGestureType int mKeyGestureType\npublic static final int KEY_GESTURE_TYPE_UNSPECIFIED\npublic static final int KEY_GESTURE_TYPE_HOME\npublic static final int KEY_GESTURE_TYPE_RECENT_APPS\npublic static final int KEY_GESTURE_TYPE_BACK\npublic static final int KEY_GESTURE_TYPE_APP_SWITCH\npublic static final int KEY_GESTURE_TYPE_LAUNCH_ASSISTANT\npublic static final int KEY_GESTURE_TYPE_LAUNCH_VOICE_ASSISTANT\npublic static final int KEY_GESTURE_TYPE_LAUNCH_SYSTEM_SETTINGS\npublic static final int KEY_GESTURE_TYPE_TOGGLE_NOTIFICATION_PANEL\npublic static final int KEY_GESTURE_TYPE_TOGGLE_TASKBAR\npublic static final int KEY_GESTURE_TYPE_TAKE_SCREENSHOT\npublic static final int KEY_GESTURE_TYPE_OPEN_SHORTCUT_HELPER\npublic static final int KEY_GESTURE_TYPE_BRIGHTNESS_UP\npublic static final int KEY_GESTURE_TYPE_BRIGHTNESS_DOWN\npublic static final int KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_UP\npublic static final int KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_DOWN\npublic static final int KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_TOGGLE\npublic static final int KEY_GESTURE_TYPE_VOLUME_UP\npublic static final int KEY_GESTURE_TYPE_VOLUME_DOWN\npublic static final int KEY_GESTURE_TYPE_VOLUME_MUTE\npublic static final int KEY_GESTURE_TYPE_ALL_APPS\npublic static final int KEY_GESTURE_TYPE_LAUNCH_SEARCH\npublic static final int KEY_GESTURE_TYPE_LANGUAGE_SWITCH\npublic static final int KEY_GESTURE_TYPE_ACCESSIBILITY_ALL_APPS\npublic static final int KEY_GESTURE_TYPE_TOGGLE_CAPS_LOCK\npublic static final int KEY_GESTURE_TYPE_SYSTEM_MUTE\npublic static final int KEY_GESTURE_TYPE_SPLIT_SCREEN_NAVIGATION\npublic static final int KEY_GESTURE_TYPE_CHANGE_SPLITSCREEN_FOCUS\npublic static final int KEY_GESTURE_TYPE_TRIGGER_BUG_REPORT\npublic static final int KEY_GESTURE_TYPE_LOCK_SCREEN\npublic static final int KEY_GESTURE_TYPE_OPEN_NOTES\npublic static final int KEY_GESTURE_TYPE_TOGGLE_POWER\npublic static final int KEY_GESTURE_TYPE_SYSTEM_NAVIGATION\npublic static final int KEY_GESTURE_TYPE_SLEEP\npublic static final int KEY_GESTURE_TYPE_WAKEUP\npublic static final int KEY_GESTURE_TYPE_MEDIA_KEY\npublic static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_BROWSER\npublic static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_EMAIL\npublic static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CONTACTS\npublic static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALENDAR\npublic static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALCULATOR\npublic static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MUSIC\npublic static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MAPS\npublic static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MESSAGING\npublic static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_GALLERY\npublic static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FILES\npublic static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_WEATHER\npublic static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FITNESS\npublic static final int KEY_GESTURE_TYPE_LAUNCH_APPLICATION_BY_PACKAGE_NAME\npublic static final int KEY_GESTURE_TYPE_DESKTOP_MODE\npublic static final int KEY_GESTURE_TYPE_MULTI_WINDOW_NAVIGATION\nclass KeyGestureEvent extends java.lang.Object implements []\n@com.android.internal.util.DataClass(genToString=true, genEqualsHashCode=true)") - @Deprecated - private void __metadata() {} - - - //@formatter:on - // End of generated code - } diff --git a/core/java/android/hardware/input/VirtualInputDeviceConfig.java b/core/java/android/hardware/input/VirtualInputDeviceConfig.java index a87980c34f2dd906ea1068c28d5e4d0b72750709..e8ef8cd11585bc28ff6dd813993b21b73545b166 100644 --- a/core/java/android/hardware/input/VirtualInputDeviceConfig.java +++ b/core/java/android/hardware/input/VirtualInputDeviceConfig.java @@ -57,7 +57,7 @@ public abstract class VirtualInputDeviceConfig { mVendorId = builder.mVendorId; mProductId = builder.mProductId; mAssociatedDisplayId = builder.mAssociatedDisplayId; - mInputDeviceName = Objects.requireNonNull(builder.mInputDeviceName); + mInputDeviceName = Objects.requireNonNull(builder.mInputDeviceName, "Missing device name"); if (mAssociatedDisplayId == Display.INVALID_DISPLAY) { throw new IllegalArgumentException( @@ -77,7 +77,7 @@ public abstract class VirtualInputDeviceConfig { mVendorId = in.readInt(); mProductId = in.readInt(); mAssociatedDisplayId = in.readInt(); - mInputDeviceName = Objects.requireNonNull(in.readString8()); + mInputDeviceName = Objects.requireNonNull(in.readString8(), "Missing device name"); } /** diff --git a/core/java/android/hardware/input/input_framework.aconfig b/core/java/android/hardware/input/input_framework.aconfig index fcd6c31d7d18924da6e6265b416e6b4fafe1f61e..4478592ae8a57622d09ac59c4b5beaccadc78c80 100644 --- a/core/java/android/hardware/input/input_framework.aconfig +++ b/core/java/android/hardware/input/input_framework.aconfig @@ -117,3 +117,10 @@ flag { description: "Allow configurable timeout before key repeat and repeat delay rate for key repeats" bug: "336585002" } + +flag { + name: "mouse_reverse_vertical_scrolling" + namespace: "input" + description: "Controls whether external mouse vertical scrolling can be reversed" + bug: "352598211" +} diff --git a/core/java/android/net/vcn/flags.aconfig b/core/java/android/net/vcn/flags.aconfig index d4d1ed22dd4eec244ed64660e55d66c64dc4e129..dcb363ccf53562a8e7f2a97ac54ccbba9ddaea47 100644 --- a/core/java/android/net/vcn/flags.aconfig +++ b/core/java/android/net/vcn/flags.aconfig @@ -55,14 +55,4 @@ flag{ metadata { purpose: PURPOSE_BUGFIX } -} - -flag{ - name: "allow_disable_ipsec_loss_detector" - namespace: "vcn" - description: "Allow disabling IPsec packet loss detector" - bug: "336638836" - metadata { - purpose: PURPOSE_BUGFIX - } } \ No newline at end of file diff --git a/core/java/android/os/AppZygote.java b/core/java/android/os/AppZygote.java index 07fbe4a04ff186d74efae40e748661fe3fcad778..0541a96e990ec60058606d7a81b21788aa8c8257 100644 --- a/core/java/android/os/AppZygote.java +++ b/core/java/android/os/AppZygote.java @@ -111,12 +111,15 @@ public class AppZygote { try { int runtimeFlags = Zygote.getMemorySafetyRuntimeFlagsForSecondaryZygote( mAppInfo, mProcessInfo); + + final int[] sharedAppGid = { + UserHandle.getSharedAppGid(UserHandle.getAppId(mAppInfo.uid)) }; mZygote = Process.ZYGOTE_PROCESS.startChildZygote( "com.android.internal.os.AppZygoteInit", mAppInfo.processName + "_zygote", mZygoteUid, mZygoteUid, - null, // gids + sharedAppGid, // Zygote gets access to shared app GID for profiles runtimeFlags, "app_zygote", // seInfo abi, // abi diff --git a/core/java/android/os/BatteryStats.java b/core/java/android/os/BatteryStats.java index c4d12d4336c6be3b1169cf63ac3c6d2b19e3d9ef..996a288ef59dc339f20805008551d50d35ca4aa1 100644 --- a/core/java/android/os/BatteryStats.java +++ b/core/java/android/os/BatteryStats.java @@ -2066,9 +2066,11 @@ public abstract class BatteryStats { public static final int EVENT_LONG_WAKE_LOCK = 0x0014; // Event for reporting change of some device states, triggered by a specific UID public static final int EVENT_STATE_CHANGE = 0x0015; + // Event for reporting change of screen states. + public static final int EVENT_DISPLAY_STATE_CHANGED = 0x0016; // Number of event types. - public static final int EVENT_COUNT = 0x0016; + public static final int EVENT_COUNT = 0x0017; // Mask to extract out only the type part of the event. public static final int EVENT_TYPE_MASK = ~(EVENT_FLAG_START|EVENT_FLAG_FINISH); @@ -3079,13 +3081,14 @@ public abstract class BatteryStats { public static final String[] HISTORY_EVENT_NAMES = new String[] { "null", "proc", "fg", "top", "sync", "wake_lock_in", "job", "user", "userfg", "conn", "active", "pkginst", "pkgunin", "alarm", "stats", "pkginactive", "pkgactive", - "tmpwhitelist", "screenwake", "wakeupap", "longwake", "state" + "tmpwhitelist", "screenwake", "wakeupap", "longwake", "state", + "display_state_changed" }; public static final String[] HISTORY_EVENT_CHECKIN_NAMES = new String[] { "Enl", "Epr", "Efg", "Etp", "Esy", "Ewl", "Ejb", "Eur", "Euf", "Ecn", "Eac", "Epi", "Epu", "Eal", "Est", "Eai", "Eaa", "Etw", - "Esw", "Ewa", "Elw", "Eec", "Esc" + "Esw", "Ewa", "Elw", "Eec", "Esc", "Eds" }; @FunctionalInterface diff --git a/core/java/android/os/Binder.java b/core/java/android/os/Binder.java index 4bc3dbedeb9448003837c502c0de161e7511fe16..97e9f34064ba92162c09631df440eac22c63807d 100644 --- a/core/java/android/os/Binder.java +++ b/core/java/android/os/Binder.java @@ -21,6 +21,8 @@ import android.annotation.Nullable; import android.annotation.SystemApi; import android.app.AppOpsManager; import android.compat.annotation.UnsupportedAppUsage; +import android.ravenwood.annotation.RavenwoodClassLoadHook; +import android.ravenwood.annotation.RavenwoodKeepWholeClass; import android.util.ExceptionUtils; import android.util.Log; import android.util.Slog; @@ -30,11 +32,9 @@ import com.android.internal.os.BinderCallHeavyHitterWatcher; import com.android.internal.os.BinderCallHeavyHitterWatcher.BinderCallHeavyHitterListener; import com.android.internal.os.BinderInternal; import com.android.internal.os.BinderInternal.CallSession; -import com.android.internal.os.SomeArgs; import com.android.internal.util.FastPrintWriter; import com.android.internal.util.FunctionalUtils.ThrowingRunnable; import com.android.internal.util.FunctionalUtils.ThrowingSupplier; -import com.android.internal.util.Preconditions; import dalvik.annotation.optimization.CriticalNative; @@ -48,7 +48,6 @@ import java.io.IOException; import java.io.PrintWriter; import java.lang.reflect.Modifier; import java.util.concurrent.atomic.AtomicReferenceArray; -import java.util.function.Supplier; /** * Base class for a remotable object, the core part of a lightweight @@ -82,6 +81,8 @@ import java.util.function.Supplier; * * @see IBinder */ +@RavenwoodKeepWholeClass +@RavenwoodClassLoadHook(RavenwoodClassLoadHook.LIBANDROID_LOADING_HOOK) public class Binder implements IBinder { /* * Set this flag to true to detect anonymous, local or member classes @@ -292,33 +293,6 @@ public class Binder implements IBinder { sWarnOnBlockingOnCurrentThread.set(sWarnOnBlocking); } - private static volatile ThreadLocal sIdentity$ravenwood; - - @android.ravenwood.annotation.RavenwoodKeepWholeClass - private static class IdentitySupplier implements Supplier { - @Override - public SomeArgs get() { - final SomeArgs args = SomeArgs.obtain(); - // Match IPCThreadState behavior - args.arg1 = Boolean.FALSE; - args.argi1 = android.os.Process.myUid(); - args.argi2 = android.os.Process.myPid(); - return args; - } - } - - /** @hide */ - @android.ravenwood.annotation.RavenwoodKeep - public static void init$ravenwood() { - sIdentity$ravenwood = ThreadLocal.withInitial(new IdentitySupplier()); - } - - /** @hide */ - @android.ravenwood.annotation.RavenwoodKeep - public static void reset$ravenwood() { - sIdentity$ravenwood = null; - } - /** * Raw native pointer to JavaBBinderHolder object. Owned by this Java object. Not null. */ @@ -346,14 +320,8 @@ public class Binder implements IBinder { * 0 for a synchronous call. */ @CriticalNative - @android.ravenwood.annotation.RavenwoodReplace public static final native int getCallingPid(); - /** @hide */ - public static final int getCallingPid$ravenwood() { - return Preconditions.requireNonNullViaRavenwoodRule(sIdentity$ravenwood).get().argi2; - } - /** * Return the Linux UID assigned to the process that sent you the * current transaction that is being processed. This UID can be used with @@ -362,14 +330,8 @@ public class Binder implements IBinder { * incoming transaction, then its own UID is returned. */ @CriticalNative - @android.ravenwood.annotation.RavenwoodReplace public static final native int getCallingUid(); - /** @hide */ - public static final int getCallingUid$ravenwood() { - return Preconditions.requireNonNullViaRavenwoodRule(sIdentity$ravenwood).get().argi1; - } - /** * Returns {@code true} if the current thread is currently executing an * incoming transaction. @@ -377,21 +339,13 @@ public class Binder implements IBinder { * @hide */ @CriticalNative - @android.ravenwood.annotation.RavenwoodReplace public static final native boolean isDirectlyHandlingTransactionNative(); - /** @hide */ - public static final boolean isDirectlyHandlingTransactionNative$ravenwood() { - // Ravenwood doesn't support IPC - return false; - } - private static boolean sIsHandlingBinderTransaction = false; /** * @hide */ - @android.ravenwood.annotation.RavenwoodKeep public static final boolean isDirectlyHandlingTransaction() { return sIsHandlingBinderTransaction || isDirectlyHandlingTransactionNative(); } @@ -400,7 +354,6 @@ public class Binder implements IBinder { * This is Test API which will be used to override output of isDirectlyHandlingTransactionNative * @hide */ - @android.ravenwood.annotation.RavenwoodKeep public static void setIsDirectlyHandlingTransactionOverride(boolean isInTransaction) { sIsHandlingBinderTransaction = isInTransaction; } @@ -412,15 +365,8 @@ public class Binder implements IBinder { * @hide */ @CriticalNative - @android.ravenwood.annotation.RavenwoodReplace private static native boolean hasExplicitIdentity(); - /** @hide */ - private static boolean hasExplicitIdentity$ravenwood() { - return Preconditions.requireNonNullViaRavenwoodRule(sIdentity$ravenwood).get().arg1 - == Boolean.TRUE; - } - /** * Return the Linux UID assigned to the process that sent the transaction * currently being processed. @@ -429,7 +375,6 @@ public class Binder implements IBinder { * executing an incoming transaction and the calling identity has not been * explicitly set with {@link #clearCallingIdentity()} */ - @android.ravenwood.annotation.RavenwoodKeep public static final int getCallingUidOrThrow() { if (!isDirectlyHandlingTransaction() && !hasExplicitIdentity()) { throw new IllegalStateException( @@ -491,26 +436,8 @@ public class Binder implements IBinder { * @see #restoreCallingIdentity(long) */ @CriticalNative - @android.ravenwood.annotation.RavenwoodReplace public static final native long clearCallingIdentity(); - /** @hide */ - public static final long clearCallingIdentity$ravenwood() { - final SomeArgs args = Preconditions.requireNonNullViaRavenwoodRule( - sIdentity$ravenwood).get(); - long res = ((long) args.argi1 << 32) | args.argi2; - if (args.arg1 == Boolean.TRUE) { - res |= (0x1 << 30); - } else { - res &= ~(0x1 << 30); - } - // Match IPCThreadState behavior - args.arg1 = Boolean.TRUE; - args.argi1 = android.os.Process.myUid(); - args.argi2 = android.os.Process.myPid(); - return res; - } - /** * Restore the identity of the incoming IPC on the current thread * back to a previously identity that was returned by {@link @@ -522,18 +449,8 @@ public class Binder implements IBinder { * @see #clearCallingIdentity */ @CriticalNative - @android.ravenwood.annotation.RavenwoodReplace public static final native void restoreCallingIdentity(long token); - /** @hide */ - public static final void restoreCallingIdentity$ravenwood(long token) { - final SomeArgs args = Preconditions.requireNonNullViaRavenwoodRule( - sIdentity$ravenwood).get(); - args.arg1 = ((token & (0x1 << 30)) != 0) ? Boolean.TRUE : Boolean.FALSE; - args.argi1 = (int) (token >> 32); - args.argi2 = (int) (token & ~(0x1 << 30)); - } - /** * Convenience method for running the provided action enclosed in * {@link #clearCallingIdentity}/{@link #restoreCallingIdentity}. @@ -708,16 +625,9 @@ public class Binder implements IBinder { * * @hide */ - @android.ravenwood.annotation.RavenwoodReplace @SystemApi(client = SystemApi.Client.PRIVILEGED_APPS) public final native void markVintfStability(); - /** @hide */ - private void markVintfStability$ravenwood() { - // This is not useful for Ravenwood which uses local binder. - // TODO(b/361785059): Use real native libbinder. - } - /** * Use a VINTF-stability binder w/o VINTF requirements. Should be called * on a binder before it is sent out of process. @@ -736,14 +646,8 @@ public class Binder implements IBinder { * in order to prevent the process from holding on to objects longer than * it needs to. */ - @android.ravenwood.annotation.RavenwoodReplace public static final native void flushPendingCommands(); - /** @hide */ - public static final void flushPendingCommands$ravenwood() { - // Ravenwood doesn't support IPC; ignored - } - /** * Add the calling thread to the IPC thread pool. This function does * not return until the current process is exiting. @@ -801,7 +705,6 @@ public class Binder implements IBinder { *

If you're creating a Binder token (a Binder object without an attached interface), * you should use {@link #Binder(String)} instead. */ - @android.ravenwood.annotation.RavenwoodKeep public Binder() { this(null); } @@ -818,12 +721,9 @@ public class Binder implements IBinder { * Instead of creating multiple tokens with the same descriptor, consider adding a suffix to * help identify them. */ - @android.ravenwood.annotation.RavenwoodKeep public Binder(@Nullable String descriptor) { mObject = getNativeBBinderHolder(); - if (mObject != 0L) { - NoImagePreloadHolder.sRegistry.registerNativeAllocation(this, mObject); - } + NoImagePreloadHolder.sRegistry.registerNativeAllocation(this, mObject); if (FIND_POTENTIAL_LEAKS) { final Class klass = getClass(); @@ -842,7 +742,6 @@ public class Binder implements IBinder { * will be implemented for you to return the given owner IInterface when * the corresponding descriptor is requested. */ - @android.ravenwood.annotation.RavenwoodKeep public void attachInterface(@Nullable IInterface owner, @Nullable String descriptor) { mOwner = owner; mDescriptor = descriptor; @@ -851,7 +750,6 @@ public class Binder implements IBinder { /** * Default implementation returns an empty interface name. */ - @android.ravenwood.annotation.RavenwoodKeep public @Nullable String getInterfaceDescriptor() { return mDescriptor; } @@ -860,7 +758,6 @@ public class Binder implements IBinder { * Default implementation always returns true -- if you got here, * the object is alive. */ - @android.ravenwood.annotation.RavenwoodKeep public boolean pingBinder() { return true; } @@ -871,7 +768,6 @@ public class Binder implements IBinder { * Note that if you're calling on a local binder, this always returns true * because your process is alive if you're calling it. */ - @android.ravenwood.annotation.RavenwoodKeep public boolean isBinderAlive() { return true; } @@ -881,7 +777,6 @@ public class Binder implements IBinder { * to return the associated {@link IInterface} if it matches the requested * descriptor. */ - @android.ravenwood.annotation.RavenwoodKeep public @Nullable IInterface queryLocalInterface(@NonNull String descriptor) { if (mDescriptor != null && mDescriptor.equals(descriptor)) { return mOwner; @@ -1080,7 +975,6 @@ public class Binder implements IBinder { * * @hide */ - @android.ravenwood.annotation.RavenwoodKeep public @Nullable String getTransactionName(int transactionCode) { return null; } @@ -1089,7 +983,6 @@ public class Binder implements IBinder { * @hide */ @VisibleForTesting - @android.ravenwood.annotation.RavenwoodKeep public final @Nullable String getTransactionTraceName(int transactionCode) { final boolean isInterfaceUserDefined = getMaxTransactionId() == 0; if (mTransactionTraceNames == null) { @@ -1127,7 +1020,6 @@ public class Binder implements IBinder { return transactionTraceName; } - @android.ravenwood.annotation.RavenwoodKeep private @NonNull String getSimpleDescriptor() { String descriptor = mDescriptor; if (descriptor == null) { @@ -1147,7 +1039,6 @@ public class Binder implements IBinder { * @return The highest user-defined transaction id of all transactions. * @hide */ - @android.ravenwood.annotation.RavenwoodKeep public int getMaxTransactionId() { return 0; } @@ -1359,14 +1250,12 @@ public class Binder implements IBinder { /** * Local implementation is a no-op. */ - @android.ravenwood.annotation.RavenwoodKeep public void linkToDeath(@NonNull DeathRecipient recipient, int flags) { } /** * Local implementation is a no-op. */ - @android.ravenwood.annotation.RavenwoodKeep public boolean unlinkToDeath(@NonNull DeathRecipient recipient, int flags) { return true; } @@ -1394,13 +1283,8 @@ public class Binder implements IBinder { } } - @android.ravenwood.annotation.RavenwoodReplace private static native long getNativeBBinderHolder(); - private static long getNativeBBinderHolder$ravenwood() { - return 0L; - } - /** * By default, we use the calling UID since we can always trust it. */ diff --git a/core/java/android/os/BugreportParams.java b/core/java/android/os/BugreportParams.java index f7b417337911bf061375690fa4fb55cd283578ed..93a8ed96b6759f24e432782382cf3534b043c47f 100644 --- a/core/java/android/os/BugreportParams.java +++ b/core/java/android/os/BugreportParams.java @@ -134,7 +134,6 @@ public final class BugreportParams { * The maximum value of supported bugreport mode. * @hide */ - @FlaggedApi(android.os.Flags.FLAG_BUGREPORT_MODE_MAX_VALUE) @TestApi public static final int BUGREPORT_MODE_MAX_VALUE = BUGREPORT_MODE_ONBOARDING; diff --git a/core/java/android/os/Build.java b/core/java/android/os/Build.java index 30d2dec8b4c4e66c45ad572e3fae7d3fa4178240..a8267d1c9d8cac4e17da1c67ad5cf1bb4153a0f7 100644 --- a/core/java/android/os/Build.java +++ b/core/java/android/os/Build.java @@ -17,6 +17,7 @@ package android.os; import android.Manifest; +import android.annotation.FlaggedApi; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.RequiresPermission; @@ -28,6 +29,7 @@ import android.app.Application; import android.compat.annotation.UnsupportedAppUsage; import android.content.Context; import android.ravenwood.annotation.RavenwoodKeepWholeClass; +import android.sdk.Flags; import android.sysprop.DeviceProperties; import android.sysprop.SocProperties; import android.sysprop.TelephonyProperties; @@ -399,11 +401,34 @@ public class Build { * device. This value never changes while a device is booted, but it may * increase when the hardware manufacturer provides an OTA update. *

+ * Together with {@link SDK_MINOR_INT}, this constant defines the + *

major.minor
version of Android.
SDK_INT
is + * increased and
SDK_MINOR_INT
is set to 0 on new Android + * dessert releases. Between these, Android may also release so called + * minor releases where
SDK_INT
remains unchanged and + *
SDK_MINOR_INT
is increased. Minor releases can add new + * APIs, and have stricter guarantees around backwards compatibility + * (e.g. no changes gated by
targetSdkVersion
) compared to + * major releases. + *

* Possible values are defined in {@link Build.VERSION_CODES}. */ public static final int SDK_INT = SystemProperties.getInt( "ro.build.version.sdk", 0); + /** + * The minor SDK version of the software currently running on this hardware + * device. This value never changes while a device is booted, but it may + * increase when the hardware manufacturer provides an OTA update. + *

+ * Together with {@link SDK_INT}, this constant defines the + *

major.minor
version of Android. See {@link SDK_INT} for + * more information. + */ + @FlaggedApi(Flags.FLAG_MAJOR_MINOR_VERSIONING_SCHEME) + public static final int SDK_MINOR_INT = SystemProperties.getInt( + "ro.build.version.sdk_minor", 0); + /** * The SDK version of the software that initially shipped on * this hardware device. It never changes during the lifetime diff --git a/core/java/android/os/IHintManager.aidl b/core/java/android/os/IHintManager.aidl index 360b2ac4f3ca548afa72c55a59260b9b0bfde522..73cdd5682f31fba7781abca6c9b362a0b6e3e5c3 100644 --- a/core/java/android/os/IHintManager.aidl +++ b/core/java/android/os/IHintManager.aidl @@ -33,7 +33,7 @@ interface IHintManager { * if creation is supported but fails. */ IHintSession createHintSessionWithConfig(in IBinder token, in int[] threadIds, - in long durationNanos, in SessionTag tag, out @nullable SessionConfig config); + in long durationNanos, in SessionTag tag, out SessionConfig config); /** * Get preferred rate limit in nanoseconds. @@ -48,6 +48,6 @@ interface IHintManager { * * Throws IllegalStateException if FMQ channel creation fails. */ - ChannelConfig getSessionChannel(in IBinder token); + @nullable ChannelConfig getSessionChannel(in IBinder token); oneway void closeSessionChannel(); } diff --git a/core/java/android/os/IpcDataCache.java b/core/java/android/os/IpcDataCache.java index bf44d65c40023a8f5725670c9e4c02039de09a60..0776cf405cfeb88dfaf9657dc6355599f848a4b3 100644 --- a/core/java/android/os/IpcDataCache.java +++ b/core/java/android/os/IpcDataCache.java @@ -16,6 +16,7 @@ package android.os; +import android.annotation.FlaggedApi; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.StringDef; @@ -551,13 +552,21 @@ public class IpcDataCache extends PropertyInvalidatedCache { Result apply(Query query) throws RemoteException; } + /** + * An interface suitable for a lambda expression instead of a QueryHandler bypassing the cache. + * @hide + */ + public interface BypassCall { + Boolean apply(Query query); + } + /** * This is a query handler that is created with a lambda expression that is invoked * every time the handler is called. The handler is specifically meant for services @@ -580,11 +589,54 @@ public class IpcDataCache extends PropertyInvalidatedCache computer) { - this(config, new SystemServerCallHandler<>(computer)); + public IpcDataCache(@NonNull Config config, @NonNull RemoteCall remoteCall) { + this(config, android.multiuser.Flags.cachingDevelopmentImprovements() ? + new QueryHandler() { + @Override + public Result apply(Query query) { + try { + return remoteCall.apply(query); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } + } : new SystemServerCallHandler<>(remoteCall)); + } + + + /** + * Create a cache using a config and a lambda expression. + * @param config The configuration for the cache. + * @param remoteCall The lambda expression that will be invoked to fetch the data. + * @param bypass The lambda expression that will be invoked to determine if the cache should be + * bypassed. + * @hide + */ + @FlaggedApi(android.multiuser.Flags.FLAG_CACHING_DEVELOPMENT_IMPROVEMENTS) + public IpcDataCache(@NonNull Config config, + @NonNull RemoteCall remoteCall, + @NonNull BypassCall bypass) { + this(config, new QueryHandler() { + @Override + public Result apply(Query query) { + try { + return remoteCall.apply(query); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } + + @Override + public boolean shouldBypassCache(Query query) { + return bypass.apply(query); + } + }); } } diff --git a/core/java/android/os/Parcel.java b/core/java/android/os/Parcel.java index 2ac2ae916e5893818dd4d59ba8c9656be2e809ba..f7285523c01a96b21addb2f9b623ffcb895f59bf 100644 --- a/core/java/android/os/Parcel.java +++ b/core/java/android/os/Parcel.java @@ -27,9 +27,8 @@ import android.annotation.SuppressLint; import android.annotation.TestApi; import android.app.AppOpsManager; import android.compat.annotation.UnsupportedAppUsage; +import android.ravenwood.annotation.RavenwoodClassLoadHook; import android.ravenwood.annotation.RavenwoodKeepWholeClass; -import android.ravenwood.annotation.RavenwoodRedirect; -import android.ravenwood.annotation.RavenwoodRedirectionClass; import android.ravenwood.annotation.RavenwoodReplace; import android.ravenwood.annotation.RavenwoodThrow; import android.text.TextUtils; @@ -234,7 +233,7 @@ import java.util.function.IntFunction; * {@link #readSparseArray(ClassLoader, Class)}. */ @RavenwoodKeepWholeClass -@RavenwoodRedirectionClass("Parcel_host") +@RavenwoodClassLoadHook(RavenwoodClassLoadHook.LIBANDROID_LOADING_HOOK) public final class Parcel { private static final boolean DEBUG_RECYCLE = false; @@ -387,148 +386,98 @@ public final class Parcel { private static final int SIZE_COMPLEX_TYPE = 1; @CriticalNative - @RavenwoodRedirect private static native void nativeMarkSensitive(long nativePtr); @FastNative - @RavenwoodThrow private static native void nativeMarkForBinder(long nativePtr, IBinder binder); @CriticalNative - @RavenwoodThrow private static native boolean nativeIsForRpc(long nativePtr); @CriticalNative - @RavenwoodRedirect private static native int nativeDataSize(long nativePtr); @CriticalNative - @RavenwoodRedirect private static native int nativeDataAvail(long nativePtr); @CriticalNative - @RavenwoodRedirect private static native int nativeDataPosition(long nativePtr); @CriticalNative - @RavenwoodRedirect private static native int nativeDataCapacity(long nativePtr); @FastNative - @RavenwoodRedirect private static native void nativeSetDataSize(long nativePtr, int size); @CriticalNative - @RavenwoodRedirect private static native void nativeSetDataPosition(long nativePtr, int pos); @FastNative - @RavenwoodRedirect private static native void nativeSetDataCapacity(long nativePtr, int size); @CriticalNative - @RavenwoodRedirect private static native boolean nativePushAllowFds(long nativePtr, boolean allowFds); @CriticalNative - @RavenwoodRedirect private static native void nativeRestoreAllowFds(long nativePtr, boolean lastValue); - @RavenwoodRedirect private static native void nativeWriteByteArray(long nativePtr, byte[] b, int offset, int len); - @RavenwoodRedirect private static native void nativeWriteBlob(long nativePtr, byte[] b, int offset, int len); @CriticalNative - @RavenwoodRedirect private static native int nativeWriteInt(long nativePtr, int val); @CriticalNative - @RavenwoodRedirect private static native int nativeWriteLong(long nativePtr, long val); @CriticalNative - @RavenwoodRedirect private static native int nativeWriteFloat(long nativePtr, float val); @CriticalNative - @RavenwoodRedirect private static native int nativeWriteDouble(long nativePtr, double val); - @RavenwoodThrow private static native void nativeSignalExceptionForError(int error); @FastNative - @RavenwoodRedirect private static native void nativeWriteString8(long nativePtr, String val); @FastNative - @RavenwoodRedirect private static native void nativeWriteString16(long nativePtr, String val); @FastNative - @RavenwoodThrow private static native void nativeWriteStrongBinder(long nativePtr, IBinder val); @FastNative - @RavenwoodRedirect private static native void nativeWriteFileDescriptor(long nativePtr, FileDescriptor val); - @RavenwoodRedirect private static native byte[] nativeCreateByteArray(long nativePtr); - @RavenwoodRedirect private static native boolean nativeReadByteArray(long nativePtr, byte[] dest, int destLen); - @RavenwoodRedirect private static native byte[] nativeReadBlob(long nativePtr); @CriticalNative - @RavenwoodRedirect private static native int nativeReadInt(long nativePtr); @CriticalNative - @RavenwoodRedirect private static native long nativeReadLong(long nativePtr); @CriticalNative - @RavenwoodRedirect private static native float nativeReadFloat(long nativePtr); @CriticalNative - @RavenwoodRedirect private static native double nativeReadDouble(long nativePtr); @FastNative - @RavenwoodRedirect private static native String nativeReadString8(long nativePtr); @FastNative - @RavenwoodRedirect private static native String nativeReadString16(long nativePtr); @FastNative - @RavenwoodThrow private static native IBinder nativeReadStrongBinder(long nativePtr); @FastNative - @RavenwoodRedirect private static native FileDescriptor nativeReadFileDescriptor(long nativePtr); - @RavenwoodRedirect private static native long nativeCreate(); - @RavenwoodRedirect private static native void nativeFreeBuffer(long nativePtr); - @RavenwoodRedirect private static native void nativeDestroy(long nativePtr); - @RavenwoodRedirect private static native byte[] nativeMarshall(long nativePtr); - @RavenwoodRedirect private static native void nativeUnmarshall( long nativePtr, byte[] data, int offset, int length); - @RavenwoodRedirect private static native int nativeCompareData(long thisNativePtr, long otherNativePtr); - @RavenwoodRedirect private static native boolean nativeCompareDataInRange( long ptrA, int offsetA, long ptrB, int offsetB, int length); - @RavenwoodRedirect private static native void nativeAppendFrom( long thisNativePtr, long otherNativePtr, int offset, int length); @CriticalNative - @RavenwoodRedirect private static native boolean nativeHasFileDescriptors(long nativePtr); - @RavenwoodRedirect private static native boolean nativeHasFileDescriptorsInRange( long nativePtr, int offset, int length); - @RavenwoodRedirect private static native boolean nativeHasBinders(long nativePtr); - @RavenwoodRedirect private static native boolean nativeHasBindersInRange( long nativePtr, int offset, int length); - @RavenwoodThrow private static native void nativeWriteInterfaceToken(long nativePtr, String interfaceName); - @RavenwoodThrow private static native void nativeEnforceInterface(long nativePtr, String interfaceName); @CriticalNative - @RavenwoodThrow private static native boolean nativeReplaceCallingWorkSourceUid( long nativePtr, int workSourceUid); @CriticalNative - @RavenwoodThrow private static native int nativeReadCallingWorkSourceUid(long nativePtr); /** Last time exception with a stack trace was written */ @@ -537,7 +486,6 @@ public final class Parcel { private static final int WRITE_EXCEPTION_STACK_TRACE_THRESHOLD_MS = 1000; @CriticalNative - @RavenwoodThrow private static native long nativeGetOpenAshmemSize(long nativePtr); public final static Parcelable.Creator STRING_CREATOR @@ -701,12 +649,10 @@ public final class Parcel { /** @hide */ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) - @RavenwoodThrow public static native long getGlobalAllocSize(); /** @hide */ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) - @RavenwoodThrow public static native long getGlobalAllocCount(); /** @@ -1298,6 +1244,7 @@ public final class Parcel { * @hide */ @UnsupportedAppUsage + @RavenwoodThrow(blockedBy = android.text.Spanned.class) public final void writeCharSequence(@Nullable CharSequence val) { TextUtils.writeToParcel(val, this, 0); } @@ -3037,7 +2984,7 @@ public final class Parcel { * @see #writeNoException * @see #readException */ - @RavenwoodReplace + @RavenwoodReplace(blockedBy = AppOpsManager.class) public final void writeException(@NonNull Exception e) { AppOpsManager.prefixParcelWithAppOpsIfNeeded(this); @@ -3076,10 +3023,15 @@ public final class Parcel { } } - /** @hide */ - public final void writeException$ravenwood(@NonNull Exception e) { - // Ravenwood doesn't support IPC, no transaction headers needed - writeInt(getExceptionCode(e)); + private void writeException$ravenwood(@NonNull Exception e) { + int code = getExceptionCode(e); + writeInt(code); + if (code == 0) { + if (e instanceof RuntimeException) { + throw (RuntimeException) e; + } + throw new RuntimeException(e); + } writeString(e.getMessage()); writeInt(0); } @@ -3137,7 +3089,7 @@ public final class Parcel { * @see #writeException * @see #readException */ - @RavenwoodReplace + @RavenwoodReplace(blockedBy = AppOpsManager.class) public final void writeNoException() { AppOpsManager.prefixParcelWithAppOpsIfNeeded(this); @@ -3168,9 +3120,7 @@ public final class Parcel { } } - /** @hide */ - public final void writeNoException$ravenwood() { - // Ravenwood doesn't support IPC, no transaction headers needed + private void writeNoException$ravenwood() { writeInt(0); } diff --git a/core/java/android/os/Process.java b/core/java/android/os/Process.java index 3b2041b0d50a58bd8c1db64335ae3b29dbd86cc3..346ee7ca4f871e6ca7e0bbf8211e4d6669993e68 100644 --- a/core/java/android/os/Process.java +++ b/core/java/android/os/Process.java @@ -589,6 +589,12 @@ public class Process { **/ public static final int THREAD_GROUP_RESTRICTED = 7; + /** + * Thread group for foreground apps in multi-window mode + * @hide + **/ + public static final int THREAD_GROUP_FOREGROUND_WINDOW = 8; + /** @hide */ public static final int SIGNAL_DEFAULT = 0; public static final int SIGNAL_QUIT = 3; diff --git a/core/java/android/os/StrictMode.java b/core/java/android/os/StrictMode.java index 50b73a9d3f6693ba5950473ef71e5cc6ad13e988..81dc46ecbd3aeaf001e382d73b0d5e868b556449 100644 --- a/core/java/android/os/StrictMode.java +++ b/core/java/android/os/StrictMode.java @@ -2605,10 +2605,15 @@ public final class StrictMode { * (Java) thread-local policy value. */ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) + @android.ravenwood.annotation.RavenwoodReplace private static void onBinderStrictModePolicyChange(@ThreadPolicyMask int newPolicy) { setBlockGuardPolicy(newPolicy); } + private static void onBinderStrictModePolicyChange$ravenwood(@ThreadPolicyMask int newPolicy) { + /* no-op */ + } + /** * A tracked, critical time span. (e.g. during an animation.) * diff --git a/core/java/android/os/SystemClock.java b/core/java/android/os/SystemClock.java index 0ed1ab6c8d725adeb84fb63c9d052294c5461b6b..4c9a02c1fc49d4fa1d3db3e8dc387b95067b3b85 100644 --- a/core/java/android/os/SystemClock.java +++ b/core/java/android/os/SystemClock.java @@ -109,6 +109,7 @@ public final class SystemClock { private static final String TAG = "SystemClock"; private static volatile IAlarmManager sIAlarmManager; + private static volatile ITimeDetectorService sITimeDetectorService; /** * Since {@code nanoTime()} is arbitrary, anchor our Ravenwood clocks against it. @@ -188,6 +189,14 @@ public final class SystemClock { return sIAlarmManager; } + private static ITimeDetectorService getITimeDetectorService() { + if (sITimeDetectorService == null) { + sITimeDetectorService = ITimeDetectorService.Stub + .asInterface(ServiceManager.getService(Context.TIME_DETECTOR_SERVICE)); + } + return sITimeDetectorService; + } + /** * Returns milliseconds since boot, not counting time spent in deep sleep. * @@ -313,15 +322,6 @@ public final class SystemClock { return System.nanoTime() / 1000L; } - /** - * @see #currentNetworkTimeMillis(ITimeDetectorService) - * @hide - */ - public static long currentNetworkTimeMillis() { - return currentNetworkTimeMillis(ITimeDetectorService.Stub - .asInterface(ServiceManager.getService(Context.TIME_DETECTOR_SERVICE))); - } - /** * Returns milliseconds since January 1, 1970 00:00:00.0 UTC, synchronized * using a remote network source outside the device. @@ -346,29 +346,29 @@ public final class SystemClock { * @throws DateTimeException when no network time can be provided. * @hide */ - public static long currentNetworkTimeMillis( - ITimeDetectorService timeDetectorService) { - if (timeDetectorService != null) { - UnixEpochTime time; - try { - time = timeDetectorService.latestNetworkTime(); - } catch (ParcelableException e) { - e.maybeRethrow(DateTimeException.class); - throw new RuntimeException(e); - } catch (RemoteException e) { - throw e.rethrowFromSystemServer(); - } - - if (time == null) { - // This is not expected. - throw new DateTimeException("Network based time is not available."); - } - long currentMillis = elapsedRealtime(); - long deltaMs = currentMillis - time.getElapsedRealtimeMillis(); - return time.getUnixEpochTimeMillis() + deltaMs; - } else { + public static long currentNetworkTimeMillis() { + ITimeDetectorService timeDetectorService = getITimeDetectorService(); + if (timeDetectorService == null) { throw new RuntimeException(new DeadSystemException()); } + + UnixEpochTime time; + try { + time = timeDetectorService.latestNetworkTime(); + } catch (ParcelableException e) { + e.maybeRethrow(DateTimeException.class); + throw new RuntimeException(e); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + if (time == null) { + // This is not expected. + throw new DateTimeException("Network based time is not available."); + } + + long currentMillis = elapsedRealtime(); + long deltaMs = currentMillis - time.getElapsedRealtimeMillis(); + return time.getUnixEpochTimeMillis() + deltaMs; } /** @@ -396,14 +396,9 @@ public final class SystemClock { */ public static @NonNull Clock currentNetworkTimeClock() { return new SimpleClock(ZoneOffset.UTC) { - private ITimeDetectorService mSvc; @Override public long millis() { - if (mSvc == null) { - mSvc = ITimeDetectorService.Stub - .asInterface(ServiceManager.getService(Context.TIME_DETECTOR_SERVICE)); - } - return SystemClock.currentNetworkTimeMillis(mSvc); + return SystemClock.currentNetworkTimeMillis(); } }; } diff --git a/core/java/android/os/SystemVibratorManager.java b/core/java/android/os/SystemVibratorManager.java index 58ab5b6fd7cab81ff9620b9d3a14efb78fc33549..cfbf5289931d940ac0bb4738764394b05869dc43 100644 --- a/core/java/android/os/SystemVibratorManager.java +++ b/core/java/android/os/SystemVibratorManager.java @@ -138,11 +138,14 @@ public class SystemVibratorManager extends VibratorManager { Log.w(TAG, "Failed to vibrate; no vibrator manager service."); return; } + Trace.traceBegin(Trace.TRACE_TAG_VIBRATOR, "vibrate, reason=" + reason); try { mService.vibrate(uid, mContext.getDeviceId(), opPkg, effect, attributes, reason, mToken); } catch (RemoteException e) { Log.w(TAG, "Failed to vibrate.", e); + } finally { + Trace.traceEnd(Trace.TRACE_TAG_VIBRATOR); } } @@ -152,11 +155,14 @@ public class SystemVibratorManager extends VibratorManager { Log.w(TAG, "Failed to perform haptic feedback; no vibrator manager service."); return; } + Trace.traceBegin(Trace.TRACE_TAG_VIBRATOR, "performHapticFeedback, reason=" + reason); try { mService.performHapticFeedback(mUid, mContext.getDeviceId(), mPackageName, constant, reason, flags, privFlags); } catch (RemoteException e) { Log.w(TAG, "Failed to perform haptic feedback.", e); + } finally { + Trace.traceEnd(Trace.TRACE_TAG_VIBRATOR); } } @@ -168,11 +174,15 @@ public class SystemVibratorManager extends VibratorManager { + " no vibrator manager service."); return; } + Trace.traceBegin(Trace.TRACE_TAG_VIBRATOR, + "performHapticFeedbackForInputDevice, reason=" + reason); try { mService.performHapticFeedbackForInputDevice(mUid, mContext.getDeviceId(), mPackageName, constant, inputDeviceId, inputSource, reason, flags, privFlags); } catch (RemoteException e) { Log.w(TAG, "Failed to perform haptic feedback for input device.", e); + } finally { + Trace.traceEnd(Trace.TRACE_TAG_VIBRATOR); } } diff --git a/core/java/android/os/UserManager.java b/core/java/android/os/UserManager.java index f1ec0e4e9bdc0db071ad836edd19823737213e5e..a4a7a983c44cc8768caa1abe0e0c2314cb021b5b 100644 --- a/core/java/android/os/UserManager.java +++ b/core/java/android/os/UserManager.java @@ -1539,10 +1539,19 @@ public class UserManager { * Specifies that the managed profile is not allowed to have unified lock screen challenge with * the primary user. * - *

Note: Setting this restriction alone doesn't automatically set a - * separate challenge. Profile owner can ask the user to set a new password using - * {@link DevicePolicyManager#ACTION_SET_NEW_PASSWORD} and verify it using - * {@link DevicePolicyManager#isUsingUnifiedPassword(ComponentName)}. + *

To ensure that there is a separate work profile password, IT admins + * have to: + *

    + *
  1. Enforce {@link UserManager#DISALLOW_UNIFIED_PASSWORD}
  2. + *
  3. Verify that {@link DevicePolicyManager#isUsingUnifiedPassword(ComponentName)} + * returns true. This indicates that there is now a separate work + * profile password configured and the set up is completed.
  4. + *
  5. In case {@link DevicePolicyManager#isUsingUnifiedPassword(ComponentName)} + * returns false, invoke {@link DevicePolicyManager#ACTION_SET_NEW_PASSWORD} + * intent and then verify again + * {@link DevicePolicyManager#isUsingUnifiedPassword(ComponentName)}.
  6. + *
+ *

* *

Can be set by profile owners. It only has effect on managed profiles when set by managed * profile owner. Has no effect on non-managed profiles or users. diff --git a/core/java/android/os/Vibrator.java b/core/java/android/os/Vibrator.java index 36233b7be2bb1c6db2fc31a2913073b0e12241f2..84325b7c28748d6efa608a1e883329e879399280 100644 --- a/core/java/android/os/Vibrator.java +++ b/core/java/android/os/Vibrator.java @@ -17,6 +17,7 @@ package android.os; import android.annotation.CallbackExecutor; +import android.annotation.FlaggedApi; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; @@ -30,6 +31,7 @@ import android.content.Context; import android.content.res.Resources; import android.hardware.vibrator.IVibrator; import android.media.AudioAttributes; +import android.os.vibrator.Flags; import android.os.vibrator.VibrationConfig; import android.os.vibrator.VibratorFrequencyProfile; import android.util.Log; @@ -312,6 +314,86 @@ public abstract class Vibrator { return getConfig().getHapticChannelMaximumAmplitude(); } + /** + * Checks whether the vibrator supports the creation of envelope effects. + * + * Envelope effects are defined by a series of frequency-amplitude pairs with specified + * transition times, allowing the creation of more complex vibration patterns. + * + * @return True if the hardware supports creating envelope effects, false otherwise. + */ + @FlaggedApi(Flags.FLAG_NORMALIZED_PWLE_EFFECTS) + public boolean areEnvelopeEffectsSupported() { + return getInfo().areEnvelopeEffectsSupported(); + } + + /** + * Retrieves the maximum duration supported for an envelope effect, in milliseconds. + * + *

If the device supports envelope effects (check {@link #areEnvelopeEffectsSupported}), + * this value will be positive. Devices with envelope effects capabilities guarantees a + * maximum duration equivalent to the product of {@link #getMaxEnvelopeEffectSize()} and + * {@link #getMaxEnvelopeEffectControlPointDurationMillis()}. If the device does not support + * envelope effects, this method will return 0. + * + * @return The maximum duration (in milliseconds) allowed for an envelope effect, or 0 if + * envelope effects are not supported. + */ + @FlaggedApi(Flags.FLAG_NORMALIZED_PWLE_EFFECTS) + public int getMaxEnvelopeEffectDurationMillis() { + return getInfo().getMaxEnvelopeEffectDurationMillis(); + } + + /** + * Retrieves the maximum number of control points supported for an envelope effect. + * + *

If the device supports envelope effects (check {@link #areEnvelopeEffectsSupported}), + * this value will be positive. Devices with envelope effects capabilities guarantee support + * for a minimum of 16 control points. If the device does not support envelope effects, + * this method will return 0. + * + * @return the maximum number of control points allowed for an envelope effect, or 0 if + * envelope effects are not supported. + */ + @FlaggedApi(Flags.FLAG_NORMALIZED_PWLE_EFFECTS) + public int getMaxEnvelopeEffectSize() { + return getInfo().getMaxEnvelopeEffectSize(); + } + + /** + * Retrieves the minimum duration supported between two control points within an envelope + * effect, in milliseconds. + * + *

If the device supports envelope effects (check {@link #areEnvelopeEffectsSupported}), + * this value will be positive. Devices with envelope effects capabilities guarantee + * support for durations down to at least 20 milliseconds. If the device does + * not support envelope effects, this method will return 0. + * + * @return the minimum allowed duration between two control points in an envelope effect, + * or 0 if envelope effects are not supported. + */ + @FlaggedApi(Flags.FLAG_NORMALIZED_PWLE_EFFECTS) + public int getMinEnvelopeEffectControlPointDurationMillis() { + return getInfo().getMinEnvelopeEffectControlPointDurationMillis(); + } + + /** + * Retrieves the maximum duration supported between two control points within an envelope + * effect, in milliseconds. + * + *

If the device supports envelope effects (check {@link #areEnvelopeEffectsSupported}), + * this value will be positive. Devices with envelope effects capabilities guarantee support + * for durations up to at least 1 second. If the device does not support envelope effects, + * this method will return 0. + * + * @return the maximum allowed duration between two control points in an envelope effect, + * or 0 if envelope effects are not supported. + */ + @FlaggedApi(Flags.FLAG_NORMALIZED_PWLE_EFFECTS) + public int getMaxEnvelopeEffectControlPointDurationMillis() { + return getInfo().getMaxEnvelopeEffectControlPointDurationMillis(); + } + /** * Configure an always-on haptics effect. * diff --git a/core/java/android/os/VibratorInfo.java b/core/java/android/os/VibratorInfo.java index 4f8c24d1f905abfa0da300f8aec3d2a12a2e9f76..5378295e3720befeffb6d26d7dfb65663dc180cc 100644 --- a/core/java/android/os/VibratorInfo.java +++ b/core/java/android/os/VibratorInfo.java @@ -60,6 +60,9 @@ public class VibratorInfo implements Parcelable { private final int mPwleSizeMax; private final float mQFactor; private final FrequencyProfile mFrequencyProfile; + private final int mMaxEnvelopeEffectSize; + private final int mMinEnvelopeEffectControlPointDurationMillis; + private final int mMaxEnvelopeEffectControlPointDurationMillis; VibratorInfo(Parcel in) { mId = in.readInt(); @@ -73,6 +76,9 @@ public class VibratorInfo implements Parcelable { mPwleSizeMax = in.readInt(); mQFactor = in.readFloat(); mFrequencyProfile = FrequencyProfile.CREATOR.createFromParcel(in); + mMaxEnvelopeEffectSize = in.readInt(); + mMinEnvelopeEffectControlPointDurationMillis = in.readInt(); + mMaxEnvelopeEffectControlPointDurationMillis = in.readInt(); } public VibratorInfo(int id, @NonNull VibratorInfo baseVibratorInfo) { @@ -80,7 +86,10 @@ public class VibratorInfo implements Parcelable { baseVibratorInfo.mSupportedBraking, baseVibratorInfo.mSupportedPrimitives, baseVibratorInfo.mPrimitiveDelayMax, baseVibratorInfo.mCompositionSizeMax, baseVibratorInfo.mPwlePrimitiveDurationMax, baseVibratorInfo.mPwleSizeMax, - baseVibratorInfo.mQFactor, baseVibratorInfo.mFrequencyProfile); + baseVibratorInfo.mQFactor, baseVibratorInfo.mFrequencyProfile, + baseVibratorInfo.mMaxEnvelopeEffectSize, + baseVibratorInfo.mMinEnvelopeEffectControlPointDurationMillis, + baseVibratorInfo.mMaxEnvelopeEffectControlPointDurationMillis); } /** @@ -111,7 +120,9 @@ public class VibratorInfo implements Parcelable { @Nullable SparseBooleanArray supportedBraking, @NonNull SparseIntArray supportedPrimitives, int primitiveDelayMax, int compositionSizeMax, int pwlePrimitiveDurationMax, int pwleSizeMax, - float qFactor, @NonNull FrequencyProfile frequencyProfile) { + float qFactor, @NonNull FrequencyProfile frequencyProfile, + int maxEnvelopeEffectSize, int minEnvelopeEffectControlPointDurationMillis, + int maxEnvelopeEffectControlPointDurationMillis) { Preconditions.checkNotNull(supportedPrimitives); Preconditions.checkNotNull(frequencyProfile); mId = id; @@ -125,6 +136,11 @@ public class VibratorInfo implements Parcelable { mPwleSizeMax = pwleSizeMax; mQFactor = qFactor; mFrequencyProfile = frequencyProfile; + mMaxEnvelopeEffectSize = maxEnvelopeEffectSize; + mMinEnvelopeEffectControlPointDurationMillis = + minEnvelopeEffectControlPointDurationMillis; + mMaxEnvelopeEffectControlPointDurationMillis = + maxEnvelopeEffectControlPointDurationMillis; } @Override @@ -140,6 +156,9 @@ public class VibratorInfo implements Parcelable { dest.writeInt(mPwleSizeMax); dest.writeFloat(mQFactor); mFrequencyProfile.writeToParcel(dest, flags); + dest.writeInt(mMaxEnvelopeEffectSize); + dest.writeInt(mMinEnvelopeEffectControlPointDurationMillis); + dest.writeInt(mMaxEnvelopeEffectControlPointDurationMillis); } @Override @@ -186,7 +205,12 @@ public class VibratorInfo implements Parcelable { && Objects.equals(mSupportedEffects, that.mSupportedEffects) && Objects.equals(mSupportedBraking, that.mSupportedBraking) && Objects.equals(mQFactor, that.mQFactor) - && Objects.equals(mFrequencyProfile, that.mFrequencyProfile); + && Objects.equals(mFrequencyProfile, that.mFrequencyProfile) + && mMaxEnvelopeEffectSize == that.mMaxEnvelopeEffectSize + && mMinEnvelopeEffectControlPointDurationMillis + == that.mMinEnvelopeEffectControlPointDurationMillis + && mMaxEnvelopeEffectControlPointDurationMillis + == that.mMaxEnvelopeEffectControlPointDurationMillis; } @Override @@ -215,6 +239,11 @@ public class VibratorInfo implements Parcelable { + ", mPwleSizeMax=" + mPwleSizeMax + ", mQFactor=" + mQFactor + ", mFrequencyProfile=" + mFrequencyProfile + + ", mMaxEnvelopeEffectSize=" + mMaxEnvelopeEffectSize + + ", mMinEnvelopeEffectControlPointDurationMillis=" + + mMinEnvelopeEffectControlPointDurationMillis + + ", mMaxEnvelopeEffectControlPointDurationMillis=" + + mMaxEnvelopeEffectControlPointDurationMillis + '}'; } @@ -234,6 +263,11 @@ public class VibratorInfo implements Parcelable { pw.println("pwleSizeMax = " + mPwleSizeMax); pw.println("q-factor = " + mQFactor); pw.println("frequencyProfile = " + mFrequencyProfile); + pw.println("mMaxEnvelopeEffectSize = " + mMaxEnvelopeEffectSize); + pw.println("mMinEnvelopeEffectControlPointDurationMillis = " + + mMinEnvelopeEffectControlPointDurationMillis); + pw.println("mMaxEnvelopeEffectControlPointDurationMillis = " + + mMaxEnvelopeEffectControlPointDurationMillis); pw.decreaseIndent(); } @@ -413,6 +447,58 @@ public class VibratorInfo implements Parcelable { return mPwleSizeMax; } + /** + * Check whether the vibrator supports the creation of envelope effects. + * + *

See {@link Vibrator#areEnvelopeEffectsSupported()} for more information on envelope + * effects. + * + * @return True if the hardware supports creating envelope effects, false otherwise. + */ + public boolean areEnvelopeEffectsSupported() { + return hasCapability(IVibrator.CAP_COMPOSE_PWLE_EFFECTS_V2); + } + + /** + * Calculates the maximum allowed duration for an envelope effect, measured in milliseconds. + * + * @return The maximum duration (in milliseconds) that an envelope effect can have. + */ + public int getMaxEnvelopeEffectDurationMillis() { + return mMaxEnvelopeEffectSize * mMaxEnvelopeEffectControlPointDurationMillis; + } + + /** + * Gets the maximum number of control points supported for envelope effects on this device. + * + * @return The maximum number of control points that can be used to define an envelope effect. + */ + public int getMaxEnvelopeEffectSize() { + return mMaxEnvelopeEffectSize; + } + + /** + * Gets the minimum allowed duration for any individual segment within an envelope effect, + * measured in milliseconds. + * + * @return The minimum duration (in milliseconds) that a segment within an envelope effect + * can have. + */ + public int getMinEnvelopeEffectControlPointDurationMillis() { + return mMinEnvelopeEffectControlPointDurationMillis; + } + + /** + * Gets the maximum allowed duration for any individual segment within an envelope effect, + * measured in milliseconds. + * + * @return The maximum duration (in milliseconds) that a segment within an envelope effect + * can have. + */ + public int getMaxEnvelopeEffectControlPointDurationMillis() { + return mMaxEnvelopeEffectControlPointDurationMillis; + } + /** * Check against this vibrator capabilities. * @@ -489,6 +575,9 @@ public class VibratorInfo implements Parcelable { if (hasCapability(IVibrator.CAP_EXTERNAL_AMPLITUDE_CONTROL)) { names.add("EXTERNAL_AMPLITUDE_CONTROL"); } + if (hasCapability(IVibrator.CAP_COMPOSE_PWLE_EFFECTS_V2)) { + names.add("CAP_COMPOSE_PWLE_EFFECTS_V2"); + } return names.toArray(new String[names.size()]); } @@ -745,6 +834,9 @@ public class VibratorInfo implements Parcelable { private float mQFactor = Float.NaN; private FrequencyProfile mFrequencyProfile = new FrequencyProfile(Float.NaN, Float.NaN, Float.NaN, null); + private int mMaxEnvelopeEffectSize; + private int mMinEnvelopeEffectControlPointDurationMillis; + private int mMaxEnvelopeEffectControlPointDurationMillis; /** A builder class for a {@link VibratorInfo}. */ public Builder(int id) { @@ -821,12 +913,46 @@ public class VibratorInfo implements Parcelable { return this; } + /** + * Configure the maximum number of control points supported for envelope effects on this + * device. + */ + @NonNull + public Builder setMaxEnvelopeEffectSize(int maxEnvelopeEffectSize) { + mMaxEnvelopeEffectSize = maxEnvelopeEffectSize; + return this; + } + + /** + * Configure the minimum supported duration for any individual segment within an + * envelope effect in milliseconds. + */ + @NonNull + public Builder setMinEnvelopeEffectControlPointDurationMillis( + int minEnvelopeEffectControlPointDuration) { + mMinEnvelopeEffectControlPointDurationMillis = minEnvelopeEffectControlPointDuration; + return this; + } + + /** + * Configure the maximum supported duration for any individual segment within an + * envelope effect in milliseconds. + */ + @NonNull + public Builder setMaxEnvelopeEffectControlPointDurationMillis( + int maxEnvelopeEffectControlPointDuration) { + mMaxEnvelopeEffectControlPointDurationMillis = maxEnvelopeEffectControlPointDuration; + return this; + } + /** Build the configured {@link VibratorInfo}. */ @NonNull public VibratorInfo build() { return new VibratorInfo(mId, mCapabilities, mSupportedEffects, mSupportedBraking, mSupportedPrimitives, mPrimitiveDelayMax, mCompositionSizeMax, - mPwlePrimitiveDurationMax, mPwleSizeMax, mQFactor, mFrequencyProfile); + mPwlePrimitiveDurationMax, mPwleSizeMax, mQFactor, mFrequencyProfile, + mMaxEnvelopeEffectSize, mMinEnvelopeEffectControlPointDurationMillis, + mMaxEnvelopeEffectControlPointDurationMillis); } /** diff --git a/core/java/android/os/flags.aconfig b/core/java/android/os/flags.aconfig index f026997bcc574aeeca651fafd3c77beaf892818a..39bd15c968d7a150a759de35bb6f11c80bcbf31b 100644 --- a/core/java/android/os/flags.aconfig +++ b/core/java/android/os/flags.aconfig @@ -51,14 +51,6 @@ flag { is_exported: true } -flag { - name: "bugreport_mode_max_value" - is_exported: true - namespace: "telephony" - description: "Introduce a constant as maximum value of bugreport mode." - bug: "305067125" -} - flag { name: "adpf_prefer_power_efficiency" is_exported: true @@ -114,14 +106,6 @@ flag { bug: "315894228" } -flag { - name: "adpf_fmq_eager_send" - namespace: "game" - description: "Guards the use of an eager-sending optimization in FMQ for low-latency messages" - is_fixed_read_only: true - bug: "315894228" -} - flag { name: "adpf_hwui_gpu" namespace: "game" diff --git a/core/java/android/os/vibrator/MultiVibratorInfo.java b/core/java/android/os/vibrator/MultiVibratorInfo.java index 5f32731292131cb14ca1a6f019588be69e37ee5b..9c2b9782ffb37bde6c4ff65e41ef54356aa7dc6b 100644 --- a/core/java/android/os/vibrator/MultiVibratorInfo.java +++ b/core/java/android/os/vibrator/MultiVibratorInfo.java @@ -59,7 +59,13 @@ public final class MultiVibratorInfo extends VibratorInfo { integerLimitIntersection(vibrators, VibratorInfo::getPwlePrimitiveDurationMax), integerLimitIntersection(vibrators, VibratorInfo::getPwleSizeMax), floatPropertyIntersection(vibrators, VibratorInfo::getQFactor), - mergedProfile); + mergedProfile, + integerLimitIntersection(vibrators, + VibratorInfo::getMaxEnvelopeEffectSize), + integerLimitIntersection(vibrators, + VibratorInfo::getMinEnvelopeEffectControlPointDurationMillis), + integerLimitIntersection(vibrators, + VibratorInfo::getMaxEnvelopeEffectControlPointDurationMillis)); } private static int capabilitiesIntersection(VibratorInfo[] infos, diff --git a/core/java/android/permission/flags.aconfig b/core/java/android/permission/flags.aconfig index 5174005a8175b940c5f1c1f3256a360b4f8fd0cf..b0791e36e124be72916c7b282be91766b4a06e1c 100644 --- a/core/java/android/permission/flags.aconfig +++ b/core/java/android/permission/flags.aconfig @@ -241,3 +241,27 @@ flag { purpose: PURPOSE_BUGFIX } } + +flag { + name: "wallet_role_icon_property_enabled" + is_exported: true + namespace: "wallet_integration" + description: "This flag is used to enabled the Wallet Role s icon fetching from manifest property" + bug: "349942654" +} + +flag { + name: "replace_body_sensors_permission_enabled" + is_exported: true + namespace: "android_health_services" + description: "This flag is used to enable replacing permission BODY_SENSORS(and BODY_SENSORS_BACKGROUND) with granular health permission READ_HEART_RATE(and READ_HEALTH_DATA_IN_BACKGROUND)" + bug: "364638912" +} + +flag { + name: "appop_access_tracking_logging_enabled" + is_fixed_read_only: true + namespace: "permissions" + description: "Enables logging of the AppOp access tracking" + bug: "365584286" +} diff --git a/core/java/android/provider/ContactsContract.java b/core/java/android/provider/ContactsContract.java index 7d00b80488a95f21e696d85b1cd09c0f90852cf9..f6eb4b52984ded963739afd3938cd2454510ea76 100644 --- a/core/java/android/provider/ContactsContract.java +++ b/core/java/android/provider/ContactsContract.java @@ -17,6 +17,8 @@ package android.provider; import android.accounts.Account; +import android.annotation.FlaggedApi; +import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.RequiresPermission; @@ -65,6 +67,8 @@ import com.google.android.collect.Sets; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -3014,6 +3018,173 @@ public final class ContactsContract { com.android.internal.R.string.config_rawContactsLocalAccountType)); } + /** + * Represents the state of the default account, and the actual {@link Account} if it's + * a cloud account. + * If the default account is set to {@link #DEFAULT_ACCOUNT_STATE_LOCAL} or + * {@link #DEFAULT_ACCOUNT_STATE_CLOUD}, new raw contacts requested for insertion + * without a + * specified {@link Account} will be saved in the default account. + * The default account can have one of the following four states: + *

    + *
  • {@link #DEFAULT_ACCOUNT_STATE_INVALID}: An invalid state that should not + * occur on the device.
  • + *
  • {@link #DEFAULT_ACCOUNT_STATE_NOT_SET}: The default account has not + * been set by the user.
  • + *
  • {@link #DEFAULT_ACCOUNT_STATE_LOCAL}: The default account is set to + * the local device storage. New raw contacts requested for insertion without a + * specified + * {@link Account} will be saved in a null or custom local account.
  • + *
  • {@link #DEFAULT_ACCOUNT_STATE_CLOUD}: The default account is set to a + * cloud-synced account. New raw contacts requested for insertion without a specified + * {@link Account} will be saved in {@link mCloudAccount}.
  • + *
+ */ + @FlaggedApi(Flags.FLAG_NEW_DEFAULT_ACCOUNT_API_ENABLED) + public static final class DefaultAccountAndState { + // The state of the default account. + /** A state that is invalid. */ + public static final int DEFAULT_ACCOUNT_STATE_INVALID = 0; + + /** A state indicating that default account is not set. */ + public static final int DEFAULT_ACCOUNT_STATE_NOT_SET = 1; + + /** A state indicating that default account is set to local device storage. */ + public static final int DEFAULT_ACCOUNT_STATE_LOCAL = 2; + + /** + * A state indicating that the default account is set as an account that is synced + * to the cloud. + */ + public static final int DEFAULT_ACCOUNT_STATE_CLOUD = 3; + + /** + * The state of the default account. One of + * {@link #DEFAULT_ACCOUNT_STATE_NOT_SET}, + * {@link #DEFAULT_ACCOUNT_STATE_LOCAL} or + * {@link #DEFAULT_ACCOUNT_STATE_CLOUD}. + */ + @DefaultAccountState + private final int mState; + + /** + * The account of the default account, when {@link mState} is { + * + * @link #STATE_SET_TO_CLOUD}, or null otherwise. + */ + private final Account mCloudAccount; + + /** + * Constructs a new `DefaultAccountAndState` instance with the specified state and + * cloud + * account. + * + * @param state The state of the default account. + * @param cloudAccount The cloud account associated with the default account, + * or null if the state is not + * {@link #DEFAULT_ACCOUNT_STATE_CLOUD}. + */ + public DefaultAccountAndState(@DefaultAccountState int state, + @Nullable Account cloudAccount) { + if (state == DEFAULT_ACCOUNT_STATE_INVALID) { + throw new IllegalArgumentException("Invalid default account state."); + } + if ((state == DEFAULT_ACCOUNT_STATE_CLOUD) != (cloudAccount != null)) { + throw new IllegalArgumentException( + "Default account can be set to cloud if and only if the cloud " + + "account is provided."); + } + this.mState = state; + this.mCloudAccount = + (mState == DEFAULT_ACCOUNT_STATE_CLOUD) ? cloudAccount : null; + } + + /** + * Creates a `DefaultAccountAndState` instance representing a default account + * that is set to the cloud and associated with the specified cloud account. + * + * @param cloudAccount The non-null cloud account associated with the default + * contacts + * account. + * @return A new `DefaultAccountAndState` instance with state + * {@link #DEFAULT_ACCOUNT_STATE_CLOUD}. + */ + public static @NonNull DefaultAccountAndState ofCloud( + @NonNull Account cloudAccount) { + return new DefaultAccountAndState(DEFAULT_ACCOUNT_STATE_CLOUD, cloudAccount); + } + + /** + * Creates a `DefaultAccountAndState` instance representing a default account + * that is set to the local device storage. + * + * @return A new `DefaultAccountAndState` instance with state + * {@link #DEFAULT_ACCOUNT_STATE_LOCAL}. + */ + public static @NonNull DefaultAccountAndState ofLocal() { + return new DefaultAccountAndState(DEFAULT_ACCOUNT_STATE_LOCAL, null); + } + + /** + * Creates a `DefaultAccountAndState` instance representing a default account + * that is not set. + * + * @return A new `DefaultAccountAndState` instance with state + * {@link #DEFAULT_ACCOUNT_STATE_NOT_SET}. + */ + public static @NonNull DefaultAccountAndState ofNotSet() { + return new DefaultAccountAndState(DEFAULT_ACCOUNT_STATE_NOT_SET, null); + } + + /** + * @return the state of the default account. + */ + @DefaultAccountState + public int getState() { + return mState; + } + + /** + * @return the cloud account associated with the default account, or null if the + * state is not {@link #DEFAULT_ACCOUNT_STATE_CLOUD}. + */ + public @Nullable Account getCloudAccount() { + return mCloudAccount; + } + + @Override + public int hashCode() { + return Objects.hash(mState, mCloudAccount); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DefaultAccountAndState that)) { + return false; + } + + return mState == that.mState && Objects.equals(mCloudAccount, + that.mCloudAccount); + } + + /** + * Annotation for all default account states. + * + * @hide + */ + @Retention(RetentionPolicy.SOURCE) + @IntDef( + prefix = {"DEFAULT_ACCOUNT_STATE_"}, + value = {DEFAULT_ACCOUNT_STATE_INVALID, + DEFAULT_ACCOUNT_STATE_NOT_SET, + DEFAULT_ACCOUNT_STATE_LOCAL, DEFAULT_ACCOUNT_STATE_CLOUD}) + public @interface DefaultAccountState { + } + } + /** * A sub-directory of a single raw contact that contains all of its * {@link ContactsContract.Data} rows. To access this directory @@ -8326,7 +8497,6 @@ public final class ContactsContract { public static final String RAW_CONTACT_ID2 = "raw_contact_id2"; } - /** * Class containing utility methods around determine what accounts in the ContactsProvider are * related to the SIM cards in the device. @@ -8839,6 +9009,30 @@ public final class ContactsContract { */ public static final String KEY_DEFAULT_ACCOUNT = "key_default_account"; + /** + * Key in the Bundle for the default account state. + * + * @hide + */ + public static final String KEY_DEFAULT_ACCOUNT_STATE = + "key_default_contacts_account_state"; + + /** + * The method to invoke in order to set the default account. + * + * @hide + */ + public static final String SET_DEFAULT_ACCOUNT_FOR_NEW_CONTACTS_METHOD = + "setDefaultAccountForNewContacts"; + + /** + * The method to invoke in order to query the default account. + * + * @hide + */ + public static final String QUERY_DEFAULT_ACCOUNT_FOR_NEW_CONTACTS_METHOD = + "queryDefaultAccountForNewContacts"; + /** * Get the account that is set as the default account for new contacts, which should be * initially selected when creating a new contact on contact management apps. diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 0a05f704f5239e85f9167ea64e75c37c2e275cff..e32625e1f7a88c0047e3327534e72927fd031923 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -17818,6 +17818,12 @@ public final class Settings { public static final String FORCE_NON_DEBUGGABLE_FINAL_BUILD_FOR_COMPAT = "force_non_debuggable_final_build_for_compat"; + /** + * Flag to enable the use of ApplicationInfo for getting not-launched status. + * + * @hide + */ + public static final String ENABLE_USE_APP_INFO_NOT_LAUNCHED = "use_app_info_not_launched"; /** * Current version of signed configuration applied. diff --git a/core/java/android/provider/flags.aconfig b/core/java/android/provider/flags.aconfig index 53d0c62ec2c59bbfb143de243ff1ea714bffa868..5c0f8737ca274b18cb61df5b8e2f22c74bf3e177 100644 --- a/core/java/android/provider/flags.aconfig +++ b/core/java/android/provider/flags.aconfig @@ -43,3 +43,12 @@ flag { purpose: PURPOSE_FEATURE } } + +# OWNER = liefuliu +flag { + name: "new_default_account_api_enabled" + is_exported: true + namespace: "contacts" + description: "Enable the new ContactsContract Default Account APIs." + bug: "359957527" +} diff --git a/core/java/android/security/attestationverification/AttestationVerificationManager.java b/core/java/android/security/attestationverification/AttestationVerificationManager.java index 2e61db1b932adfb3b9109301872c92640e581578..acf33822b3c739f39ac05f89b2d07fbe1e46cae3 100644 --- a/core/java/android/security/attestationverification/AttestationVerificationManager.java +++ b/core/java/android/security/attestationverification/AttestationVerificationManager.java @@ -322,6 +322,10 @@ public class AttestationVerificationManager { /** Requirements bundle parameter for a challenge. */ public static final String PARAM_CHALLENGE = "localbinding.challenge"; + /** Requirements bundle parameter for max patch level diff (int) for a peer device. **/ + public static final String PARAM_MAX_PATCH_LEVEL_DIFF_MONTHS = + "param_max_patch_level_diff_months"; + /** @hide */ public static String localBindingTypeToString(@LocalBindingType int localBindingType) { final String text; diff --git a/core/java/android/security/attestationverification/OWNERS b/core/java/android/security/attestationverification/OWNERS index 80a1f44b84277b871f2f9256548f422e268fb550..15b9ce4c76962914ea7ba1116b34a595652c833c 100644 --- a/core/java/android/security/attestationverification/OWNERS +++ b/core/java/android/security/attestationverification/OWNERS @@ -2,3 +2,6 @@ dlm@google.com dkrahn@google.com +guojing@google.com +raphk@google.com +yukl@google.com \ No newline at end of file diff --git a/core/java/android/security/flags.aconfig b/core/java/android/security/flags.aconfig index f6f0eff918e317876a9262ae5ff40a94683fe401..a86c961e6785f889a2e85623805a44dae804a3c1 100644 --- a/core/java/android/security/flags.aconfig +++ b/core/java/android/security/flags.aconfig @@ -99,3 +99,10 @@ flag { description: "Causes TrustManagerService to listen for credential attempts and ignore reports from upstream" bug: "323086607" } + +flag { + name: "clear_strong_auth_on_add_primary_credential" + namespace: "biometrics" + description: "Clear StrongAuth on add credential" + bug: "320817991" +} diff --git a/core/java/android/service/notification/ZenModeConfig.java b/core/java/android/service/notification/ZenModeConfig.java index 3d8d933cbbcc4220f1c26a21bb40d9ffc2a7256d..752f174504f257ce9aef20077ccfec7c8ecf48be 100644 --- a/core/java/android/service/notification/ZenModeConfig.java +++ b/core/java/android/service/notification/ZenModeConfig.java @@ -2553,7 +2553,7 @@ public class ZenModeConfig implements Parcelable { if (!Flags.modesUi()) { return manualRule != null; } - return manualRule != null && manualRule.isAutomaticActive(); + return manualRule != null && manualRule.isActive(); } public static class ZenRule implements Parcelable { @@ -2932,8 +2932,7 @@ public class ZenModeConfig implements Parcelable { } } - // TODO: b/363193376 - Rename to isActive() - public boolean isAutomaticActive() { + public boolean isActive() { if (Flags.modesApi() && Flags.modesUi()) { if (!enabled || getPkg() == null) { return false; @@ -3173,7 +3172,7 @@ public class ZenModeConfig implements Parcelable { // DND turned on by an automatic rule for (ZenRule automaticRule : config.automaticRules.values()) { - if (automaticRule.isAutomaticActive()) { + if (automaticRule.isActive()) { if (isValidEventConditionId(automaticRule.conditionId) || isValidScheduleConditionId(automaticRule.conditionId)) { // set text if automatic rule end time is the latest active rule end time diff --git a/core/java/android/service/notification/ZenModeDiff.java b/core/java/android/service/notification/ZenModeDiff.java index 05c2a9c26709381e5081c72a971773dad2ea581c..60a7d6b5a3befae3688f74adb5a2938deb3d451d 100644 --- a/core/java/android/service/notification/ZenModeDiff.java +++ b/core/java/android/service/notification/ZenModeDiff.java @@ -495,8 +495,8 @@ public class ZenModeDiff { // Even if added or removed, there may be a change in whether or not it was active. // This only applies to automatic rules. - boolean fromActive = from != null ? from.isAutomaticActive() : false; - boolean toActive = to != null ? to.isAutomaticActive() : false; + boolean fromActive = from != null ? from.isActive() : false; + boolean toActive = to != null ? to.isActive() : false; if (fromActive != toActive) { mActiveDiff = new FieldDiff<>(fromActive, toActive); } diff --git a/core/java/android/text/ClientFlags.java b/core/java/android/text/ClientFlags.java index bbe9cdbbce9fef9283d258f5878029d37c4b90a1..c2ad508c2b4424c4af2985e2e110a710bbadc4ae 100644 --- a/core/java/android/text/ClientFlags.java +++ b/core/java/android/text/ClientFlags.java @@ -27,27 +27,6 @@ import com.android.text.flags.Flags; * @hide */ public class ClientFlags { - /** - * @see Flags#noBreakNoHyphenationSpan() - */ - public static boolean noBreakNoHyphenationSpan() { - return TextFlags.isFeatureEnabled(Flags.FLAG_NO_BREAK_NO_HYPHENATION_SPAN); - } - - /** - * @see Flags#fixLineHeightForLocale() - */ - public static boolean fixLineHeightForLocale() { - return TextFlags.isFeatureEnabled(Flags.FLAG_FIX_LINE_HEIGHT_FOR_LOCALE); - } - - /** - * @see Flags#icuBidiMigration() - */ - public static boolean icuBidiMigration() { - return TextFlags.isFeatureEnabled(Flags.FLAG_ICU_BIDI_MIGRATION); - } - /** * @see Flags#fixMisalignedContextMenu() */ diff --git a/core/java/android/text/MeasuredParagraph.java b/core/java/android/text/MeasuredParagraph.java index 896e08726419031293e23cf4dcdf7cf328498d75..31a226341907f67ec82c3355aadd2a2a23b3c20c 100644 --- a/core/java/android/text/MeasuredParagraph.java +++ b/core/java/android/text/MeasuredParagraph.java @@ -42,8 +42,6 @@ import android.text.style.MetricAffectingSpan; import android.text.style.ReplacementSpan; import android.util.Pools.SynchronizedPool; -import com.android.text.flags.Flags; - import java.util.Arrays; /** @@ -201,14 +199,11 @@ public class MeasuredParagraph { * @hide */ public @Layout.Direction int getParagraphDir() { - if (Flags.icuBidiMigration()) { - if (mBidi == null) { - return Layout.DIR_LEFT_TO_RIGHT; - } - return (mBidi.getParaLevel() & 0x01) == 0 - ? Layout.DIR_LEFT_TO_RIGHT : Layout.DIR_RIGHT_TO_LEFT; + if (mBidi == null) { + return Layout.DIR_LEFT_TO_RIGHT; } - return mParaDir; + return (mBidi.getParaLevel() & 0x01) == 0 + ? Layout.DIR_LEFT_TO_RIGHT : Layout.DIR_RIGHT_TO_LEFT; } /** @@ -219,71 +214,62 @@ public class MeasuredParagraph { */ public Directions getDirections(@IntRange(from = 0) int start, // inclusive @IntRange(from = 0) int end) { // exclusive - if (Flags.icuBidiMigration()) { - // Easy case: mBidi == null means the text is all LTR and no bidi suppot is needed. - if (mBidi == null) { - return Layout.DIRS_ALL_LEFT_TO_RIGHT; - } + // Easy case: mBidi == null means the text is all LTR and no bidi suppot is needed. + if (mBidi == null) { + return Layout.DIRS_ALL_LEFT_TO_RIGHT; + } - // Easy case: If the original text only contains single directionality run, the - // substring is only single run. - if (start == end) { - if ((mBidi.getParaLevel() & 0x01) == 0) { - return Layout.DIRS_ALL_LEFT_TO_RIGHT; - } else { - return Layout.DIRS_ALL_RIGHT_TO_LEFT; - } + // Easy case: If the original text only contains single directionality run, the + // substring is only single run. + if (start == end) { + if ((mBidi.getParaLevel() & 0x01) == 0) { + return Layout.DIRS_ALL_LEFT_TO_RIGHT; + } else { + return Layout.DIRS_ALL_RIGHT_TO_LEFT; } + } - // Okay, now we need to generate the line instance. - Bidi bidi = mBidi.createLineBidi(start, end); - - // Easy case: If the line instance only contains single directionality run, no need - // to reorder visually. - if (bidi.getRunCount() == 1) { - if (bidi.getRunLevel(0) == 1) { - return Layout.DIRS_ALL_RIGHT_TO_LEFT; - } else if (bidi.getRunLevel(0) == 0) { - return Layout.DIRS_ALL_LEFT_TO_RIGHT; - } else { - return new Directions(new int[] { - 0, bidi.getRunLevel(0) << Layout.RUN_LEVEL_SHIFT | (end - start)}); - } - } + // Okay, now we need to generate the line instance. + Bidi bidi = mBidi.createLineBidi(start, end); - // Reorder directionality run visually. - byte[] levels = new byte[bidi.getRunCount()]; - for (int i = 0; i < bidi.getRunCount(); ++i) { - levels[i] = (byte) bidi.getRunLevel(i); + // Easy case: If the line instance only contains single directionality run, no need + // to reorder visually. + if (bidi.getRunCount() == 1) { + if (bidi.getRunLevel(0) == 1) { + return Layout.DIRS_ALL_RIGHT_TO_LEFT; + } else if (bidi.getRunLevel(0) == 0) { + return Layout.DIRS_ALL_LEFT_TO_RIGHT; + } else { + return new Directions(new int[] { + 0, bidi.getRunLevel(0) << Layout.RUN_LEVEL_SHIFT | (end - start)}); } - int[] visualOrders = Bidi.reorderVisual(levels); - - int[] dirs = new int[bidi.getRunCount() * 2]; - for (int i = 0; i < bidi.getRunCount(); ++i) { - int vIndex; - if ((mBidi.getBaseLevel() & 0x01) == 1) { - // For the historical reasons, if the base directionality is RTL, the Android - // draws from the right, i.e. the visually reordered run needs to be reversed. - vIndex = visualOrders[bidi.getRunCount() - i - 1]; - } else { - vIndex = visualOrders[i]; - } + } - // Special packing of dire - dirs[i * 2] = bidi.getRunStart(vIndex); - dirs[i * 2 + 1] = bidi.getRunLevel(vIndex) << Layout.RUN_LEVEL_SHIFT - | (bidi.getRunLimit(vIndex) - dirs[i * 2]); + // Reorder directionality run visually. + byte[] levels = new byte[bidi.getRunCount()]; + for (int i = 0; i < bidi.getRunCount(); ++i) { + levels[i] = (byte) bidi.getRunLevel(i); + } + int[] visualOrders = Bidi.reorderVisual(levels); + + int[] dirs = new int[bidi.getRunCount() * 2]; + for (int i = 0; i < bidi.getRunCount(); ++i) { + int vIndex; + if ((mBidi.getBaseLevel() & 0x01) == 1) { + // For the historical reasons, if the base directionality is RTL, the Android + // draws from the right, i.e. the visually reordered run needs to be reversed. + vIndex = visualOrders[bidi.getRunCount() - i - 1]; + } else { + vIndex = visualOrders[i]; } - return new Directions(dirs); - } - if (mLtrWithoutBidi) { - return Layout.DIRS_ALL_LEFT_TO_RIGHT; + // Special packing of dire + dirs[i * 2] = bidi.getRunStart(vIndex); + dirs[i * 2 + 1] = bidi.getRunLevel(vIndex) << Layout.RUN_LEVEL_SHIFT + | (bidi.getRunLimit(vIndex) - dirs[i * 2]); } - final int length = end - start; - return AndroidBidi.directions(mParaDir, mLevels.getRawArray(), start, mCopiedBuffer, start, - length); + return new Directions(dirs); } /** @@ -681,84 +667,56 @@ public class MeasuredParagraph { } } - if (Flags.icuBidiMigration()) { - if ((textDir == TextDirectionHeuristics.LTR - || textDir == TextDirectionHeuristics.FIRSTSTRONG_LTR - || textDir == TextDirectionHeuristics.ANYRTL_LTR) - && TextUtils.doesNotNeedBidi(mCopiedBuffer, 0, mTextLength)) { - mLevels.clear(); - mLtrWithoutBidi = true; - return; - } - final int bidiRequest; - if (textDir == TextDirectionHeuristics.LTR) { - bidiRequest = Bidi.LTR; - } else if (textDir == TextDirectionHeuristics.RTL) { - bidiRequest = Bidi.RTL; - } else if (textDir == TextDirectionHeuristics.FIRSTSTRONG_LTR) { - bidiRequest = Bidi.LEVEL_DEFAULT_LTR; - } else if (textDir == TextDirectionHeuristics.FIRSTSTRONG_RTL) { - bidiRequest = Bidi.LEVEL_DEFAULT_RTL; - } else { - final boolean isRtl = textDir.isRtl(mCopiedBuffer, 0, mTextLength); - bidiRequest = isRtl ? Bidi.RTL : Bidi.LTR; - } - mBidi = new Bidi(mCopiedBuffer, 0, null, 0, mCopiedBuffer.length, bidiRequest); - - if (mCopiedBuffer.length > 0 - && mBidi.getParagraphIndex(mCopiedBuffer.length - 1) != 0) { - // Historically, the MeasuredParagraph does not treat the CR letters as paragraph - // breaker but ICU BiDi treats it as paragraph breaker. In the MeasureParagraph, - // the given range always represents a single paragraph, so if the BiDi object has - // multiple paragraph, it should contains a CR letters in the text. Using CR is not - // common in Android and also it should not penalize the easy case, e.g. all LTR, - // check the paragraph count here and replace the CR letters and re-calculate - // BiDi again. - for (int i = 0; i < mTextLength; ++i) { - if (Character.isSurrogate(mCopiedBuffer[i])) { - // All block separators are in BMP. - continue; - } - if (UCharacter.getDirection(mCopiedBuffer[i]) - == UCharacterDirection.BLOCK_SEPARATOR) { - mCopiedBuffer[i] = OBJECT_REPLACEMENT_CHARACTER; - } - } - mBidi = new Bidi(mCopiedBuffer, 0, null, 0, mCopiedBuffer.length, bidiRequest); - } - mLevels.resize(mTextLength); - byte[] rawArray = mLevels.getRawArray(); - for (int i = 0; i < mTextLength; ++i) { - rawArray[i] = mBidi.getLevelAt(i); - } - mLtrWithoutBidi = false; - return; - } if ((textDir == TextDirectionHeuristics.LTR || textDir == TextDirectionHeuristics.FIRSTSTRONG_LTR || textDir == TextDirectionHeuristics.ANYRTL_LTR) && TextUtils.doesNotNeedBidi(mCopiedBuffer, 0, mTextLength)) { mLevels.clear(); - mParaDir = Layout.DIR_LEFT_TO_RIGHT; mLtrWithoutBidi = true; + return; + } + final int bidiRequest; + if (textDir == TextDirectionHeuristics.LTR) { + bidiRequest = Bidi.LTR; + } else if (textDir == TextDirectionHeuristics.RTL) { + bidiRequest = Bidi.RTL; + } else if (textDir == TextDirectionHeuristics.FIRSTSTRONG_LTR) { + bidiRequest = Bidi.LEVEL_DEFAULT_LTR; + } else if (textDir == TextDirectionHeuristics.FIRSTSTRONG_RTL) { + bidiRequest = Bidi.LEVEL_DEFAULT_RTL; } else { - final int bidiRequest; - if (textDir == TextDirectionHeuristics.LTR) { - bidiRequest = Layout.DIR_REQUEST_LTR; - } else if (textDir == TextDirectionHeuristics.RTL) { - bidiRequest = Layout.DIR_REQUEST_RTL; - } else if (textDir == TextDirectionHeuristics.FIRSTSTRONG_LTR) { - bidiRequest = Layout.DIR_REQUEST_DEFAULT_LTR; - } else if (textDir == TextDirectionHeuristics.FIRSTSTRONG_RTL) { - bidiRequest = Layout.DIR_REQUEST_DEFAULT_RTL; - } else { - final boolean isRtl = textDir.isRtl(mCopiedBuffer, 0, mTextLength); - bidiRequest = isRtl ? Layout.DIR_REQUEST_RTL : Layout.DIR_REQUEST_LTR; + final boolean isRtl = textDir.isRtl(mCopiedBuffer, 0, mTextLength); + bidiRequest = isRtl ? Bidi.RTL : Bidi.LTR; + } + mBidi = new Bidi(mCopiedBuffer, 0, null, 0, mCopiedBuffer.length, bidiRequest); + + if (mCopiedBuffer.length > 0 + && mBidi.getParagraphIndex(mCopiedBuffer.length - 1) != 0) { + // Historically, the MeasuredParagraph does not treat the CR letters as paragraph + // breaker but ICU BiDi treats it as paragraph breaker. In the MeasureParagraph, + // the given range always represents a single paragraph, so if the BiDi object has + // multiple paragraph, it should contains a CR letters in the text. Using CR is not + // common in Android and also it should not penalize the easy case, e.g. all LTR, + // check the paragraph count here and replace the CR letters and re-calculate + // BiDi again. + for (int i = 0; i < mTextLength; ++i) { + if (Character.isSurrogate(mCopiedBuffer[i])) { + // All block separators are in BMP. + continue; + } + if (UCharacter.getDirection(mCopiedBuffer[i]) + == UCharacterDirection.BLOCK_SEPARATOR) { + mCopiedBuffer[i] = OBJECT_REPLACEMENT_CHARACTER; + } } - mLevels.resize(mTextLength); - mParaDir = AndroidBidi.bidi(bidiRequest, mCopiedBuffer, mLevels.getRawArray()); - mLtrWithoutBidi = false; + mBidi = new Bidi(mCopiedBuffer, 0, null, 0, mCopiedBuffer.length, bidiRequest); + } + mLevels.resize(mTextLength); + byte[] rawArray = mLevels.getRawArray(); + for (int i = 0; i < mTextLength; ++i) { + rawArray[i] = mBidi.getLevelAt(i); } + mLtrWithoutBidi = false; } private void applyReplacementRun(@NonNull ReplacementSpan replacement, diff --git a/core/java/android/text/TextFlags.java b/core/java/android/text/TextFlags.java index 0f1b031a8fad19141990fd3e69b5d33e2d888fb7..076721f629ed3b4f41e1670bb13635cb0fb56305 100644 --- a/core/java/android/text/TextFlags.java +++ b/core/java/android/text/TextFlags.java @@ -55,9 +55,6 @@ public final class TextFlags { * List of text flags to be transferred to the application process. */ public static final String[] TEXT_ACONFIGS_FLAGS = { - Flags.FLAG_NO_BREAK_NO_HYPHENATION_SPAN, - Flags.FLAG_FIX_LINE_HEIGHT_FOR_LOCALE, - Flags.FLAG_ICU_BIDI_MIGRATION, Flags.FLAG_FIX_MISALIGNED_CONTEXT_MENU, }; @@ -67,9 +64,6 @@ public final class TextFlags { * The order must be the same to the TEXT_ACONFIG_FLAGS. */ public static final boolean[] TEXT_ACONFIG_DEFAULT_VALUE = { - Flags.noBreakNoHyphenationSpan(), - Flags.fixLineHeightForLocale(), - Flags.icuBidiMigration(), Flags.fixMisalignedContextMenu(), }; diff --git a/core/java/android/text/flags/24Q3.aconfig b/core/java/android/text/flags/24Q3.aconfig new file mode 100644 index 0000000000000000000000000000000000000000..7035fc842a48b5b5103186aeaac4afa1aacb8627 --- /dev/null +++ b/core/java/android/text/flags/24Q3.aconfig @@ -0,0 +1,54 @@ +package: "com.android.text.flags" +container: "system" + +# This aconfig file contains released flags in 24Q3 those cannot be removed. + +flag { + name: "use_bounds_for_width" + is_exported: true + namespace: "text" + description: "Feature flag for preventing horizontal clipping." + bug: "63938206" +} + +flag { + name: "word_style_auto" + is_exported: true + namespace: "text" + description: "A feature flag that implements line break word style auto." + bug: "280005585" +} + +flag { + name: "letter_spacing_justification" + is_exported: true + namespace: "text" + description: "A feature flag that implement inter character justification." + bug: "283193133" +} + +flag { + name: "fix_line_height_for_locale" + is_exported: true + namespace: "text" + description: "Feature flag that preserve the line height of the TextView and EditText even if the the locale is different from Latin" + bug: "303326708" +} + +flag { + name: "new_fonts_fallback_xml" + is_exported: true + namespace: "text" + description: "Feature flag for deprecating fonts.xml. By setting true for this feature flag, the new font configuration XML, /system/etc/font_fallback.xml is used. The new XML has a new syntax and flexibility of variable font declarations, but it is not compatible with the apps that reads fonts.xml. So, fonts.xml is maintained as a subset of the font_fallback.xml" + # Make read only, as it could be used before the Settings provider is initialized. + is_fixed_read_only: true + bug: "281769620" +} + +flag { + name: "no_break_no_hyphenation_span" + is_exported: true + namespace: "text" + description: "A feature flag that adding new spans that prevents line breaking and hyphenation." + bug: "283193586" +} diff --git a/core/java/android/text/flags/flags.aconfig b/core/java/android/text/flags/flags.aconfig index b2be1a7ef3512f39ea52b6c5fa6b33d000b5f1c9..3c61f4f5a33c2172a992ae77544e37473f0a6348 100644 --- a/core/java/android/text/flags/flags.aconfig +++ b/core/java/android/text/flags/flags.aconfig @@ -1,32 +1,6 @@ package: "com.android.text.flags" container: "system" -flag { - name: "new_fonts_fallback_xml" - is_exported: true - namespace: "text" - description: "Feature flag for deprecating fonts.xml. By setting true for this feature flag, the new font configuration XML, /system/etc/font_fallback.xml is used. The new XML has a new syntax and flexibility of variable font declarations, but it is not compatible with the apps that reads fonts.xml. So, fonts.xml is maintained as a subset of the font_fallback.xml" - # Make read only, as it could be used before the Settings provider is initialized. - is_fixed_read_only: true - bug: "281769620" -} - -flag { - name: "fix_line_height_for_locale" - is_exported: true - namespace: "text" - description: "Feature flag that preserve the line height of the TextView and EditText even if the the locale is different from Latin" - bug: "303326708" -} - -flag { - name: "no_break_no_hyphenation_span" - is_exported: true - namespace: "text" - description: "A feature flag that adding new spans that prevents line breaking and hyphenation." - bug: "283193586" -} - flag { name: "use_optimized_boottime_font_loading" namespace: "text" @@ -50,37 +24,6 @@ flag { } } -flag { - name: "use_bounds_for_width" - is_exported: true - namespace: "text" - description: "Feature flag for preventing horizontal clipping." - bug: "63938206" -} - -flag { - name: "deprecate_ui_fonts" - namespace: "text" - description: "Feature flag for deprecating UI fonts. By setting true for this feature flag, the elegant text height of will be turned on by default unless explicitly setting it to false by attribute or Java API call." - bug: "279646685" -} - -flag { - name: "word_style_auto" - is_exported: true - namespace: "text" - description: "A feature flag that implements line break word style auto." - bug: "280005585" -} - -flag { - name: "letter_spacing_justification" - is_exported: true - namespace: "text" - description: "A feature flag that implement inter character justification." - bug: "283193133" -} - flag { name: "escape_clears_focus" namespace: "text" @@ -119,22 +62,6 @@ flag { } } -flag { - name: "icu_bidi_migration" - namespace: "text" - description: "A flag for replacing AndroidBidi with android.icu.text.Bidi." - bug: "317144801" -} - -flag { - name: "lazy_variation_instance" - namespace: "text" - description: "A flag for enabling lazy variation instance creation." - # Make read only, as it could be used before the Settings provider is initialized. - is_fixed_read_only: true - bug: "324676775" -} - flag { name: "handwriting_end_of_line_tap" namespace: "text" diff --git a/core/java/android/util/Slog.java b/core/java/android/util/Slog.java index 9ecb4cbb283d0ec1ac9a0d1fe1684f65336ce55d..b2017a5fa868ac3e27947cc348a6de09f453ea97 100644 --- a/core/java/android/util/Slog.java +++ b/core/java/android/util/Slog.java @@ -224,7 +224,6 @@ public final class Slog { /** * Similar to {@link #wtf(String, String)}, but does not output anything to the log. */ - @android.ravenwood.annotation.RavenwoodThrow public static void wtfQuiet(@Nullable String tag, @NonNull String msg) { Log.wtfQuiet(Log.LOG_ID_SYSTEM, tag, msg, true); } @@ -243,7 +242,6 @@ public final class Slog { * @see Log#wtfStack(String, String) */ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023) - @android.ravenwood.annotation.RavenwoodThrow public static int wtfStack(@Nullable String tag, @NonNull String msg) { return Log.wtf(Log.LOG_ID_SYSTEM, tag, msg, null, true, true); } diff --git a/core/java/android/view/Display.java b/core/java/android/view/Display.java index 82c52a6e893156d78d61c6f3968da5ad743d360d..f8c97eb5fa72ccb7cfd053f1189518a425345b40 100644 --- a/core/java/android/view/Display.java +++ b/core/java/android/view/Display.java @@ -20,6 +20,8 @@ import static android.Manifest.permission.CONFIGURE_DISPLAY_COLOR_MODE; import static android.Manifest.permission.CONTROL_DISPLAY_BRIGHTNESS; import static android.hardware.flags.Flags.FLAG_OVERLAYPROPERTIES_CLASS_API; +import static com.android.server.display.feature.flags.Flags.FLAG_HIGHEST_HDR_SDR_RATIO_API; + import android.Manifest; import android.annotation.FlaggedApi; import android.annotation.IntDef; @@ -1498,6 +1500,15 @@ public final class Display { } } + /** + * @return The highest possible HDR/SDR ratio. If {@link #isHdrSdrRatioAvailable()} returns + * false, this method returns 1. + */ + @FlaggedApi(FLAG_HIGHEST_HDR_SDR_RATIO_API) + public float getHighestHdrSdrRatio() { + return mGlobal.getHighestHdrSdrRatio(mDisplayId); + } + /** * Sets the default {@link Display.Mode} to use for the display. The display mode includes * preference for resolution and refresh rate. diff --git a/core/java/android/view/PointerIcon.java b/core/java/android/view/PointerIcon.java index 815fd1c49a38ad078bab2a700d1127324a2a438b..dd950e83dd521eef8615ca2a1c318756270ceb45 100644 --- a/core/java/android/view/PointerIcon.java +++ b/core/java/android/view/PointerIcon.java @@ -540,8 +540,6 @@ public final class PointerIcon implements Parcelable { // Assumes they have the exact duration. mDurationPerFrame = animationDrawable.getDuration(0); mBitmapFrames = new Bitmap[frames - 1]; - final int width = drawable.getIntrinsicWidth(); - final int height = drawable.getIntrinsicHeight(); final boolean isVectorAnimation = drawable instanceof VectorDrawable; mDrawNativeDropShadow = isVectorAnimation; for (int i = 1; i < frames; ++i) { @@ -556,9 +554,6 @@ public final class PointerIcon implements Parcelable { + "is a different type from the others. All frames should be the " + "same type."); } - // TODO(b/361232935): Check when bitmap size of the ith frame is different - // drawableFrame.getIntrinsicWidth() != width || - // drawableFrame.getIntrinsicHeight() != height if (isVectorAnimation) { drawableFrame = getBitmapDrawableFromVectorDrawable(resources, (VectorDrawable) drawableFrame, pointerScale); diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 7b4ea41554f1fbeef164220844740ed42f286de2..0ed0e60f6b4d660f9df9726dc79b349543fb8c4e 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -371,7 +371,7 @@ import java.util.function.Predicate; * * * {@link #onTouchEvent(MotionEvent)} - * Called when a touch screen motion event occurs. + * Called when a motion event occurs with pointers down on the view. * * * @@ -17873,7 +17873,13 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } /** - * Implement this method to handle touch screen motion events. + * Implement this method to handle pointer events. + *

+ * This method is called to handle motion events where pointers are down on + * the view. For example, this could include touchscreen touches, stylus + * touches, or click-and-drag events from a mouse. However, it is not called + * for motion events that do not involve pointers being down, such as hover + * events or mouse scroll wheel movements. *

* If this method is used to detect click actions, it is recommended that * the actions be performed by implementing and calling diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java index 3b5286a04b3d8ce8ffc87c47214484cf78cb461f..22374173b988b00c78ceb1a5f82b07c3a1ef6d86 100644 --- a/core/java/android/view/ViewGroup.java +++ b/core/java/android/view/ViewGroup.java @@ -4504,6 +4504,11 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager final View[] children = mChildren; for (int i = 0; i < count; i++) { final View child = children[i]; + if (child == null) { + throw new IllegalStateException(getClass().getSimpleName() + " contains null " + + "child at index " + i + " when traversal in dispatchGetDisplayList," + + " the view may have been removed."); + } if (((child.mViewFlags & VISIBILITY_MASK) == VISIBLE || child.getAnimation() != null)) { recreateChildDisplayList(child); } diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java index 67a207e34a1acf9bfca7a447a66e8983ddca41d3..5b39f62db2614b7be6e8ab376bd28c6df5714233 100644 --- a/core/java/android/view/WindowManager.java +++ b/core/java/android/view/WindowManager.java @@ -107,6 +107,7 @@ import android.content.pm.ActivityInfo; import android.content.pm.PackageManager; import android.content.res.Configuration; import android.graphics.Bitmap; +import android.graphics.Insets; import android.graphics.PixelFormat; import android.graphics.Point; import android.graphics.Rect; @@ -2371,7 +2372,7 @@ public interface WindowManager extends ViewManager { public static final int TYPE_SECURE_SYSTEM_OVERLAY = FIRST_SYSTEM_WINDOW+15; /** - * Window type: the drag-and-drop pseudowindow. There is only one + * Window type: the drag-and-drop pseudowindow. There is only one * drag layer (at most), and it is placed on top of all other windows. * In multiuser systems shows only on the owning user's window. * @hide @@ -2381,7 +2382,7 @@ public interface WindowManager extends ViewManager { /** * Window type: panel that slides out from over the status bar * In multiuser systems shows on all users' windows. These windows - * are displayed on top of the stauts bar and any {@link #TYPE_STATUS_BAR_PANEL} + * are displayed on top of the status bar and any {@link #TYPE_STATUS_BAR_PANEL} * windows. * @hide */ @@ -4648,6 +4649,30 @@ public interface WindowManager extends ViewManager { */ public InsetsFrameProvider[] providedInsets; + /** + * Sets the insets to be provided by the window. + * + * @param insetsParams The parameters for the insets to be provided by the window. + * + * @hide + */ + @FlaggedApi(android.companion.virtualdevice.flags.Flags.FLAG_STATUS_BAR_AND_INSETS) + @SystemApi + public void setInsetsParams(@NonNull List insetsParams) { + if (insetsParams.isEmpty()) { + providedInsets = null; + } else { + providedInsets = new InsetsFrameProvider[insetsParams.size()]; + for (int i = 0; i < insetsParams.size(); ++i) { + final InsetsParams params = insetsParams.get(i); + providedInsets[i] = + new InsetsFrameProvider(/* owner= */ this, /* index= */ i, + params.getType()) + .setInsetsSize(params.getInsetsSize()); + } + } + } + /** * Specifies which {@link InsetsType}s should be forcibly shown. The types shown by this * method won't affect the app's layout. This field only takes effects if the caller has @@ -6116,6 +6141,56 @@ public interface WindowManager extends ViewManager { } } + /** + * Specifies the parameters of the insets provided by a window. + * + * @see WindowManager.LayoutParams#setInsetsParams(List) + * @see android.graphics.Insets + * + * @hide + */ + @FlaggedApi(android.companion.virtualdevice.flags.Flags.FLAG_STATUS_BAR_AND_INSETS) + @SystemApi + public static class InsetsParams { + + private final @InsetsType int mType; + private @Nullable Insets mInsets; + + /** + * Creates an instance of InsetsParams. + * + * @param type the type of insets to provide, e.g. {@link WindowInsets.Type#statusBars()}. + * @see WindowInsets.Type + */ + public InsetsParams(@InsetsType int type) { + mType = type; + } + + /** + * Sets the size of the provided insets. If {@code null}, then the provided insets will + * have the same size as the window frame. + */ + public @NonNull InsetsParams setInsetsSize(@Nullable Insets insets) { + mInsets = insets; + return this; + } + + /** + * Returns the type of provided insets. + */ + public @InsetsType int getType() { + return mType; + } + + /** + * Returns the size of the provided insets. May be {@code null} if the provided insets have + * the same size as the window frame. + */ + public @Nullable Insets getInsetsSize() { + return mInsets; + } + } + /** * Holds the WM lock for the specified amount of milliseconds. * Intended for use by the tests that need to imitate lock contention. diff --git a/core/java/android/view/accessibility/AccessibilityManager.java b/core/java/android/view/accessibility/AccessibilityManager.java index a87e5c8e1b567b68e9a563b56e71d7abaf0c778c..2b7cf427a5622da1e851f42484ae756a699f1fc4 100644 --- a/core/java/android/view/accessibility/AccessibilityManager.java +++ b/core/java/android/view/accessibility/AccessibilityManager.java @@ -1774,7 +1774,8 @@ public final class AccessibilityManager { } /** - * Notifies that the accessibility button in the system's navigation area has been clicked + * Notifies that the accessibility button in the system's navigation area has been clicked, + * or a gesture shortcut input has been performed. * * @param displayId The logical display id. * @hide @@ -1785,7 +1786,8 @@ public final class AccessibilityManager { } /** - * Perform the accessibility button for the given target which is assigned to the button. + * Perform the accessibility button or gesture + * for the given target which is assigned to the button. * * @param displayId displayId The logical display id. * @param targetName The flattened {@link ComponentName} string or the class name of a system @@ -1809,6 +1811,31 @@ public final class AccessibilityManager { } } + /** + * Notifies that a shortcut was long-clicked. + * This displays the dialog used to select which target the given shortcut will use, + * from its list of targets. + * The current shortcut type is determined by the current navigation mode. + * + * @param displayId The id of the display to show the dialog on. + * @hide + */ + @RequiresPermission(Manifest.permission.STATUS_BAR_SERVICE) + public void notifyAccessibilityButtonLongClicked(int displayId) { + final IAccessibilityManager service; + synchronized (mLock) { + service = getServiceLocked(); + if (service == null) { + return; + } + } + try { + service.notifyAccessibilityButtonLongClicked(displayId); + } catch (RemoteException re) { + Log.e(LOG_TAG, "Error while dispatching accessibility button long click. ", re); + } + } + /** * Notifies that the visibility of the accessibility button in the system's navigation area * has changed. diff --git a/core/java/android/view/accessibility/IAccessibilityManager.aidl b/core/java/android/view/accessibility/IAccessibilityManager.aidl index 2de3ce8532e3be89e53dfb8c4ce4cf1fedec1e1b..e04fa1537d54bede8af84d967762416232ac4502 100644 --- a/core/java/android/view/accessibility/IAccessibilityManager.aidl +++ b/core/java/android/view/accessibility/IAccessibilityManager.aidl @@ -88,6 +88,8 @@ interface IAccessibilityManager { @EnforcePermission("STATUS_BAR_SERVICE") void notifyAccessibilityButtonClicked(int displayId, String targetName); + @EnforcePermission("STATUS_BAR_SERVICE") + void notifyAccessibilityButtonLongClicked(int displayId); @EnforcePermission("STATUS_BAR_SERVICE") void notifyAccessibilityButtonVisibilityChanged(boolean available); diff --git a/core/java/android/view/flags/scroll_feedback_flags.aconfig b/core/java/android/view/flags/scroll_feedback_flags.aconfig index e9c85684dbd87442fc3a30824fc6f5ae64687175..658aa29a3cc65bb0dceffab21103a35d354b1a08 100644 --- a/core/java/android/view/flags/scroll_feedback_flags.aconfig +++ b/core/java/android/view/flags/scroll_feedback_flags.aconfig @@ -21,4 +21,5 @@ flag { name: "enable_touch_scroll_feedback" description: "Enables touchscreen haptic scroll feedback" bug: "331830899" + is_fixed_read_only: true } diff --git a/core/java/android/webkit/UserPackage.java b/core/java/android/webkit/UserPackage.java index 1da2af4593481907df2558e04cd4c26a8bdfc287..b18dbbc21cda8bc5812cdb33592e4b44270709bf 100644 --- a/core/java/android/webkit/UserPackage.java +++ b/core/java/android/webkit/UserPackage.java @@ -15,12 +15,14 @@ */ package android.webkit; +import android.annotation.NonNull; +import android.annotation.Nullable; import android.content.Context; import android.content.pm.ApplicationInfo; import android.content.pm.PackageInfo; -import android.content.pm.PackageManager.NameNotFoundException; -import android.content.pm.UserInfo; +import android.content.pm.PackageManager; import android.os.Build; +import android.os.UserHandle; import android.os.UserManager; import java.util.ArrayList; @@ -31,30 +33,31 @@ import java.util.List; * @hide */ public class UserPackage { - private final UserInfo mUserInfo; + private final UserHandle mUser; private final PackageInfo mPackageInfo; public static final int MINIMUM_SUPPORTED_SDK = Build.VERSION_CODES.TIRAMISU; - public UserPackage(UserInfo user, PackageInfo packageInfo) { - this.mUserInfo = user; - this.mPackageInfo = packageInfo; + public UserPackage(@NonNull UserHandle user, @Nullable PackageInfo packageInfo) { + mUser = user; + mPackageInfo = packageInfo; } /** * Returns a list of (User,PackageInfo) pairs corresponding to the PackageInfos for all * device users for the package named {@param packageName}. */ - public static List getPackageInfosAllUsers(Context context, - String packageName, int packageFlags) { - List users = getAllUsers(context); + public static @NonNull List getPackageInfosAllUsers(@NonNull Context context, + @NonNull String packageName, int packageFlags) { + UserManager userManager = context.getSystemService(UserManager.class); + List users = userManager.getUserHandles(false); List userPackages = new ArrayList(users.size()); - for (UserInfo user : users) { + for (UserHandle user : users) { + PackageManager pm = context.createContextAsUser(user, 0).getPackageManager(); PackageInfo packageInfo = null; try { - packageInfo = context.getPackageManager().getPackageInfoAsUser( - packageName, packageFlags, user.id); - } catch (NameNotFoundException e) { + packageInfo = pm.getPackageInfo(packageName, packageFlags); + } catch (PackageManager.NameNotFoundException e) { } userPackages.add(new UserPackage(user, packageInfo)); } @@ -88,18 +91,11 @@ public class UserPackage { return packageInfo.applicationInfo.targetSdkVersion >= MINIMUM_SUPPORTED_SDK; } - public UserInfo getUserInfo() { - return mUserInfo; + public UserHandle getUser() { + return mUser; } public PackageInfo getPackageInfo() { return mPackageInfo; } - - - private static List getAllUsers(Context context) { - UserManager userManager = (UserManager) context.getSystemService(Context.USER_SERVICE); - return userManager.getUsers(); - } - } diff --git a/core/java/android/webkit/WebViewDelegate.java b/core/java/android/webkit/WebViewDelegate.java index 8501474b70a61484a0a08af5c92508f83ccda1c5..4c5802ccfcf5a89a6431fe3d4825dd2f00a704df 100644 --- a/core/java/android/webkit/WebViewDelegate.java +++ b/core/java/android/webkit/WebViewDelegate.java @@ -137,9 +137,13 @@ public final class WebViewDelegate { */ @Deprecated public void detachDrawGlFunctor(View containerView, long nativeDrawGLFunctor) { - ViewRootImpl viewRootImpl = containerView.getViewRootImpl(); - if (nativeDrawGLFunctor != 0 && viewRootImpl != null) { - viewRootImpl.detachFunctor(nativeDrawGLFunctor); + if (Flags.mainlineApis()) { + throw new UnsupportedOperationException(); + } else { + ViewRootImpl viewRootImpl = containerView.getViewRootImpl(); + if (nativeDrawGLFunctor != 0 && viewRootImpl != null) { + viewRootImpl.detachFunctor(nativeDrawGLFunctor); + } } } diff --git a/core/java/android/webkit/WebViewUpdateManager.java b/core/java/android/webkit/WebViewUpdateManager.java index 0eb710015ea994ae503493ddcd0a35df53b63dab..b9a5e4aedeb96acf509a5abc9817025f2a0b5e87 100644 --- a/core/java/android/webkit/WebViewUpdateManager.java +++ b/core/java/android/webkit/WebViewUpdateManager.java @@ -43,22 +43,29 @@ public final class WebViewUpdateManager { /** * Get the singleton instance of the manager. * - * This exists for the benefit of callsites without a {@link Context}; prefer + *

This exists for the benefit of callsites without a {@link Context}; prefer * {@link Context#getSystemService(Class)} otherwise. * - * This can only be used on devices with {@link PackageManager#FEATURE_WEBVIEW}. + *

This must only be called on devices with {@link PackageManager#FEATURE_WEBVIEW}, + * and will WTF or throw {@link UnsupportedOperationException} otherwise. */ @SuppressLint("ManagerLookup") // service opts in to getSystemServiceWithNoContext() @RequiresFeature(PackageManager.FEATURE_WEBVIEW) - public static @Nullable WebViewUpdateManager getInstance() { - return (WebViewUpdateManager) SystemServiceRegistry.getSystemServiceWithNoContext( - Context.WEBVIEW_UPDATE_SERVICE); + public static @NonNull WebViewUpdateManager getInstance() { + WebViewUpdateManager manager = + (WebViewUpdateManager) SystemServiceRegistry.getSystemServiceWithNoContext( + Context.WEBVIEW_UPDATE_SERVICE); + if (manager == null) { + throw new UnsupportedOperationException("WebView not supported by device"); + } else { + return manager; + } } /** * Block until system-level WebView preparations are complete. * - * This also makes the current WebView provider package visible to the caller. + *

This also makes the current WebView provider package visible to the caller. * * @return the status of WebView preparation and the current provider package. */ @@ -86,7 +93,7 @@ public final class WebViewUpdateManager { /** * Get the complete list of supported WebView providers for this device. * - * This includes all configured providers, regardless of whether they are currently available + *

This includes all configured providers, regardless of whether they are currently available * or valid. */ @SuppressLint({"ParcelableList", "ArrayReturn"}) @@ -101,13 +108,15 @@ public final class WebViewUpdateManager { /** * Get the list of currently-valid WebView providers for this device. * - * This only includes providers that are currently present on the device and meet the validity - * criteria (signature, version, etc), but does not check if the provider is installed and - * enabled for all users. + *

This only includes providers that are currently present on the device and meet the + * validity criteria (signature, version, etc), but does not check if the provider is installed + * and enabled for all users. + * + *

Note that this will be filtered by the caller's package visibility; callers should + * have QUERY_ALL_PACKAGES permission to ensure that the list is complete. */ @SuppressLint({"ParcelableList", "ArrayReturn"}) - @RequiresPermission(allOf = {android.Manifest.permission.INTERACT_ACROSS_USERS, - android.Manifest.permission.QUERY_ALL_PACKAGES}) + @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS) public @NonNull WebViewProviderInfo[] getValidWebViewPackages() { try { return mService.getValidWebViewPackages(); @@ -132,7 +141,7 @@ public final class WebViewUpdateManager { /** * Ask the system to switch to a specific WebView implementation if possible. * - * This choice will be stored persistently. + *

This choice will be stored persistently. * * @param newProvider the package name to use. * @return the package name which is now in use, which may not be the @@ -162,7 +171,7 @@ public final class WebViewUpdateManager { /** * Get the WebView provider which will be used if no explicit choice has been made. * - * The default provider is not guaranteed to be a valid/usable WebView implementation. + *

The default provider is not guaranteed to be a valid/usable WebView implementation. * * @return the default WebView provider. */ diff --git a/core/java/android/webkit/WebViewUpdateService.java b/core/java/android/webkit/WebViewUpdateService.java index 01af182a10fa0862701dd2c6183732dfb7d9c556..644d917c8be6e04d11a0ac541f511d3b589d4003 100644 --- a/core/java/android/webkit/WebViewUpdateService.java +++ b/core/java/android/webkit/WebViewUpdateService.java @@ -16,6 +16,7 @@ package android.webkit; +import android.annotation.RequiresPermission; import android.annotation.SystemApi; import android.compat.annotation.UnsupportedAppUsage; import android.os.RemoteException; @@ -54,7 +55,11 @@ public final class WebViewUpdateService { /** * Fetch all packages that could potentially implement WebView and are currently valid. + * + *

Note that this will be filtered by the caller's package visibility; callers should + * have QUERY_ALL_PACKAGES permission to ensure that the list is complete. */ + @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS) public static WebViewProviderInfo[] getValidWebViewPackages() { if (Flags.updateServiceIpcWrapper()) { if (WebViewFactory.isWebViewSupported()) { diff --git a/core/java/android/widget/RemoteViews.java b/core/java/android/widget/RemoteViews.java index a395c1a05744bcb43c6fef83e30145678da8f92e..e1154ca0701cd229dfc86a1d794e4a82a506030b 100644 --- a/core/java/android/widget/RemoteViews.java +++ b/core/java/android/widget/RemoteViews.java @@ -83,6 +83,7 @@ import android.os.Parcelable; import android.os.Process; import android.os.RemoteException; import android.os.StrictMode; +import android.os.Trace; import android.os.UserHandle; import android.system.Os; import android.text.TextUtils; @@ -153,6 +154,7 @@ import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executor; import java.util.concurrent.TimeUnit; import java.util.function.Consumer; +import java.util.function.Function; import java.util.function.Predicate; /** @@ -712,6 +714,24 @@ public class RemoteViews implements Parcelable, Filter { } public abstract void writeToParcel(Parcel dest, int flags); + + /** + * Override to return true if this Action can be serialized to Protobuf, and implement + * writeToProto / createFromProto. + * + * If this returns false, then the action will be omitted from RemoteViews previews created + * with createPreviewFromProto / writePreviewToProto. + * + * Because Parcelables should not be serialized to disk, any action that contains an Intent, + * PendingIntent, or Bundle should return false here. + */ + public boolean canWriteToProto() { + return false; + } + + public void writeToProto(ProtoOutputStream out, Context context, Resources appResources) { + throw new UnsupportedOperationException(); + } } /** @@ -1506,6 +1526,7 @@ public class RemoteViews implements Parcelable, Filter { switch (in.getFieldNumber()) { case (int) RemoteViewsProto.RemoteCollectionCache.ENTRIES: final LongSparseArray entry = new LongSparseArray<>(); + final long entryToken = in.start( RemoteViewsProto.RemoteCollectionCache.ENTRIES); while (in.nextField() != NO_MORE_FIELDS) { @@ -1533,10 +1554,12 @@ public class RemoteViews implements Parcelable, Filter { } } in.end(entryToken); + checkContainsKeys(entry, new long[]{RemoteViewsProto.RemoteCollectionCache.Entry.ID, RemoteViewsProto.RemoteCollectionCache.Entry.URI, RemoteViewsProto.RemoteCollectionCache.Entry.ITEMS}); + entries.add(entry); break; default: @@ -2247,6 +2270,62 @@ public class RemoteViews implements Parcelable, Filter { public int getActionTag() { return BITMAP_REFLECTION_ACTION_TAG; } + + @Override + public boolean canWriteToProto() { + return true; + } + + @Override + public void writeToProto(ProtoOutputStream out, Context context, Resources appResources) { + final long token = out.start(RemoteViewsProto.Action.BITMAP_REFLECTION_ACTION); + out.write(RemoteViewsProto.BitmapReflectionAction.VIEW_ID, + appResources.getResourceName(mViewId)); + out.write(RemoteViewsProto.BitmapReflectionAction.METHOD_NAME, mMethodName); + out.write(RemoteViewsProto.BitmapReflectionAction.BITMAP_ID, mBitmapId); + out.end(token); + } + } + + private PendingResources createFromBitmapReflectionActionFromProto(ProtoInputStream in) + throws Exception { + final LongSparseArray values = new LongSparseArray<>(); + + final long token = in.start(RemoteViewsProto.Action.BITMAP_REFLECTION_ACTION); + while (in.nextField() != NO_MORE_FIELDS) { + switch (in.getFieldNumber()) { + case (int) RemoteViewsProto.BitmapReflectionAction.VIEW_ID: + values.put(RemoteViewsProto.BitmapReflectionAction.VIEW_ID, + in.readString(RemoteViewsProto.BitmapReflectionAction.VIEW_ID)); + break; + case (int) RemoteViewsProto.BitmapReflectionAction.METHOD_NAME: + values.put(RemoteViewsProto.BitmapReflectionAction.METHOD_NAME, + in.readString(RemoteViewsProto.BitmapReflectionAction.METHOD_NAME)); + break; + case (int) RemoteViewsProto.BitmapReflectionAction.BITMAP_ID: + values.put(RemoteViewsProto.BitmapReflectionAction.BITMAP_ID, + in.readInt(RemoteViewsProto.BitmapReflectionAction.BITMAP_ID)); + break; + default: + Log.w(LOG_TAG, "Unhandled field while reading RemoteViews proto!\n" + + ProtoUtils.currentFieldToString(in)); + } + } + in.end(token); + + checkContainsKeys(values, new long[]{RemoteViewsProto.BitmapReflectionAction.VIEW_ID, + RemoteViewsProto.BitmapReflectionAction.METHOD_NAME}); + + return (context, resources, rootData, depth) -> { + int viewId = getAsIdentifier(resources, values, + RemoteViewsProto.BitmapReflectionAction.VIEW_ID); + return new BitmapReflectionAction(viewId, + (String) values.get(RemoteViewsProto.BitmapReflectionAction.METHOD_NAME), + rootData.mBitmapCache.getBitmapForId( + (int) values.get(RemoteViewsProto.BitmapReflectionAction.BITMAP_ID, + 0))); + }; + } /** @@ -2560,6 +2639,268 @@ public class RemoteViews implements Parcelable, Filter { public int getActionTag() { return REFLECTION_ACTION_TAG; } + + @Override + public boolean canWriteToProto() { + return true; + } + + @Override + public void writeToProto(ProtoOutputStream out, Context context, Resources appResources) { + final long token = out.start(RemoteViewsProto.Action.REFLECTION_ACTION); + out.write(RemoteViewsProto.ReflectionAction.VIEW_ID, + appResources.getResourceName(mViewId)); + out.write(RemoteViewsProto.ReflectionAction.METHOD_NAME, mMethodName); + out.write(RemoteViewsProto.ReflectionAction.PARAMETER_TYPE, mType); + if (this.mValue != null) { + switch (this.mType) { + case BOOLEAN: + // ProtoOutputStream will omit this write if the value is false + out.write(RemoteViewsProto.ReflectionAction.BOOLEAN_VALUE, + (boolean) this.mValue); + break; + case BYTE: + out.write(RemoteViewsProto.ReflectionAction.BYTE_VALUE, + new byte[]{(byte) this.mValue}); + break; + case SHORT: + out.write(RemoteViewsProto.ReflectionAction.SHORT_VALUE, + (short) this.mValue); + break; + case INT: + out.write(RemoteViewsProto.ReflectionAction.INT_VALUE, (int) this.mValue); + break; + case LONG: + out.write(RemoteViewsProto.ReflectionAction.LONG_VALUE, (long) this.mValue); + break; + case FLOAT: + out.write(RemoteViewsProto.ReflectionAction.FLOAT_VALUE, + (float) this.mValue); + break; + case DOUBLE: + out.write(RemoteViewsProto.ReflectionAction.DOUBLE_VALUE, + (double) this.mValue); + break; + case CHAR: + out.write(RemoteViewsProto.ReflectionAction.CHAR_VALUE, + (Character) this.mValue); + break; + case STRING: + out.write(RemoteViewsProto.ReflectionAction.STRING_VALUE, + (String) this.mValue); + break; + case CHAR_SEQUENCE: + long csToken = out.start( + RemoteViewsProto.ReflectionAction.CHAR_SEQUENCE_VALUE); + RemoteViewsSerializers.writeCharSequenceToProto(out, + (CharSequence) this.mValue); + out.end(csToken); + break; + case URI: + out.write(RemoteViewsProto.ReflectionAction.URI_VALUE, + ((Uri) this.mValue).toString()); + break; + case BITMAP: + final ByteArrayOutputStream bytes = new ByteArrayOutputStream(); + ((Bitmap) this.mValue).compress(Bitmap.CompressFormat.WEBP_LOSSLESS, 100, + bytes); + out.write(RemoteViewsProto.ReflectionAction.BITMAP_VALUE, + bytes.toByteArray()); + break; + case BLEND_MODE: + out.write(RemoteViewsProto.ReflectionAction.BLEND_MODE_VALUE, + BlendMode.toValue((BlendMode) this.mValue)); + break; + case COLOR_STATE_LIST: + writeColorStateListToProto(out, (ColorStateList) this.mValue, + RemoteViewsProto.ReflectionAction.COLOR_STATE_LIST_VALUE); + break; + case ICON: + writeIconToProto(out, appResources, (Icon) this.mValue, + RemoteViewsProto.ReflectionAction.ICON_VALUE); + break; + case BUNDLE: + case INTENT: + default: + break; + } + } + out.end(token); + } + + public static PendingResources createFromProto(ProtoInputStream in) + throws Exception { + final LongSparseArray values = new LongSparseArray<>(); + + final long token = in.start(RemoteViewsProto.Action.REFLECTION_ACTION); + while (in.nextField() != NO_MORE_FIELDS) { + switch (in.getFieldNumber()) { + case (int) RemoteViewsProto.ReflectionAction.VIEW_ID: + values.put(RemoteViewsProto.ReflectionAction.VIEW_ID, + in.readString(RemoteViewsProto.ReflectionAction.VIEW_ID)); + break; + case (int) RemoteViewsProto.ReflectionAction.METHOD_NAME: + values.put(RemoteViewsProto.ReflectionAction.METHOD_NAME, + in.readString(RemoteViewsProto.ReflectionAction.METHOD_NAME)); + break; + case (int) RemoteViewsProto.ReflectionAction.PARAMETER_TYPE: + values.put(RemoteViewsProto.ReflectionAction.PARAMETER_TYPE, + in.readInt(RemoteViewsProto.ReflectionAction.PARAMETER_TYPE)); + break; + case (int) RemoteViewsProto.ReflectionAction.BOOLEAN_VALUE: + values.put(RemoteViewsProto.ReflectionAction.BOOLEAN_VALUE, + in.readBoolean(RemoteViewsProto.ReflectionAction.BOOLEAN_VALUE)); + break; + case (int) RemoteViewsProto.ReflectionAction.BYTE_VALUE: + values.put(RemoteViewsProto.ReflectionAction.BYTE_VALUE, + in.readBytes(RemoteViewsProto.ReflectionAction.BYTE_VALUE)); + break; + case (int) RemoteViewsProto.ReflectionAction.SHORT_VALUE: + values.put(RemoteViewsProto.ReflectionAction.SHORT_VALUE, + (short) in.readInt(RemoteViewsProto.ReflectionAction.SHORT_VALUE)); + break; + case (int) RemoteViewsProto.ReflectionAction.INT_VALUE: + values.put(RemoteViewsProto.ReflectionAction.INT_VALUE, + in.readInt(RemoteViewsProto.ReflectionAction.INT_VALUE)); + break; + case (int) RemoteViewsProto.ReflectionAction.LONG_VALUE: + values.put(RemoteViewsProto.ReflectionAction.LONG_VALUE, + in.readLong(RemoteViewsProto.ReflectionAction.LONG_VALUE)); + break; + case (int) RemoteViewsProto.ReflectionAction.FLOAT_VALUE: + values.put(RemoteViewsProto.ReflectionAction.FLOAT_VALUE, + in.readFloat(RemoteViewsProto.ReflectionAction.FLOAT_VALUE)); + break; + case (int) RemoteViewsProto.ReflectionAction.DOUBLE_VALUE: + values.put(RemoteViewsProto.ReflectionAction.DOUBLE_VALUE, + in.readDouble(RemoteViewsProto.ReflectionAction.DOUBLE_VALUE)); + break; + case (int) RemoteViewsProto.ReflectionAction.CHAR_VALUE: + values.put(RemoteViewsProto.ReflectionAction.CHAR_VALUE, + (char) in.readInt(RemoteViewsProto.ReflectionAction.CHAR_VALUE)); + break; + case (int) RemoteViewsProto.ReflectionAction.STRING_VALUE: + values.put(RemoteViewsProto.ReflectionAction.STRING_VALUE, + in.readString(RemoteViewsProto.ReflectionAction.STRING_VALUE)); + break; + case (int) RemoteViewsProto.ReflectionAction.CHAR_SEQUENCE_VALUE: + values.put(RemoteViewsProto.ReflectionAction.CHAR_SEQUENCE_VALUE, + createCharSequenceFromProto(in, + RemoteViewsProto.ReflectionAction.CHAR_SEQUENCE_VALUE)); + break; + case (int) RemoteViewsProto.ReflectionAction.URI_VALUE: + values.put(RemoteViewsProto.ReflectionAction.URI_VALUE, + in.readString(RemoteViewsProto.ReflectionAction.URI_VALUE)); + break; + case (int) RemoteViewsProto.ReflectionAction.BITMAP_VALUE: + byte[] bitmapData = in.readBytes( + RemoteViewsProto.ReflectionAction.BITMAP_VALUE); + values.put(RemoteViewsProto.ReflectionAction.BITMAP_VALUE, + BitmapFactory.decodeByteArray(bitmapData, 0, bitmapData.length)); + break; + case (int) RemoteViewsProto.ReflectionAction.COLOR_STATE_LIST_VALUE: + values.put(RemoteViewsProto.ReflectionAction.COLOR_STATE_LIST_VALUE, + createColorStateListFromProto(in, + RemoteViewsProto.ReflectionAction.COLOR_STATE_LIST_VALUE)); + break; + case (int) RemoteViewsProto.ReflectionAction.ICON_VALUE: + values.put(RemoteViewsProto.ReflectionAction.ICON_VALUE, + createIconFromProto(in, + RemoteViewsProto.ReflectionAction.ICON_VALUE)); + break; + case (int) RemoteViewsProto.ReflectionAction.BLEND_MODE_VALUE: + values.put(RemoteViewsProto.ReflectionAction.BLEND_MODE_VALUE, + BlendMode.fromValue(in.readInt( + RemoteViewsProto.ReflectionAction.BLEND_MODE_VALUE))); + break; + default: + Log.w(LOG_TAG, "Unhandled field while reading RemoteViews proto!\n" + + ProtoUtils.currentFieldToString(in)); + } + } + in.end(token); + + checkContainsKeys(values, new long[]{RemoteViewsProto.ReflectionAction.VIEW_ID, + RemoteViewsProto.ReflectionAction.METHOD_NAME, + RemoteViewsProto.ReflectionAction.PARAMETER_TYPE}); + + return (context, resources, rootData, depth) -> { + int viewId = getAsIdentifier(resources, values, + RemoteViewsProto.ReflectionAction.VIEW_ID); + Object value = null; + int parameterType = (int) values.get( + RemoteViewsProto.ReflectionAction.PARAMETER_TYPE); + switch (parameterType) { + case BOOLEAN: + value = (boolean) values.get( + RemoteViewsProto.ReflectionAction.BOOLEAN_VALUE, false); + break; + case BYTE: + byte[] bytes = (byte[]) values.get( + RemoteViewsProto.ReflectionAction.BYTE_VALUE); + if (bytes != null && bytes.length > 0) { + value = bytes[0]; + } + break; + case SHORT: + value = (short) values.get(RemoteViewsProto.ReflectionAction.SHORT_VALUE, + 0); + break; + case INT: + value = (int) values.get(RemoteViewsProto.ReflectionAction.INT_VALUE, 0); + break; + case LONG: + value = (long) values.get(RemoteViewsProto.ReflectionAction.LONG_VALUE, 0); + break; + case FLOAT: + value = (float) values.get(RemoteViewsProto.ReflectionAction.FLOAT_VALUE, + 0); + break; + case DOUBLE: + value = (double) values.get(RemoteViewsProto.ReflectionAction.DOUBLE_VALUE, + 0); + break; + case CHAR: + value = (char) values.get(RemoteViewsProto.ReflectionAction.CHAR_VALUE, 0); + break; + case STRING: + value = (String) values.get(RemoteViewsProto.ReflectionAction.STRING_VALUE); + break; + case CHAR_SEQUENCE: + value = (CharSequence) values.get( + RemoteViewsProto.ReflectionAction.CHAR_SEQUENCE_VALUE); + break; + case URI: + value = Uri.parse( + (String) values.get(RemoteViewsProto.ReflectionAction.URI_VALUE)); + break; + case BITMAP: + value = (Bitmap) values.get(RemoteViewsProto.ReflectionAction.BITMAP_VALUE); + break; + case BLEND_MODE: + value = (BlendMode) values.get( + RemoteViewsProto.ReflectionAction.BLEND_MODE_VALUE); + break; + case COLOR_STATE_LIST: + value = (ColorStateList) values.get( + RemoteViewsProto.ReflectionAction.COLOR_STATE_LIST_VALUE); + break; + case ICON: + value = ((PendingResources) values.get( + RemoteViewsProto.ReflectionAction.ICON_VALUE)).create(context, + resources, rootData, depth); + break; + case BUNDLE: + case INTENT: + default: + // omit the action for unsupported parameter types + return null; + } + return new ReflectionAction(viewId, + (String) values.get(RemoteViewsProto.ReflectionAction.METHOD_NAME), + parameterType, value); + }; + } } private static final class ResourceReflectionAction extends BaseReflectionAction { @@ -2740,7 +3081,87 @@ public class RemoteViews implements Parcelable, Filter { public int getActionTag() { return ATTRIBUTE_REFLECTION_ACTION_TAG; } + + @Override + public boolean canWriteToProto() { + return true; + } + + @Override + public void writeToProto(ProtoOutputStream out, Context context, Resources appResources) { + final long token = out.start(RemoteViewsProto.Action.ATTRIBUTE_REFLECTION_ACTION); + out.write(RemoteViewsProto.AttributeReflectionAction.VIEW_ID, + appResources.getResourceName(mViewId)); + out.write(RemoteViewsProto.AttributeReflectionAction.METHOD_NAME, mMethodName); + out.write(RemoteViewsProto.AttributeReflectionAction.PARAMETER_TYPE, mType); + out.write(RemoteViewsProto.AttributeReflectionAction.RESOURCE_TYPE, mResourceType); + if (mAttrId != 0) { + out.write(RemoteViewsProto.AttributeReflectionAction.ATTRIBUTE_ID, + appResources.getResourceName(mAttrId)); + } + out.end(token); + } + + public static PendingResources createFromProto(ProtoInputStream in) + throws Exception { + final LongSparseArray values = new LongSparseArray<>(); + + final long token = in.start(RemoteViewsProto.Action.ATTRIBUTE_REFLECTION_ACTION); + while (in.nextField() != NO_MORE_FIELDS) { + switch (in.getFieldNumber()) { + case (int) RemoteViewsProto.AttributeReflectionAction.VIEW_ID: { + values.put(RemoteViewsProto.AttributeReflectionAction.VIEW_ID, + in.readString(RemoteViewsProto.AttributeReflectionAction.VIEW_ID)); + break; + } + case (int) RemoteViewsProto.AttributeReflectionAction.METHOD_NAME: + values.put(RemoteViewsProto.AttributeReflectionAction.METHOD_NAME, + in.readString( + RemoteViewsProto.AttributeReflectionAction.METHOD_NAME)); + break; + case (int) RemoteViewsProto.AttributeReflectionAction.ATTRIBUTE_ID: + values.put(RemoteViewsProto.AttributeReflectionAction.ATTRIBUTE_ID, + in.readString( + RemoteViewsProto.AttributeReflectionAction.ATTRIBUTE_ID)); + break; + case (int) RemoteViewsProto.AttributeReflectionAction.PARAMETER_TYPE: + values.put(RemoteViewsProto.AttributeReflectionAction.PARAMETER_TYPE, + in.readInt( + RemoteViewsProto.AttributeReflectionAction.PARAMETER_TYPE)); + break; + case (int) RemoteViewsProto.AttributeReflectionAction.RESOURCE_TYPE: + values.put(RemoteViewsProto.AttributeReflectionAction.RESOURCE_TYPE, + in.readInt( + RemoteViewsProto.AttributeReflectionAction.RESOURCE_TYPE)); + break; + default: + Log.w(LOG_TAG, "Unhandled field while reading RemoteViews proto!\n" + + ProtoUtils.currentFieldToString(in)); + } + } + in.end(token); + + checkContainsKeys(values, new long[]{RemoteViewsProto.AttributeReflectionAction.VIEW_ID, + RemoteViewsProto.AttributeReflectionAction.METHOD_NAME, + RemoteViewsProto.AttributeReflectionAction.PARAMETER_TYPE, + RemoteViewsProto.AttributeReflectionAction.RESOURCE_TYPE}); + + return (context, resources, rootData, depth) -> { + int viewId = getAsIdentifier(resources, values, + RemoteViewsProto.AttributeReflectionAction.VIEW_ID); + int attributeId = (values.indexOfKey( + RemoteViewsProto.AttributeReflectionAction.ATTRIBUTE_ID) >= 0) + ? getAsIdentifier(resources, values, + RemoteViewsProto.AttributeReflectionAction.ATTRIBUTE_ID) : 0; + return new AttributeReflectionAction(viewId, + (String) values.get(RemoteViewsProto.AttributeReflectionAction.METHOD_NAME), + (int) values.get(RemoteViewsProto.AttributeReflectionAction.PARAMETER_TYPE), + (int) values.get(RemoteViewsProto.AttributeReflectionAction.RESOURCE_TYPE), + attributeId); + }; + } } + private static final class ComplexUnitDimensionReflectionAction extends BaseReflectionAction { private final float mValue; @ComplexDimensionUnit @@ -2794,6 +3215,101 @@ public class RemoteViews implements Parcelable, Filter { public int getActionTag() { return COMPLEX_UNIT_DIMENSION_REFLECTION_ACTION_TAG; } + + @Override + public boolean canWriteToProto() { + return true; + } + + @Override + public void writeToProto(ProtoOutputStream out, Context context, Resources appResources) { + final long token = out.start( + RemoteViewsProto.Action.COMPLEX_UNIT_DIMENSION_REFLECTION_ACTION); + out.write(RemoteViewsProto.ComplexUnitDimensionReflectionAction.VIEW_ID, + appResources.getResourceName(mViewId)); + out.write(RemoteViewsProto.ComplexUnitDimensionReflectionAction.METHOD_NAME, + mMethodName); + out.write(RemoteViewsProto.ComplexUnitDimensionReflectionAction.PARAMETER_TYPE, mType); + out.write(RemoteViewsProto.ComplexUnitDimensionReflectionAction.DIMENSION_VALUE, + mValue); + out.write(RemoteViewsProto.ComplexUnitDimensionReflectionAction.UNIT, mUnit); + out.end(token); + } + + public static PendingResources createFromProto(ProtoInputStream in) + throws Exception { + final LongSparseArray values = new LongSparseArray<>(); + + final long token = in.start( + RemoteViewsProto.Action.COMPLEX_UNIT_DIMENSION_REFLECTION_ACTION); + while (in.nextField() != NO_MORE_FIELDS) { + switch (in.getFieldNumber()) { + case (int) RemoteViewsProto.ComplexUnitDimensionReflectionAction.VIEW_ID: + values.put(RemoteViewsProto.ComplexUnitDimensionReflectionAction.VIEW_ID, + in.readString( + RemoteViewsProto + .ComplexUnitDimensionReflectionAction.VIEW_ID)); + break; + case (int) RemoteViewsProto.ComplexUnitDimensionReflectionAction.METHOD_NAME: + values.put( + RemoteViewsProto.ComplexUnitDimensionReflectionAction.METHOD_NAME, + in.readString( + RemoteViewsProto + .ComplexUnitDimensionReflectionAction.METHOD_NAME)); + break; + case (int) RemoteViewsProto.ComplexUnitDimensionReflectionAction.PARAMETER_TYPE: + values.put( + RemoteViewsProto + .ComplexUnitDimensionReflectionAction.PARAMETER_TYPE, + in.readInt( + RemoteViewsProto + .ComplexUnitDimensionReflectionAction + .PARAMETER_TYPE)); + break; + case (int) RemoteViewsProto + .ComplexUnitDimensionReflectionAction.DIMENSION_VALUE: + values.put( + RemoteViewsProto + .ComplexUnitDimensionReflectionAction.DIMENSION_VALUE, + in.readFloat( + RemoteViewsProto + .ComplexUnitDimensionReflectionAction + .DIMENSION_VALUE)); + break; + case (int) RemoteViewsProto.ComplexUnitDimensionReflectionAction.UNIT: + values.put(RemoteViewsProto.ComplexUnitDimensionReflectionAction.UNIT, + in.readInt( + RemoteViewsProto + .ComplexUnitDimensionReflectionAction.UNIT)); + break; + default: + Log.w(LOG_TAG, "Unhandled field while reading RemoteViews proto!\n" + + ProtoUtils.currentFieldToString(in)); + } + } + in.end(token); + + checkContainsKeys(values, + new long[]{RemoteViewsProto.ComplexUnitDimensionReflectionAction.VIEW_ID, + RemoteViewsProto.ComplexUnitDimensionReflectionAction.METHOD_NAME, + RemoteViewsProto.ComplexUnitDimensionReflectionAction.PARAMETER_TYPE}); + + return (context, resources, rootData, depth) -> { + int viewId = getAsIdentifier(resources, values, + RemoteViewsProto.ComplexUnitDimensionReflectionAction.VIEW_ID); + return new ComplexUnitDimensionReflectionAction(viewId, (String) values.get( + RemoteViewsProto.ComplexUnitDimensionReflectionAction.METHOD_NAME), + (int) values.get( + RemoteViewsProto + .ComplexUnitDimensionReflectionAction.PARAMETER_TYPE), + (float) values.get( + RemoteViewsProto + .ComplexUnitDimensionReflectionAction.DIMENSION_VALUE, + 0), + (int) values.get(RemoteViewsProto.ComplexUnitDimensionReflectionAction.UNIT, + 0)); + }; + } } private static final class NightModeReflectionAction extends BaseReflectionAction { @@ -2868,6 +3384,145 @@ public class RemoteViews implements Parcelable, Filter { visitIconUri((Icon) mLightValue, visitor); } } + + @Override + public boolean canWriteToProto() { + return true; + } + + @Override + public void writeToProto(ProtoOutputStream out, Context context, Resources appResources) { + final long token = out.start(RemoteViewsProto.Action.NIGHT_MODE_REFLECTION_ACTION); + out.write(RemoteViewsProto.NightModeReflectionAction.VIEW_ID, + appResources.getResourceName(mViewId)); + out.write(RemoteViewsProto.NightModeReflectionAction.METHOD_NAME, mMethodName); + out.write(RemoteViewsProto.NightModeReflectionAction.PARAMETER_TYPE, mType); + switch (this.mType) { + case ICON: + writeIconToProto(out, appResources, (Icon) mLightValue, + RemoteViewsProto.NightModeReflectionAction.LIGHT_ICON); + writeIconToProto(out, appResources, (Icon) mDarkValue, + RemoteViewsProto.NightModeReflectionAction.DARK_ICON); + break; + case COLOR_STATE_LIST: + writeColorStateListToProto(out, (ColorStateList) mLightValue, + RemoteViewsProto.NightModeReflectionAction.LIGHT_COLOR_STATE_LIST); + writeColorStateListToProto(out, (ColorStateList) mDarkValue, + RemoteViewsProto.NightModeReflectionAction.DARK_COLOR_STATE_LIST); + break; + case INT: + out.write(RemoteViewsProto.NightModeReflectionAction.LIGHT_INT, + (int) mLightValue); + out.write(RemoteViewsProto.NightModeReflectionAction.DARK_INT, + (int) mDarkValue); + break; + } + out.end(token); + } + + public static PendingResources createFromProto(ProtoInputStream in) + throws Exception { + final LongSparseArray values = new LongSparseArray<>(); + + final long token = in.start(RemoteViewsProto.Action.NIGHT_MODE_REFLECTION_ACTION); + while (in.nextField() != NO_MORE_FIELDS) { + switch (in.getFieldNumber()) { + case (int) RemoteViewsProto.NightModeReflectionAction.VIEW_ID: + values.put(RemoteViewsProto.NightModeReflectionAction.VIEW_ID, + in.readString(RemoteViewsProto.NightModeReflectionAction.VIEW_ID)); + break; + case (int) RemoteViewsProto.NightModeReflectionAction.METHOD_NAME: + values.put(RemoteViewsProto.NightModeReflectionAction.METHOD_NAME, + in.readString( + RemoteViewsProto.NightModeReflectionAction.METHOD_NAME)); + break; + case (int) RemoteViewsProto.NightModeReflectionAction.PARAMETER_TYPE: + values.put(RemoteViewsProto.NightModeReflectionAction.PARAMETER_TYPE, + in.readInt( + RemoteViewsProto.NightModeReflectionAction.PARAMETER_TYPE)); + break; + case (int) RemoteViewsProto.NightModeReflectionAction.LIGHT_ICON: + values.put(RemoteViewsProto.NightModeReflectionAction.LIGHT_ICON, + createIconFromProto(in, + RemoteViewsProto.NightModeReflectionAction.LIGHT_ICON)); + break; + case (int) RemoteViewsProto.NightModeReflectionAction.LIGHT_COLOR_STATE_LIST: + values.put( + RemoteViewsProto.NightModeReflectionAction.LIGHT_COLOR_STATE_LIST, + createColorStateListFromProto(in, + RemoteViewsProto + .NightModeReflectionAction.LIGHT_COLOR_STATE_LIST)); + break; + case (int) RemoteViewsProto.NightModeReflectionAction.LIGHT_INT: + values.put(RemoteViewsProto.NightModeReflectionAction.LIGHT_INT, + in.readInt(RemoteViewsProto.NightModeReflectionAction.LIGHT_INT)); + break; + case (int) RemoteViewsProto.NightModeReflectionAction.DARK_ICON: + values.put(RemoteViewsProto.NightModeReflectionAction.DARK_ICON, + createIconFromProto(in, + RemoteViewsProto.NightModeReflectionAction.DARK_ICON)); + break; + case (int) RemoteViewsProto.NightModeReflectionAction.DARK_COLOR_STATE_LIST: + values.put(RemoteViewsProto.NightModeReflectionAction.DARK_COLOR_STATE_LIST, + createColorStateListFromProto(in, + RemoteViewsProto + .NightModeReflectionAction.DARK_COLOR_STATE_LIST)); + break; + case (int) RemoteViewsProto.NightModeReflectionAction.DARK_INT: + values.put(RemoteViewsProto.NightModeReflectionAction.DARK_INT, + in.readInt(RemoteViewsProto.NightModeReflectionAction.DARK_INT)); + break; + default: + Log.w(LOG_TAG, "Unhandled field while reading RemoteViews proto!\n" + + ProtoUtils.currentFieldToString(in)); + } + } + in.end(token); + + checkContainsKeys(values, new long[]{RemoteViewsProto.NightModeReflectionAction.VIEW_ID, + RemoteViewsProto.NightModeReflectionAction.METHOD_NAME, + RemoteViewsProto.NightModeReflectionAction.PARAMETER_TYPE}); + + return (context, resources, rootData, depth) -> { + int viewId = getAsIdentifier(resources, values, + RemoteViewsProto.NightModeReflectionAction.VIEW_ID); + String methodName = (String) values.get( + RemoteViewsProto.NightModeReflectionAction.METHOD_NAME); + int parameterType = (int) values.get( + RemoteViewsProto.NightModeReflectionAction.PARAMETER_TYPE); + switch (parameterType) { + case ICON: + PendingResources pendingLightIcon = + (PendingResources) values.get( + RemoteViewsProto.NightModeReflectionAction.LIGHT_ICON); + PendingResources pendingDarkIcon = + (PendingResources) values.get( + RemoteViewsProto.NightModeReflectionAction.DARK_ICON); + Icon lightIcon = pendingLightIcon != null ? pendingLightIcon.create(context, + resources, rootData, depth) : null; + Icon darkIcon = pendingDarkIcon != null ? pendingDarkIcon.create(context, + resources, rootData, depth) : null; + return new NightModeReflectionAction(viewId, methodName, parameterType, + lightIcon, darkIcon); + case COLOR_STATE_LIST: + return new NightModeReflectionAction(viewId, methodName, parameterType, + (ColorStateList) values.get( + RemoteViewsProto + .NightModeReflectionAction.LIGHT_COLOR_STATE_LIST), + (ColorStateList) values.get( + RemoteViewsProto + .NightModeReflectionAction.DARK_COLOR_STATE_LIST)); + case INT: + return new NightModeReflectionAction(viewId, methodName, parameterType, + (int) values.get( + RemoteViewsProto.NightModeReflectionAction.LIGHT_INT, 0), + (int) values.get( + RemoteViewsProto.NightModeReflectionAction.DARK_INT, 0)); + default: + throw new RuntimeException("Unknown parameterType: " + parameterType); + } + }; + } } /** @@ -3353,6 +4008,46 @@ public class RemoteViews implements Parcelable, Filter { public int mergeBehavior() { return MERGE_APPEND; } + + @Override + public boolean canWriteToProto() { + return true; + } + + @Override + public void writeToProto(ProtoOutputStream out, Context context, Resources appResources) { + final long token = out.start(RemoteViewsProto.Action.REMOVE_FROM_PARENT_ACTION); + out.write(RemoteViewsProto.RemoveFromParentAction.VIEW_ID, + appResources.getResourceName(mViewId)); + out.end(token); + } + + public static PendingResources createFromProto(ProtoInputStream in) + throws Exception { + final LongSparseArray values = new LongSparseArray<>(); + + final long token = in.start(RemoteViewsProto.Action.REMOVE_FROM_PARENT_ACTION); + while (in.nextField() != NO_MORE_FIELDS) { + switch (in.getFieldNumber()) { + case (int) RemoteViewsProto.RemoveFromParentAction.VIEW_ID: + values.put(RemoteViewsProto.RemoveFromParentAction.VIEW_ID, + in.readString(RemoteViewsProto.RemoveFromParentAction.VIEW_ID)); + break; + default: + Log.w(LOG_TAG, "Unhandled field while reading RemoteViews proto!\n" + + ProtoUtils.currentFieldToString(in)); + } + } + in.end(token); + + checkContainsKeys(values, new long[]{RemoteViewsProto.RemoveFromParentAction.VIEW_ID}); + + return (context, resources, rootData, depth) -> { + int viewId = getAsIdentifier(resources, values, + RemoteViewsProto.RemoveFromParentAction.VIEW_ID); + return new RemoveFromParentAction(viewId); + }; + } } /** @@ -3768,6 +4463,64 @@ public class RemoteViews implements Parcelable, Filter { public String getUniqueKey() { return super.getUniqueKey() + mProperty; } + + @Override + public boolean canWriteToProto() { + return true; + } + + @Override + public void writeToProto(ProtoOutputStream out, Context context, Resources appResources) { + final long token = out.start(RemoteViewsProto.Action.LAYOUT_PARAM_ACTION); + out.write(RemoteViewsProto.LayoutParamAction.VIEW_ID, + appResources.getResourceName(mViewId)); + out.write(RemoteViewsProto.LayoutParamAction.PROPERTY, mProperty); + out.write(RemoteViewsProto.LayoutParamAction.LAYOUT_VALUE, mValue); + out.write(RemoteViewsProto.LayoutParamAction.VALUE_TYPE, mValueType); + out.end(token); + } + + public static PendingResources createFromProto(ProtoInputStream in) + throws Exception { + final LongSparseArray values = new LongSparseArray<>(); + + final long token = in.start(RemoteViewsProto.Action.LAYOUT_PARAM_ACTION); + while (in.nextField() != NO_MORE_FIELDS) { + switch (in.getFieldNumber()) { + case (int) RemoteViewsProto.LayoutParamAction.VIEW_ID: + values.put(RemoteViewsProto.LayoutParamAction.VIEW_ID, + in.readString(RemoteViewsProto.LayoutParamAction.VIEW_ID)); + break; + case (int) RemoteViewsProto.LayoutParamAction.PROPERTY: + values.put(RemoteViewsProto.LayoutParamAction.PROPERTY, + in.readInt(RemoteViewsProto.LayoutParamAction.PROPERTY)); + break; + case (int) RemoteViewsProto.LayoutParamAction.LAYOUT_VALUE: + values.put(RemoteViewsProto.LayoutParamAction.LAYOUT_VALUE, + in.readInt(RemoteViewsProto.LayoutParamAction.LAYOUT_VALUE)); + break; + case (int) RemoteViewsProto.LayoutParamAction.VALUE_TYPE: + values.put(RemoteViewsProto.LayoutParamAction.VALUE_TYPE, + in.readInt(RemoteViewsProto.LayoutParamAction.VALUE_TYPE)); + break; + default: + Log.w(LOG_TAG, "Unhandled field while reading RemoteViews proto!\n" + + ProtoUtils.currentFieldToString(in)); + } + } + in.end(token); + + checkContainsKeys(values, new long[]{RemoteViewsProto.LayoutParamAction.VIEW_ID}); + + return (context, resources, rootData, depth) -> { + int viewId = getAsIdentifier(resources, values, + RemoteViewsProto.LayoutParamAction.VIEW_ID); + return new LayoutParamAction(viewId, + (int) values.get(RemoteViewsProto.LayoutParamAction.PROPERTY, 0), + (int) values.get(RemoteViewsProto.LayoutParamAction.LAYOUT_VALUE, 0), + (int) values.get(RemoteViewsProto.LayoutParamAction.VALUE_TYPE, 0)); + }; + } } /** @@ -6251,6 +7004,18 @@ public class RemoteViews implements Parcelable, Filter { private View inflateView(Context context, RemoteViews rv, @Nullable ViewGroup parent, @StyleRes int applyThemeResId, @Nullable ColorResources colorResources) { + try { + Trace.beginSection(rv.hasDrawInstructions() + ? "RemoteViews#inflateViewWithDrawInstructions" + : "RemoteViews#inflateView"); + return inflateViewInternal(context, rv, parent, applyThemeResId, colorResources); + } finally { + Trace.endSection(); + } + } + + private View inflateViewInternal(Context context, RemoteViews rv, @Nullable ViewGroup parent, + @StyleRes int applyThemeResId, @Nullable ColorResources colorResources) { // RemoteViews may be built by an application installed in another // user. So build a context that loads resources from that user but // still returns the current users userId so settings like data / time formats @@ -6417,10 +7182,17 @@ public class RemoteViews implements Parcelable, Filter { if (mRV.mActions != null) { int count = mRV.mActions.size(); mActions = new Action[count]; - for (int i = 0; i < count && !isCancelled(); i++) { - // TODO: check if isCancelled in nested views. - mActions[i] = mRV.mActions.get(i) - .initActionAsync(mTree, mParent, mApplyParams); + try { + Trace.beginSection(hasDrawInstructions() + ? "RemoteViews#initActionAsyncWithDrawInstructions" + : "RemoteViews#initActionAsync"); + for (int i = 0; i < count && !isCancelled(); i++) { + // TODO: check if isCancelled in nested views. + mActions[i] = mRV.mActions.get(i) + .initActionAsync(mTree, mParent, mApplyParams); + } + } finally { + Trace.endSection(); } } else { mActions = null; @@ -6442,13 +7214,19 @@ public class RemoteViews implements Parcelable, Filter { try { if (mActions != null) { - ActionApplyParams applyParams = mApplyParams.clone(); if (applyParams.handler == null) { applyParams.handler = DEFAULT_INTERACTION_HANDLER; } - for (Action a : mActions) { - a.apply(viewTree.mRoot, mParent, applyParams); + try { + Trace.beginSection(hasDrawInstructions() + ? "RemoteViews#applyActionsAsyncWithDrawInstructions" + : "RemoteViews#applyActionsAsync"); + for (Action a : mActions) { + a.apply(viewTree.mRoot, mParent, applyParams); + } + } finally { + Trace.endSection(); } } // If the parent of the view is has is a root, resolve the recycling. @@ -6635,8 +7413,15 @@ public class RemoteViews implements Parcelable, Filter { } if (mActions != null) { final int count = mActions.size(); - for (int i = 0; i < count; i++) { - mActions.get(i).apply(v, parent, params); + try { + Trace.beginSection(hasDrawInstructions() + ? "RemoteViews#applyActionsWithDrawInstructions" + : "RemoteViews#applyActions"); + for (int i = 0; i < count; i++) { + mActions.get(i).apply(v, parent, params); + } + } finally { + Trace.endSection(); } } } @@ -7668,6 +8453,7 @@ public class RemoteViews implements Parcelable, Filter { values.put(RemoteViewsProto.RemoteCollectionItems.IDS, new ArrayList()); values.put(RemoteViewsProto.RemoteCollectionItems.VIEWS, new ArrayList>()); + while (in.nextField() != NO_MORE_FIELDS) { switch (in.getFieldNumber()) { case (int) RemoteViewsProto.RemoteCollectionItems.IDS: @@ -7704,6 +8490,7 @@ public class RemoteViews implements Parcelable, Filter { checkContainsKeys(values, new long[]{RemoteViewsProto.RemoteCollectionItems.VIEW_TYPE_COUNT}); + return (context, resources, rootData, depth) -> { List idList = (List) values.get( RemoteViewsProto.RemoteCollectionItems.IDS); @@ -8149,6 +8936,16 @@ public class RemoteViews implements Parcelable, Filter { out.write(SizeFProto.HEIGHT, mIdealSize.getHeight()); out.end(token); } + + if (mActions != null) { + for (Action action : mActions) { + if (action.canWriteToProto()) { + final long token = out.start(RemoteViewsProto.ACTIONS); + action.writeToProto(out, context, appResources); + out.end(token); + } + } + } } else if (hasSizedRemoteViews()) { out.write(RemoteViewsProto.MODE, MODE_HAS_SIZED_REMOTEVIEWS); for (RemoteViews view : mSizedRemoteViews) { @@ -8192,6 +8989,7 @@ public class RemoteViews implements Parcelable, Filter { String mLayoutResName = null; String mLightBackgroundResName = null; String mViewResName = null; + final List> mActions = new ArrayList<>(); final List> mSizedRemoteViews = new ArrayList<>(); PendingResources mLandscapeViews = null; PendingResources mPortraitViews = null; @@ -8230,6 +9028,14 @@ public class RemoteViews implements Parcelable, Filter { case (int) RemoteViewsProto.PROVIDER_INSTANCE_ID: ref.mProviderInstanceId = in.readInt(RemoteViewsProto.PROVIDER_INSTANCE_ID); break; + case (int) RemoteViewsProto.ACTIONS: + final long actionsToken = in.start(RemoteViewsProto.ACTIONS); + final PendingResources action = createActionFromProto(ref.mRv, in); + if (action != null) { + ref.mActions.add(action); + } + in.end(actionsToken); + break; case (int) RemoteViewsProto.SIZED_REMOTEVIEWS: final long sizedToken = in.start(RemoteViewsProto.SIZED_REMOTEVIEWS); ref.mSizedRemoteViews.add(createFromProto(in)); @@ -8328,19 +9134,27 @@ public class RemoteViews implements Parcelable, Filter { } } if (ref.mPopulateRemoteCollectionCache != null) { - ref.mPopulateRemoteCollectionCache.create(context, resources, rootData, depth); + ref.mPopulateRemoteCollectionCache.create(appContext, appResources, rootData, + depth); } if (ref.mProviderInstanceId != -1) { rv.mProviderInstanceId = ref.mProviderInstanceId; } if (ref.mMode == MODE_NORMAL) { rv.setIdealSize(ref.mIdealSize); + for (PendingResources pendingAction : ref.mActions) { + Action action = pendingAction.create(appContext, appResources, rootData, depth); + if (action != null) { + rv.addAction(action); + } + } return rv; } else if (ref.mMode == MODE_HAS_SIZED_REMOTEVIEWS) { List sizedViews = new ArrayList<>(); for (RemoteViews.PendingResources pendingViews : ref.mSizedRemoteViews) { - RemoteViews views = pendingViews.create(context, resources, rootData, depth); + RemoteViews views = pendingViews.create(appContext, appResources, rootData, + depth); sizedViews.add(views); } rv.initializeSizedRemoteViews(sizedViews.iterator()); @@ -8349,8 +9163,8 @@ public class RemoteViews implements Parcelable, Filter { checkProtoResultNotNull(ref.mLandscapeViews, "Missing landscape views"); checkProtoResultNotNull(ref.mPortraitViews, "Missing portrait views"); RemoteViews parentRv = new RemoteViews( - ref.mLandscapeViews.create(context, resources, rootData, depth), - ref.mPortraitViews.create(context, resources, rootData, depth)); + ref.mLandscapeViews.create(appContext, appResources, rootData, depth), + ref.mPortraitViews.create(appContext, appResources, rootData, depth)); parentRv.initializeFrom(/* src= */ rv, /* hierarchyRoot= */ rv); return parentRv; } else { @@ -8370,6 +9184,35 @@ public class RemoteViews implements Parcelable, Filter { throws Exception; } + @Nullable + private static PendingResources createActionFromProto(RemoteViews rv, + ProtoInputStream in) throws Exception { + int actionFieldId = in.nextField(); + if (actionFieldId == NO_MORE_FIELDS) { + // action was omitted + return null; + } + switch (actionFieldId) { + case (int) RemoteViewsProto.Action.ATTRIBUTE_REFLECTION_ACTION: + return AttributeReflectionAction.createFromProto(in); + case (int) RemoteViewsProto.Action.BITMAP_REFLECTION_ACTION: + return rv.createFromBitmapReflectionActionFromProto(in); + case (int) RemoteViewsProto.Action.COMPLEX_UNIT_DIMENSION_REFLECTION_ACTION: + return ComplexUnitDimensionReflectionAction.createFromProto(in); + case (int) RemoteViewsProto.Action.LAYOUT_PARAM_ACTION: + return LayoutParamAction.createFromProto(in); + case (int) RemoteViewsProto.Action.NIGHT_MODE_REFLECTION_ACTION: + return NightModeReflectionAction.createFromProto(in); + case (int) RemoteViewsProto.Action.REFLECTION_ACTION: + return ReflectionAction.createFromProto(in); + case (int) RemoteViewsProto.Action.REMOVE_FROM_PARENT_ACTION: + return RemoveFromParentAction.createFromProto(in); + default: + throw new RuntimeException("Unhandled field while reading Action proto!\n" + + ProtoUtils.currentFieldToString(in)); + } + } + private static void checkValidResource(int id, String message, String resName) throws Exception { if (id == 0) throw new Exception(message + ": " + resName); @@ -8392,6 +9235,22 @@ public class RemoteViews implements Parcelable, Filter { } } + private static int getAsIdentifier(Resources resources, LongSparseArray array, long fieldId) + throws Exception { + String resName = (String) array.get(fieldId); + int id = resources.getIdentifier(resName, /* defType= */ null, /* defPackage= */ null); + checkValidResource(id, "Invalid id", resName); + return id; + } + + private static int getAsIdentifier(Resources resources, SparseArray array, int key) + throws Exception { + String resName = (String) array.get(key); + int id = resources.getIdentifier(resName, /* defType= */ null, /* defPackage= */ null); + checkValidResource(id, "Invalid id", resName); + return id; + } + private static SizeF createSizeFFromProto(ProtoInputStream in) throws Exception { float width = 0; float height = 0; @@ -8411,4 +9270,43 @@ public class RemoteViews implements Parcelable, Filter { return new SizeF(width, height); } + + private static void writeIconToProto(ProtoOutputStream out, Resources appResources, Icon icon, + long fieldId) { + long token = out.start(fieldId); + RemoteViewsSerializers.writeIconToProto(out, appResources, icon); + out.end(token); + } + + private static PendingResources createIconFromProto(ProtoInputStream in, long fieldId) + throws Exception { + long token = in.start(fieldId); + Function icon = RemoteViewsSerializers.createIconFromProto(in); + in.end(token); + return (context, resources, rootData, depth) -> icon.apply(resources); + } + + private static void writeColorStateListToProto(ProtoOutputStream out, + ColorStateList colorStateList, long fieldId) { + long token = out.start(fieldId); + colorStateList.writeToProto(out); + out.end(token); + } + + private static ColorStateList createColorStateListFromProto(ProtoInputStream in, long fieldId) + throws Exception { + long token = in.start(fieldId); + ColorStateList colorStateList = ColorStateList.createFromProto(in); + in.end(token); + return colorStateList; + } + + private static CharSequence createCharSequenceFromProto(ProtoInputStream in, long fieldId) + throws Exception { + long token = in.start(fieldId); + CharSequence cs = RemoteViewsSerializers.createCharSequenceFromProto(in); + in.end(token); + return cs; + } + } diff --git a/core/java/android/widget/ScrollView.java b/core/java/android/widget/ScrollView.java index b5bf529fadbda7572e160f4ac65f1d4ccdcf483b..511c832a4876ff7e71652fe1b85d2a19967315b7 100644 --- a/core/java/android/widget/ScrollView.java +++ b/core/java/android/widget/ScrollView.java @@ -16,6 +16,7 @@ package android.widget; +import static android.view.flags.Flags.enableTouchScrollFeedback; import static android.view.flags.Flags.viewVelocityApi; import android.annotation.ColorInt; @@ -846,6 +847,8 @@ public class ScrollView extends FrameLayout { deltaY += mTouchSlop; } } + boolean hitTopLimit = false; + boolean hitBottomLimit = false; if (mIsBeingDragged) { // Scroll to follow the motion event mLastMotionY = y - mScrollOffset[1]; @@ -889,12 +892,14 @@ public class ScrollView extends FrameLayout { if (!mEdgeGlowBottom.isFinished()) { mEdgeGlowBottom.onRelease(); } + hitTopLimit = true; } else if (pulledToY > range) { mEdgeGlowBottom.onPullDistance((float) deltaY / getHeight(), 1.f - displacement); if (!mEdgeGlowTop.isFinished()) { mEdgeGlowTop.onRelease(); } + hitBottomLimit = true; } if (shouldDisplayEdgeEffects() && (!mEdgeGlowTop.isFinished() || !mEdgeGlowBottom.isFinished())) { @@ -902,6 +907,20 @@ public class ScrollView extends FrameLayout { } } } + + // TODO: b/360198915 - Add unit tests. + if (enableTouchScrollFeedback()) { + if (hitTopLimit || hitBottomLimit) { + initHapticScrollFeedbackProviderIfNotExists(); + mHapticScrollFeedbackProvider.onScrollLimit(vtev.getDeviceId(), + vtev.getSource(), MotionEvent.AXIS_Y, + /* isStart= */ hitTopLimit); + } else if (Math.abs(deltaY) != 0) { + initHapticScrollFeedbackProviderIfNotExists(); + mHapticScrollFeedbackProvider.onScrollProgress(vtev.getDeviceId(), + vtev.getSource(), MotionEvent.AXIS_Y, deltaY); + } + } break; case MotionEvent.ACTION_UP: if (mIsBeingDragged) { diff --git a/core/java/android/widget/flags/flags.aconfig b/core/java/android/widget/flags/flags.aconfig new file mode 100644 index 0000000000000000000000000000000000000000..f0ed83be8f1e70908e9f62fe7bf77935e0b72593 --- /dev/null +++ b/core/java/android/widget/flags/flags.aconfig @@ -0,0 +1,11 @@ +package: "android.widget.flags" +container: "system" +flag { + name: "enable_fading_view_group" + namespace: "system_performance" + description: "FRP screen during OOBE must have fading and scaling animation in Wear Watches" + bug: "348515581" + metadata { + purpose: PURPOSE_BUGFIX + } +} \ No newline at end of file diff --git a/core/java/android/window/BackProgressAnimator.java b/core/java/android/window/BackProgressAnimator.java index 12d4ab8bc9630a6f293a1c91800f6c2641fa490a..465e11a048f0e7458a2f20eeb5dc77405a43f5d0 100644 --- a/core/java/android/window/BackProgressAnimator.java +++ b/core/java/android/window/BackProgressAnimator.java @@ -212,6 +212,17 @@ public class BackProgressAnimator implements DynamicAnimation.OnAnimationUpdateL mBackCancelledFinishRunnable = null; } + /** + * Removes the finishCallback passed into {@link #onBackCancelled} + */ + public void removeOnBackInvokedFinishCallback() { + if (mBackInvokedFlingAnim != null) { + mBackInvokedFlingAnim.removeUpdateListener(mOnBackInvokedFlingUpdateListener); + mBackInvokedFlingAnim.removeEndListener(mOnAnimationEndListener); + } + mBackInvokedFinishRunnable = null; + } + /** Returns true if the back animation is in progress. */ @VisibleForTesting(visibility = PACKAGE) public boolean isBackAnimationInProgress() { diff --git a/core/java/android/window/OnBackInvokedDispatcher.java b/core/java/android/window/OnBackInvokedDispatcher.java index bccee9215c2dae2703c8adeac9700b061f00f598..0632a37a5dfb8ee8c0d0109f6c4381dace0b6f68 100644 --- a/core/java/android/window/OnBackInvokedDispatcher.java +++ b/core/java/android/window/OnBackInvokedDispatcher.java @@ -76,7 +76,7 @@ public interface OnBackInvokedDispatcher { * @param callback The callback to be registered. If the callback instance has been already * registered, the existing instance (no matter its priority) will be * unregistered and registered again. - * @throws {@link IllegalArgumentException} if the priority is negative. + * @throws IllegalArgumentException if the priority is negative. */ @SuppressLint({"ExecutorRegistration"}) void registerOnBackInvokedCallback( diff --git a/core/java/android/window/TaskFragmentOrganizer.java b/core/java/android/window/TaskFragmentOrganizer.java index 4cc0d8a77a2b8ccaac1addbb2dcf98bb87c50873..c316800108bd8eef250f5de34d0135d6480e01f9 100644 --- a/core/java/android/window/TaskFragmentOrganizer.java +++ b/core/java/android/window/TaskFragmentOrganizer.java @@ -68,6 +68,23 @@ public class TaskFragmentOrganizer extends WindowOrganizer { */ public static final String KEY_ERROR_CALLBACK_OP_TYPE = "operation_type"; + /** + * Key to bundle {@link TaskFragmentInfo}s from the system in + * {@link #registerOrganizer(boolean, Bundle)} + * + * @hide + */ + public static final String KEY_RESTORE_TASK_FRAGMENTS_INFO = "key_restore_task_fragments_info"; + + /** + * Key to bundle {@link TaskFragmentParentInfo} from the system in + * {@link #registerOrganizer(boolean, Bundle)} + * + * @hide + */ + public static final String KEY_RESTORE_TASK_FRAGMENT_PARENT_INFO = + "key_restore_task_fragment_parent_info"; + /** * No change set. */ diff --git a/core/java/android/window/TransitionInfo.java b/core/java/android/window/TransitionInfo.java index 1083f64513b1f96883b94e16750d6e5d0b290a97..ec79f94a6dd33b7f7ef0896bfd0301e97d118638 100644 --- a/core/java/android/window/TransitionInfo.java +++ b/core/java/android/window/TransitionInfo.java @@ -1141,6 +1141,7 @@ public final class TransitionInfo implements Parcelable { // Customize activity transition animation private CustomActivityTransition mCustomActivityOpenTransition; private CustomActivityTransition mCustomActivityCloseTransition; + private int mUserId; private AnimationOptions(int type) { mType = type; @@ -1159,6 +1160,7 @@ public final class TransitionInfo implements Parcelable { mAnimations = in.readInt(); mCustomActivityOpenTransition = in.readTypedObject(CustomActivityTransition.CREATOR); mCustomActivityCloseTransition = in.readTypedObject(CustomActivityTransition.CREATOR); + mUserId = in.readInt(); } /** Make basic customized animation for a package */ @@ -1283,6 +1285,14 @@ public final class TransitionInfo implements Parcelable { return options; } + public void setUserId(int userId) { + mUserId = userId; + } + + public int getUserId() { + return mUserId; + } + public int getType() { return mType; } @@ -1349,6 +1359,7 @@ public final class TransitionInfo implements Parcelable { dest.writeInt(mAnimations); dest.writeTypedObject(mCustomActivityOpenTransition, flags); dest.writeTypedObject(mCustomActivityCloseTransition, flags); + dest.writeInt(mUserId); } @NonNull @@ -1406,6 +1417,7 @@ public final class TransitionInfo implements Parcelable { if (mExitResId != DEFAULT_ANIMATION_RESOURCES_ID) { sb.append(" exitResId=").append(mExitResId); } + sb.append(" mUserId=").append(mUserId); sb.append('}'); return sb.toString(); } diff --git a/core/java/android/window/WindowOnBackInvokedDispatcher.java b/core/java/android/window/WindowOnBackInvokedDispatcher.java index b6c0d7cb00efc8bd7aea2977d012f0293aa30238..bb89a2499838d2f644ab13cfd68a10b86965c469 100644 --- a/core/java/android/window/WindowOnBackInvokedDispatcher.java +++ b/core/java/android/window/WindowOnBackInvokedDispatcher.java @@ -243,6 +243,8 @@ public class WindowOnBackInvokedDispatcher implements OnBackInvokedDispatcher { if (previousTopCallback == callback) { // We should call onBackCancelled() when an active callback is removed from // dispatcher. + mProgressAnimator.removeOnBackCancelledFinishCallback(); + mProgressAnimator.removeOnBackInvokedFinishCallback(); sendCancelledIfInProgress(callback); mHandler.post(mProgressAnimator::reset); setTopOnBackInvokedCallback(getTopCallback()); diff --git a/services/core/java/com/android/server/wm/utils/DesktopModeFlagsUtil.java b/core/java/android/window/flags/DesktopModeFlags.java similarity index 83% rename from services/core/java/com/android/server/wm/utils/DesktopModeFlagsUtil.java rename to core/java/android/window/flags/DesktopModeFlags.java index d33313e08742cc886b2ea3bca9257a7b16bd9c37..5c53d66e49fedea2b1a8da36dafefbbd10979e7d 100644 --- a/services/core/java/com/android/server/wm/utils/DesktopModeFlagsUtil.java +++ b/core/java/android/window/flags/DesktopModeFlags.java @@ -14,9 +14,7 @@ * limitations under the License. */ -package com.android.server.wm.utils; - -import static com.android.server.wm.utils.DesktopModeFlagsUtil.ToggleOverride.OVERRIDE_UNSET; +package android.window.flags; import android.annotation.Nullable; import android.content.Context; @@ -28,18 +26,18 @@ import com.android.window.flags.Flags; import java.util.function.Supplier; /** - * Util to check desktop mode flags state. + * Checks desktop mode flag state. * - * This utility is used to allow developer option toggles to override flags related to desktop - * windowing. + *

This enum provides a centralized way to control the behavior of flags related to desktop + * windowing features which are aiming for developer preview before their release. It allows + * developer option to override the default behavior of these flags. * - * Computes whether Desktop Windowing related flags should be enabled by using the aconfig flag - * value and the developer option override state (if applicable). + *

NOTE: Flags should only be added to this enum when they have received Product and UX + * alignment that the feature is ready for developer preview, otherwise just do a flag check. * - * This is a partial copy of {@link com.android.wm.shell.shared.desktopmode.DesktopModeFlags} which - * is to be used in WM core. + * @hide */ -public enum DesktopModeFlagsUtil { +public enum DesktopModeFlags { // All desktop mode related flags to be overridden by developer option toggle will be added here DESKTOP_WINDOWING_MODE( Flags::enableDesktopWindowingMode, /* shouldOverrideByDevOption= */ true), @@ -55,7 +53,7 @@ public enum DesktopModeFlagsUtil { // be refreshed only on reboots as overridden state is expected to take effect on reboots. private static ToggleOverride sCachedToggleOverride; - DesktopModeFlagsUtil(Supplier flagFunction, boolean shouldOverrideByDevOption) { + DesktopModeFlags(Supplier flagFunction, boolean shouldOverrideByDevOption) { this.mFlagFunction = flagFunction; this.mShouldOverrideByDevOption = shouldOverrideByDevOption; } @@ -101,13 +99,13 @@ public enum DesktopModeFlagsUtil { int settingValue = Settings.Global.getInt( context.getContentResolver(), Settings.Global.DEVELOPMENT_OVERRIDE_DESKTOP_MODE_FEATURES, - OVERRIDE_UNSET.getSetting() + ToggleOverride.OVERRIDE_UNSET.getSetting() ); - return ToggleOverride.fromSetting(settingValue, OVERRIDE_UNSET); + return ToggleOverride.fromSetting(settingValue, ToggleOverride.OVERRIDE_UNSET); } /** Override state of desktop mode developer option toggle. */ - enum ToggleOverride { + private enum ToggleOverride { OVERRIDE_UNSET, OVERRIDE_OFF, OVERRIDE_ON; diff --git a/core/java/android/window/flags/lse_desktop_experience.aconfig b/core/java/android/window/flags/lse_desktop_experience.aconfig index 3998ac634f4341a56a8a2fc6b1a0b6eefbf98feb..0f401d3e60b11dc6d10d68fdb1d4ef295022a561 100644 --- a/core/java/android/window/flags/lse_desktop_experience.aconfig +++ b/core/java/android/window/flags/lse_desktop_experience.aconfig @@ -144,6 +144,13 @@ flag { bug: "327589741" } +flag { + name: "enable_resizing_metrics" + namespace: "lse_desktop_experience" + description: "Whether to enable log collection for task resizing in desktop windowing mode" + bug: "341319100" +} + flag { name: "enable_caption_compat_inset_force_consumption" namespace: "lse_desktop_experience" @@ -214,6 +221,13 @@ flag { bug: "356570693" } +flag { + name: "enable_desktop_windowing_exit_transitions" + namespace: "lse_desktop_experience" + description: "Enables exit desktop windowing transition & motion polish changes" + bug: "353650462" +} + flag { name: "enable_compat_ui_visibility_status" namespace: "lse_desktop_experience" @@ -251,3 +265,10 @@ flag { description: "Persists the desktop windowing session across reboots." bug: "350456942" } + +flag { + name: "enable_display_focus_in_shell_transitions" + namespace: "lse_desktop_experience" + description: "Creates a shell transition when display focus switches." + bug: "356109871" +} diff --git a/core/java/android/window/flags/windowing_frontend.aconfig b/core/java/android/window/flags/windowing_frontend.aconfig index a786fc24d9a7991e8eb0cff26cdaf21b34e84b48..69b91fdfaa9851ba50b58cc94bf9358587ffb529 100644 --- a/core/java/android/window/flags/windowing_frontend.aconfig +++ b/core/java/android/window/flags/windowing_frontend.aconfig @@ -143,6 +143,13 @@ flag { bug: "200769420" } +flag { + name: "universal_resizable_by_default" + namespace: "windowing_frontend" + description: "The orientation, aspect ratio, resizability of activity will follow system behavior by default" + bug: "357141415" +} + flag { name: "respect_non_top_visible_fixed_orientation" namespace: "windowing_frontend" @@ -180,6 +187,17 @@ flag { } } +flag { + name: "update_dims_when_window_shown" + namespace: "windowing_frontend" + description: "Check if we need to update dim layers when a new window draws the first frame" + bug: "327332488" + is_fixed_read_only: true + metadata { + purpose: PURPOSE_BUGFIX + } +} + flag { name: "release_snapshot_aggressively" namespace: "windowing_frontend" diff --git a/core/java/android/window/flags/windowing_sdk.aconfig b/core/java/android/window/flags/windowing_sdk.aconfig index 8077a55bf74de7507e160fd508e59b5fc115a152..13648de5b28ecb3d4128b1ed5fdddd43a60740f5 100644 --- a/core/java/android/window/flags/windowing_sdk.aconfig +++ b/core/java/android/window/flags/windowing_sdk.aconfig @@ -115,3 +115,10 @@ flag { bug: "289875940" is_fixed_read_only: true } + +flag { + namespace: "windowing_sdk" + name: "touch_pass_through_opt_in" + description: "Requires apps to opt-in to overlay pass through touches and provide APIs to opt-in" + bug: "358129114" +} diff --git a/core/java/com/android/internal/accessibility/dialog/AccessibilityButtonChooserActivity.java b/core/java/com/android/internal/accessibility/dialog/AccessibilityButtonChooserActivity.java index 01cbb5514669d613bb88feffb1be15ac009d00a5..81d8adfce2ae576ca5181f12f984fff1c0167da2 100644 --- a/core/java/com/android/internal/accessibility/dialog/AccessibilityButtonChooserActivity.java +++ b/core/java/com/android/internal/accessibility/dialog/AccessibilityButtonChooserActivity.java @@ -20,7 +20,6 @@ import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL; import static com.android.internal.accessibility.AccessibilityShortcutController.MAGNIFICATION_COMPONENT_NAME; import static com.android.internal.accessibility.AccessibilityShortcutController.MAGNIFICATION_CONTROLLER_NAME; -import static com.android.internal.accessibility.common.ShortcutConstants.UserShortcutType.GESTURE; import static com.android.internal.accessibility.common.ShortcutConstants.UserShortcutType.SOFTWARE; import static com.android.internal.accessibility.dialog.AccessibilityTargetHelper.getTargets; import static com.android.internal.accessibility.util.AccessibilityStatsLogUtils.logAccessibilityButtonLongPressStatus; @@ -44,6 +43,8 @@ import java.util.List; * Activity used to display and persist a service or feature target for the Accessibility button. */ public class AccessibilityButtonChooserActivity extends Activity { + public static final String EXTRA_TYPE_TO_CHOOSE = "TYPE"; + private final List mTargets = new ArrayList<>(); @Override @@ -67,8 +68,8 @@ public class AccessibilityButtonChooserActivity extends Activity { NAV_BAR_MODE_GESTURAL == getResources().getInteger( com.android.internal.R.integer.config_navBarInteractionMode); - final int targetType = (isGestureNavigateEnabled - && android.provider.Flags.a11yStandaloneGestureEnabled()) ? GESTURE : SOFTWARE; + final int targetType = android.provider.Flags.a11yStandaloneGestureEnabled() + ? getIntent().getIntExtra(EXTRA_TYPE_TO_CHOOSE, SOFTWARE) : SOFTWARE; if (isGestureNavigateEnabled) { final TextView promptPrologue = findViewById(R.id.accessibility_button_prompt_prologue); diff --git a/core/java/com/android/internal/app/IBatteryStats.aidl b/core/java/com/android/internal/app/IBatteryStats.aidl index ebcae277c62b1ba944c15c6a9c43352c052e21c3..a5e166b9517749b59dcf54c2a37806e811ef427b 100644 --- a/core/java/com/android/internal/app/IBatteryStats.aidl +++ b/core/java/com/android/internal/app/IBatteryStats.aidl @@ -144,9 +144,9 @@ interface IBatteryStats { @EnforcePermission("UPDATE_DEVICE_STATS") void noteGpsSignalQuality(int signalLevel); @EnforcePermission("UPDATE_DEVICE_STATS") - void noteScreenState(int state); + void noteScreenState(int displayId, int state, int reason); @EnforcePermission("UPDATE_DEVICE_STATS") - void noteScreenBrightness(int brightness); + void noteScreenBrightness(int displayId, int brightness); @EnforcePermission("UPDATE_DEVICE_STATS") void noteUserActivity(int uid, int event); @EnforcePermission("UPDATE_DEVICE_STATS") diff --git a/core/java/com/android/internal/app/SetScreenLockDialogActivity.java b/core/java/com/android/internal/app/SetScreenLockDialogActivity.java index 360fcafe33180decdff77e1a032f0886ba91673c..4c3af4d453809c80074a89752d4b26f54136f207 100644 --- a/core/java/com/android/internal/app/SetScreenLockDialogActivity.java +++ b/core/java/com/android/internal/app/SetScreenLockDialogActivity.java @@ -60,6 +60,7 @@ public class SetScreenLockDialogActivity extends AlertActivity LAUNCH_REASON_PRIVATE_SPACE_SETTINGS_ACCESS, LAUNCH_REASON_DISABLE_QUIET_MODE, LAUNCH_REASON_UNKNOWN, + LAUNCH_REASON_RESET_PRIVATE_SPACE_SETTINGS_ACCESS, }) @Retention(RetentionPolicy.SOURCE) public @interface LaunchReason { @@ -67,6 +68,7 @@ public class SetScreenLockDialogActivity extends AlertActivity public static final int LAUNCH_REASON_UNKNOWN = -1; public static final int LAUNCH_REASON_DISABLE_QUIET_MODE = 1; public static final int LAUNCH_REASON_PRIVATE_SPACE_SETTINGS_ACCESS = 2; + public static final int LAUNCH_REASON_RESET_PRIVATE_SPACE_SETTINGS_ACCESS = 3; private @LaunchReason int mReason; private int mOriginUserId; @@ -139,7 +141,11 @@ public class SetScreenLockDialogActivity extends AlertActivity // Always set private space message if launch reason is specific to private space builder.setMessage(R.string.private_space_set_up_screen_lock_message); return; + } else if (mReason == LAUNCH_REASON_RESET_PRIVATE_SPACE_SETTINGS_ACCESS) { + builder.setMessage(R.string.private_space_set_up_screen_lock_for_reset); + return; } + final UserManager userManager = getApplicationContext().getSystemService(UserManager.class); if (userManager != null) { UserInfo userInfo = userManager.getUserInfo(mOriginUserId); diff --git a/core/java/com/android/internal/jank/flags.aconfig b/core/java/com/android/internal/jank/flags.aconfig index b6b8bc5ac44cbae58b4a277ed49c0c262915aef9..82f50ae848b3b0cda0ee88f7b6a7efa8485fcbe2 100644 --- a/core/java/com/android/internal/jank/flags.aconfig +++ b/core/java/com/android/internal/jank/flags.aconfig @@ -3,7 +3,7 @@ container: "system" flag { name: "use_sf_frame_duration" - namespace: "android_platform_window_surfaces" + namespace: "window_surfaces" description: "Whether to get the frame duration from SurfaceFlinger, or HWUI" bug: "354763298" is_fixed_read_only: true diff --git a/core/java/com/android/internal/pm/pkg/component/AconfigFlags.java b/core/java/com/android/internal/pm/pkg/component/AconfigFlags.java index b873175451e1e918a005b10e1c25740cdbab7070..39aadfb24b0cfabd45596341a7b2672f30592c5b 100644 --- a/core/java/com/android/internal/pm/pkg/component/AconfigFlags.java +++ b/core/java/com/android/internal/pm/pkg/component/AconfigFlags.java @@ -18,6 +18,7 @@ package com.android.internal.pm.pkg.component; import static com.android.internal.pm.pkg.parsing.ParsingUtils.ANDROID_RES_NAMESPACE; +import android.aconfig.DeviceProtos; import android.aconfig.nano.Aconfig; import android.aconfig.nano.Aconfig.parsed_flag; import android.aconfig.nano.Aconfig.parsed_flags; @@ -40,7 +41,7 @@ import org.xmlpull.v1.XmlPullParserException; import java.io.File; import java.io.FileInputStream; import java.io.IOException; -import java.util.List; +import java.util.Arrays; import java.util.Map; /** @@ -54,12 +55,6 @@ import java.util.Map; public class AconfigFlags { private static final String LOG_TAG = "AconfigFlags"; - private static final List sTextProtoFilesOnDevice = List.of( - "/system/etc/aconfig_flags.pb", - "/system_ext/etc/aconfig_flags.pb", - "/product/etc/aconfig_flags.pb", - "/vendor/etc/aconfig_flags.pb"); - public enum Permission { READ_WRITE, READ_ONLY @@ -73,7 +68,10 @@ public class AconfigFlags { Slog.v(LOG_TAG, "Feature disabled, skipped all loading"); return; } - for (String fileName : sTextProtoFilesOnDevice) { + final var defaultFlagProtoFiles = + (Process.myUid() == Process.SYSTEM_UID) ? DeviceProtos.parsedFlagsProtoPaths() + : Arrays.asList(DeviceProtos.PATHS); + for (String fileName : defaultFlagProtoFiles) { try (var inputStream = new FileInputStream(fileName)) { loadAconfigDefaultValues(inputStream.readAllBytes()); } catch (IOException e) { diff --git a/core/java/com/android/internal/policy/TransitionAnimation.java b/core/java/com/android/internal/policy/TransitionAnimation.java index 238e6f56153b0682d2a4b27fef5a5d7c8abcd295..201f26760956e817bc4a457fe2dfd39469cd25ca 100644 --- a/core/java/com/android/internal/policy/TransitionAnimation.java +++ b/core/java/com/android/internal/policy/TransitionAnimation.java @@ -49,7 +49,7 @@ import android.hardware.HardwareBuffer; import android.media.Image; import android.media.ImageReader; import android.os.Handler; -import android.os.SystemProperties; +import android.os.UserHandle; import android.util.Slog; import android.view.InflateException; import android.view.SurfaceControl; @@ -187,23 +187,44 @@ public class TransitionAnimation { return createHiddenByKeyguardExit(mContext, mInterpolator, onWallpaper, toShade, subtle); } + /** Load keyguard unocclude animation for user. */ + @Nullable + public Animation loadKeyguardUnoccludeAnimation(int userId) { + return loadDefaultAnimationRes(com.android.internal.R.anim.wallpaper_open_exit, userId); + } + + /** Same as {@code loadKeyguardUnoccludeAnimation} for current user. */ @Nullable public Animation loadKeyguardUnoccludeAnimation() { - return loadDefaultAnimationRes(com.android.internal.R.anim.wallpaper_open_exit); + return loadKeyguardUnoccludeAnimation(UserHandle.USER_CURRENT); } + /** Load voice activity open animation for user. */ @Nullable - public Animation loadVoiceActivityOpenAnimation(boolean enter) { + public Animation loadVoiceActivityOpenAnimation(boolean enter, int userId) { return loadDefaultAnimationRes(enter ? com.android.internal.R.anim.voice_activity_open_enter - : com.android.internal.R.anim.voice_activity_open_exit); + : com.android.internal.R.anim.voice_activity_open_exit, userId); } + /** Same as {@code loadVoiceActivityOpenAnimation} for current user. */ @Nullable - public Animation loadVoiceActivityExitAnimation(boolean enter) { + public Animation loadVoiceActivityOpenAnimation(boolean enter) { + return loadVoiceActivityOpenAnimation(enter, UserHandle.USER_CURRENT); + } + + /** Load voice activity exit animation for user. */ + @Nullable + public Animation loadVoiceActivityExitAnimation(boolean enter, int userId) { return loadDefaultAnimationRes(enter ? com.android.internal.R.anim.voice_activity_close_enter - : com.android.internal.R.anim.voice_activity_close_exit); + : com.android.internal.R.anim.voice_activity_close_exit, userId); + } + + /** Same as {@code loadVoiceActivityExitAnimation} for current user. */ + @Nullable + public Animation loadVoiceActivityExitAnimation(boolean enter) { + return loadVoiceActivityExitAnimation(enter, UserHandle.USER_CURRENT); } @Nullable @@ -211,10 +232,17 @@ public class TransitionAnimation { return loadAnimationRes(packageName, resId); } + /** Load cross profile app enter animation for user. */ @Nullable - public Animation loadCrossProfileAppEnterAnimation() { + public Animation loadCrossProfileAppEnterAnimation(int userId) { return loadAnimationRes(DEFAULT_PACKAGE, - com.android.internal.R.anim.task_open_enter_cross_profile_apps); + com.android.internal.R.anim.task_open_enter_cross_profile_apps, userId); + } + + /** Same as {@code loadCrossProfileAppEnterAnimation} for current user. */ + @Nullable + public Animation loadCrossProfileAppEnterAnimation() { + return loadCrossProfileAppEnterAnimation(UserHandle.USER_CURRENT); } @Nullable @@ -230,11 +258,11 @@ public class TransitionAnimation { appRect.height(), 0, null); } - /** Load animation by resource Id from specific package. */ + /** Load animation by resource Id from specific package for user. */ @Nullable - public Animation loadAnimationRes(String packageName, int resId) { + public Animation loadAnimationRes(String packageName, int resId, int userId) { if (ResourceId.isValid(resId)) { - AttributeCache.Entry ent = getCachedAnimations(packageName, resId); + AttributeCache.Entry ent = getCachedAnimations(packageName, resId, userId); if (ent != null) { return loadAnimationSafely(ent.context, resId, mTag); } @@ -242,10 +270,22 @@ public class TransitionAnimation { return null; } - /** Load animation by resource Id from android package. */ + /** Same as {@code loadAnimationRes} for current user. */ + @Nullable + public Animation loadAnimationRes(String packageName, int resId) { + return loadAnimationRes(packageName, resId, UserHandle.USER_CURRENT); + } + + /** Load animation by resource Id from android package for user. */ + @Nullable + public Animation loadDefaultAnimationRes(int resId, int userId) { + return loadAnimationRes(DEFAULT_PACKAGE, resId, userId); + } + + /** Same as {@code loadDefaultAnimationRes} for current user. */ @Nullable public Animation loadDefaultAnimationRes(int resId) { - return loadAnimationRes(DEFAULT_PACKAGE, resId); + return loadAnimationRes(DEFAULT_PACKAGE, resId, UserHandle.USER_CURRENT); } /** Load animation by attribute Id from specific LayoutParams */ @@ -378,10 +418,10 @@ public class TransitionAnimation { } @Nullable - private AttributeCache.Entry getCachedAnimations(String packageName, int resId) { + private AttributeCache.Entry getCachedAnimations(String packageName, int resId, int userId) { if (mDebug) { - Slog.v(mTag, "Loading animations: package=" - + packageName + " resId=0x" + Integer.toHexString(resId)); + Slog.v(mTag, "Loading animations: package=" + packageName + " resId=0x" + + Integer.toHexString(resId) + " for user=" + userId); } if (packageName != null) { if ((resId & 0xFF000000) == 0x01000000) { @@ -392,11 +432,16 @@ public class TransitionAnimation { + packageName); } return AttributeCache.instance().get(packageName, resId, - com.android.internal.R.styleable.WindowAnimation); + com.android.internal.R.styleable.WindowAnimation, userId); } return null; } + @Nullable + private AttributeCache.Entry getCachedAnimations(String packageName, int resId) { + return getCachedAnimations(packageName, resId, UserHandle.USER_CURRENT); + } + /** Returns window animation style ID from {@link LayoutParams} or from system in some cases */ public int getAnimationStyleResId(@NonNull LayoutParams lp) { int resId = lp.windowAnimations; diff --git a/core/java/com/android/internal/widget/ViewGroupFader.java b/core/java/com/android/internal/widget/ViewGroupFader.java index b54023a3382e8b666b1a525701533e7d6390b8cf..21206c244c8fb11338638ca3686402b0edab23af 100644 --- a/core/java/com/android/internal/widget/ViewGroupFader.java +++ b/core/java/com/android/internal/widget/ViewGroupFader.java @@ -16,12 +16,14 @@ package com.android.internal.widget; +import android.content.res.Resources; import android.graphics.Rect; import android.view.View; import android.view.ViewGroup; import android.view.ViewGroup.MarginLayoutParams; import android.view.animation.BaseInterpolator; import android.view.animation.PathInterpolator; +import android.widget.flags.Flags; /** * This class is ported from @@ -36,7 +38,7 @@ import android.view.animation.PathInterpolator; * height of the child. When not in the top or bottom regions, children have their default alpha and * scale. */ -class ViewGroupFader { +public class ViewGroupFader { private static final float SCALE_LOWER_BOUND = 0.7f; private float mScaleLowerBound = SCALE_LOWER_BOUND; @@ -68,7 +70,7 @@ class ViewGroupFader { private BaseInterpolator mBottomInterpolator = new PathInterpolator(0.3f, 0f, 0.7f, 1f); /** Callback which is called when attempting to fade a view. */ - interface AnimationCallback { + public interface AnimationCallback { boolean shouldFadeFromTop(View view); boolean shouldFadeFromBottom(View view); @@ -82,7 +84,7 @@ class ViewGroupFader { * of the current position. */ // TODO(b/182846214): Clean up the interface design to avoid exposing too much details to users. - interface ChildViewBoundsProvider { + public interface ChildViewBoundsProvider { /** * Provide the bounds of the child view. * @@ -168,7 +170,7 @@ class ViewGroupFader { } } - ViewGroupFader( + public ViewGroupFader( ViewGroup parent, AnimationCallback callback, ChildViewBoundsProvider childViewBoundsProvider) { @@ -212,7 +214,7 @@ class ViewGroupFader { this.mContainerBoundsProvider = boundsProvider; } - void updateFade() { + public void updateFade() { mContainerBoundsProvider.provideBounds(mParent, mContainerBounds); mTopBoundPixels = mContainerBounds.height() * mChainedBoundsTop; mBottomBoundPixels = mContainerBounds.height() * mChainedBoundsBottom; @@ -221,13 +223,20 @@ class ViewGroupFader { } /** For each list element, calculate and adjust the scale and alpha based on its position */ - private void updateListElementFades(ViewGroup parent, boolean shouldFade) { + public void updateListElementFades(ViewGroup parent, boolean shouldFade) { for (int i = 0; i < parent.getChildCount(); i++) { View child = parent.getChildAt(i); if (child.getVisibility() != View.VISIBLE) { continue; } + if (Flags.enableFadingViewGroup() && Resources.getSystem().getBoolean( + com.android.internal.R.bool.config_enableViewGroupScalingFading)) { + if (child instanceof ViewGroup) { + updateListElementFades((ViewGroup) child, true); + } + } + if (shouldFade) { fadeElement(parent, child); } @@ -312,4 +321,4 @@ class ViewGroupFader { private static float lerp(float min, float max, float fraction) { return min + (max - min) * fraction; } -} +} \ No newline at end of file diff --git a/core/jni/android_database_SQLiteConnection.cpp b/core/jni/android_database_SQLiteConnection.cpp index 7410468199b89e961707728f28efdfa87707343b..3370f386f4d2f56ab7964e9df5b4d28753d7d4f6 100644 --- a/core/jni/android_database_SQLiteConnection.cpp +++ b/core/jni/android_database_SQLiteConnection.cpp @@ -70,11 +70,14 @@ struct SQLiteConnection { // Open flags. // Must be kept in sync with the constants defined in SQLiteDatabase.java. enum { + // LINT.IfChange OPEN_READWRITE = 0x00000000, OPEN_READONLY = 0x00000001, OPEN_READ_MASK = 0x00000001, NO_LOCALIZED_COLLATORS = 0x00000010, + NO_DOUBLE_QUOTED_STRS = 0x00000020, CREATE_IF_NECESSARY = 0x10000000, + // LINT.ThenChange(/core/java/android/database/sqlite/SQLiteDatabase.java) }; sqlite3* const db; @@ -156,6 +159,18 @@ static jlong nativeOpen(JNIEnv* env, jclass clazz, jstring pathStr, jint openFla } } + // Disallow double-quoted string literals if the proper flag is set. + if ((openFlags & SQLiteConnection::NO_DOUBLE_QUOTED_STRS) != 0) { + void *setting = 0; + int err = 0; + if ((err = sqlite3_db_config(db, SQLITE_DBCONFIG_DQS_DDL, 0, setting)) != SQLITE_OK) { + ALOGE("failed to configure SQLITE_DBCONFIG_DQS_DDL: %d", err); + } + if ((err = sqlite3_db_config(db, SQLITE_DBCONFIG_DQS_DML, 0, setting)) != SQLITE_OK) { + ALOGE("failed to configure SQLITE_DBCONFIG_DQS_DML: %d", err); + } + } + // Check that the database is really read/write when that is what we asked for. if ((sqliteFlags & SQLITE_OPEN_READWRITE) && sqlite3_db_readonly(db, NULL)) { throw_sqlite3_exception(env, db, "Could not open the database in read/write mode."); diff --git a/core/jni/android_os_Parcel.cpp b/core/jni/android_os_Parcel.cpp index 584ebaa221fc9b14970afc8db3dd7363113c8a33..dec724b6a7ff86f97ff8335cc12cf85c7fb54110 100644 --- a/core/jni/android_os_Parcel.cpp +++ b/core/jni/android_os_Parcel.cpp @@ -90,7 +90,7 @@ void recycleJavaParcelObject(JNIEnv* env, jobject parcelObj) env->CallVoidMethod(parcelObj, gParcelOffsets.recycle); } -static void android_os_Parcel_markSensitive(jlong nativePtr) +static void android_os_Parcel_markSensitive(CRITICAL_JNI_PARAMS_COMMA jlong nativePtr) { Parcel* parcel = reinterpret_cast(nativePtr); if (parcel) { @@ -116,30 +116,30 @@ static void android_os_Parcel_markForBinder(JNIEnv* env, jclass clazz, jlong nat } } -static jboolean android_os_Parcel_isForRpc(jlong nativePtr) { +static jboolean android_os_Parcel_isForRpc(CRITICAL_JNI_PARAMS_COMMA jlong nativePtr) { Parcel* parcel = reinterpret_cast(nativePtr); return parcel ? parcel->isForRpc() : false; } -static jint android_os_Parcel_dataSize(jlong nativePtr) +static jint android_os_Parcel_dataSize(CRITICAL_JNI_PARAMS_COMMA jlong nativePtr) { Parcel* parcel = reinterpret_cast(nativePtr); return parcel ? parcel->dataSize() : 0; } -static jint android_os_Parcel_dataAvail(jlong nativePtr) +static jint android_os_Parcel_dataAvail(CRITICAL_JNI_PARAMS_COMMA jlong nativePtr) { Parcel* parcel = reinterpret_cast(nativePtr); return parcel ? parcel->dataAvail() : 0; } -static jint android_os_Parcel_dataPosition(jlong nativePtr) +static jint android_os_Parcel_dataPosition(CRITICAL_JNI_PARAMS_COMMA jlong nativePtr) { Parcel* parcel = reinterpret_cast(nativePtr); return parcel ? parcel->dataPosition() : 0; } -static jint android_os_Parcel_dataCapacity(jlong nativePtr) +static jint android_os_Parcel_dataCapacity(CRITICAL_JNI_PARAMS_COMMA jlong nativePtr) { Parcel* parcel = reinterpret_cast(nativePtr); return parcel ? parcel->dataCapacity() : 0; @@ -156,7 +156,7 @@ static void android_os_Parcel_setDataSize(JNIEnv* env, jclass clazz, jlong nativ } } -static void android_os_Parcel_setDataPosition(jlong nativePtr, jint pos) +static void android_os_Parcel_setDataPosition(CRITICAL_JNI_PARAMS_COMMA jlong nativePtr, jint pos) { Parcel* parcel = reinterpret_cast(nativePtr); if (parcel != NULL) { @@ -175,7 +175,8 @@ static void android_os_Parcel_setDataCapacity(JNIEnv* env, jclass clazz, jlong n } } -static jboolean android_os_Parcel_pushAllowFds(jlong nativePtr, jboolean allowFds) +static jboolean android_os_Parcel_pushAllowFds(CRITICAL_JNI_PARAMS_COMMA + jlong nativePtr, jboolean allowFds) { Parcel* parcel = reinterpret_cast(nativePtr); jboolean ret = JNI_TRUE; @@ -185,7 +186,8 @@ static jboolean android_os_Parcel_pushAllowFds(jlong nativePtr, jboolean allowFd return ret; } -static void android_os_Parcel_restoreAllowFds(jlong nativePtr, jboolean lastValue) +static void android_os_Parcel_restoreAllowFds(CRITICAL_JNI_PARAMS_COMMA + jlong nativePtr, jboolean lastValue) { Parcel* parcel = reinterpret_cast(nativePtr); if (parcel != NULL) { @@ -259,22 +261,22 @@ static void android_os_Parcel_writeBlob(JNIEnv* env, jclass clazz, jlong nativeP blob.release(); } -static int android_os_Parcel_writeInt(jlong nativePtr, jint val) { +static int android_os_Parcel_writeInt(CRITICAL_JNI_PARAMS_COMMA jlong nativePtr, jint val) { Parcel* parcel = reinterpret_cast(nativePtr); return (parcel != NULL) ? parcel->writeInt32(val) : OK; } -static int android_os_Parcel_writeLong(jlong nativePtr, jlong val) { +static int android_os_Parcel_writeLong(CRITICAL_JNI_PARAMS_COMMA jlong nativePtr, jlong val) { Parcel* parcel = reinterpret_cast(nativePtr); return (parcel != NULL) ? parcel->writeInt64(val) : OK; } -static int android_os_Parcel_writeFloat(jlong nativePtr, jfloat val) { +static int android_os_Parcel_writeFloat(CRITICAL_JNI_PARAMS_COMMA jlong nativePtr, jfloat val) { Parcel* parcel = reinterpret_cast(nativePtr); return (parcel != NULL) ? parcel->writeFloat(val) : OK; } -static int android_os_Parcel_writeDouble(jlong nativePtr, jdouble val) { +static int android_os_Parcel_writeDouble(CRITICAL_JNI_PARAMS_COMMA jlong nativePtr, jdouble val) { Parcel* parcel = reinterpret_cast(nativePtr); return (parcel != NULL) ? parcel->writeDouble(val) : OK; } @@ -446,7 +448,7 @@ static jbyteArray android_os_Parcel_readBlob(JNIEnv* env, jclass clazz, jlong na return ret; } -static jint android_os_Parcel_readInt(jlong nativePtr) +static jint android_os_Parcel_readInt(CRITICAL_JNI_PARAMS_COMMA jlong nativePtr) { Parcel* parcel = reinterpret_cast(nativePtr); if (parcel != NULL) { @@ -455,7 +457,7 @@ static jint android_os_Parcel_readInt(jlong nativePtr) return 0; } -static jlong android_os_Parcel_readLong(jlong nativePtr) +static jlong android_os_Parcel_readLong(CRITICAL_JNI_PARAMS_COMMA jlong nativePtr) { Parcel* parcel = reinterpret_cast(nativePtr); if (parcel != NULL) { @@ -464,7 +466,7 @@ static jlong android_os_Parcel_readLong(jlong nativePtr) return 0; } -static jfloat android_os_Parcel_readFloat(jlong nativePtr) +static jfloat android_os_Parcel_readFloat(CRITICAL_JNI_PARAMS_COMMA jlong nativePtr) { Parcel* parcel = reinterpret_cast(nativePtr); if (parcel != NULL) { @@ -473,7 +475,7 @@ static jfloat android_os_Parcel_readFloat(jlong nativePtr) return 0; } -static jdouble android_os_Parcel_readDouble(jlong nativePtr) +static jdouble android_os_Parcel_readDouble(CRITICAL_JNI_PARAMS_COMMA jlong nativePtr) { Parcel* parcel = reinterpret_cast(nativePtr); if (parcel != NULL) { @@ -690,7 +692,7 @@ static jboolean android_os_Parcel_hasBindersInRange(JNIEnv* env, jclass clazz, j return JNI_FALSE; } -static jboolean android_os_Parcel_hasFileDescriptors(jlong nativePtr) +static jboolean android_os_Parcel_hasFileDescriptors(CRITICAL_JNI_PARAMS_COMMA jlong nativePtr) { jboolean ret = JNI_FALSE; Parcel* parcel = reinterpret_cast(nativePtr); @@ -807,7 +809,7 @@ static jlong android_os_Parcel_getGlobalAllocCount(JNIEnv* env, jclass clazz) return Parcel::getGlobalAllocCount(); } -static jlong android_os_Parcel_getOpenAshmemSize(jlong nativePtr) +static jlong android_os_Parcel_getOpenAshmemSize(CRITICAL_JNI_PARAMS_COMMA jlong nativePtr) { Parcel* parcel = reinterpret_cast(nativePtr); if (parcel != NULL) { @@ -816,7 +818,7 @@ static jlong android_os_Parcel_getOpenAshmemSize(jlong nativePtr) return 0; } -static jint android_os_Parcel_readCallingWorkSourceUid(jlong nativePtr) +static jint android_os_Parcel_readCallingWorkSourceUid(CRITICAL_JNI_PARAMS_COMMA jlong nativePtr) { Parcel* parcel = reinterpret_cast(nativePtr); if (parcel != NULL) { @@ -825,7 +827,8 @@ static jint android_os_Parcel_readCallingWorkSourceUid(jlong nativePtr) return IPCThreadState::kUnsetWorkSource; } -static jboolean android_os_Parcel_replaceCallingWorkSourceUid(jlong nativePtr, jint uid) +static jboolean android_os_Parcel_replaceCallingWorkSourceUid(CRITICAL_JNI_PARAMS_COMMA + jlong nativePtr, jint uid) { Parcel* parcel = reinterpret_cast(nativePtr); if (parcel != NULL) { diff --git a/core/jni/android_util_Binder.cpp b/core/jni/android_util_Binder.cpp index 921b77d61f4df28f8c05f834c76d387ae6d9ab16..f2c70b5f41d40c5f82b193eef2a8b1ac67c00a1c 100644 --- a/core/jni/android_util_Binder.cpp +++ b/core/jni/android_util_Binder.cpp @@ -1152,60 +1152,60 @@ void signalExceptionForError(JNIEnv* env, jobject obj, status_t err, // ---------------------------------------------------------------------------- -static jint android_os_Binder_getCallingPid() +static jint android_os_Binder_getCallingPid(CRITICAL_JNI_PARAMS) { return IPCThreadState::self()->getCallingPid(); } -static jint android_os_Binder_getCallingUid() +static jint android_os_Binder_getCallingUid(CRITICAL_JNI_PARAMS) { return IPCThreadState::self()->getCallingUid(); } -static jboolean android_os_Binder_isDirectlyHandlingTransactionNative() { +static jboolean android_os_Binder_isDirectlyHandlingTransactionNative(CRITICAL_JNI_PARAMS) { return getCurrentServingCall() == BinderCallType::BINDER; } -static jlong android_os_Binder_clearCallingIdentity() +static jlong android_os_Binder_clearCallingIdentity(CRITICAL_JNI_PARAMS) { return IPCThreadState::self()->clearCallingIdentity(); } -static void android_os_Binder_restoreCallingIdentity(jlong token) +static void android_os_Binder_restoreCallingIdentity(CRITICAL_JNI_PARAMS_COMMA jlong token) { IPCThreadState::self()->restoreCallingIdentity(token); } -static jboolean android_os_Binder_hasExplicitIdentity() { +static jboolean android_os_Binder_hasExplicitIdentity(CRITICAL_JNI_PARAMS) { return IPCThreadState::self()->hasExplicitIdentity(); } -static void android_os_Binder_setThreadStrictModePolicy(jint policyMask) +static void android_os_Binder_setThreadStrictModePolicy(CRITICAL_JNI_PARAMS_COMMA jint policyMask) { IPCThreadState::self()->setStrictModePolicy(policyMask); } -static jint android_os_Binder_getThreadStrictModePolicy() +static jint android_os_Binder_getThreadStrictModePolicy(CRITICAL_JNI_PARAMS) { return IPCThreadState::self()->getStrictModePolicy(); } -static jlong android_os_Binder_setCallingWorkSourceUid(jint workSource) +static jlong android_os_Binder_setCallingWorkSourceUid(CRITICAL_JNI_PARAMS_COMMA jint workSource) { return IPCThreadState::self()->setCallingWorkSourceUid(workSource); } -static jlong android_os_Binder_getCallingWorkSourceUid() +static jlong android_os_Binder_getCallingWorkSourceUid(CRITICAL_JNI_PARAMS) { return IPCThreadState::self()->getCallingWorkSourceUid(); } -static jlong android_os_Binder_clearCallingWorkSource() +static jlong android_os_Binder_clearCallingWorkSource(CRITICAL_JNI_PARAMS) { return IPCThreadState::self()->clearCallingWorkSource(); } -static void android_os_Binder_restoreCallingWorkSource(jlong token) +static void android_os_Binder_restoreCallingWorkSource(CRITICAL_JNI_PARAMS_COMMA jlong token) { IPCThreadState::self()->restoreCallingWorkSource(token); } diff --git a/core/jni/android_util_Process.cpp b/core/jni/android_util_Process.cpp index e5ac0e1a8f6e18e4b413ab12fb1275c77a694f97..49191ee02ad6b3aaf9dfcbb010b66f39a4f5dbbe 100644 --- a/core/jni/android_util_Process.cpp +++ b/core/jni/android_util_Process.cpp @@ -404,6 +404,11 @@ static void get_cpuset_cores_for_policy(SchedPolicy policy, cpu_set_t *cpu_set) return; } break; + case SP_FOREGROUND_WINDOW: + if (!CgroupGetAttributePath("HighCapacityWICPUs", &filename)) { + return; + } + break; case SP_TOP_APP: if (!CgroupGetAttributePath("MaxCapacityCPUs", &filename)) { return; diff --git a/core/proto/android/widget/remoteviews.proto b/core/proto/android/widget/remoteviews.proto index 5892396bddc42a80790f521b35279ac050f7200a..47c97b08666b1b0ad3e68c48d2d18aa20799f7f2 100644 --- a/core/proto/android/widget/remoteviews.proto +++ b/core/proto/android/widget/remoteviews.proto @@ -54,6 +54,7 @@ message RemoteViewsProto { optional bool has_draw_instructions = 13; repeated bytes bitmap_cache = 14; optional RemoteCollectionCache remote_collection_cache = 15; + repeated Action actions = 16; message RemoteCollectionCache { message Entry { @@ -288,6 +289,91 @@ message RemoteViewsProto { } } } + + message Action { + oneof action { + AttributeReflectionAction attribute_reflection_action = 1; + BitmapReflectionAction bitmap_reflection_action = 2; + ComplexUnitDimensionReflectionAction complex_unit_dimension_reflection_action = 3; + LayoutParamAction layout_param_action = 4; + NightModeReflectionAction night_mode_reflection_action = 5; + ReflectionAction reflection_action = 6; + RemoveFromParentAction remove_from_parent_action = 7; + } + } + + message AttributeReflectionAction { + optional string view_id = 1; + optional string method_name = 2; + optional int32 parameter_type = 3; + optional int32 resource_type = 4; + optional string attribute_id = 5; + } + + message BitmapReflectionAction { + optional string view_id = 1; + optional string method_name = 2; + optional int32 bitmap_id = 3; + } + + message ComplexUnitDimensionReflectionAction { + optional string view_id = 1; + optional string method_name = 2; + optional int32 parameter_type = 3; + optional float dimension_value = 4; + optional int32 unit = 5; + } + + message LayoutParamAction { + optional string view_id = 1; + optional int32 property = 2; + optional int32 layout_value = 3; + optional int32 value_type = 4; + } + + message NightModeReflectionAction { + optional string view_id = 1; + optional string method_name = 2; + optional int32 parameter_type = 3; + oneof light { + Icon light_icon = 4; + android.content.res.ColorStateListProto light_color_state_list = 5; + int32 light_int = 6; + } + oneof dark { + Icon dark_icon = 7; + android.content.res.ColorStateListProto dark_color_state_list = 8; + int32 dark_int = 9; + } + } + + message ReflectionAction { + optional string view_id = 1; + optional string method_name = 2; + optional int32 parameter_type = 3; + oneof reflection_value { + bool boolean_value = 4; + bytes byte_value = 5; + int32 short_value = 6; + int32 int_value = 7; + int64 long_value = 8; + float float_value = 9; + double double_value = 10; + int32 char_value = 11; + string string_value = 12; + CharSequence char_sequence_value = 13; + string uri_value = 14; + bytes bitmap_value = 15; + android.content.res.ColorStateListProto color_state_list_value = 16; + Icon icon_value = 17; + int32 blend_mode_value = 18; + // Intent and Bundle values are excluded. + } + } + + message RemoveFromParentAction { + optional string view_id = 1; + } } diff --git a/core/res/res/values-am/strings.xml b/core/res/res/values-am/strings.xml index 2873785e9387f5fc9e6a60e8f613bd80abf3f61d..a7b6661a42e5307f49578edf1f8769e93575f84b 100644 --- a/core/res/res/values-am/strings.xml +++ b/core/res/res/values-am/strings.xml @@ -1746,8 +1746,7 @@ "አንድ መተግበሪያ የፍቃድ ጥያቄውን እያደበዘዘ ነው ስለዚህ የእርስዎ ምላሽ ሊረጋገጥ አይችልም።" "አንድ ባህሪን መጠቀም ለመጀመር መታ ያድርጉት፦" "በተደራሽነት አዝራር የሚጠቀሙባቸው ባሕሪያት ይምረጡ" - - + "በድምፅ ቁልፍ አቋራጭ የሚጠቀሙባቸው ባህሪያት ይምረጡ" "%s ጠፍቷል" "አቋራጮችን አርትዕ ያድርጉ" "ተከናውኗል" diff --git a/core/res/res/values-as/strings.xml b/core/res/res/values-as/strings.xml index bc1dba27ff5ff3cf175fbb7a5596998998f2025a..c5ad8bab39d0ac282185d45304b9e6d130527d03 100644 --- a/core/res/res/values-as/strings.xml +++ b/core/res/res/values-as/strings.xml @@ -1356,7 +1356,7 @@ "ভিপিএন" "অজ্ঞাত প্ৰকাৰৰ নেটৱৰ্ক" - "স্বীকাৰ কৰক" + "গ্ৰহণ কৰক" "প্ৰত্যাখ্যান কৰক" "বর্ণ লিখক" "এছএমএছ বার্তাবোৰ পঠিয়াই থকা হৈছে" @@ -1746,8 +1746,7 @@ "এটা এপে অনুমতিৰ অনুৰোধটো অস্পষ্ট কৰি আছে আৰু সেয়েহে আপোনাৰ সঁহাৰিটো সত্যাপন কৰিব নোৱাৰি।" "কোনো এটা সুবিধা ব্যৱহাৰ কৰিবলৈ সেইটোত টিপক:" "সাধ্য-সুবিধা বুটামটোৰ জৰিয়তে ব্যৱহাৰ কৰিবলৈ সুবিধাসমূহ বাছনি কৰক" - - + "ভলিউম কীৰ শ্বৰ্টকাটটোৰ জৰিয়তে ব্যৱহাৰ কৰিবলৈ সুবিধাসমূহ বাছনি কৰক" "%s বন্ধ কৰা হৈছে" "শ্বৰ্টকাটসমূহ সম্পাদনা কৰক" "কৰা হ’ল" diff --git a/core/res/res/values-b+sr+Latn/strings.xml b/core/res/res/values-b+sr+Latn/strings.xml index b83eca56023fb952449a6f10b4dc29f2f28038b7..8f0f4b2259c8a27bd8c73eebe6201864e1bbfd13 100644 --- a/core/res/res/values-b+sr+Latn/strings.xml +++ b/core/res/res/values-b+sr+Latn/strings.xml @@ -1747,8 +1747,7 @@ "Aplikacija krije zahtev za dozvolu, pa odgovor ne može da se verifikuje." "Dodirnite neku funkciju da biste počeli da je koristite:" "Odaberite funkcije koje ćete koristiti sa dugmetom Pristupačnost" - - + "Odaberite funkcije koje će se koristiti sa prečicom za tastere za jačinu zvuka" "Usluga %s je isključena" "Izmenite prečice" "Gotovo" diff --git a/core/res/res/values-be/strings.xml b/core/res/res/values-be/strings.xml index 5964570662685ea489588ebfd3c93c2381c46920..7a49bf348acfc4ea5298d71a628e300e3aa4e482 100644 --- a/core/res/res/values-be/strings.xml +++ b/core/res/res/values-be/strings.xml @@ -1748,8 +1748,7 @@ "Праграма хавае запыт дазволу, таму ваш адказ немагчыма спраўдзіць." "Каб пачаць выкарыстоўваць функцыю, націсніце на яе:" "Выберыце функцыі, якія будзеце выкарыстоўваць з кнопкай спецыяльных магчымасцей" - - + "Выберыце функцыі для выкарыстання з клавішамі гучнасці" "Сэрвіс \"%s\" выключаны" "Змяніць ярлыкі" "Гатова" diff --git a/core/res/res/values-cs/strings.xml b/core/res/res/values-cs/strings.xml index b9ceede3c8be3b5c82072ad27b1d351697ec9e40..69e6483a03f4ab9018d431373da973cd2157b346 100644 --- a/core/res/res/values-cs/strings.xml +++ b/core/res/res/values-cs/strings.xml @@ -1748,8 +1748,7 @@ "Žádost o oprávnění skrývá nějaká aplikace, proto vaši odpověď nelze ověřit." "Chcete-li některou funkci začít používat, klepněte na ni:" "Vyberte funkce, které budete používat s tlačítkem přístupnosti" - - + "Vyberte funkce, které budete používat se zkratkou tlačítek hlasitosti" "Služba %s byla vypnuta" "Upravit zkratky" "Hotovo" diff --git a/core/res/res/values-en-rCA/strings.xml b/core/res/res/values-en-rCA/strings.xml index 19547f81d6361953792b2c5aa705f207f704e376..dad63334dc6cbfd85d049ad40ea64b8de24f9460 100644 --- a/core/res/res/values-en-rCA/strings.xml +++ b/core/res/res/values-en-rCA/strings.xml @@ -1746,8 +1746,7 @@ "An app is obscuring the permission request so your response cannot be verified." "Tap a feature to start using it:" "Choose features to use with the accessibility button" - - + "Choose features to use with the volume keys shortcut" "%s has been turned off" "Edit shortcuts" "Done" diff --git a/core/res/res/values-en-rXC/strings.xml b/core/res/res/values-en-rXC/strings.xml index c1eade14fbc6a3ef274c5734f427cfce209c12a3..0bcbed786d446a3bfc4c83dbddad109d98f90c61 100644 --- a/core/res/res/values-en-rXC/strings.xml +++ b/core/res/res/values-en-rXC/strings.xml @@ -1746,8 +1746,7 @@ "‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‎‏‏‎‎‏‏‏‏‏‎‏‏‏‎‎‎‎‎‏‎‏‎‏‎‏‏‎‏‎‏‏‏‎‏‏‏‎‎‏‎‎‏‏‎‎‎‏‏‎‏‎‎‏‏‏‏‏‏‎‎‏‏‎An app is obscuring the permission request so your response cannot be verified.‎‏‎‎‏‎" "‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‏‏‎‏‎‎‏‏‎‏‎‎‏‏‎‏‏‏‏‏‎‏‏‏‏‏‏‏‏‎‏‏‏‎‏‏‏‎‎‎‎‎‏‏‏‏‎‏‎‏‎‎‎‎‎‏‎‎‎‏‏‎‎‎‎Tap a feature to start using it:‎‏‎‎‏‎" "‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‎‏‎‏‏‎‏‎‏‎‎‏‎‏‎‏‎‏‏‏‏‏‎‎‏‎‏‏‏‏‎‎‏‏‏‏‎‎‎‎‎‏‎‏‎‎‎‎‎‎‎‏‎‏‏‏‎‎‏‎‏‎Choose features to use with the accessibility button‎‏‎‎‏‎" - - + "‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‎‏‏‏‏‏‏‎‎‏‎‏‎‎‏‏‏‎‎‎‎‏‏‎‏‎‎‎‏‏‎‏‏‏‏‏‎‏‎‎‏‎‎‎‏‎‏‏‎‎‎‏‎‏‎‏‏‏‎‏‏‎‎‎Choose features to use with the volume keys shortcut‎‏‎‎‏‎" "‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‏‏‏‎‏‏‏‏‏‎‏‎‏‏‏‏‏‎‏‎‎‎‏‏‏‎‎‎‏‏‏‎‎‏‏‎‎‎‏‎‎‏‎‏‎‏‎‏‎‏‏‏‎‏‏‏‎‎‏‎‎‏‏‏‎‎‏‎‎‏‏‎%s‎‏‎‎‏‏‏‎ has been turned off‎‏‎‎‏‎" "‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‏‏‏‏‏‎‏‏‎‏‎‏‎‎‎‎‏‎‎‎‏‎‎‏‎‎‎‎‏‎‎‏‏‎‎‎‎‎‏‎‎‎‏‎‏‏‏‎‎‏‎‏‎‎‎‎‏‎‎‎‎‏‏‏‎Edit shortcuts‎‏‎‎‏‎" "‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‎‏‏‏‏‏‏‎‏‏‎‎‏‎‏‏‏‎‏‎‎‎‏‏‎‎‏‏‎‏‎‏‏‎‎‎‏‏‏‎‎‎‎‎‏‎‏‎‏‎‏‎‎‎‏‎‏‎‎‏‎‎‏‏‎‏‏‏‎‎‎Done‎‏‎‎‏‎" diff --git a/core/res/res/values-es/strings.xml b/core/res/res/values-es/strings.xml index ff7d912255cb9538e95621b8916c0519967f9cc5..e50d5faea41b48c91b1a26346cf1bf0a73d6f67d 100644 --- a/core/res/res/values-es/strings.xml +++ b/core/res/res/values-es/strings.xml @@ -1747,8 +1747,7 @@ "Una aplicación está ocultando la solicitud de permiso, por lo que no se puede verificar tu respuesta." "Toca una función para empezar a usarla:" "Selecciona qué funciones usar con el botón de accesibilidad" - - + "Selecciona qué funciones usar con el acceso directo de teclas de volumen" "Se ha desactivado %s" "Editar accesos directos" "Hecho" @@ -1758,7 +1757,7 @@ "Corrección de color" "Modo Una mano" "Atenuación extra" - "Dispositivos auditivos" + "Audífonos" "Al mantener pulsadas las teclas de volumen, se ha activado %1$s." "Se han mantenido pulsadas las teclas de volumen. Se ha desactivado %1$s." "Suelta las teclas de volumen. Para activar %1$s, mantén pulsadas las dos teclas de volumen de nuevo durante 3 segundos." diff --git a/core/res/res/values-et-rEE/config.xml b/core/res/res/values-et-rEE/config.xml new file mode 100644 index 0000000000000000000000000000000000000000..cf4d07f2ead0b93308490691166e71bf0833c6ec --- /dev/null +++ b/core/res/res/values-et-rEE/config.xml @@ -0,0 +1,21 @@ + + + + false + diff --git a/core/res/res/values-fa/strings.xml b/core/res/res/values-fa/strings.xml index 5e474cde8a0930cebc847d97fb1dc6e7a498347b..0c46ed93a60202834aca61403bd0ea6644fb2183 100644 --- a/core/res/res/values-fa/strings.xml +++ b/core/res/res/values-fa/strings.xml @@ -1746,8 +1746,7 @@ "پاسخ شما تأیید نشد زیرا یک برنامه درخواست اجازه را مسدود کرده است." "برای استفاده از ویژگی، روی آن تک‌ضرب بزنید:" "انتخاب ویژگی‌های موردنظر برای استفاده با دکمه دسترس‌پذیری" - - + "انتخاب کنید کدام ویژگی‌ها با میان‌بر کلیدهای میزان صدا استفاده شود" "%s خاموش شده است" "ویرایش میان‌برها" "تمام" diff --git a/core/res/res/values-gu/strings.xml b/core/res/res/values-gu/strings.xml index 2810b5e40107210be0e3df6e763fb6d6b1e85f6a..2ac70ab79c3bb9e3aaca07f1028089215febf814 100644 --- a/core/res/res/values-gu/strings.xml +++ b/core/res/res/values-gu/strings.xml @@ -1746,8 +1746,7 @@ "કોઈ ઍપ પરવાનગીની વિનંતીને ઢાંકી રહી છે, તેથી તમારા પ્રતિસાદની ચકાસણી કરી શકાતી નથી." "સુવિધાનો ઉપયોગ શરૂ કરવા તેના પર ટૅપ કરો:" "ઍક્સેસિબિલિટી બટન વડે તમે ઉપયોગમાં લેવા માગો છો તે સુવિધાઓ પસંદ કરો" - - + "વૉલ્યૂમ કી શૉર્ટકટ વડે તમે ઉપયોગમાં લેવા માગો છો તે સુવિધાઓ પસંદ કરો" "%s બંધ કરવામાં આવ્યું છે" "શૉર્ટકટમાં ફેરફાર કરો" "થઈ ગયું" diff --git a/core/res/res/values-hi/strings.xml b/core/res/res/values-hi/strings.xml index 700e91ad8eb834486f8d8d0fa535db131271ebc6..5f1bb9a74d2787ffaffcffe512937d5a17d08b87 100644 --- a/core/res/res/values-hi/strings.xml +++ b/core/res/res/values-hi/strings.xml @@ -1746,8 +1746,7 @@ "ऐप्लिकेशन की वजह से, अनुमति का अनुरोध समझने में परेशानी हो रही है. इसलिए, आपके जवाब की पुष्टि नहीं की जा सकी." "किसी सुविधा का इस्तेमाल करने के लिए, उस पर टैप करें:" "सुलभता बटन पर टैप करके, इस्तेमाल करने के लिए सुविधाएं चुनें" - - + "वे सुविधाएं चुनें जिन्हें आवाज़ बटनों के शॉर्टकट के ज़रिए इस्तेमाल करना है" "%s को बंद कर दिया गया है" "शॉर्टकट में बदलाव करें" "हो गया" diff --git a/core/res/res/values-is/strings.xml b/core/res/res/values-is/strings.xml index 3eb2e4bd0a2c6daffcac16d3172d4d1f278aca70..057b830d4fb70783d0bb98b2d2c2d738115475c9 100644 --- a/core/res/res/values-is/strings.xml +++ b/core/res/res/values-is/strings.xml @@ -1746,8 +1746,7 @@ "Forrit er að fela heimildarbeiðnina svo ekki er hægt að staðfesta svarið þitt." "Ýttu á eiginleika til að byrja að nota hann:" "Veldu eiginleika sem á að nota með aðgengishnappinum" - - + "Veldu eiginleika sem á að nota með flýtileið hljóðstyrkstakka" "Slökkt hefur verið á %s" "Breyta flýtileiðum" "Lokið" diff --git a/core/res/res/values-ja/strings.xml b/core/res/res/values-ja/strings.xml index bcff8138c10353759438c334acd3d894aed123b0..0705b36d9450d29dd9dc9bf5e62dd8ac0d2b84f0 100644 --- a/core/res/res/values-ja/strings.xml +++ b/core/res/res/values-ja/strings.xml @@ -1400,10 +1400,10 @@ "USB テザリング ON" "USB MIDI モード ON" "ウェブカメラとしてデバイスを接続しました" - "USB アクセサリが接続されました" + "USB アクセサリーが接続されました" "タップしてその他のオプションを表示します。" "接続されているデバイスを充電しています。タップすると、他の項目が表示されます。" - "アナログのオーディオ アクセサリを検出" + "アナログのオーディオ アクセサリーを検出" "接続したデバイスはこのスマートフォンと互換性がありません。タップすると、詳細を確認できます。" "USB デバッグが接続されました" "無効にするにはここをタップしてください" @@ -1746,8 +1746,7 @@ "権限のリクエストを遮っているアプリがあるため、同意の回答を確認できません。" "使用を開始する機能をタップ:" "ユーザー補助機能ボタンで使用する機能の選択" - - + "音量ボタンのショートカットで使用する機能の選択" "%s はオフになっています" "ショートカットの編集" "完了" diff --git a/core/res/res/values-ka/strings.xml b/core/res/res/values-ka/strings.xml index 0adebb002c05862295c0fc9a79a748ce55036f5c..bac23337e0d183bebdb6da693695407505b2e36b 100644 --- a/core/res/res/values-ka/strings.xml +++ b/core/res/res/values-ka/strings.xml @@ -1746,8 +1746,7 @@ "აპი მალავს ნებართვის მოთხოვნას, ასე რომ, თქვენი პასუხი ვერ დადასტურდება." "შეეხეთ ფუნქციას მისი გამოყენების დასაწყებად:" "აირჩიეთ ფუნქციები, რომელთა გამოყენებაც გსურთ მარტივი წვდომის ღილაკით" - - + "ხმის კლავიშების მალსახმობების მეშვეობით გამოსაყენებელი ფუნქციების არჩევა" "%s გამორთულია" "მალსახმობების რედაქტირება" "მზადაა" diff --git a/core/res/res/values-km/strings.xml b/core/res/res/values-km/strings.xml index f3dd775defef9324e1b7228445f63e012ef7e035..1f931c6644e3d7c1d9dad7afc5665243cb2866c5 100644 --- a/core/res/res/values-km/strings.xml +++ b/core/res/res/values-km/strings.xml @@ -1746,8 +1746,7 @@ "កម្មវិធីមួយកំពុងបិទបាំងសំណើសុំការអនុញ្ញាត ដូច្នេះមិនអាចផ្ទៀងផ្ទាត់ការឆ្លើយតបរបស់អ្នកបានទេ។" "ចុចមុខងារណាមួយ ដើម្បចាប់ផ្ដើមប្រើ៖" "ជ្រើសរើស​មុខងារ ដើម្បីប្រើ​ជាមួយ​ប៊ូតុង​ភាពងាយស្រួល" - - + "ជ្រើសរើស​មុខងារ ដើម្បីប្រើ​ជាមួយផ្លូវកាត់គ្រាប់ចុច​កម្រិតសំឡេង" "បានបិទ %s" "កែ​ផ្លូវកាត់" "រួចរាល់" diff --git a/core/res/res/values-kn/strings.xml b/core/res/res/values-kn/strings.xml index a772e32c12214707a314567af2bbfb3368c208df..941a1b2572ce341fc040fa8787b3192783bc6866 100644 --- a/core/res/res/values-kn/strings.xml +++ b/core/res/res/values-kn/strings.xml @@ -1746,8 +1746,7 @@ "ಆ್ಯಪ್‌ವೊಂದು ಅನುಮತಿ ವಿನಂತಿಯನ್ನು ಮರೆಮಾಚುತ್ತಿರುವ ಕಾರಣ ನಿಮ್ಮ ಪ್ರತಿಕ್ರಿಯೆಯನ್ನು ಪರಿಶೀಲಿಸಲು ಸಾಧ್ಯವಿಲ್ಲ." "ವೈಶಿಷ್ಟ್ದ ಬಳಸುವುದನ್ನು ಪ್ರಾರಂಭಿಸಲು ಅದನ್ನು ಟ್ಯಾಪ್ ಮಾಡಿ:" "ಆ್ಯಕ್ಸೆಸಿಬಿಲಿಟಿ ಬಟನ್ ಜೊತೆಗೆ ಬಳಸಲು ವೈಶಿಷ್ಟ್ಯಗಳನ್ನು ಆಯ್ಕೆಮಾಡಿ" - - + "ವಾಲ್ಯೂಮ್ ಕೀ ಶಾರ್ಟ್‌ಕಟ್ ಜೊತೆಗೆ ಬಳಸಲು ಫೀಚರ್‌ಗಳನ್ನು ಆಯ್ಕೆಮಾಡಿ" "%s ಅನ್ನು ಆಫ್ ಮಾಡಲಾಗಿದೆ" "ಶಾರ್ಟ್‌ಕಟ್‌‍ಗಳನ್ನು ಎಡಿಟ್ ಮಾಡಿ" "ಪೂರ್ಣಗೊಂಡಿದೆ" diff --git a/core/res/res/values-ky/strings.xml b/core/res/res/values-ky/strings.xml index 4c2ee5f88d9965563a0ce2f91d185ce9a8e08335..43fd6a78cc73b8f1c0d8ab7141d73ddc74fe38cd 100644 --- a/core/res/res/values-ky/strings.xml +++ b/core/res/res/values-ky/strings.xml @@ -1746,8 +1746,7 @@ "Колдонмо уруксат суроону жашырып койгондуктан, жообуңузду ырастоо мүмкүн эмес." "Функцияны колдонуп баштоо үчүн аны таптап коюңуз:" "Атайын мүмкүнчүлүктөр баскычы менен колдонгуңуз келген функцияларды тандаңыз" - - + "Үн баскычтары менен кайсы функцияларды иштеткиңиз келет?" "%s өчүрүлдү" "Кыска жолдорду түзөтүү" "Бүттү" diff --git a/core/res/res/values-lo/strings.xml b/core/res/res/values-lo/strings.xml index b62750311caa0c52bb42cbd0dd7838c237cc331c..dc15e9afc0cf9a214df349f7a1cda240706d2621 100644 --- a/core/res/res/values-lo/strings.xml +++ b/core/res/res/values-lo/strings.xml @@ -1746,8 +1746,7 @@ "ແອັບໜຶ່ງກຳລັງປິດບັງຄຳຮ້ອງຂໍການອະນຸຍາດ ດັ່ງນັ້ນຈຶ່ງບໍ່ສາມາດຢັ້ງຢືນຄຳຕອບຂອງທ່ານໄດ້." "ແຕະໃສ່ຄຸນສົມບັດໃດໜຶ່ງເພື່ອເລີ່ມການນຳໃຊ້ມັນ:" "ເລືອກຄຸນສົມບັດເພື່ອໃຊ້ກັບປຸ່ມການຊ່ວຍເຂົ້າເຖິງ" - - + "ເລືອກຄຸນສົມບັດທີ່ຈະໃຊ້ກັບທາງລັດຂອງປຸ່ມລະດັບສຽງ" "ປິດ %s ໄວ້ແລ້ວ" "ແກ້ໄຂທາງລັດ" "ແລ້ວໆ" diff --git a/core/res/res/values-ml/strings.xml b/core/res/res/values-ml/strings.xml index 2b1c52ff0825cf766429339b0df017f595824373..6d60696f40e99fd75f99eefb2fdb26bef9bbc113 100644 --- a/core/res/res/values-ml/strings.xml +++ b/core/res/res/values-ml/strings.xml @@ -1746,8 +1746,7 @@ "ഒരു ആപ്പ്, അനുമതി അഭ്യർത്ഥന മറയ്‌ക്കുന്നതിനാൽ നിങ്ങളുടെ പ്രതികരണം പരിശോധിച്ചുറപ്പിക്കാനാകില്ല." "ഉപയോഗിച്ച് തുടങ്ങാൻ ഫീച്ചർ ടാപ്പ് ചെയ്യുക:" "ഉപയോഗസഹായി ബട്ടണിന്റെ സഹായത്തോടെ, ഉപയോഗിക്കാൻ ഫീച്ചറുകൾ തിരഞ്ഞെടുക്കുക" - - + "വോളിയം കീകളുടെ കുറുക്കുവഴികൾക്കൊപ്പം ഉപയോഗിക്കേണ്ട ഫീച്ചറുകൾ തിരഞ്ഞെടുക്കുക" "%s ഓഫാക്കിയിരിക്കുന്നു" "കുറുക്കുവഴികൾ തിരുത്തുക" "പൂർത്തിയാക്കി" diff --git a/core/res/res/values-mr/strings.xml b/core/res/res/values-mr/strings.xml index 67c3b980d70072491985bcbc30e872e432ea7fad..30403cf0984f1c8b042a1667f3d06c4958261331 100644 --- a/core/res/res/values-mr/strings.xml +++ b/core/res/res/values-mr/strings.xml @@ -1746,8 +1746,7 @@ "परवानगी मागणारी विनंती अ‍ॅपमुळे अस्पष्‍ट होत असल्‍याने, तुमच्या प्रतिसादाची पडताळणी केली जाऊ शकत नाही." "वैशिष्ट्य वापरणे सुरू करण्यासाठी त्यावर टॅप करा:" "अ‍ॅक्सेसिबिलिटी बटणासोबत वापरायची असलेली ॲप्स निवडा" - - + "व्‍हॉल्‍यूम की शॉर्टकटसोबत वापरायची असलेली ॲप्स निवडा" "%s बंद केले आहे" "शॉर्टकट संपादित करा" "पूर्ण झाले" diff --git a/core/res/res/values-ms/strings.xml b/core/res/res/values-ms/strings.xml index 5eac79316474989b9bf4a633bdab8f9015e793e4..e17c62bb168e614c3fa6c9be79a16dfcea356caf 100644 --- a/core/res/res/values-ms/strings.xml +++ b/core/res/res/values-ms/strings.xml @@ -1746,8 +1746,7 @@ "Apl menghalang permintaan kebenaran, maka jawapan anda tidak dapat disahkan." "Ketik ciri untuk mula menggunakan ciri itu:" "Pilih ciri untuk digunakan dengan butang kebolehaksesan" - - + "Pilih ciri untuk digunakan dengan pintasan kekunci kelantangan" "%s telah dimatikan" "Edit pintasan" "Selesai" diff --git a/core/res/res/values-my/strings.xml b/core/res/res/values-my/strings.xml index b09539c27bac3008f0a5c3d06b79374058a781d1..85fb0e9e27d747c90a4d98fa9196036887f62a43 100644 --- a/core/res/res/values-my/strings.xml +++ b/core/res/res/values-my/strings.xml @@ -1746,8 +1746,7 @@ "အက်ပ်တစ်ခုသည် ခွင့်ပြုချက်တောင်းဆိုမှုကို ပိတ်နေသဖြင့် သင့်တုံ့ပြန်မှုကို စိစစ်၍မရပါ။" "ဝန်ဆောင်မှုကို စတင်အသုံးပြုရန် တို့ပါ−" "အများသုံးနိုင်မှု ခလုတ်ဖြင့် အသုံးပြုရန် ဝန်ဆောင်မှုများကို ရွေးပါ" - - + "အသံထိန်းခလုတ်ဖြတ်လမ်းဖြင့် အသုံးပြုရန်အတွက် တူးလ်များကိုရွေးပါ" "%s ကို ပိတ်ထားသည်" "ဖြတ်လမ်းများကို တည်းဖြတ်ရန်" "ပြီးပြီ" diff --git a/core/res/res/values-ne/strings.xml b/core/res/res/values-ne/strings.xml index 9f3530a3e15ddc13dfbc8fc97543d36a8518b555..36e3254135eb4d21f3166cd77537ecb4f2036030 100644 --- a/core/res/res/values-ne/strings.xml +++ b/core/res/res/values-ne/strings.xml @@ -1746,8 +1746,7 @@ "कुनै एपका कारण अनुमतिसम्बन्धी अनुरोध बुझ्न कठिनाइ भइरहेकाले तपाईंको जवाफको पुष्टि गर्न सकिएन।" "कुनै सुविधा प्रयोग गर्न थाल्न उक्त सुविधामा ट्याप गर्नुहोस्:" "पहुँचको बटनमार्फत प्रयोग गर्न चाहेका सुविधाहरू छनौट गर्नुहोस्" - - + "भोल्युम बटनको सर्टकटमार्फत प्रयोग गर्न चाहेका सुविधाहरू छनौट गर्नुहोस्" "%s निष्क्रिय पारिएको छ" "सर्टकटहरू सम्पादन गर्नुहोस्" "सम्पन्न भयो" diff --git a/core/res/res/values-nl/strings.xml b/core/res/res/values-nl/strings.xml index 8209504a62f30a374f7e72fbec6e8cd1f1c8d19c..18773f6c147394a0ed3f7d12db6a5c267b44d7fa 100644 --- a/core/res/res/values-nl/strings.xml +++ b/core/res/res/values-nl/strings.xml @@ -642,7 +642,7 @@ "Hiermee sta je de app toe locaties van je mediacollectie te bekijken." "Biometrische gegevens gebruiken" "Biometrische gegevens of schermvergrendeling gebruiken" - "Je identiteit verifiëren" + "Je identiteit bevestigen" "Gebruik je biometrische gegevens om door te gaan" "Gebruik je biometrische gegevens of schermvergrendeling om door te gaan" "Biometrische hardware niet beschikbaar" @@ -1746,8 +1746,7 @@ "Een app dekt het verzoek om rechten af, waardoor je reactie niet kan worden geverifieerd." "Tik op een functie om deze te gebruiken:" "Functies kiezen voor gebruik met de knop Toegankelijkheid" - - + "Functies kiezen voor gebruik met de snelkoppeling met volumeknoppen" "%s is uitgezet" "Snelkoppelingen bewerken" "Klaar" diff --git a/core/res/res/values-pt-rPT/strings.xml b/core/res/res/values-pt-rPT/strings.xml index 71940ef78cbd26d5a0db5878f664a27c43234c47..28c130c42fe4b7989eed0b60e83aa94e889dd7a0 100644 --- a/core/res/res/values-pt-rPT/strings.xml +++ b/core/res/res/values-pt-rPT/strings.xml @@ -1747,8 +1747,7 @@ "Uma app está a ocultar o pedido de autorização e, por isso, não é possível validar a sua resposta." "Toque numa funcionalidade para começar a utilizá-la:" "Escolha funcionalidades para utilizar com o botão Acessibilidade" - - + "Escolha funcionalidades para usar com o atalho de teclas de volume" "O serviço %s foi desativado." "Editar atalhos" "Concluído" diff --git a/core/res/res/values-ru/strings.xml b/core/res/res/values-ru/strings.xml index 22501f2a01b16576a1b95184e97e8f00f451ce31..3c374ef5de2889698218b963743be343d53a33a6 100644 --- a/core/res/res/values-ru/strings.xml +++ b/core/res/res/values-ru/strings.xml @@ -1748,8 +1748,7 @@ "Невозможно принять ваш ответ, поскольку запрос разрешения скрыт другим приложением." "Выберите, какую функцию использовать:" "Выберите функции, которые будут запускаться с помощью кнопки специальных возможностей" - - + "Выберите функции, которые вы хотите запускать кнопками регулировки громкости" "Сервис \"%s\" отключен." "Изменить ярлыки" "Готово" diff --git a/core/res/res/values-sk/strings.xml b/core/res/res/values-sk/strings.xml index 3289bbc7416ff08e1581c0849480d9c36597e0f6..7185bcdb0de6458c3c2f000723e0f4c9c29e29fc 100644 --- a/core/res/res/values-sk/strings.xml +++ b/core/res/res/values-sk/strings.xml @@ -1748,8 +1748,7 @@ "Aplikácia zakrýva žiadosť o povolenie, takže vaša odpoveď sa nedá overiť." "Klepnutím na funkciu ju začnite používať:" "Výber funkcií, ktoré chcete používať tlačidlom dostupnosti" - - + "Vyberte funkcie, ktoré chcete používať so skratkou tlačidiel hlasitosti" "Služba %s bola vypnutá" "Upraviť skratky" "Hotovo" diff --git a/core/res/res/values-sl/strings.xml b/core/res/res/values-sl/strings.xml index 99ce0469be55e1e4ca7dbb72508573affd76b6ac..e67bf9c910a33123007e52585c8ef5bcbd0722c4 100644 --- a/core/res/res/values-sl/strings.xml +++ b/core/res/res/values-sl/strings.xml @@ -1748,8 +1748,7 @@ "Aplikacija zakriva zahtevo za dovoljenje, zato ni mogoče potrditi vašega odgovora." "Če želite začeti uporabljati funkcijo, se je dotaknite:" "Izberite funkcije, ki jih želite uporabljati z gumbom za dostopnost" - - + "Izberite funkcije, ki jih želite uporabljati z bližnjico gumbov za glasnost" "Storitev %s je izklopljena" "Uredi bližnjice" "Končano" diff --git a/core/res/res/values-sr/strings.xml b/core/res/res/values-sr/strings.xml index 0451b561347bf713096058505a814d42bfeac3bd..f5988c282e36821818dfdcc89bf8362685c0a817 100644 --- a/core/res/res/values-sr/strings.xml +++ b/core/res/res/values-sr/strings.xml @@ -1747,8 +1747,7 @@ "Апликација крије захтев за дозволу, па одговор не може да се верификује." "Додирните неку функцију да бисте почели да је користите:" "Одаберите функције које ћете користити са дугметом Приступачност" - - + "Одаберите функције које ће се користити са пречицом за тастере за јачину звука" "Услуга %s је искључена" "Измените пречице" "Готово" diff --git a/core/res/res/values-ta/strings.xml b/core/res/res/values-ta/strings.xml index b1ce5149861d8119520d2ab7e09b76ec8994be2d..626205e42483ed70fe6cfa3d33f1fd49e37ea582 100644 --- a/core/res/res/values-ta/strings.xml +++ b/core/res/res/values-ta/strings.xml @@ -1746,8 +1746,7 @@ "அணுகல் கோரிக்கையை ஓர் ஆப்ஸ் மறைப்பதால் உங்கள் பதிலைச் சரிபார்க்க முடியாது." "ஒரு அம்சத்தைப் பயன்படுத்த அதைத் தட்டவும்:" "அணுகல்தன்மை பட்டன் மூலம் பயன்படுத்த விரும்பும் அம்சங்களைத் தேர்வுசெய்யுங்கள்" - - + "ஒலியளவு விசைகளுக்கான ஷார்ட்கட்டுடன் பயன்படுத்துவதற்கான அம்சங்களைத் தேர்வுசெய்யுங்கள்" "%s ஆஃப் செய்யப்பட்டுள்ளது" "ஷார்ட்கட்களை மாற்று" "முடிந்தது" diff --git a/core/res/res/values-te/strings.xml b/core/res/res/values-te/strings.xml index 4b655d156a5059d56ef0bc3c3df0a2121a3ebb67..db19868b37dd1b6a180138bda9abea1f2d6e7a48 100644 --- a/core/res/res/values-te/strings.xml +++ b/core/res/res/values-te/strings.xml @@ -1746,8 +1746,7 @@ "ఒక యాప్ అనుమతి రిక్వెస్ట్‌కు అడ్డు తగులుతోంది కాబట్టి మీ సమాధానం వెరిఫై చేయడం సాధ్యం కాదు." "ఫీచర్‌ని ఉపయోగించడం ప్రారంభించడానికి, దాన్ని ట్యాప్ చేయండి:" "యాక్సెసిబిలిటీ బటన్‌తో ఉపయోగించడానికి ఫీచర్లను ఎంచుకోండి" - - + "వాల్యూమ్ కీల షార్ట్‌కట్‌తో ఉపయోగించడానికి ఫీచర్లను ఎంచుకోండి" "%s ఆఫ్ చేయబడింది" "షార్ట్‌కట్‌లను ఎడిట్ చేయండి" "పూర్తయింది" diff --git a/core/res/res/values-th/strings.xml b/core/res/res/values-th/strings.xml index d979c340e2168d68c6c20d04b5c38f784e3b39b6..b34cf59a2bb8e22a08f88c0fbfd1fb1a87ad5fac 100644 --- a/core/res/res/values-th/strings.xml +++ b/core/res/res/values-th/strings.xml @@ -1746,8 +1746,7 @@ "มีแอปหนึ่งบดบังคำขอสิทธิ์ เราจึงยืนยันการตอบกลับของคุณไม่ได้" "แตะฟีเจอร์เพื่อเริ่มใช้" "เลือกฟีเจอร์ที่จะใช้กับปุ่มการช่วยเหลือพิเศษ" - - + "เลือกฟีเจอร์ที่จะใช้กับทางลัดปุ่มปรับระดับเสียง" "ปิด %s แล้ว" "แก้ไขทางลัด" "เสร็จ" diff --git a/core/res/res/values-tl/strings.xml b/core/res/res/values-tl/strings.xml index fbbb32c1c8fa56186055779394a9ca1d98d61672..b976f204e395be6d04b2abb9cd3706ccf5033066 100644 --- a/core/res/res/values-tl/strings.xml +++ b/core/res/res/values-tl/strings.xml @@ -1746,8 +1746,7 @@ "May app na pumipigil sa kahilingan sa pahintulot kaya hindi ma-verify ang iyong sagot." "I-tap ang isang feature para simulan itong gamitin:" "Pumili ng mga feature na gagana sa pamamagitan ng button ng accessibility" - - + "Pumili ng mga feature na gagana sa pamamagitan ng shortcut ng mga volume key" "Na-off ang %s" "I-edit ang mga shortcut" "Tapos na" diff --git a/core/res/res/values-ur/strings.xml b/core/res/res/values-ur/strings.xml index d2f0898acd0c64e9c395ee556cbcda0dbef51a84..fcfff0faa88c3dee62513eae3efa451ef5fb3eb4 100644 --- a/core/res/res/values-ur/strings.xml +++ b/core/res/res/values-ur/strings.xml @@ -1746,8 +1746,7 @@ "ایپ اجازت کی درخواست کو مبہم کر رہی ہے لہذا آپ کے جواب کی تصدیق نہیں کی جا سکتی۔" "ایک خصوصیت کا استعمال شروع کرنے کیلئے اسے تھپتھپائیں:" "ایکسیسبیلٹی بٹن کے ساتھ استعمال کرنے کیلئے خصوصیات منتخب کریں" - - + "والیوم کلیدوں کے شارٹ کٹ کے ساتھ استعمال کرنے کیلئے خصوصیات منتخب کریں" "%s کو آف کر دیا گیا ہے" "شارٹ کٹس میں ترمیم کریں" "ہو گیا" diff --git a/core/res/res/values-watch/config.xml b/core/res/res/values-watch/config.xml index 52662149b23a111288827c4184c59e45602bc849..e28b6462bad7d1b13499b6f1f664ca1f1352d5f7 100644 --- a/core/res/res/values-watch/config.xml +++ b/core/res/res/values-watch/config.xml @@ -96,4 +96,8 @@ false + + + true diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index 38aff7590a42135772ab05a8f3a7ce504633f34d..f6267f6174b67ab47f7c91404952fd88433d938d 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -7121,4 +7121,8 @@ 500 + + + false diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml index 606c7fdaa95471b411251b74bf7de5145eb5312a..d63421057939c9f49c8511e74e7917535a04e82f 100644 --- a/core/res/res/values/strings.xml +++ b/core/res/res/values/strings.xml @@ -5509,6 +5509,9 @@ To use your private space, set a screen lock on this device + + To delete private space, set a screen lock on this device + App is not available diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 46938948b1335da1e68c93a34dfeec75a57f4aff..bd8077e71c5a8d807660ba7cfb76b6072d9c3bd5 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -3299,6 +3299,8 @@ + + @@ -5601,4 +5603,6 @@ + + diff --git a/core/tests/BroadcastRadioTests/Android.bp b/core/tests/BroadcastRadioTests/Android.bp index beffb9aac12b30889bf215fec271afd3394d8272..7d4ae00c405a2297ddda1ea9b786bb51f9918f02 100644 --- a/core/tests/BroadcastRadioTests/Android.bp +++ b/core/tests/BroadcastRadioTests/Android.bp @@ -45,7 +45,7 @@ android_test { "flag-junit", "mockito-target-extended", ], - libs: ["android.test.base"], + libs: ["android.test.base.stubs.system"], test_suites: [ "general-tests", "automotive-general-tests", diff --git a/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/RadioServiceUserControllerTest.java b/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/RadioServiceUserControllerTest.java index 516253b0ebfffe364f7993454fe1ab15b0dd2f75..44beb55b77dbfb67c5b2518a66caa03d9d68263d 100644 --- a/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/RadioServiceUserControllerTest.java +++ b/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/RadioServiceUserControllerTest.java @@ -19,18 +19,18 @@ package com.android.server.broadcastradio; import static com.android.dx.mockito.inline.extended.ExtendedMockito.doReturn; import static com.android.dx.mockito.inline.extended.ExtendedMockito.doThrow; -import static com.google.common.truth.Truth.assertWithMessage; - import static org.mockito.Mockito.when; import android.app.ActivityManager; -import android.app.compat.CompatChanges; import android.os.Binder; import android.os.UserHandle; import com.android.dx.mockito.inline.extended.StaticMockitoSessionBuilder; +import com.google.common.truth.Expect; + import org.junit.Before; +import org.junit.Rule; import org.junit.Test; import org.mockito.Mock; @@ -41,36 +41,40 @@ public final class RadioServiceUserControllerTest extends ExtendedRadioMockitoTe private static final int USER_ID_1 = 11; private static final int USER_ID_2 = 12; + private RadioServiceUserController mUserController; @Mock private UserHandle mUserHandleMock; + @Rule + public final Expect expect = Expect.create(); + @Override protected void initializeSession(StaticMockitoSessionBuilder builder) { - builder.spyStatic(ActivityManager.class).spyStatic(Binder.class) - .spyStatic(CompatChanges.class); + builder.spyStatic(ActivityManager.class).spyStatic(Binder.class); } @Before public void setUp() { doReturn(mUserHandleMock).when(() -> Binder.getCallingUserHandle()); doReturn(USER_ID_1).when(() -> ActivityManager.getCurrentUser()); + mUserController = new RadioServiceUserControllerImpl(); } @Test public void isCurrentOrSystemUser_forCurrentUser_returnsFalse() { when(mUserHandleMock.getIdentifier()).thenReturn(USER_ID_1); - assertWithMessage("Current user") - .that(RadioServiceUserController.isCurrentOrSystemUser()).isTrue(); + expect.withMessage("Current user") + .that(mUserController.isCurrentOrSystemUser()).isTrue(); } @Test public void isCurrentOrSystemUser_forNonCurrentUser_returnsFalse() { when(mUserHandleMock.getIdentifier()).thenReturn(USER_ID_2); - assertWithMessage("Non-current user") - .that(RadioServiceUserController.isCurrentOrSystemUser()).isFalse(); + expect.withMessage("Non-current user") + .that(mUserController.isCurrentOrSystemUser()).isFalse(); } @Test @@ -78,8 +82,8 @@ public final class RadioServiceUserControllerTest extends ExtendedRadioMockitoTe when(mUserHandleMock.getIdentifier()).thenReturn(USER_ID_1); when(mUserHandleMock.getIdentifier()).thenReturn(UserHandle.USER_SYSTEM); - assertWithMessage("System user") - .that(RadioServiceUserController.isCurrentOrSystemUser()).isTrue(); + expect.withMessage("System user") + .that(mUserController.isCurrentOrSystemUser()).isTrue(); } @Test @@ -87,14 +91,14 @@ public final class RadioServiceUserControllerTest extends ExtendedRadioMockitoTe when(mUserHandleMock.getIdentifier()).thenReturn(USER_ID_1); doThrow(new RuntimeException()).when(ActivityManager::getCurrentUser); - assertWithMessage("User when activity manager fails") - .that(RadioServiceUserController.isCurrentOrSystemUser()).isFalse(); + expect.withMessage("User when activity manager fails") + .that(mUserController.isCurrentOrSystemUser()).isFalse(); } @Test public void getCurrentUser() { - assertWithMessage("Current user") - .that(RadioServiceUserController.getCurrentUser()).isEqualTo(USER_ID_1); + expect.withMessage("Current user") + .that(mUserController.getCurrentUser()).isEqualTo(USER_ID_1); } @Test @@ -102,7 +106,15 @@ public final class RadioServiceUserControllerTest extends ExtendedRadioMockitoTe when(mUserHandleMock.getIdentifier()).thenReturn(USER_ID_1); doThrow(new RuntimeException()).when(ActivityManager::getCurrentUser); - assertWithMessage("Current user when activity manager fails") - .that(RadioServiceUserController.getCurrentUser()).isEqualTo(UserHandle.USER_NULL); + expect.withMessage("Current user when activity manager fails") + .that(mUserController.getCurrentUser()).isEqualTo(UserHandle.USER_NULL); + } + + @Test + public void getCallingUserId() { + when(mUserHandleMock.getIdentifier()).thenReturn(USER_ID_1); + + expect.withMessage("Calling user id") + .that(mUserController.getCallingUserId()).isEqualTo(USER_ID_1); } } diff --git a/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/aidl/BroadcastRadioServiceImplTest.java b/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/aidl/BroadcastRadioServiceImplTest.java index 22f3bd4abe1133fe778e40c4a250ef5ba467d5ac..63f12d82b48ae3b71180943a5f318d49e9e0c714 100644 --- a/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/aidl/BroadcastRadioServiceImplTest.java +++ b/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/aidl/BroadcastRadioServiceImplTest.java @@ -91,12 +91,13 @@ public final class BroadcastRadioServiceImplTest extends ExtendedRadioMockitoTes private IAnnouncementListener mAnnouncementListenerMock; @Mock private IBinder mListenerBinderMock; + @Mock + private RadioServiceUserController mUserControllerMock; @Override protected void initializeSession(StaticMockitoSessionBuilder builder) { builder.spyStatic(ServiceManager.class) - .spyStatic(RadioModule.class) - .spyStatic(RadioServiceUserController.class); + .spyStatic(RadioModule.class); } @Test @@ -156,7 +157,7 @@ public final class BroadcastRadioServiceImplTest extends ExtendedRadioMockitoTes @Test public void openSession_forNonCurrentUser_throwsException() throws Exception { createBroadcastRadioService(); - doReturn(false).when(() -> RadioServiceUserController.isCurrentOrSystemUser()); + doReturn(false).when(mUserControllerMock).isCurrentOrSystemUser(); IllegalStateException thrown = assertThrows(IllegalStateException.class, () -> mBroadcastRadioService.openSession(FM_RADIO_MODULE_ID, @@ -206,9 +207,9 @@ public final class BroadcastRadioServiceImplTest extends ExtendedRadioMockitoTes } private void createBroadcastRadioService() throws RemoteException { - doReturn(true).when(() -> RadioServiceUserController.isCurrentOrSystemUser()); + doReturn(true).when(mUserControllerMock).isCurrentOrSystemUser(); mockServiceManager(); - mBroadcastRadioService = new BroadcastRadioServiceImpl(SERVICE_LIST); + mBroadcastRadioService = new BroadcastRadioServiceImpl(SERVICE_LIST, mUserControllerMock); } private void mockServiceManager() throws RemoteException { @@ -222,9 +223,9 @@ public final class BroadcastRadioServiceImplTest extends ExtendedRadioMockitoTes any(IServiceCallback.class))); doReturn(mFmRadioModuleMock).when(() -> RadioModule.tryLoadingModule( - eq(FM_RADIO_MODULE_ID), anyString(), any(IBinder.class))); + eq(FM_RADIO_MODULE_ID), anyString(), any(IBinder.class), any())); doReturn(mDabRadioModuleMock).when(() -> RadioModule.tryLoadingModule( - eq(DAB_RADIO_MODULE_ID), anyString(), any(IBinder.class))); + eq(DAB_RADIO_MODULE_ID), anyString(), any(IBinder.class), any())); when(mFmRadioModuleMock.getProperties()).thenReturn(mFmModuleMock); when(mDabRadioModuleMock.getProperties()).thenReturn(mDabModuleMock); diff --git a/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/aidl/RadioModuleTest.java b/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/aidl/RadioModuleTest.java index a952bde956d8b2a56ec22c984fa4d05c314e11e5..368df090070bffe14759ee8ab3823bb82e107520 100644 --- a/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/aidl/RadioModuleTest.java +++ b/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/aidl/RadioModuleTest.java @@ -34,6 +34,8 @@ import android.hardware.radio.RadioManager; import android.os.ParcelableException; import android.os.RemoteException; +import com.android.server.broadcastradio.RadioServiceUserController; + import com.google.common.truth.Expect; import org.junit.Before; @@ -63,6 +65,8 @@ public final class RadioModuleTest { private IAnnouncementListener mListenerMock; @Mock private android.hardware.broadcastradio.ICloseHandle mHalCloseHandleMock; + @Mock + private RadioServiceUserController mUserControllerMock; // RadioModule under test private RadioModule mRadioModule; @@ -70,7 +74,8 @@ public final class RadioModuleTest { @Before public void setup() throws RemoteException { - mRadioModule = new RadioModule(mBroadcastRadioMock, TEST_MODULE_PROPERTIES); + mRadioModule = new RadioModule(mBroadcastRadioMock, TEST_MODULE_PROPERTIES, + mUserControllerMock); // TODO(b/241118988): test non-null image for getImage method when(mBroadcastRadioMock.getImage(anyInt())).thenReturn(null); diff --git a/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/aidl/TunerSessionTest.java b/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/aidl/TunerSessionTest.java index 92dfe38c31feb467b48cf44e982e9b076ee61739..24d18e0893d00dbdd2beb161187502c5cc76500c 100644 --- a/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/aidl/TunerSessionTest.java +++ b/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/aidl/TunerSessionTest.java @@ -49,12 +49,10 @@ import android.hardware.radio.ProgramSelector; import android.hardware.radio.RadioManager; import android.hardware.radio.RadioTuner; import android.hardware.radio.UniqueProgramIdentifier; -import android.os.Binder; import android.os.DeadObjectException; import android.os.ParcelableException; import android.os.RemoteException; import android.os.ServiceSpecificException; -import android.os.UserHandle; import android.platform.test.flag.junit.SetFlagsRule; import android.util.ArrayMap; import android.util.ArraySet; @@ -148,10 +146,10 @@ public final class TunerSessionTest extends ExtendedRadioMockitoTestCase { // Mocks @Mock - private UserHandle mUserHandleMock; - @Mock private IBroadcastRadio mBroadcastRadioMock; private android.hardware.radio.ITunerCallback[] mAidlTunerCallbackMocks; + @Mock + private RadioServiceUserController mUserControllerMock; // RadioModule under test private RadioModule mRadioModule; @@ -170,8 +168,7 @@ public final class TunerSessionTest extends ExtendedRadioMockitoTestCase { @Override protected void initializeSession(StaticMockitoSessionBuilder builder) { - builder.spyStatic(RadioServiceUserController.class).spyStatic(CompatChanges.class) - .spyStatic(Binder.class); + builder.spyStatic(CompatChanges.class); } @Before @@ -182,13 +179,12 @@ public final class TunerSessionTest extends ExtendedRadioMockitoTestCase { doReturn(true).when(() -> CompatChanges.isChangeEnabled( eq(ConversionUtils.RADIO_U_VERSION_REQUIRED), anyInt())); - doReturn(USER_ID_1).when(mUserHandleMock).getIdentifier(); - doReturn(mUserHandleMock).when(() -> Binder.getCallingUserHandle()); - doReturn(true).when(() -> RadioServiceUserController.isCurrentOrSystemUser()); - doReturn(USER_ID_1).when(() -> RadioServiceUserController.getCurrentUser()); + doReturn(USER_ID_1).when(mUserControllerMock).getCallingUserId(); + doReturn(true).when(mUserControllerMock).isCurrentOrSystemUser(); + doReturn(USER_ID_1).when(mUserControllerMock).getCurrentUser(); mRadioModule = new RadioModule(mBroadcastRadioMock, - AidlTestUtils.makeDefaultModuleProperties()); + AidlTestUtils.makeDefaultModuleProperties(), mUserControllerMock); doAnswer(invocation -> { mHalTunerCallback = (ITunerCallback) invocation.getArguments()[0]; @@ -237,7 +233,7 @@ public final class TunerSessionTest extends ExtendedRadioMockitoTestCase { @Test public void setConfiguration_forNonCurrentUser_doesNotInvokesCallback() throws Exception { openAidlClients(/* numClients= */ 1); - doReturn(false).when(() -> RadioServiceUserController.isCurrentOrSystemUser()); + doReturn(false).when(mUserControllerMock).isCurrentOrSystemUser(); mTunerSessions[0].setConfiguration(FM_BAND_CONFIG); @@ -434,7 +430,7 @@ public final class TunerSessionTest extends ExtendedRadioMockitoTestCase { @Test public void tune_forNonCurrentUser_doesNotTune() throws Exception { openAidlClients(/* numClients= */ 1); - doReturn(false).when(() -> RadioServiceUserController.isCurrentOrSystemUser()); + doReturn(false).when(mUserControllerMock).isCurrentOrSystemUser(); ProgramSelector initialSel = AidlTestUtils.makeFmSelector(AM_FM_FREQUENCY_LIST[1]); RadioManager.ProgramInfo tuneInfo = AidlTestUtils.makeProgramInfo(initialSel, SIGNAL_QUALITY); @@ -514,7 +510,7 @@ public final class TunerSessionTest extends ExtendedRadioMockitoTestCase { openAidlClients(/* numClients= */ 1); mHalCurrentInfo = AidlTestUtils.makeHalProgramInfo( ConversionUtils.programSelectorToHalProgramSelector(initialSel), SIGNAL_QUALITY); - doReturn(false).when(() -> RadioServiceUserController.isCurrentOrSystemUser()); + doReturn(false).when(mUserControllerMock).isCurrentOrSystemUser(); mTunerSessions[0].step(/* directionDown= */ true, /* skipSubChannel= */ false); @@ -593,7 +589,7 @@ public final class TunerSessionTest extends ExtendedRadioMockitoTestCase { openAidlClients(/* numClients= */ 1); mHalCurrentInfo = AidlTestUtils.makeHalProgramInfo( ConversionUtils.programSelectorToHalProgramSelector(initialSel), SIGNAL_QUALITY); - doReturn(false).when(() -> RadioServiceUserController.isCurrentOrSystemUser()); + doReturn(false).when(mUserControllerMock).isCurrentOrSystemUser(); mTunerSessions[0].seek(/* directionDown= */ true, /* skipSubChannel= */ false); @@ -627,7 +623,7 @@ public final class TunerSessionTest extends ExtendedRadioMockitoTestCase { @Test public void cancel_forNonCurrentUser_doesNotCancel() throws Exception { openAidlClients(/* numClients= */ 1); - doReturn(false).when(() -> RadioServiceUserController.isCurrentOrSystemUser()); + doReturn(false).when(mUserControllerMock).isCurrentOrSystemUser(); mTunerSessions[0].cancel(); @@ -698,7 +694,7 @@ public final class TunerSessionTest extends ExtendedRadioMockitoTestCase { @Test public void startBackgroundScan_forNonCurrentUser_doesNotInvokesCallback() throws Exception { openAidlClients(/* numClients= */ 1); - doReturn(false).when(() -> RadioServiceUserController.isCurrentOrSystemUser()); + doReturn(false).when(mUserControllerMock).isCurrentOrSystemUser(); mTunerSessions[0].startBackgroundScan(); @@ -968,7 +964,7 @@ public final class TunerSessionTest extends ExtendedRadioMockitoTestCase { openAidlClients(/* numClients= */ 1); ProgramList.Filter filter = new ProgramList.Filter(new ArraySet<>(), new ArraySet<>(), /* includeCategories= */ true, /* excludeModifications= */ false); - doReturn(false).when(() -> RadioServiceUserController.isCurrentOrSystemUser()); + doReturn(false).when(mUserControllerMock).isCurrentOrSystemUser(); mTunerSessions[0].startProgramListUpdates(filter); @@ -1007,7 +1003,7 @@ public final class TunerSessionTest extends ExtendedRadioMockitoTestCase { ProgramList.Filter filter = new ProgramList.Filter(new ArraySet<>(), new ArraySet<>(), /* includeCategories= */ true, /* excludeModifications= */ false); mTunerSessions[0].startProgramListUpdates(filter); - doReturn(false).when(() -> RadioServiceUserController.isCurrentOrSystemUser()); + doReturn(false).when(mUserControllerMock).isCurrentOrSystemUser(); mTunerSessions[0].stopProgramListUpdates(); @@ -1073,7 +1069,7 @@ public final class TunerSessionTest extends ExtendedRadioMockitoTestCase { public void setConfigFlag_forNonCurrentUser_doesNotSetConfigFlag() throws Exception { openAidlClients(/* numClients= */ 1); int flag = UNSUPPORTED_CONFIG_FLAG + 1; - doReturn(false).when(() -> RadioServiceUserController.isCurrentOrSystemUser()); + doReturn(false).when(mUserControllerMock).isCurrentOrSystemUser(); mTunerSessions[0].setConfigFlag(flag, /* value= */ true); @@ -1138,7 +1134,7 @@ public final class TunerSessionTest extends ExtendedRadioMockitoTestCase { openAidlClients(/* numClients= */ 1); Map parametersSet = Map.of("mockParam1", "mockValue1", "mockParam2", "mockValue2"); - doReturn(false).when(() -> RadioServiceUserController.isCurrentOrSystemUser()); + doReturn(false).when(mUserControllerMock).isCurrentOrSystemUser(); mTunerSessions[0].setParameters(parametersSet); @@ -1192,7 +1188,7 @@ public final class TunerSessionTest extends ExtendedRadioMockitoTestCase { public void onCurrentProgramInfoChanged_withNonCurrentUser_doesNotInvokeCallback() throws Exception { openAidlClients(1); - doReturn(USER_ID_2).when(() -> RadioServiceUserController.getCurrentUser()); + doReturn(USER_ID_2).when(mUserControllerMock).getCurrentUser(); mHalTunerCallback.onCurrentProgramInfoChanged(AidlTestUtils.makeHalProgramInfo( AidlTestUtils.makeHalFmSelector(AM_FM_FREQUENCY_LIST[1]), SIGNAL_QUALITY)); diff --git a/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/hal2/BroadcastRadioServiceHidlTest.java b/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/hal2/BroadcastRadioServiceHidlTest.java index acf698bce33da0e9f20a57b2fc84d5fe2e9f5512..7c3f221f9bf5e72f7dd476f13e5cc097ec4ca126 100644 --- a/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/hal2/BroadcastRadioServiceHidlTest.java +++ b/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/hal2/BroadcastRadioServiceHidlTest.java @@ -88,11 +88,12 @@ public final class BroadcastRadioServiceHidlTest extends ExtendedRadioMockitoTes private IAnnouncementListener mAnnouncementListenerMock; @Mock private IBinder mBinderMock; + @Mock + private RadioServiceUserController mUserControllerMock; @Override protected void initializeSession(StaticMockitoSessionBuilder builder) { - builder.spyStatic(RadioModule.class) - .spyStatic(RadioServiceUserController.class); + builder.spyStatic(RadioModule.class); } @Test @@ -156,7 +157,7 @@ public final class BroadcastRadioServiceHidlTest extends ExtendedRadioMockitoTes @Test public void openSession_forNonCurrentUser_throwsException() throws Exception { createBroadcastRadioService(); - doReturn(false).when(() -> RadioServiceUserController.isCurrentOrSystemUser()); + when(mUserControllerMock.isCurrentOrSystemUser()).thenReturn(false); IllegalStateException thrown = assertThrows(IllegalStateException.class, () -> mBroadcastRadioService.openSession(FM_RADIO_MODULE_ID, @@ -206,11 +207,11 @@ public final class BroadcastRadioServiceHidlTest extends ExtendedRadioMockitoTes } private void createBroadcastRadioService() throws RemoteException { - doReturn(true).when(() -> RadioServiceUserController.isCurrentOrSystemUser()); + when(mUserControllerMock.isCurrentOrSystemUser()).thenReturn(true); mockServiceManager(); mBroadcastRadioService = new BroadcastRadioService(/* nextModuleId= */ FM_RADIO_MODULE_ID, - mServiceManagerMock); + mServiceManagerMock, mUserControllerMock); } private void mockServiceManager() throws RemoteException { @@ -231,9 +232,9 @@ public final class BroadcastRadioServiceHidlTest extends ExtendedRadioMockitoTes }).thenReturn(true); doReturn(mFmRadioModuleMock).when(() -> RadioModule.tryLoadingModule( - eq(FM_RADIO_MODULE_ID), anyString())); + eq(FM_RADIO_MODULE_ID), anyString(), any())); doReturn(mDabRadioModuleMock).when(() -> RadioModule.tryLoadingModule( - eq(DAB_RADIO_MODULE_ID), anyString())); + eq(DAB_RADIO_MODULE_ID), anyString(), any())); when(mFmRadioModuleMock.getProperties()).thenReturn(mFmModuleMock); when(mDabRadioModuleMock.getProperties()).thenReturn(mDabModuleMock); diff --git a/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/hal2/RadioModuleHidlTest.java b/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/hal2/RadioModuleHidlTest.java index 1f5e77038728614cc536060f741b98488f55ef11..b53f7ca879aac38e7a8728fcdcbd97ab28ba9248 100644 --- a/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/hal2/RadioModuleHidlTest.java +++ b/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/hal2/RadioModuleHidlTest.java @@ -36,6 +36,8 @@ import android.hardware.radio.ICloseHandle; import android.hardware.radio.RadioManager; import android.os.RemoteException; +import com.android.server.broadcastradio.RadioServiceUserController; + import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -61,13 +63,16 @@ public final class RadioModuleHidlTest { private IAnnouncementListener mListenerMock; @Mock private android.hardware.broadcastradio.V2_0.ICloseHandle mHalCloseHandleMock; + @Mock + private RadioServiceUserController mUserControllerMock; private RadioModule mRadioModule; private android.hardware.broadcastradio.V2_0.IAnnouncementListener mHalListener; @Before public void setup() throws RemoteException { - mRadioModule = new RadioModule(mBroadcastRadioMock, TEST_MODULE_PROPERTIES); + mRadioModule = new RadioModule(mBroadcastRadioMock, TEST_MODULE_PROPERTIES, + mUserControllerMock); when(mBroadcastRadioMock.getImage(anyInt())).thenReturn(new ArrayList(0)); diff --git a/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/hal2/StartProgramListUpdatesFanoutTest.java b/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/hal2/StartProgramListUpdatesFanoutTest.java index 8c16d79133ce4e597000a63fd1ee1760240a3ba4..fa0744775f6d7aefc64c70ab53fe353906820d21 100644 --- a/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/hal2/StartProgramListUpdatesFanoutTest.java +++ b/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/hal2/StartProgramListUpdatesFanoutTest.java @@ -38,13 +38,13 @@ import android.hardware.radio.RadioManager; import android.hardware.radio.UniqueProgramIdentifier; import android.os.RemoteException; -import com.android.dx.mockito.inline.extended.StaticMockitoSessionBuilder; -import com.android.server.broadcastradio.ExtendedRadioMockitoTestCase; import com.android.server.broadcastradio.RadioServiceUserController; import org.junit.Before; import org.junit.Test; +import org.junit.runner.RunWith; import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; import org.mockito.stubbing.Answer; import org.mockito.verification.VerificationWithTimeout; @@ -55,7 +55,8 @@ import java.util.List; /** * Tests for v2 HAL RadioModule. */ -public class StartProgramListUpdatesFanoutTest extends ExtendedRadioMockitoTestCase { +@RunWith(MockitoJUnitRunner.class) +public class StartProgramListUpdatesFanoutTest { private static final String TAG = "BroadcastRadioTests.hal2.StartProgramListUpdatesFanout"; private static final VerificationWithTimeout CB_TIMEOUT = timeout(500); @@ -64,6 +65,8 @@ public class StartProgramListUpdatesFanoutTest extends ExtendedRadioMockitoTestC @Mock IBroadcastRadio mBroadcastRadioMock; @Mock ITunerSession mHalTunerSessionMock; private android.hardware.radio.ITunerCallback[] mAidlTunerCallbackMocks; + @Mock + private RadioServiceUserController mUserControllerMock; // RadioModule under test private RadioModule mRadioModule; @@ -110,17 +113,12 @@ public class StartProgramListUpdatesFanoutTest extends ExtendedRadioMockitoTestC private static final RadioManager.ProgramInfo TEST_DAB_INFO = TestUtils.makeProgramInfo( TEST_DAB_SELECTOR, TEST_QUALITY); - @Override - protected void initializeSession(StaticMockitoSessionBuilder builder) { - builder.spyStatic(RadioServiceUserController.class); - } - @Before public void setup() throws RemoteException { - doReturn(true).when(() -> RadioServiceUserController.isCurrentOrSystemUser()); + doReturn(true).when(mUserControllerMock).isCurrentOrSystemUser(); - mRadioModule = new RadioModule(mBroadcastRadioMock, - TestUtils.makeDefaultModuleProperties()); + mRadioModule = new RadioModule(mBroadcastRadioMock, TestUtils.makeDefaultModuleProperties(), + mUserControllerMock); doAnswer((Answer) invocation -> { mHalTunerCallback = (ITunerCallback) invocation.getArguments()[0]; diff --git a/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/hal2/TunerSessionHidlTest.java b/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/hal2/TunerSessionHidlTest.java index 55aae9d3396aa9daee70c655e160766f496ad222..62445cf90028798eea44deebea5d0766a88e43b6 100644 --- a/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/hal2/TunerSessionHidlTest.java +++ b/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/hal2/TunerSessionHidlTest.java @@ -44,16 +44,12 @@ import android.hardware.radio.ProgramList; import android.hardware.radio.ProgramSelector; import android.hardware.radio.RadioManager; import android.hardware.radio.RadioTuner; -import android.os.Binder; import android.os.DeadObjectException; import android.os.ParcelableException; import android.os.RemoteException; -import android.os.UserHandle; import android.util.ArrayMap; import android.util.ArraySet; -import com.android.dx.mockito.inline.extended.StaticMockitoSessionBuilder; -import com.android.server.broadcastradio.ExtendedRadioMockitoTestCase; import com.android.server.broadcastradio.RadioServiceUserController; import com.google.common.truth.Expect; @@ -76,7 +72,7 @@ import java.util.Map; * Tests for HIDL HAL TunerSession. */ @RunWith(MockitoJUnitRunner.class) -public final class TunerSessionHidlTest extends ExtendedRadioMockitoTestCase { +public final class TunerSessionHidlTest { private static final int USER_ID_1 = 11; private static final int USER_ID_2 = 12; @@ -103,28 +99,22 @@ public final class TunerSessionHidlTest extends ExtendedRadioMockitoTestCase { @Rule public final Expect mExpect = Expect.create(); - @Mock - private UserHandle mUserHandleMock; @Mock private IBroadcastRadio mBroadcastRadioMock; @Mock ITunerSession mHalTunerSessionMock; private android.hardware.radio.ITunerCallback[] mAidlTunerCallbackMocks; - - @Override - protected void initializeSession(StaticMockitoSessionBuilder builder) { - builder.spyStatic(RadioServiceUserController.class).spyStatic(Binder.class); - } + @Mock + private RadioServiceUserController mUserControllerMock; @Before public void setup() throws Exception { - doReturn(USER_ID_1).when(mUserHandleMock).getIdentifier(); - doReturn(mUserHandleMock).when(() -> Binder.getCallingUserHandle()); - doReturn(true).when(() -> RadioServiceUserController.isCurrentOrSystemUser()); - doReturn(USER_ID_1).when(() -> RadioServiceUserController.getCurrentUser()); + doReturn(USER_ID_1).when(mUserControllerMock).getCallingUserId(); + doReturn(true).when(mUserControllerMock).isCurrentOrSystemUser(); + doReturn(USER_ID_1).when(mUserControllerMock).getCurrentUser(); mRadioModule = new RadioModule(mBroadcastRadioMock, - TestUtils.makeDefaultModuleProperties()); + TestUtils.makeDefaultModuleProperties(), mUserControllerMock); doAnswer(invocation -> { mHalTunerCallback = (ITunerCallback) invocation.getArguments()[0]; @@ -228,7 +218,7 @@ public final class TunerSessionHidlTest extends ExtendedRadioMockitoTestCase { @Test public void setConfiguration_forNonCurrentUser_doesNotInvokesCallback() throws Exception { openAidlClients(/* numClients= */ 1); - doReturn(false).when(() -> RadioServiceUserController.isCurrentOrSystemUser()); + doReturn(false).when(mUserControllerMock).isCurrentOrSystemUser(); mTunerSessions[0].setConfiguration(FM_BAND_CONFIG); @@ -403,7 +393,7 @@ public final class TunerSessionHidlTest extends ExtendedRadioMockitoTestCase { @Test public void tune_forNonCurrentUser_doesNotTune() throws Exception { openAidlClients(/* numClients= */ 1); - doReturn(false).when(() -> RadioServiceUserController.isCurrentOrSystemUser()); + doReturn(false).when(mUserControllerMock).isCurrentOrSystemUser(); ProgramSelector initialSel = TestUtils.makeFmSelector(AM_FM_FREQUENCY_LIST[1]); RadioManager.ProgramInfo tuneInfo = TestUtils.makeProgramInfo(initialSel, SIGNAL_QUALITY); @@ -481,7 +471,7 @@ public final class TunerSessionHidlTest extends ExtendedRadioMockitoTestCase { openAidlClients(/* numClients= */ 1); mHalCurrentInfo = TestUtils.makeHalProgramInfo( Convert.programSelectorToHal(initialSel), SIGNAL_QUALITY); - doReturn(false).when(() -> RadioServiceUserController.isCurrentOrSystemUser()); + doReturn(false).when(mUserControllerMock).isCurrentOrSystemUser(); mTunerSessions[0].step(/* directionDown= */ true, /* skipSubChannel= */ false); @@ -559,7 +549,7 @@ public final class TunerSessionHidlTest extends ExtendedRadioMockitoTestCase { openAidlClients(/* numClients= */ 1); mHalCurrentInfo = TestUtils.makeHalProgramInfo( Convert.programSelectorToHal(initialSel), SIGNAL_QUALITY); - doReturn(false).when(() -> RadioServiceUserController.isCurrentOrSystemUser()); + doReturn(false).when(mUserControllerMock).isCurrentOrSystemUser(); mTunerSessions[0].seek(/* directionDown= */ true, /* skipSubChannel= */ false); @@ -593,7 +583,7 @@ public final class TunerSessionHidlTest extends ExtendedRadioMockitoTestCase { @Test public void cancel_forNonCurrentUser_doesNotCancel() throws Exception { openAidlClients(/* numClients= */ 1); - doReturn(false).when(() -> RadioServiceUserController.isCurrentOrSystemUser()); + doReturn(false).when(mUserControllerMock).isCurrentOrSystemUser(); mTunerSessions[0].cancel(); @@ -663,7 +653,7 @@ public final class TunerSessionHidlTest extends ExtendedRadioMockitoTestCase { @Test public void startBackgroundScan_forNonCurrentUser_doesNotInvokesCallback() throws Exception { openAidlClients(/* numClients= */ 1); - doReturn(false).when(() -> RadioServiceUserController.isCurrentOrSystemUser()); + doReturn(false).when(mUserControllerMock).isCurrentOrSystemUser(); mTunerSessions[0].startBackgroundScan(); @@ -676,7 +666,7 @@ public final class TunerSessionHidlTest extends ExtendedRadioMockitoTestCase { openAidlClients(/* numClients= */ 1); ProgramList.Filter filter = new ProgramList.Filter(new ArraySet<>(), new ArraySet<>(), /* includeCategories= */ true, /* excludeModifications= */ false); - doReturn(false).when(() -> RadioServiceUserController.isCurrentOrSystemUser()); + doReturn(false).when(mUserControllerMock).isCurrentOrSystemUser(); mTunerSessions[0].startProgramListUpdates(filter); @@ -715,7 +705,7 @@ public final class TunerSessionHidlTest extends ExtendedRadioMockitoTestCase { ProgramList.Filter aidlFilter = new ProgramList.Filter(new ArraySet<>(), new ArraySet<>(), /* includeCategories= */ true, /* excludeModifications= */ false); mTunerSessions[0].startProgramListUpdates(aidlFilter); - doReturn(false).when(() -> RadioServiceUserController.isCurrentOrSystemUser()); + doReturn(false).when(mUserControllerMock).isCurrentOrSystemUser(); mTunerSessions[0].stopProgramListUpdates(); @@ -781,7 +771,7 @@ public final class TunerSessionHidlTest extends ExtendedRadioMockitoTestCase { public void setConfigFlag_forNonCurrentUser_doesNotSetConfigFlag() throws Exception { openAidlClients(/* numClients= */ 1); int flag = UNSUPPORTED_CONFIG_FLAG + 1; - doReturn(false).when(() -> RadioServiceUserController.isCurrentOrSystemUser()); + doReturn(false).when(mUserControllerMock).isCurrentOrSystemUser(); mTunerSessions[0].setConfigFlag(flag, /* value= */ true); @@ -846,7 +836,7 @@ public final class TunerSessionHidlTest extends ExtendedRadioMockitoTestCase { openAidlClients(/* numClients= */ 1); Map parametersSet = Map.of("mockParam1", "mockValue1", "mockParam2", "mockValue2"); - doReturn(false).when(() -> RadioServiceUserController.isCurrentOrSystemUser()); + doReturn(false).when(mUserControllerMock).isCurrentOrSystemUser(); mTunerSessions[0].setParameters(parametersSet); @@ -900,7 +890,7 @@ public final class TunerSessionHidlTest extends ExtendedRadioMockitoTestCase { public void onCurrentProgramInfoChanged_withNonCurrentUser_doesNotInvokeCallback() throws Exception { openAidlClients(1); - doReturn(USER_ID_2).when(() -> RadioServiceUserController.getCurrentUser()); + doReturn(USER_ID_2).when(mUserControllerMock).getCurrentUser(); mHalTunerCallback.onCurrentProgramInfoChanged(TestUtils.makeHalProgramInfo( TestUtils.makeHalFmSelector(/* freq= */ 97300), SIGNAL_QUALITY)); diff --git a/core/tests/ConnectivityManagerTest/Android.bp b/core/tests/ConnectivityManagerTest/Android.bp index f17a28d22c17057240cbf239218e1f3c358754aa..6421899631ff343539799e117b5745b3a26be074 100644 --- a/core/tests/ConnectivityManagerTest/Android.bp +++ b/core/tests/ConnectivityManagerTest/Android.bp @@ -24,8 +24,8 @@ package { android_test { name: "ConnectivityManagerTest", libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", ], static_libs: [ "junit", diff --git a/core/tests/GameManagerTests/Android.bp b/core/tests/GameManagerTests/Android.bp index a252f8b53fabf09e254cf1f5a581747cf81c4674..1abceb820fc1b0ad0cb7342a8d583f756fbe0cbc 100644 --- a/core/tests/GameManagerTests/Android.bp +++ b/core/tests/GameManagerTests/Android.bp @@ -32,7 +32,7 @@ android_test { "platform-test-annotations", "truth", ], - libs: ["android.test.runner"], + libs: ["android.test.runner.stubs.system"], platform_apis: true, certificate: "platform", test_suites: ["device-tests"], diff --git a/core/tests/InputMethodCoreTests/Android.bp b/core/tests/InputMethodCoreTests/Android.bp index ac6462589e16e16646ac7f434536a909d200e354..2b524d58ced700eb4e28210c5f46cbdeb3dbbec3 100644 --- a/core/tests/InputMethodCoreTests/Android.bp +++ b/core/tests/InputMethodCoreTests/Android.bp @@ -42,9 +42,9 @@ android_test { ], libs: [ - "android.test.runner", - "android.test.base", - "android.test.mock", + "android.test.runner.stubs", + "android.test.base.stubs", + "android.test.mock.stubs", "framework", "ext", "framework-res", diff --git a/core/tests/PackageInstallerSessions/Android.bp b/core/tests/PackageInstallerSessions/Android.bp index b631df1fcf578e62992e859dbab92c970e0427e9..d10ecd07a44c71ade74b8d702740d3a9764ae121 100644 --- a/core/tests/PackageInstallerSessions/Android.bp +++ b/core/tests/PackageInstallerSessions/Android.bp @@ -39,8 +39,8 @@ android_test { ], libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs", + "android.test.base.stubs", "framework", "framework-res", ], diff --git a/core/tests/PlatformCompatFramework/Android.bp b/core/tests/PlatformCompatFramework/Android.bp index 2621d280bd9da7b6097f7af958fcb57fbd333c92..a3fdf7b43bee5c7aae2655382411f84ba1c80c81 100644 --- a/core/tests/PlatformCompatFramework/Android.bp +++ b/core/tests/PlatformCompatFramework/Android.bp @@ -12,8 +12,8 @@ android_test { // Include all test java files. srcs: ["src/**/*.java"], libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", ], static_libs: [ "junit", diff --git a/core/tests/bandwidthtests/Android.bp b/core/tests/bandwidthtests/Android.bp index 8645b39da5a84f90af8c5fbd9e3515f7f6f92b7e..b7357122dff824923ef906b1b2eb43330ac626b2 100644 --- a/core/tests/bandwidthtests/Android.bp +++ b/core/tests/bandwidthtests/Android.bp @@ -27,9 +27,9 @@ android_test { // Include all test java files. srcs: ["src/**/*.java"], libs: [ - "android.test.runner", - "org.apache.http.legacy", - "android.test.base", + "android.test.runner.stubs", + "org.apache.http.legacy.stubs", + "android.test.base.stubs", ], static_libs: [ "junit", diff --git a/core/tests/batterystatstests/BatteryStatsLoadTests/Android.bp b/core/tests/batterystatstests/BatteryStatsLoadTests/Android.bp index 1c0ea839ec02eaf2255c1dc288ab1577576ae756..926edfed16ef1ca38d6f6568206a3eedbd5514c0 100644 --- a/core/tests/batterystatstests/BatteryStatsLoadTests/Android.bp +++ b/core/tests/batterystatstests/BatteryStatsLoadTests/Android.bp @@ -16,7 +16,7 @@ android_test { "compatibility-device-util-axt", "junit", ], - libs: ["android.test.runner"], + libs: ["android.test.runner.stubs.system"], platform_apis: true, certificate: "platform", } diff --git a/core/tests/bugreports/Android.bp b/core/tests/bugreports/Android.bp index 15e07e535b3965edeb705a28a0bd0adf6ce5c810..664d54d374b4a5971d3cdad06efb6b97add52209 100644 --- a/core/tests/bugreports/Android.bp +++ b/core/tests/bugreports/Android.bp @@ -26,8 +26,8 @@ android_test { srcs: ["src/**/*.java"], data: [":bugreport_artifacts"], libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.test", + "android.test.base.stubs.test", ], static_libs: [ "android.tracing.flags-aconfig-java", @@ -43,3 +43,10 @@ filegroup { name: "bugreport_artifacts", srcs: ["config/test-sysconfig.xml"], } + +test_module_config { + name: "BugreportManagerTestCases_android_server_os", + base: "BugreportManagerTestCases", + test_suites: ["general-tests"], + exclude_annotations: ["androidx.test.filters.LargeTest"], +} diff --git a/core/tests/companiontests/Android.bp b/core/tests/companiontests/Android.bp index d31b8f4701082ee1f1bcef3f3e85d3c9d6c454ad..cb0951e59d048c865dfa90ebb0ec72869181818d 100644 --- a/core/tests/companiontests/Android.bp +++ b/core/tests/companiontests/Android.bp @@ -12,8 +12,8 @@ android_test { // Include all test java files. srcs: ["src/**/*.java"], libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", ], static_libs: ["junit"], platform_apis: true, diff --git a/core/tests/coretests/Android.bp b/core/tests/coretests/Android.bp index 99cbf0504be67861798c5db4db3ef6a74fc66ea3..d98836f8ce202bfbb6ea734c9e4ed393da395c91 100644 --- a/core/tests/coretests/Android.bp +++ b/core/tests/coretests/Android.bp @@ -107,10 +107,10 @@ android_test { ], libs: [ - "android.test.runner", - "org.apache.http.legacy", - "android.test.base", - "android.test.mock", + "android.test.runner.stubs", + "org.apache.http.legacy.stubs", + "android.test.base.stubs", + "android.test.mock.stubs", "framework", "ext", "framework-res", @@ -158,8 +158,8 @@ android_app { use_resource_processor: false, libs: [ "framework-res", - "android.test.runner", - "org.apache.http.legacy", + "android.test.runner.stubs", + "org.apache.http.legacy.stubs", ], uses_libs: [ "android.test.runner", @@ -225,9 +225,9 @@ android_library { ], libs: [ - "android.test.runner", - "android.test.base", - "android.test.mock", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", + "android.test.mock.stubs.system", "framework", "framework-res", ], @@ -236,8 +236,8 @@ android_library { android_ravenwood_test { name: "FrameworksCoreTestsRavenwood", libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", ], static_libs: [ "core-test-rules", // for libcore.dalvik.system.CloseGuardSupport @@ -299,26 +299,22 @@ android_ravenwood_test { auto_gen_config: true, } -FLAKY_OR_IGNORED = [ - "androidx.test.filters.FlakyTest", - "org.junit.Ignore", -] - test_module_config { name: "FrameworksCoreTests_Presubmit", base: "FrameworksCoreTests", test_suites: [ + "automotive-tests", "device-tests", "device-platinum-tests", ], include_annotations: ["android.platform.test.annotations.Presubmit"], - exclude_annotations: FLAKY_OR_IGNORED, } test_module_config { name: "FrameworksCoreTests_inputmethod", base: "FrameworksCoreTests", test_suites: [ + "automotive-tests", "device-tests", "device-platinum-tests", ], @@ -333,39 +329,40 @@ test_module_config { name: "FrameworksCoreTests_context", base: "FrameworksCoreTests", test_suites: [ + "automotive-tests", "device-tests", "device-platinum-tests", ], include_filters: ["android.content.ContextTest"], - exclude_annotations: FLAKY_OR_IGNORED, } test_module_config { name: "FrameworksCoreTests_keyguard_manager", base: "FrameworksCoreTests", test_suites: [ + "automotive-tests", "device-tests", "device-platinum-tests", ], include_filters: ["android.app.KeyguardManagerTest"], - exclude_annotations: FLAKY_OR_IGNORED, } test_module_config { name: "FrameworksCoreTests_property_invalidated_cache", base: "FrameworksCoreTests", test_suites: [ + "automotive-tests", "device-tests", "device-platinum-tests", ], include_filters: ["android.app.PropertyInvalidatedCacheTests"], - exclude_annotations: FLAKY_OR_IGNORED, } test_module_config { name: "FrameworksCoreTests_android_content", base: "FrameworksCoreTests", test_suites: [ + "automotive-tests", "device-tests", "device-platinum-tests", ], @@ -374,36 +371,36 @@ test_module_config { "android.content.ComponentCallbacksControllerTest", "android.content.ContextWrapperTest", ], - exclude_annotations: FLAKY_OR_IGNORED, } test_module_config { name: "FrameworksCoreTests_sqlite", base: "FrameworksCoreTests", test_suites: [ + "automotive-tests", "device-tests", "device-platinum-tests", ], include_filters: ["android.database.sqlite.SQLiteRawStatementTest"], - exclude_annotations: FLAKY_OR_IGNORED, } test_module_config { name: "FrameworksCoreTests_android_net", base: "FrameworksCoreTests", test_suites: [ + "automotive-tests", "device-tests", "device-platinum-tests", ], include_filters: ["android.net"], include_annotations: ["android.platform.test.annotations.Presubmit"], - exclude_annotations: FLAKY_OR_IGNORED, } test_module_config { name: "FrameworksCoreTests_battery_stats", base: "FrameworksCoreTests", test_suites: [ + "automotive-tests", "device-tests", "device-platinum-tests", ], @@ -415,6 +412,7 @@ test_module_config { name: "FrameworksCoreTests_environment", base: "FrameworksCoreTests", test_suites: [ + "automotive-tests", "device-tests", "device-platinum-tests", ], @@ -425,6 +423,7 @@ test_module_config { name: "FrameworksCoreTests_util_data_charset", base: "FrameworksCoreTests", test_suites: [ + "automotive-tests", "device-tests", "device-platinum-tests", ], @@ -438,6 +437,7 @@ test_module_config { name: "FrameworksCoreTests_xml", base: "FrameworksCoreTests", test_suites: [ + "automotive-tests", "device-tests", "device-platinum-tests", ], @@ -451,6 +451,7 @@ test_module_config { name: "FrameworksCoreTests_util_apk", base: "FrameworksCoreTests", test_suites: [ + "automotive-tests", "device-tests", "device-platinum-tests", ], @@ -461,6 +462,7 @@ test_module_config { name: "FrameworksCoreTests_textclassifier", base: "FrameworksCoreTests", test_suites: [ + "automotive-tests", "device-tests", "device-platinum-tests", ], @@ -472,6 +474,7 @@ test_module_config { name: "FrameworksCoreTests_internal_app", base: "FrameworksCoreTests", test_suites: [ + "automotive-tests", "device-tests", "device-platinum-tests", ], @@ -486,6 +489,7 @@ test_module_config { name: "FrameworksCoreTests_internal_content", base: "FrameworksCoreTests", test_suites: [ + "automotive-tests", "device-tests", "device-platinum-tests", ], @@ -496,6 +500,7 @@ test_module_config { name: "FrameworksCoreTests_internal_infra", base: "FrameworksCoreTests", test_suites: [ + "automotive-tests", "device-tests", "device-platinum-tests", ], @@ -506,17 +511,18 @@ test_module_config { name: "FrameworksCoreTests_internal_jank", base: "FrameworksCoreTests", test_suites: [ + "automotive-tests", "device-tests", "device-platinum-tests", ], include_filters: ["com.android.internal.jank"], - exclude_annotations: FLAKY_OR_IGNORED, } test_module_config { name: "FrameworksCoreTests_internal_os_binder", base: "FrameworksCoreTests", test_suites: [ + "automotive-tests", "device-tests", "device-platinum-tests", ], @@ -528,6 +534,7 @@ test_module_config { name: "FrameworksCoreTests_internal_os_kernel", base: "FrameworksCoreTests", test_suites: [ + "automotive-tests", "device-tests", "device-platinum-tests", ], @@ -544,6 +551,7 @@ test_module_config { name: "FrameworksCoreTests_server_power", base: "FrameworksCoreTests", test_suites: [ + "automotive-tests", "device-tests", "device-platinum-tests", ], @@ -554,6 +562,7 @@ test_module_config { name: "FrameworksCoreTests_internal_security", base: "FrameworksCoreTests", test_suites: [ + "automotive-tests", "device-tests", "device-platinum-tests", ], @@ -565,28 +574,29 @@ test_module_config { name: "FrameworksCoreTests_internal_util_latency_tracker", base: "FrameworksCoreTests", test_suites: [ + "automotive-tests", "device-tests", "device-platinum-tests", ], include_filters: ["com.android.internal.util.LatencyTrackerTest"], - exclude_annotations: FLAKY_OR_IGNORED, } test_module_config { name: "FrameworksCoreTests_content_capture_options", base: "FrameworksCoreTests", test_suites: [ + "automotive-tests", "device-tests", "device-platinum-tests", ], include_filters: ["android.content.ContentCaptureOptionsTest"], - exclude_annotations: FLAKY_OR_IGNORED, } test_module_config { name: "FrameworksCoreTests_android_content_integrity", base: "FrameworksCoreTests", test_suites: [ + "automotive-tests", "device-tests", "device-platinum-tests", ], @@ -597,30 +607,31 @@ test_module_config { name: "FrameworksCoreTests_android_content_pm_PreSubmit", base: "FrameworksCoreTests", test_suites: [ + "automotive-tests", "device-tests", "device-platinum-tests", ], include_filters: ["android.content.pm."], include_annotations: ["android.platform.test.annotations.Presubmit"], - exclude_annotations: FLAKY_OR_IGNORED, } test_module_config { name: "FrameworksCoreTests_android_content_pm_PostSubmit", base: "FrameworksCoreTests", test_suites: [ + "automotive-tests", "device-tests", "device-platinum-tests", ], include_filters: ["android.content.pm."], include_annotations: ["android.platform.test.annotations.Postsubmit"], - exclude_annotations: FLAKY_OR_IGNORED, } test_module_config { name: "FrameworksCoreTests_android_content_res", base: "FrameworksCoreTests", test_suites: [ + "automotive-tests", "device-tests", "device-platinum-tests", ], @@ -637,18 +648,19 @@ test_module_config { name: "FrameworksCoreTests_android_content_res_PostSubmit", base: "FrameworksCoreTests", test_suites: [ + "automotive-tests", "device-tests", "device-platinum-tests", ], include_filters: ["android.content.res."], include_annotations: ["android.platform.test.annotations.Postsubmit"], - exclude_annotations: FLAKY_OR_IGNORED, } test_module_config { name: "FrameworksCoreTests_android_service", base: "FrameworksCoreTests", test_suites: [ + "automotive-tests", "device-tests", "device-platinum-tests", ], @@ -668,65 +680,52 @@ test_module_config { name: "FrameworksCoreTests_android_view_contentcapture", base: "FrameworksCoreTests", test_suites: [ + "automotive-tests", "device-tests", "device-platinum-tests", ], include_filters: ["android.view.contentcapture"], - exclude_annotations: FLAKY_OR_IGNORED, } test_module_config { name: "FrameworksCoreTests_android_view_contentprotection", base: "FrameworksCoreTests", test_suites: [ + "automotive-tests", "device-tests", "device-platinum-tests", ], include_filters: ["android.view.contentprotection"], - exclude_annotations: FLAKY_OR_IGNORED, } test_module_config { name: "FrameworksCoreTests_com_android_internal_content_Presubmit", base: "FrameworksCoreTests", test_suites: [ + "automotive-tests", "device-tests", "device-platinum-tests", ], include_filters: ["com.android.internal.content."], include_annotations: ["android.platform.test.annotations.Presubmit"], - exclude_annotations: FLAKY_OR_IGNORED, } test_module_config { name: "FrameworksCoreTests_drawable", base: "FrameworksCoreTests", test_suites: [ + "automotive-tests", "device-tests", "device-platinum-tests", ], include_filters: ["android.graphics.drawable.IconTest"], } -test_module_config { - name: "FrameworksCoreTests_accessibility_NO_FLAKES", - base: "FrameworksCoreTests", - test_suites: [ - "device-tests", - "device-platinum-tests", - ], - include_filters: [ - "com.android.internal.accessibility", - "android.accessibilityservice", - "android.view.accessibility", - ], - exclude_annotations: ["androidx.test.filters.FlakyTest"], -} - test_module_config { name: "FrameworksCoreTests_accessibility", base: "FrameworksCoreTests", test_suites: [ + "automotive-tests", "device-tests", "device-platinum-tests", ], @@ -741,6 +740,7 @@ test_module_config { name: "FrameworksCoreTests_usage", base: "FrameworksCoreTests", test_suites: [ + "automotive-tests", "device-tests", "device-platinum-tests", ], @@ -751,6 +751,7 @@ test_module_config { name: "FrameworksCoreTests_fastdata", base: "FrameworksCoreTests", test_suites: [ + "automotive-tests", "device-tests", "device-platinum-tests", ], @@ -761,6 +762,7 @@ test_module_config { name: "FrameworksCoreTests_hardware_input", base: "FrameworksCoreTests", test_suites: [ + "automotive-tests", "device-tests", "device-platinum-tests", ], @@ -771,6 +773,7 @@ test_module_config { name: "FrameworksCoreTests_view_verified", base: "FrameworksCoreTests", test_suites: [ + "automotive-tests", "device-tests", "device-platinum-tests", ], @@ -780,10 +783,35 @@ test_module_config { ], } +test_module_config { + name: "FrameworksCoreTests_android_net_Presubmit", + base: "FrameworksCoreTests", + test_suites: [ + "automotive-tests", + "device-platinum-tests", + "device-tests", + ], + include_filters: ["android.net"], + include_annotations: ["android.platform.test.annotations.Presubmit"], +} + +test_module_config { + name: "FrameworksCoreTests_content_pm_Postsubmit", + base: "FrameworksCoreTests", + test_suites: [ + "automotive-tests", + "device-platinum-tests", + "device-tests", + ], + include_filters: ["android.content.pm."], + include_annotations: ["android.platform.test.annotations.Postsubmit"], +} + test_module_config { name: "FrameworksCoreTests_jank", base: "FrameworksCoreTests", test_suites: [ + "automotive-tests", "device-tests", "device-platinum-tests", ], @@ -792,18 +820,17 @@ test_module_config { "com.android.internal.jank.InteractionJankMonitorTest", "com.android.internal.util.LatencyTrackerTest", ], - exclude_annotations: FLAKY_OR_IGNORED, } test_module_config { name: "FrameworksCoreTests_Platinum", base: "FrameworksCoreTests", test_suites: [ + "automotive-tests", "device-tests", "device-platinum-tests", ], include_annotations: ["android.platform.test.annotations.PlatinumTest"], - exclude_annotations: FLAKY_OR_IGNORED, } test_module_config { diff --git a/core/tests/coretests/src/android/app/NotificationChannelTest.java b/core/tests/coretests/src/android/app/NotificationChannelTest.java index e47ef2df48b93afbf471eec2d9fba5910d48474b..e19f887c12845bd426541afdf6e412619c87e1b0 100644 --- a/core/tests/coretests/src/android/app/NotificationChannelTest.java +++ b/core/tests/coretests/src/android/app/NotificationChannelTest.java @@ -47,12 +47,13 @@ import android.os.RemoteException; import android.os.VibrationEffect; import android.platform.test.annotations.EnableFlags; import android.platform.test.annotations.Presubmit; +import android.platform.test.annotations.UsesFlags; +import android.platform.test.flag.junit.FlagsParameterization; import android.platform.test.flag.junit.SetFlagsRule; import android.provider.MediaStore.Audio.AudioColumns; import android.test.mock.MockContentResolver; import android.util.Xml; -import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.filters.SmallTest; import com.android.modules.utils.TypedXmlPullParser; @@ -61,6 +62,7 @@ import com.android.modules.utils.TypedXmlSerializer; import com.google.common.base.Strings; import org.junit.Before; +import org.junit.ClassRule; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -71,14 +73,28 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.lang.reflect.Field; import java.util.Arrays; +import java.util.List; import java.util.function.Consumer; -@RunWith(AndroidJUnit4.class) +import platform.test.runner.parameterized.ParameterizedAndroidJunit4; +import platform.test.runner.parameterized.Parameters; + +@RunWith(ParameterizedAndroidJunit4.class) +@UsesFlags(android.app.Flags.class) @SmallTest @Presubmit public class NotificationChannelTest { + @ClassRule + public static final SetFlagsRule.ClassRule mSetFlagsClassRule = new SetFlagsRule.ClassRule(); + + @Parameters(name = "{0}") + public static List getParams() { + return FlagsParameterization.allCombinationsOf( + Flags.FLAG_NOTIF_CHANNEL_CROP_VIBRATION_EFFECTS); + } + @Rule - public final SetFlagsRule mSetFlagsRule = new SetFlagsRule(); + public final SetFlagsRule mSetFlagsRule; private final String CLASS = "android.app.NotificationChannel"; @@ -86,6 +102,10 @@ public class NotificationChannelTest { ContentProvider mContentProvider; IContentProvider mIContentProvider; + public NotificationChannelTest(FlagsParameterization flags) { + mSetFlagsRule = mSetFlagsClassRule.createSetFlagsRule(flags); + } + @Before public void setUp() throws Exception { mContext = mock(Context.class); diff --git a/core/tests/coretests/src/android/app/NotificationTest.java b/core/tests/coretests/src/android/app/NotificationTest.java index ef6ff0518dacc7aea209860723ed3e2ef9946b9a..0837b458c3ba4241e57dc705820f78fdefb011d3 100644 --- a/core/tests/coretests/src/android/app/NotificationTest.java +++ b/core/tests/coretests/src/android/app/NotificationTest.java @@ -214,6 +214,25 @@ public class NotificationTest { assertFalse(n.hasCompletedProgress()); } + @Test + @EnableFlags(Flags.FLAG_API_RICH_ONGOING) + public void testGetShortCriticalText_noneSet() { + Notification n = new Notification.Builder(mContext, "test") + .build(); + + assertSame(n.getShortCriticalText(), null); + } + + @Test + @EnableFlags(Flags.FLAG_API_RICH_ONGOING) + public void testGetShortCriticalText_isSet() { + Notification n = new Notification.Builder(mContext, "test") + .setShortCriticalText("short critical text here") + .build(); + + assertSame(n.getShortCriticalText(), "short critical text here"); + } + @Test public void largeIconMultipleReferences_keptAfterParcelling() { Icon originalIcon = Icon.createWithBitmap(BitmapFactory.decodeResource( diff --git a/core/tests/coretests/src/android/content/pm/LauncherActivityInfoTest.java b/core/tests/coretests/src/android/content/pm/LauncherActivityInfoTest.java index e19c4b15d300da0e31fc7f3a35b7755e1c107b0d..3616ff5cc144f17e792e397eec7e60994817c7fc 100644 --- a/core/tests/coretests/src/android/content/pm/LauncherActivityInfoTest.java +++ b/core/tests/coretests/src/android/content/pm/LauncherActivityInfoTest.java @@ -33,71 +33,169 @@ import org.junit.runner.RunWith; public class LauncherActivityInfoTest { @Test - public void testTrimStart() { - // Invisible case - assertThat(LauncherActivityInfo.trimStart("\u0009").toString()).isEmpty(); - // It is not supported in the system font - assertThat(LauncherActivityInfo.trimStart("\u0FE1").toString()).isEmpty(); - // Surrogates case - assertThat(LauncherActivityInfo.trimStart("\uD83E\uDD36").toString()) - .isEqualTo("\uD83E\uDD36"); - assertThat(LauncherActivityInfo.trimStart("\u0009\u0FE1\uD83E\uDD36A").toString()) - .isEqualTo("\uD83E\uDD36A"); - assertThat(LauncherActivityInfo.trimStart("\uD83E\uDD36A\u0009\u0FE1").toString()) - .isEqualTo("\uD83E\uDD36A\u0009\u0FE1"); - assertThat(LauncherActivityInfo.trimStart("A\uD83E\uDD36\u0009\u0FE1A").toString()) - .isEqualTo("A\uD83E\uDD36\u0009\u0FE1A"); - assertThat(LauncherActivityInfo.trimStart( - "A\uD83E\uDD36\u0009\u0FE1A\uD83E\uDD36").toString()) - .isEqualTo("A\uD83E\uDD36\u0009\u0FE1A\uD83E\uDD36"); - assertThat(LauncherActivityInfo.trimStart( - "\u0009\u0FE1\uD83E\uDD36A\u0009\u0FE1").toString()) - .isEqualTo("\uD83E\uDD36A\u0009\u0FE1"); + public void testIsVisible_normal() { + // normal + assertThat(LauncherActivityInfo.isVisible("label")).isTrue(); + // 1 surrogates case + assertThat(LauncherActivityInfo.isVisible("\uD83E\uDD36")).isTrue(); } @Test - public void testTrimEnd() { - // Invisible case - assertThat(LauncherActivityInfo.trimEnd("\u0009").toString()).isEmpty(); - // It is not supported in the system font - assertThat(LauncherActivityInfo.trimEnd("\u0FE1").toString()).isEmpty(); - // Surrogates case - assertThat(LauncherActivityInfo.trimEnd("\uD83E\uDD36").toString()) - .isEqualTo("\uD83E\uDD36"); - assertThat(LauncherActivityInfo.trimEnd("\u0009\u0FE1\uD83E\uDD36A").toString()) - .isEqualTo("\u0009\u0FE1\uD83E\uDD36A"); - assertThat(LauncherActivityInfo.trimEnd("\uD83E\uDD36A\u0009\u0FE1").toString()) - .isEqualTo("\uD83E\uDD36A"); - assertThat(LauncherActivityInfo.trimEnd("A\uD83E\uDD36\u0009\u0FE1A").toString()) - .isEqualTo("A\uD83E\uDD36\u0009\u0FE1A"); - assertThat(LauncherActivityInfo.trimEnd( - "A\uD83E\uDD36\u0009\u0FE1A\uD83E\uDD36").toString()) - .isEqualTo("A\uD83E\uDD36\u0009\u0FE1A\uD83E\uDD36"); - assertThat(LauncherActivityInfo.trimEnd( - "\u0009\u0FE1\uD83E\uDD36A\u0009\u0FE1").toString()) - .isEqualTo("\u0009\u0FE1\uD83E\uDD36A"); + public void testIsVisible_onlyInvisibleCharacter() { + // 1 invisible + assertThat(LauncherActivityInfo.isVisible("\u0009")).isFalse(); + // 2 invisible + assertThat(LauncherActivityInfo.isVisible("\u0009\u3164")).isFalse(); + // 3 invisible + assertThat(LauncherActivityInfo.isVisible("\u3000\u0009\u3164")).isFalse(); + // 4 invisible + assertThat(LauncherActivityInfo.isVisible("\u200F\u3000\u0009\u3164")).isFalse(); } @Test - public void testTrim() { - // Invisible case - assertThat(LauncherActivityInfo.trim("\u0009").toString()).isEmpty(); - // It is not supported in the system font - assertThat(LauncherActivityInfo.trim("\u0FE1").toString()).isEmpty(); - // Surrogates case - assertThat(LauncherActivityInfo.trim("\uD83E\uDD36").toString()) - .isEqualTo("\uD83E\uDD36"); - assertThat(LauncherActivityInfo.trim("\u0009\u0FE1\uD83E\uDD36A").toString()) - .isEqualTo("\uD83E\uDD36A"); - assertThat(LauncherActivityInfo.trim("\uD83E\uDD36A\u0009\u0FE1").toString()) - .isEqualTo("\uD83E\uDD36A"); - assertThat(LauncherActivityInfo.trim("A\uD83E\uDD36\u0009\u0FE1A").toString()) - .isEqualTo("A\uD83E\uDD36\u0009\u0FE1A"); - assertThat(LauncherActivityInfo.trim( - "A\uD83E\uDD36\u0009\u0FE1A\uD83E\uDD36").toString()) - .isEqualTo("A\uD83E\uDD36\u0009\u0FE1A\uD83E\uDD36"); - assertThat(LauncherActivityInfo.trim( - "\u0009\u0FE1\uD83E\uDD36A\u0009\u0FE1").toString()) - .isEqualTo("\uD83E\uDD36A"); + public void testIsVisible_onlyNotSupportedCharacter() { + // 1 not supported + assertThat(LauncherActivityInfo.isVisible("\u0FE1")).isFalse(); + // 2 not supported + assertThat(LauncherActivityInfo.isVisible("\u0FE1\u0FE2")).isFalse(); + // 3 not supported + assertThat(LauncherActivityInfo.isVisible("\u0FE1\u0FE2\u0FE3")).isFalse(); + // 4 not supported + assertThat(LauncherActivityInfo.isVisible("\u0FE1\u0FE2\u0FE3\u0FE4")).isFalse(); + } + + @Test + public void testIsVisible_invisibleAndNotSupportedCharacter() { + // 1 invisible, 1 not supported + assertThat(LauncherActivityInfo.isVisible("\u0009\u0FE1")).isFalse(); + // 1 invisible, 2 not supported + assertThat(LauncherActivityInfo.isVisible("\u0009\u0FE1\u0FE2")).isFalse(); + // 1 invisible, 3 not supported + assertThat(LauncherActivityInfo.isVisible("\u0009\u0FE1\u0FE2\u0FE3")).isFalse(); + // 1 invisible, 4 not supported + assertThat(LauncherActivityInfo.isVisible("\u0009\u0FE1\u0FE2\u0FE3\u0FE4")).isFalse(); + + // 2 invisible, 1 not supported + assertThat(LauncherActivityInfo.isVisible("\u0009\u3164\u0FE1")).isFalse(); + // 2 invisible, 2 not supported + assertThat(LauncherActivityInfo.isVisible("\u0009\u3164\u0FE1\u0FE2")).isFalse(); + // 2 invisible, 3 not supported + assertThat(LauncherActivityInfo.isVisible("\u0009\u3164\u0FE1\u0FE2\u0FE3")).isFalse(); + // 2 invisible, 4 not supported + assertThat(LauncherActivityInfo.isVisible( + "\u0009\u3164\u0FE1\u0FE2\u0FE3\u0FE4")).isFalse(); + + // 3 invisible, 1 not supported + assertThat(LauncherActivityInfo.isVisible("\u3000\u0009\u3164\u0FE1")).isFalse(); + // 3 invisible, 2 not supported + assertThat(LauncherActivityInfo.isVisible("\u3000\u0009\u3164\u0FE1\u0FE2")).isFalse(); + // 3 invisible, 3 not supported + assertThat(LauncherActivityInfo.isVisible( + "\u3000\u0009\u3164\u0FE1\u0FE2\u0FE3")).isFalse(); + // 3 invisible, 4 not supported + assertThat(LauncherActivityInfo.isVisible( + "\u3000\u0009\u3164\u0FE1\u0FE2\u0FE3\u0FE4")).isFalse(); + + // 4 invisible, 1 not supported + assertThat(LauncherActivityInfo.isVisible("\u200F\u3000\u0009\u3164\u0FE1")).isFalse(); + // 4 invisible, 2 not supported + assertThat(LauncherActivityInfo.isVisible( + "\u200F\u3000\u0009\u3164\u0FE1\u0FE2")).isFalse(); + // 4 invisible, 3 not supported + assertThat(LauncherActivityInfo.isVisible( + "\u200F\u3000\u0009\u3164\u0FE1\u0FE2\u0FE3")).isFalse(); + // 4 invisible, 4 not supported + assertThat(LauncherActivityInfo.isVisible( + "\u200F\u3000\u0009\u3164\u0FE1\u0FE2\u0FE3\u0FE4")).isFalse(); + + // 1 not supported, 1 invisible, + assertThat(LauncherActivityInfo.isVisible("\u0FE1\u0009")).isFalse(); + // 1 not supported, 2 invisible + assertThat(LauncherActivityInfo.isVisible("\u0FE1\u0009\u3164")).isFalse(); + // 1 not supported, 3 invisible + assertThat(LauncherActivityInfo.isVisible("\u0FE1\u3000\u0009\u3164")).isFalse(); + // 1 not supported, 4 invisible + assertThat(LauncherActivityInfo.isVisible("\u0FE1\u200F\u3000\u0009\u3164")).isFalse(); + } + + @Test + public void testIsVisible_invisibleAndNormalCharacter() { + // 1 invisible, 1 surrogates + assertThat(LauncherActivityInfo.isVisible("\u0009\uD83E\uDD36")).isTrue(); + // 2 invisible, 1 surrogates + assertThat(LauncherActivityInfo.isVisible("\u0009\u3164\uD83E\uDD36")).isTrue(); + // 3 invisible, 1 surrogates + assertThat(LauncherActivityInfo.isVisible("\u3000\u0009\u3164\uD83E\uDD36")).isFalse(); + // 4 invisible, 1 surrogates + assertThat(LauncherActivityInfo.isVisible( + "\u200F\u3000\u0009\u3164\uD83E\uDD36")).isFalse(); + } + + @Test + public void testIsVisible_notSupportedAndNormalCharacter() { + // 1 not supported, 1 surrogates + assertThat(LauncherActivityInfo.isVisible("\u0FE1\uD83E\uDD36")).isTrue(); + // 2 not supported, 1 surrogates + assertThat(LauncherActivityInfo.isVisible("\u0FE1\u0FE2\uD83E\uDD36")).isTrue(); + // 3 not supported, 1 surrogates + assertThat(LauncherActivityInfo.isVisible("\u0FE1\u0FE2\u0FE3\uD83E\uDD36")).isTrue(); + // 4 not supported, 1 surrogates + assertThat(LauncherActivityInfo.isVisible( + "\u0FE1\u0FE2\u0FE3\u0FE4\uD83E\uDD36")).isTrue(); + } + + @Test + public void testIsVisible_mixAllCharacter() { + // 1 invisible, 1 not supported, 1 surrogates + assertThat(LauncherActivityInfo.isVisible("\u0009\u0FE1\uD83E\uDD36")).isTrue(); + // 1 invisible, 1 not supported, 1 invisible, 1 surrogates + assertThat(LauncherActivityInfo.isVisible("\u0009\u0FE1\u3164\uD83E\uDD36")).isTrue(); + // 1 invisible, 1 not supported, 2 invisible, 1 surrogates + assertThat(LauncherActivityInfo.isVisible( + "\u0009\u0FE1\u3000\u3164\uD83E\uDD36")).isTrue(); + // 1 invisible, 1 not supported, 3 invisible, 1 surrogates + assertThat(LauncherActivityInfo.isVisible( + "\u0009\u0FE1\u200F\u3000\u3164\uD83E\uDD36")).isTrue(); + + // 2 invisible, 1 not supported, 1 surrogates + assertThat(LauncherActivityInfo.isVisible("\u0009\u3164\u0FE1\uD83E\uDD36")).isTrue(); + // 2 invisible, 2 not supported, 1 surrogates + assertThat(LauncherActivityInfo.isVisible( + "\u0009\u3164\u0FE1\u0FE2\uD83E\uDD36")).isTrue(); + + // 3 invisible, 1 not supported, 1 surrogates + assertThat(LauncherActivityInfo.isVisible( + "\u3000\u0009\u3164\u0FE1\uD83E\uDD36")).isFalse(); + // 3 invisible, 2 not supported, 1 surrogates + assertThat(LauncherActivityInfo.isVisible( + "\u3000\u0009\u3164\u0FE1\u0FE2\uD83E\uDD36")).isFalse(); + // 3 invisible, 3 not supported, 1 surrogates + assertThat(LauncherActivityInfo.isVisible( + "\u3000\u0009\u3164\u0FE1\u0FE2\u0FE3\uD83E\uDD36")).isFalse(); + + // 4 invisible, 1 not supported, 1 surrogates + assertThat(LauncherActivityInfo.isVisible( + "\u200F\u3000\u0009\u3164\u0FE1\uD83E\uDD36")).isFalse(); + // 4 invisible, 2 not supported, 1 surrogates + assertThat(LauncherActivityInfo.isVisible( + "\u200F\u3000\u0009\u3164\u0FE1\u0FE2\uD83E\uDD36")).isFalse(); + // 4 invisible, 3 not supported, 1 surrogates + assertThat(LauncherActivityInfo.isVisible( + "\u200F\u3000\u0009\u3164\u0FE1\u0FE2\u0FE3\uD83E\uDD36")).isFalse(); + // 4 invisible, 4 not supported, 1 surrogates + assertThat(LauncherActivityInfo.isVisible( + "\u200F\u3000\u0009\u3164\u0FE1\u0FE2\u0FE3\u0FE4\uD83E\uDD36")).isFalse(); + + // 1 not supported, 1 invisible, 1 surrogates + assertThat(LauncherActivityInfo.isVisible("\u0FE1\u0009\uD83E\uDD36")).isTrue(); + // 1 not supported, 2 invisible, 1 surrogates + assertThat(LauncherActivityInfo.isVisible("\u0FE1\u0009\u3164\uD83E\uDD36")).isTrue(); + // 1 not supported, 3 invisible, 1 surrogates + assertThat(LauncherActivityInfo.isVisible( + "\u0FE1\u3000\u0009\u3164\uD83E\uDD36")).isTrue(); + // 1 not supported, 4 invisible, 1 surrogates + assertThat(LauncherActivityInfo.isVisible( + "\u0FE1\u200F\u3000\u0009\u3164\uD83E\uDD36")).isTrue(); + } } diff --git a/core/tests/coretests/src/android/database/sqlite/SQLiteDatabaseTest.java b/core/tests/coretests/src/android/database/sqlite/SQLiteDatabaseTest.java index 519f23b0deb664c699f1c69f74a8c512744348e3..9d477094692a0cda9713f492d5425ddce465cd7d 100644 --- a/core/tests/coretests/src/android/database/sqlite/SQLiteDatabaseTest.java +++ b/core/tests/coretests/src/android/database/sqlite/SQLiteDatabaseTest.java @@ -25,6 +25,7 @@ import static org.junit.Assert.fail; import android.content.Context; import android.database.Cursor; import android.database.DatabaseUtils; +import android.database.DefaultDatabaseErrorHandler; import android.platform.test.annotations.RequiresFlagsEnabled; import android.platform.test.flag.junit.CheckFlagsRule; import android.platform.test.flag.junit.DeviceFlagsValueProvider; @@ -538,4 +539,124 @@ public class SQLiteDatabaseTest { assertEquals(1, db.mConnection.size()); } + + // Create and open the database, allowing or disallowing double-quoted strings. + private void createDatabase(boolean noDoubleQuotedStrs) throws Exception { + // The open-flags that do not change in this test. + int flags = SQLiteDatabase.CREATE_IF_NECESSARY | SQLiteDatabase.OPEN_READWRITE; + + // The flag to be tested. + int flagUnderTest = SQLiteDatabase.NO_DOUBLE_QUOTED_STRS; + + if (noDoubleQuotedStrs) { + flags |= flagUnderTest; + } else { + flags &= ~flagUnderTest; + } + mDatabase = SQLiteDatabase.openDatabase(mDatabaseFile.getPath(), null, flags, null); + } + + /** + * This test verifies that the NO_DOUBLE_QUOTED_STRS flag works as expected when opening a + * database. This does not test that the flag is initialized as expected from the system + * properties. + */ + @Test + public void testNoDoubleQuotedStrings() throws Exception { + closeAndDeleteDatabase(); + createDatabase(/* noDoubleQuotedStrs */ false); + + mDatabase.beginTransaction(); + try { + mDatabase.execSQL("CREATE TABLE t1 (t text);"); + // Insert a value in double-quotes. This is invalid but accepted. + mDatabase.execSQL("INSERT INTO t1 (t) VALUES (\"foo\")"); + } finally { + mDatabase.endTransaction(); + } + + closeAndDeleteDatabase(); + createDatabase(/* noDoubleQuotedStrs */ true); + + mDatabase.beginTransaction(); + try { + mDatabase.execSQL("CREATE TABLE t1 (t text);"); + try { + // Insert a value in double-quotes. This is invalid and must throw. + mDatabase.execSQL("INSERT INTO t1 (t) VALUES (\"foo\")"); + fail("expected an exception"); + } catch (SQLiteException e) { + assertTrue(e.toString().contains("no such column")); + } + } finally { + mDatabase.endTransaction(); + } + closeAndDeleteDatabase(); + } + + @Test + public void testCloseCorruptionReport() throws Exception { + mDatabase.beginTransaction(); + try { + mDatabase.execSQL("CREATE TABLE t2 (i int, j int);"); + mDatabase.execSQL("INSERT INTO t2 (i, j) VALUES (2, 20)"); + mDatabase.execSQL("INSERT INTO t2 (i, j) VALUES (3, 30)"); + mDatabase.setTransactionSuccessful(); + } finally { + mDatabase.endTransaction(); + } + + // Start a transaction and announce that the DB is corrupted. + DefaultDatabaseErrorHandler errorHandler = new DefaultDatabaseErrorHandler(); + + // Do not bother with endTransaction; the database will have been closed in the corruption + // handler. + mDatabase.beginTransaction(); + try { + errorHandler.onCorruption(mDatabase); + mDatabase.execSQL("INSERT INTO t2 (i, j) VALUES (4, 40)"); + fail("expected an exception"); + } catch (IllegalStateException e) { + final Throwable cause = e.getCause(); + assertNotNull(cause); + boolean found = false; + for (StackTraceElement s : cause.getStackTrace()) { + if (s.getMethodName().contains("onCorruption")) { + found = true; + } + } + assertTrue(found); + } + } + + @Test + public void testCloseReport() throws Exception { + mDatabase.beginTransaction(); + try { + mDatabase.execSQL("CREATE TABLE t2 (i int, j int);"); + mDatabase.execSQL("INSERT INTO t2 (i, j) VALUES (2, 20)"); + mDatabase.execSQL("INSERT INTO t2 (i, j) VALUES (3, 30)"); + mDatabase.setTransactionSuccessful(); + } finally { + mDatabase.endTransaction(); + } + + mDatabase.close(); + try { + // Do not bother with endTransaction; the database has already been close. + mDatabase.beginTransaction(); + fail("expected an exception"); + } catch (IllegalStateException e) { + assertTrue(e.toString().contains("attempt to re-open an already-closed object")); + final Throwable cause = e.getCause(); + assertNotNull(cause); + boolean found = false; + for (StackTraceElement s : cause.getStackTrace()) { + if (s.getMethodName().contains("testCloseReport")) { + found = true; + } + } + assertTrue(found); + } + } } diff --git a/core/tests/coretests/src/android/os/BinderTest.java b/core/tests/coretests/src/android/os/BinderTest.java index 9767d677807de0ad09d93706925ee934b283a5b7..90ec93e464188b19bcf29c47a23223e2827210fd 100644 --- a/core/tests/coretests/src/android/os/BinderTest.java +++ b/core/tests/coretests/src/android/os/BinderTest.java @@ -24,18 +24,16 @@ import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.ArgumentMatchers.anyInt; import static org.testng.Assert.assertThrows; -import android.platform.test.annotations.IgnoreUnderRavenwood; +import android.platform.test.annotations.DisabledOnRavenwood; import android.platform.test.ravenwood.RavenwoodRule; import androidx.test.filters.SmallTest; import com.android.internal.os.BinderInternal; - import org.junit.Rule; import org.junit.Test; -@IgnoreUnderRavenwood(blockedBy = WorkSource.class) public class BinderTest { private static final int UID = 100; @@ -89,6 +87,7 @@ public class BinderTest { @SmallTest @Test(expected = java.lang.SecurityException.class) + @DisabledOnRavenwood(blockedBy = ServiceManagerNative.class) public void testServiceManagerNativeSecurityException() throws RemoteException { // Find the service manager IServiceManager sServiceManager = ServiceManagerNative @@ -101,6 +100,7 @@ public class BinderTest { @SmallTest @Test(expected = java.lang.NullPointerException.class) + @DisabledOnRavenwood(blockedBy = ServiceManagerNative.class) public void testServiceManagerNativeNullptrException() throws RemoteException { // Find the service manager IServiceManager sServiceManager = ServiceManagerNative diff --git a/core/tests/coretests/src/android/os/BundleTest.java b/core/tests/coretests/src/android/os/BundleTest.java index ded6fc5de2e5406cc3e07c9046d3859c6b2ec8e8..31e07524d777e5e5b77bde20234977ec8aff6ce0 100644 --- a/core/tests/coretests/src/android/os/BundleTest.java +++ b/core/tests/coretests/src/android/os/BundleTest.java @@ -25,7 +25,6 @@ import static org.junit.Assert.assertThrows; import static org.junit.Assert.assertTrue; import android.platform.test.annotations.DisabledOnRavenwood; -import android.platform.test.annotations.IgnoreUnderRavenwood; import android.platform.test.annotations.Presubmit; import android.platform.test.ravenwood.RavenwoodRule; import android.util.Log; @@ -131,7 +130,6 @@ public class BundleTest { } @Test - @IgnoreUnderRavenwood(blockedBy = ParcelFileDescriptor.class) public void testCreateFromParcel() throws Exception { boolean withFd; Parcel p; @@ -312,7 +310,7 @@ public class BundleTest { } @Test - @IgnoreUnderRavenwood(blockedBy = Parcel.class) + @DisabledOnRavenwood(reason = "Ravenwood tests run on the BCP") public void kindofEquals_lazyValuesAndDifferentClassLoaders_returnsFalse() { Parcelable p1 = new CustomParcelable(13, "Tiramisu"); Parcelable p2 = new CustomParcelable(13, "Tiramisu"); @@ -368,7 +366,6 @@ public class BundleTest { } @Test - @IgnoreUnderRavenwood(blockedBy = Parcel.class) public void readWriteLengthMismatch_logsWtf() throws Exception { mWtfHandler = Log.setWtfHandler((tag, e, system) -> { throw new RuntimeException(e); @@ -383,7 +380,7 @@ public class BundleTest { } @Test - @IgnoreUnderRavenwood(blockedBy = Parcel.class) + @DisabledOnRavenwood(reason = "Ravenwood tests run on the BCP") public void getParcelable_whenThrowingAndNotDefusing_throws() throws Exception { Bundle.setShouldDefuse(false); Bundle bundle = new Bundle(); @@ -396,7 +393,7 @@ public class BundleTest { } @Test - @IgnoreUnderRavenwood(blockedBy = Parcel.class) + @DisabledOnRavenwood(reason = "Ravenwood tests run on the BCP") public void getParcelable_whenThrowingAndDefusing_returnsNull() throws Exception { Bundle.setShouldDefuse(true); Bundle bundle = new Bundle(); @@ -412,7 +409,7 @@ public class BundleTest { } @Test - @IgnoreUnderRavenwood(blockedBy = Parcel.class) + @DisabledOnRavenwood(reason = "Ravenwood tests run on the BCP") public void getParcelable_whenThrowingAndDefusing_leavesElement() throws Exception { Bundle.setShouldDefuse(true); Bundle bundle = new Bundle(); @@ -447,7 +444,6 @@ public class BundleTest { } @Test - @DisabledOnRavenwood(blockedBy = Parcel.class) public void parcelledBundleWithBinder_shouldReturnHasBindersTrue() throws Exception { Bundle bundle = new Bundle(); bundle.putParcelable("test", new CustomParcelable(13, "Tiramisu")); @@ -470,7 +466,6 @@ public class BundleTest { } @Test - @DisabledOnRavenwood(blockedBy = Parcel.class) public void parcelledBundleWithoutBinder_shouldReturnHasBindersFalse() throws Exception { Bundle bundle = new Bundle(); bundle.putParcelable("test", new CustomParcelable(13, "Tiramisu")); diff --git a/core/tests/coretests/src/android/os/IpcDataCacheTest.java b/core/tests/coretests/src/android/os/IpcDataCacheTest.java index b03fd64857868447a585994669708d451a420c4b..64f77b309829b93b797db6061c75f2e077b69b9a 100644 --- a/core/tests/coretests/src/android/os/IpcDataCacheTest.java +++ b/core/tests/coretests/src/android/os/IpcDataCacheTest.java @@ -18,7 +18,9 @@ package android.os; import static org.junit.Assert.assertEquals; +import android.multiuser.Flags; import android.platform.test.annotations.IgnoreUnderRavenwood; +import android.platform.test.annotations.RequiresFlagsEnabled; import android.platform.test.ravenwood.RavenwoodRule; import androidx.test.filters.SmallTest; @@ -151,8 +153,6 @@ public class IpcDataCacheTest { tester.verify(9); } - // This test is disabled pending an sepolicy change that allows any app to set the - // test property. @Test public void testRemoteCall() { @@ -192,6 +192,44 @@ public class IpcDataCacheTest { tester.verify(4); } + @Test + @RequiresFlagsEnabled(Flags.FLAG_CACHING_DEVELOPMENT_IMPROVEMENTS) + public void testRemoteCallBypass() { + + // A stand-in for the binder. The test verifies that calls are passed through to + // this class properly. + ServerProxy tester = new ServerProxy(); + + // Create a cache that uses simple arithmetic to computer its values. + IpcDataCache.Config config = new IpcDataCache.Config(4, MODULE, API, "testCache3"); + IpcDataCache testCache = + new IpcDataCache<>(config, (x) -> tester.query(x), (x) -> x % 9 == 0); + + IpcDataCache.setTestMode(true); + testCache.testPropertyName(); + + tester.verify(0); + assertEquals(tester.value(3), testCache.query(3)); + tester.verify(1); + assertEquals(tester.value(3), testCache.query(3)); + tester.verify(2); + testCache.invalidateCache(); + assertEquals(tester.value(3), testCache.query(3)); + tester.verify(3); + assertEquals(tester.value(5), testCache.query(5)); + tester.verify(4); + assertEquals(tester.value(5), testCache.query(5)); + tester.verify(4); + assertEquals(tester.value(3), testCache.query(3)); + tester.verify(4); + assertEquals(tester.value(9), testCache.query(9)); + tester.verify(5); + assertEquals(tester.value(3), testCache.query(3)); + tester.verify(5); + assertEquals(tester.value(5), testCache.query(5)); + tester.verify(5); + } + @Test public void testDisableCache() { diff --git a/core/tests/coretests/src/android/os/ParcelNullabilityTest.java b/core/tests/coretests/src/android/os/ParcelNullabilityTest.java index 09395f15a57b295ffae42de9b8f0fc1b9b1efc3e..96316c436d61a748e570edc7ac7f2ad172a37f52 100644 --- a/core/tests/coretests/src/android/os/ParcelNullabilityTest.java +++ b/core/tests/coretests/src/android/os/ParcelNullabilityTest.java @@ -20,7 +20,7 @@ import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; -import android.platform.test.annotations.IgnoreUnderRavenwood; +import android.platform.test.annotations.DisabledOnRavenwood; import android.platform.test.ravenwood.RavenwoodRule; import android.util.ArrayMap; @@ -67,7 +67,7 @@ public final class ParcelNullabilityTest { } @Test - @IgnoreUnderRavenwood(blockedBy = Parcel.class) + @DisabledOnRavenwood(blockedBy = android.text.Spanned.class) public void nullCharSequence() { Parcel p = Parcel.obtain(); p.writeCharSequence(null); @@ -76,7 +76,6 @@ public final class ParcelNullabilityTest { } @Test - @IgnoreUnderRavenwood(blockedBy = Parcel.class) public void nullStrongBinder() { Parcel p = Parcel.obtain(); p.writeStrongBinder(null); @@ -85,7 +84,6 @@ public final class ParcelNullabilityTest { } @Test - @IgnoreUnderRavenwood(blockedBy = Parcel.class) public void nullStringInterface() { Parcel p = Parcel.obtain(); p.writeStrongInterface(null); diff --git a/core/tests/coretests/src/android/os/ParcelTest.java b/core/tests/coretests/src/android/os/ParcelTest.java index 037323111e9fb5227c990e0e90ca59625fe84074..da9d687ee2b0465831dc2dffecc2d621d7fd33df 100644 --- a/core/tests/coretests/src/android/os/ParcelTest.java +++ b/core/tests/coretests/src/android/os/ParcelTest.java @@ -23,7 +23,6 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertThrows; import static org.junit.Assert.assertTrue; -import android.platform.test.annotations.IgnoreUnderRavenwood; import android.platform.test.annotations.Presubmit; import android.platform.test.ravenwood.RavenwoodRule; import android.util.Log; @@ -48,7 +47,6 @@ public class ParcelTest { private static final String INTERFACE_TOKEN_2 = "Another IBinder interface token"; @Test - @IgnoreUnderRavenwood(blockedBy = Parcel.class) public void testIsForRpc() { Parcel p = Parcel.obtain(); assertEquals(false, p.isForRpc()); @@ -56,7 +54,6 @@ public class ParcelTest { } @Test - @IgnoreUnderRavenwood(blockedBy = Parcel.class) public void testCallingWorkSourceUidAfterWrite() { Parcel p = Parcel.obtain(); // Method does not throw if replaceCallingWorkSourceUid is called before requests headers @@ -77,7 +74,6 @@ public class ParcelTest { } @Test - @IgnoreUnderRavenwood(blockedBy = Parcel.class) public void testCallingWorkSourceUidAfterEnforce() { Parcel p = Parcel.obtain(); p.writeInterfaceToken(INTERFACE_TOKEN_1); @@ -95,7 +91,6 @@ public class ParcelTest { } @Test - @IgnoreUnderRavenwood(blockedBy = Parcel.class) public void testParcelWithMultipleHeaders() { Parcel p = Parcel.obtain(); Binder.setCallingWorkSourceUid(WORK_SOURCE_1); @@ -153,7 +148,6 @@ public class ParcelTest { } @Test - @IgnoreUnderRavenwood(blockedBy = Parcel.class) public void testCompareDataInRange_whenSameDataWithBinder() { Binder binder = new Binder(); Parcel pA = Parcel.obtain(); @@ -313,7 +307,6 @@ public class ParcelTest { * and 1M length for complex objects are allowed. */ @Test - @IgnoreUnderRavenwood(blockedBy = Parcel.class) public void testAllocations_whenWithinLimit() { Binder.setIsDirectlyHandlingTransactionOverride(true); Parcel p = Parcel.obtain(); @@ -398,7 +391,6 @@ public class ParcelTest { } @Test - @IgnoreUnderRavenwood(blockedBy = Parcel.class) public void testHasBinders_AfterWritingBinderToParcel() { Binder binder = new Binder(); Parcel pA = Parcel.obtain(); @@ -410,7 +402,6 @@ public class ParcelTest { } @Test - @IgnoreUnderRavenwood(blockedBy = Parcel.class) public void testHasBindersInRange_AfterWritingBinderToParcel() { Binder binder = new Binder(); Parcel pA = Parcel.obtain(); diff --git a/core/tests/coretests/src/android/text/TextLineLetterSpacingTest.kt b/core/tests/coretests/src/android/text/TextLineLetterSpacingTest.kt index 71980c125f01d94f7567b244df7351b935b39146..e4e04a0285884783938cdaac0cd1017f9ac479a3 100644 --- a/core/tests/coretests/src/android/text/TextLineLetterSpacingTest.kt +++ b/core/tests/coretests/src/android/text/TextLineLetterSpacingTest.kt @@ -17,11 +17,9 @@ package android.text import android.graphics.Paint -import android.platform.test.annotations.RequiresFlagsEnabled import android.platform.test.flag.junit.DeviceFlagsValueProvider import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest -import com.android.text.flags.Flags.FLAG_LETTER_SPACING_JUSTIFICATION import com.google.common.truth.Truth.assertThat import org.junit.Rule import org.junit.Test @@ -40,7 +38,6 @@ class TextLineLetterSpacingTest { @JvmField val mCheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule() - @RequiresFlagsEnabled(FLAG_LETTER_SPACING_JUSTIFICATION) @Test fun calculateRunFlagTest() { // Only one Bidi run @@ -84,7 +81,6 @@ class TextLineLetterSpacingTest { .isEqualTo(LEFT_EDGE) } - @RequiresFlagsEnabled(FLAG_LETTER_SPACING_JUSTIFICATION) @Test fun resolveRunFlagForSubSequenceTest() { val runStart = 5 diff --git a/core/tests/coretests/src/android/widget/RemoteViewsProtoTest.java b/core/tests/coretests/src/android/widget/RemoteViewsProtoTest.java deleted file mode 100644 index 7c140329f0e41d6eeb37e2773de0144800eef401..0000000000000000000000000000000000000000 --- a/core/tests/coretests/src/android/widget/RemoteViewsProtoTest.java +++ /dev/null @@ -1,155 +0,0 @@ -/* - * 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 android.widget; - -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; - -import android.content.Context; -import android.util.SizeF; -import android.util.proto.ProtoInputStream; -import android.util.proto.ProtoOutputStream; -import android.view.View; - -import androidx.test.InstrumentationRegistry; -import androidx.test.ext.junit.runners.AndroidJUnit4; -import androidx.test.filters.SmallTest; - -import com.android.frameworks.coretests.R; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.junit.runner.RunWith; - -import java.util.Map; - -/** - * Tests for RemoteViews. - */ -@RunWith(AndroidJUnit4.class) -@SmallTest -public class RemoteViewsProtoTest { - - // This can point to any other package which exists on the device. - private static final String OTHER_PACKAGE = "com.android.systemui"; - - @Rule - public final ExpectedException exception = ExpectedException.none(); - - private Context mContext; - private String mPackage; - private LinearLayout mContainer; - - @Before - public void setup() { - mContext = InstrumentationRegistry.getContext(); - mPackage = mContext.getPackageName(); - mContainer = new LinearLayout(mContext); - } - - @Test - public void copy_canStillBeApplied() { - RemoteViews original = new RemoteViews(mPackage, R.layout.remote_views_test); - - RemoteViews clone = recreateFromProto(original); - - clone.apply(mContext, mContainer); - } - - @SuppressWarnings("ReturnValueIgnored") - @Test - public void clone_repeatedly() { - RemoteViews original = new RemoteViews(mPackage, R.layout.remote_views_test); - - recreateFromProto(original); - recreateFromProto(original); - - original.apply(mContext, mContainer); - } - - @Test - public void clone_chained() { - RemoteViews original = new RemoteViews(mPackage, R.layout.remote_views_test); - - RemoteViews clone = recreateFromProto(recreateFromProto(original)); - - - clone.apply(mContext, mContainer); - } - - @Test - public void landscapePortraitViews_lightBackgroundLayoutFlag() { - RemoteViews inner = new RemoteViews(mPackage, R.layout.remote_views_text); - inner.setLightBackgroundLayoutId(R.layout.remote_views_light_background_text); - - RemoteViews parent = new RemoteViews(inner, inner); - parent.addFlags(RemoteViews.FLAG_USE_LIGHT_BACKGROUND_LAYOUT); - - View view = recreateFromProto(parent).apply(mContext, mContainer); - assertNull(view.findViewById(R.id.text)); - assertNotNull(view.findViewById(R.id.light_background_text)); - } - - @Test - public void sizedViews_lightBackgroundLayoutFlag() { - RemoteViews inner = new RemoteViews(mPackage, R.layout.remote_views_text); - inner.setLightBackgroundLayoutId(R.layout.remote_views_light_background_text); - - RemoteViews parent = new RemoteViews( - Map.of(new SizeF(0, 0), inner, new SizeF(100, 100), inner)); - parent.addFlags(RemoteViews.FLAG_USE_LIGHT_BACKGROUND_LAYOUT); - - View view = recreateFromProto(parent).apply(mContext, mContainer); - assertNull(view.findViewById(R.id.text)); - assertNotNull(view.findViewById(R.id.light_background_text)); - } - - @Test - public void nestedLandscapeViews() throws Exception { - RemoteViews views = new RemoteViews(mPackage, R.layout.remote_views_test); - for (int i = 0; i < 10; i++) { - views = new RemoteViews(views, new RemoteViews(mPackage, R.layout.remote_views_test)); - } - // writeTo/createFromProto works - recreateFromProto(views); - - views = new RemoteViews(mPackage, R.layout.remote_views_test); - for (int i = 0; i < 11; i++) { - views = new RemoteViews(views, new RemoteViews(mPackage, R.layout.remote_views_test)); - } - // writeTo/createFromProto fails - exception.expect(IllegalArgumentException.class); - recreateFromProtoNoRethrow(views); - } - - private RemoteViews recreateFromProto(RemoteViews views) { - try { - return recreateFromProtoNoRethrow(views); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - private RemoteViews recreateFromProtoNoRethrow(RemoteViews views) throws Exception { - ProtoOutputStream out = new ProtoOutputStream(); - views.writePreviewToProto(mContext, out); - ProtoInputStream in = new ProtoInputStream(out.getBytes()); - return RemoteViews.createPreviewFromProto(mContext, in); - } -} diff --git a/core/tests/coretests/src/android/window/WindowOnBackInvokedDispatcherTest.java b/core/tests/coretests/src/android/window/WindowOnBackInvokedDispatcherTest.java index d153edd9da39f6d2582093ff0cd44fe8dfb5b5f2..46dfcb5247fb13ca1b4aacae4b9c14ca6b9bf64b 100644 --- a/core/tests/coretests/src/android/window/WindowOnBackInvokedDispatcherTest.java +++ b/core/tests/coretests/src/android/window/WindowOnBackInvokedDispatcherTest.java @@ -44,6 +44,7 @@ import android.view.IWindowSession; import android.view.ImeBackAnimationController; import android.view.MotionEvent; +import androidx.annotation.NonNull; import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.filters.SmallTest; import androidx.test.platform.app.InstrumentationRegistry; @@ -61,6 +62,10 @@ import org.mockito.junit.MockitoRule; import java.util.ArrayList; import java.util.List; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicInteger; /** * Tests for {@link WindowOnBackInvokedDispatcherTest} @@ -117,6 +122,8 @@ public class WindowOnBackInvokedDispatcherTest { mDispatcher = new WindowOnBackInvokedDispatcher(mContext, Looper.getMainLooper()); mDispatcher.attachToWindow(mWindowSession, mWindow, null, mImeBackAnimationController); + clearInvocations(mCallback1); + clearInvocations(mCallback2); } private void waitForIdle() { @@ -472,6 +479,102 @@ public class WindowOnBackInvokedDispatcherTest { verifyImeCallackRegistrations(); } + @Test + public void onBackInvoked_notCalledAfterCallbackUnregistration() + throws RemoteException, InterruptedException { + // Setup a callback that unregisters itself after the gesture is finished but before the + // fling animation has ended + final AtomicBoolean unregisterOnProgressUpdate = new AtomicBoolean(false); + final AtomicInteger onBackInvokedCalled = new AtomicInteger(0); + final CountDownLatch onBackCancelledCalled = new CountDownLatch(1); + OnBackAnimationCallback onBackAnimationCallback = new OnBackAnimationCallback() { + @Override + public void onBackProgressed(@NonNull BackEvent backEvent) { + if (unregisterOnProgressUpdate.get()) { + mDispatcher.unregisterOnBackInvokedCallback(this); + } + } + + @Override + public void onBackInvoked() { + onBackInvokedCalled.getAndIncrement(); + } + + @Override + public void onBackCancelled() { + onBackCancelledCalled.countDown(); + } + }; + mDispatcher.registerOnBackInvokedCallback(PRIORITY_DEFAULT, onBackAnimationCallback); + OnBackInvokedCallbackInfo callbackInfo = assertSetCallbackInfo(); + + callbackInfo.getCallback().onBackStarted(mBackEvent); + waitForIdle(); + assertTrue(mDispatcher.mProgressAnimator.isBackAnimationInProgress()); + + // simulate back gesture finished and onBackInvoked() called, which starts the fling slow + // down animation. By setting unregisterOnProgressUpdate to true, the callback will + // unregister itself as soon as it receives the first progress event (coming from the + // generated fling slow down events) + unregisterOnProgressUpdate.set(true); + callbackInfo.getCallback().onBackInvoked(); + waitForIdle(); + onBackCancelledCalled.await(1000, TimeUnit.MILLISECONDS); + + // verify that onBackCancelled is called in this case instead of onBackInvoked + assertEquals(0, onBackCancelledCalled.getCount()); + assertEquals(0, onBackInvokedCalled.get()); + verify(mWindowSession).setOnBackInvokedCallbackInfo(Mockito.eq(mWindow), isNull()); + assertFalse(mDispatcher.mProgressAnimator.isBackAnimationInProgress()); + } + + @Test + public void onBackCancelled_calledOnceAfterCallbackUnregistration() + throws RemoteException, InterruptedException { + // Setup a callback that unregisters itself after the gesture is finished but before the + // progress is animated back to 0f + final AtomicBoolean unregisterOnProgressUpdate = new AtomicBoolean(false); + final AtomicInteger onBackInvokedCalled = new AtomicInteger(0); + final CountDownLatch onBackCancelledCalled = new CountDownLatch(1); + OnBackAnimationCallback onBackAnimationCallback = new OnBackAnimationCallback() { + @Override + public void onBackProgressed(@NonNull BackEvent backEvent) { + if (unregisterOnProgressUpdate.get()) { + mDispatcher.unregisterOnBackInvokedCallback(this); + } + } + + @Override + public void onBackInvoked() { + onBackInvokedCalled.getAndIncrement(); + } + + @Override + public void onBackCancelled() { + onBackCancelledCalled.countDown(); + } + }; + mDispatcher.registerOnBackInvokedCallback(PRIORITY_DEFAULT, onBackAnimationCallback); + OnBackInvokedCallbackInfo callbackInfo = assertSetCallbackInfo(); + + callbackInfo.getCallback().onBackStarted(mBackEvent); + waitForIdle(); + assertTrue(mDispatcher.mProgressAnimator.isBackAnimationInProgress()); + + // simulate back gesture finished and onBackCancelled() called, which starts the progress + // animation back to 0f. On the first progress emission, the callback will unregister itself + unregisterOnProgressUpdate.set(true); + callbackInfo.getCallback().onBackCancelled(); + waitForIdle(); + onBackCancelledCalled.await(1000, TimeUnit.MILLISECONDS); + + // verify that onBackCancelled is called exactly once in this case + assertEquals(0, onBackCancelledCalled.getCount()); + assertEquals(0, onBackInvokedCalled.get()); + verify(mWindowSession).setOnBackInvokedCallbackInfo(Mockito.eq(mWindow), isNull()); + assertFalse(mDispatcher.mProgressAnimator.isBackAnimationInProgress()); + } + private void verifyImeCallackRegistrations() throws RemoteException { // verify default callback is replaced with ImeBackAnimationController mDispatcher.registerOnBackInvokedCallbackUnchecked(mDefaultImeCallback, PRIORITY_DEFAULT); diff --git a/services/tests/wmtests/src/com/android/server/wm/utils/DesktopModeFlagsUtilTest.java b/core/tests/coretests/src/android/window/flags/DesktopModeFlagsTest.java similarity index 77% rename from services/tests/wmtests/src/com/android/server/wm/utils/DesktopModeFlagsUtilTest.java rename to core/tests/coretests/src/android/window/flags/DesktopModeFlagsTest.java index 46b8e3a430c86ada3ad3634aae4ea283da75a87f..32345e6062294f874233cfdd3e1d27677618f374 100644 --- a/services/tests/wmtests/src/com/android/server/wm/utils/DesktopModeFlagsUtilTest.java +++ b/core/tests/coretests/src/android/window/flags/DesktopModeFlagsTest.java @@ -14,11 +14,10 @@ * limitations under the License. */ -package com.android.server.wm.utils; +package android.window.flags; + +import static android.window.flags.DesktopModeFlags.DESKTOP_WINDOWING_MODE; -import static com.android.server.wm.utils.DesktopModeFlagsUtil.DESKTOP_WINDOWING_MODE; -import static com.android.server.wm.utils.DesktopModeFlagsUtil.ToggleOverride.OVERRIDE_OFF; -import static com.android.server.wm.utils.DesktopModeFlagsUtil.ToggleOverride.OVERRIDE_ON; import static com.android.window.flags.Flags.FLAG_ENABLE_DESKTOP_WINDOWING_MODE; import static com.android.window.flags.Flags.FLAG_ENABLE_WINDOWING_DYNAMIC_INITIAL_BOUNDS; import static com.android.window.flags.Flags.FLAG_SHOW_DESKTOP_WINDOWING_DEV_OPTION; @@ -26,16 +25,16 @@ import static com.android.window.flags.Flags.FLAG_SHOW_DESKTOP_WINDOWING_DEV_OPT import static com.google.common.truth.Truth.assertThat; import android.content.ContentResolver; +import android.content.Context; import android.platform.test.annotations.DisableFlags; import android.platform.test.annotations.EnableFlags; import android.platform.test.annotations.Presubmit; import android.platform.test.flag.junit.SetFlagsRule; import android.provider.Settings; +import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.filters.SmallTest; - -import com.android.server.wm.WindowTestRunner; -import com.android.server.wm.WindowTestsBase; +import androidx.test.platform.app.InstrumentationRegistry; import org.junit.Before; import org.junit.Rule; @@ -45,21 +44,28 @@ import org.junit.runner.RunWith; import java.lang.reflect.Field; /** - * Test class for [DesktopModeFlagsUtil] + * Test class for {@link DesktopModeFlags} * * Build/Install/Run: - * atest WmTests:DesktopModeFlagsUtilTest + * atest FrameworksCoreTests:DesktopModeFlagsTest */ @SmallTest @Presubmit -@RunWith(WindowTestRunner.class) -public class DesktopModeFlagsUtilTest extends WindowTestsBase { +@RunWith(AndroidJUnit4.class) +public class DesktopModeFlagsTest { @Rule public SetFlagsRule setFlagsRule = new SetFlagsRule(); + private Context mContext; + + private static final int OVERRIDE_OFF_SETTING = 0; + private static final int OVERRIDE_ON_SETTING = 1; + private static final int OVERRIDE_UNSET_SETTING = -1; + @Before public void setUp() throws Exception { + mContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); resetCache(); } @@ -67,7 +73,7 @@ public class DesktopModeFlagsUtilTest extends WindowTestsBase { @DisableFlags(FLAG_SHOW_DESKTOP_WINDOWING_DEV_OPTION) @EnableFlags(FLAG_ENABLE_DESKTOP_WINDOWING_MODE) public void isEnabled_devOptionFlagDisabled_overrideOff_featureFlagOn_returnsTrue() { - setOverride(OVERRIDE_OFF.getSetting()); + setOverride(OVERRIDE_OFF_SETTING); // In absence of dev options, follow flag assertThat(DESKTOP_WINDOWING_MODE.isEnabled(mContext)).isTrue(); } @@ -76,7 +82,7 @@ public class DesktopModeFlagsUtilTest extends WindowTestsBase { @Test @DisableFlags({FLAG_SHOW_DESKTOP_WINDOWING_DEV_OPTION, FLAG_ENABLE_DESKTOP_WINDOWING_MODE}) public void isEnabled_devOptionFlagDisabled_overrideOn_featureFlagOff_returnsFalse() { - setOverride(OVERRIDE_ON.getSetting()); + setOverride(OVERRIDE_ON_SETTING); assertThat(DESKTOP_WINDOWING_MODE.isEnabled(mContext)).isFalse(); } @@ -84,7 +90,7 @@ public class DesktopModeFlagsUtilTest extends WindowTestsBase { @Test @EnableFlags({FLAG_SHOW_DESKTOP_WINDOWING_DEV_OPTION, FLAG_ENABLE_DESKTOP_WINDOWING_MODE}) public void isEnabled_overrideUnset_featureFlagOn_returnsTrue() { - setOverride(DesktopModeFlagsUtil.ToggleOverride.OVERRIDE_UNSET.getSetting()); + setOverride(OVERRIDE_UNSET_SETTING); // For overridableFlag, for unset overrides, follow flag assertThat(DESKTOP_WINDOWING_MODE.isEnabled(mContext)).isTrue(); @@ -94,7 +100,7 @@ public class DesktopModeFlagsUtilTest extends WindowTestsBase { @EnableFlags(FLAG_SHOW_DESKTOP_WINDOWING_DEV_OPTION) @DisableFlags(FLAG_ENABLE_DESKTOP_WINDOWING_MODE) public void isEnabled_overrideUnset_featureFlagOff_returnsFalse() { - setOverride(DesktopModeFlagsUtil.ToggleOverride.OVERRIDE_UNSET.getSetting()); + setOverride(OVERRIDE_UNSET_SETTING); // For overridableFlag, for unset overrides, follow flag assertThat(DESKTOP_WINDOWING_MODE.isEnabled(mContext)).isFalse(); @@ -141,7 +147,7 @@ public class DesktopModeFlagsUtilTest extends WindowTestsBase { @Test @EnableFlags({FLAG_SHOW_DESKTOP_WINDOWING_DEV_OPTION, FLAG_ENABLE_DESKTOP_WINDOWING_MODE}) public void isEnabled_overrideOff_featureFlagOn_returnsFalse() { - setOverride(OVERRIDE_OFF.getSetting()); + setOverride(OVERRIDE_OFF_SETTING); // For overridableFlag, follow override if they exist assertThat(DESKTOP_WINDOWING_MODE.isEnabled(mContext)).isFalse(); @@ -151,7 +157,7 @@ public class DesktopModeFlagsUtilTest extends WindowTestsBase { @EnableFlags(FLAG_SHOW_DESKTOP_WINDOWING_DEV_OPTION) @DisableFlags(FLAG_ENABLE_DESKTOP_WINDOWING_MODE) public void isEnabled_overrideOn_featureFlagOff_returnsTrue() { - setOverride(OVERRIDE_ON.getSetting()); + setOverride(OVERRIDE_ON_SETTING); // For overridableFlag, follow override if they exist assertThat(DESKTOP_WINDOWING_MODE.isEnabled(mContext)).isTrue(); @@ -160,12 +166,12 @@ public class DesktopModeFlagsUtilTest extends WindowTestsBase { @Test @EnableFlags({FLAG_SHOW_DESKTOP_WINDOWING_DEV_OPTION, FLAG_ENABLE_DESKTOP_WINDOWING_MODE}) public void isEnabled_overrideOffThenOn_featureFlagOn_returnsFalseAndFalse() { - setOverride(OVERRIDE_OFF.getSetting()); + setOverride(OVERRIDE_OFF_SETTING); // For overridableFlag, follow override if they exist assertThat(DESKTOP_WINDOWING_MODE.isEnabled(mContext)).isFalse(); - setOverride(OVERRIDE_ON.getSetting()); + setOverride(OVERRIDE_ON_SETTING); // Keep overrides constant through the process assertThat(DESKTOP_WINDOWING_MODE.isEnabled(mContext)).isFalse(); @@ -175,12 +181,12 @@ public class DesktopModeFlagsUtilTest extends WindowTestsBase { @EnableFlags(FLAG_SHOW_DESKTOP_WINDOWING_DEV_OPTION) @DisableFlags(FLAG_ENABLE_DESKTOP_WINDOWING_MODE) public void isEnabled_overrideOnThenOff_featureFlagOff_returnsTrueAndTrue() { - setOverride(OVERRIDE_ON.getSetting()); + setOverride(OVERRIDE_ON_SETTING); // For overridableFlag, follow override if they exist assertThat(DESKTOP_WINDOWING_MODE.isEnabled(mContext)).isTrue(); - setOverride(OVERRIDE_OFF.getSetting()); + setOverride(OVERRIDE_OFF_SETTING); // Keep overrides constant through the process assertThat(DESKTOP_WINDOWING_MODE.isEnabled(mContext)).isTrue(); @@ -190,19 +196,19 @@ public class DesktopModeFlagsUtilTest extends WindowTestsBase { @EnableFlags({FLAG_SHOW_DESKTOP_WINDOWING_DEV_OPTION, FLAG_ENABLE_DESKTOP_WINDOWING_MODE, FLAG_ENABLE_WINDOWING_DYNAMIC_INITIAL_BOUNDS}) public void isEnabled_dwFlagOn_overrideUnset_featureFlagOn_returnsTrue() { - setOverride(DesktopModeFlagsUtil.ToggleOverride.OVERRIDE_UNSET.getSetting()); + setOverride(OVERRIDE_UNSET_SETTING); // For unset overrides, follow flag - assertThat(DesktopModeFlagsUtil.DYNAMIC_INITIAL_BOUNDS.isEnabled(mContext)).isTrue(); + assertThat(DesktopModeFlags.DYNAMIC_INITIAL_BOUNDS.isEnabled(mContext)).isTrue(); } @Test @EnableFlags({FLAG_SHOW_DESKTOP_WINDOWING_DEV_OPTION, FLAG_ENABLE_DESKTOP_WINDOWING_MODE}) @DisableFlags(FLAG_ENABLE_WINDOWING_DYNAMIC_INITIAL_BOUNDS) public void isEnabled_dwFlagOn_overrideUnset_featureFlagOff_returnsFalse() { - setOverride(DesktopModeFlagsUtil.ToggleOverride.OVERRIDE_UNSET.getSetting()); + setOverride(OVERRIDE_UNSET_SETTING); // For unset overrides, follow flag - assertThat(DesktopModeFlagsUtil.DYNAMIC_INITIAL_BOUNDS.isEnabled(mContext)).isFalse(); + assertThat(DesktopModeFlags.DYNAMIC_INITIAL_BOUNDS.isEnabled(mContext)).isFalse(); } @Test @@ -212,20 +218,20 @@ public class DesktopModeFlagsUtilTest extends WindowTestsBase { FLAG_ENABLE_WINDOWING_DYNAMIC_INITIAL_BOUNDS }) public void isEnabled_dwFlagOn_overrideOn_featureFlagOn_returnsTrue() { - setOverride(OVERRIDE_ON.getSetting()); + setOverride(OVERRIDE_ON_SETTING); // When toggle override matches its default state (dw flag), don't override flags - assertThat(DesktopModeFlagsUtil.DYNAMIC_INITIAL_BOUNDS.isEnabled(mContext)).isTrue(); + assertThat(DesktopModeFlags.DYNAMIC_INITIAL_BOUNDS.isEnabled(mContext)).isTrue(); } @Test @EnableFlags({FLAG_SHOW_DESKTOP_WINDOWING_DEV_OPTION, FLAG_ENABLE_DESKTOP_WINDOWING_MODE}) @DisableFlags(FLAG_ENABLE_WINDOWING_DYNAMIC_INITIAL_BOUNDS) public void isEnabled_dwFlagOn_overrideOn_featureFlagOff_returnsFalse() { - setOverride(OVERRIDE_ON.getSetting()); + setOverride(OVERRIDE_ON_SETTING); // When toggle override matches its default state (dw flag), don't override flags - assertThat(DesktopModeFlagsUtil.DYNAMIC_INITIAL_BOUNDS.isEnabled(mContext)).isFalse(); + assertThat(DesktopModeFlags.DYNAMIC_INITIAL_BOUNDS.isEnabled(mContext)).isFalse(); } @Test @@ -235,20 +241,20 @@ public class DesktopModeFlagsUtilTest extends WindowTestsBase { FLAG_ENABLE_WINDOWING_DYNAMIC_INITIAL_BOUNDS }) public void isEnabled_dwFlagOn_overrideOff_featureFlagOn_returnsTrue() { - setOverride(OVERRIDE_OFF.getSetting()); + setOverride(OVERRIDE_OFF_SETTING); // Follow override if they exist, and is not equal to default toggle state (dw flag) - assertThat(DesktopModeFlagsUtil.DYNAMIC_INITIAL_BOUNDS.isEnabled(mContext)).isTrue(); + assertThat(DesktopModeFlags.DYNAMIC_INITIAL_BOUNDS.isEnabled(mContext)).isTrue(); } @Test @EnableFlags({FLAG_SHOW_DESKTOP_WINDOWING_DEV_OPTION, FLAG_ENABLE_DESKTOP_WINDOWING_MODE}) @DisableFlags(FLAG_ENABLE_WINDOWING_DYNAMIC_INITIAL_BOUNDS) public void isEnabled_dwFlagOn_overrideOff_featureFlagOff_returnsFalse() { - setOverride(OVERRIDE_OFF.getSetting()); + setOverride(OVERRIDE_OFF_SETTING); // Follow override if they exist, and is not equal to default toggle state (dw flag) - assertThat(DesktopModeFlagsUtil.DYNAMIC_INITIAL_BOUNDS.isEnabled(mContext)).isFalse(); + assertThat(DesktopModeFlags.DYNAMIC_INITIAL_BOUNDS.isEnabled(mContext)).isFalse(); } @Test @@ -258,10 +264,10 @@ public class DesktopModeFlagsUtilTest extends WindowTestsBase { }) @DisableFlags(FLAG_ENABLE_DESKTOP_WINDOWING_MODE) public void isEnabled_dwFlagOff_overrideUnset_featureFlagOn_returnsTrue() { - setOverride(DesktopModeFlagsUtil.ToggleOverride.OVERRIDE_UNSET.getSetting()); + setOverride(OVERRIDE_UNSET_SETTING); // For unset overrides, follow flag - assertThat(DesktopModeFlagsUtil.DYNAMIC_INITIAL_BOUNDS.isEnabled(mContext)).isTrue(); + assertThat(DesktopModeFlags.DYNAMIC_INITIAL_BOUNDS.isEnabled(mContext)).isTrue(); } @Test @@ -271,10 +277,10 @@ public class DesktopModeFlagsUtilTest extends WindowTestsBase { FLAG_ENABLE_WINDOWING_DYNAMIC_INITIAL_BOUNDS }) public void isEnabled_dwFlagOff_overrideUnset_featureFlagOff_returnsFalse() { - setOverride(DesktopModeFlagsUtil.ToggleOverride.OVERRIDE_UNSET.getSetting()); + setOverride(OVERRIDE_UNSET_SETTING); // For unset overrides, follow flag - assertThat(DesktopModeFlagsUtil.DYNAMIC_INITIAL_BOUNDS.isEnabled(mContext)).isFalse(); + assertThat(DesktopModeFlags.DYNAMIC_INITIAL_BOUNDS.isEnabled(mContext)).isFalse(); } @Test @@ -284,10 +290,10 @@ public class DesktopModeFlagsUtilTest extends WindowTestsBase { }) @DisableFlags(FLAG_ENABLE_DESKTOP_WINDOWING_MODE) public void isEnabled_dwFlagOff_overrideOn_featureFlagOn_returnsTrue() { - setOverride(OVERRIDE_ON.getSetting()); + setOverride(OVERRIDE_ON_SETTING); // Follow override if they exist, and is not equal to default toggle state (dw flag) - assertThat(DesktopModeFlagsUtil.DYNAMIC_INITIAL_BOUNDS.isEnabled(mContext)).isTrue(); + assertThat(DesktopModeFlags.DYNAMIC_INITIAL_BOUNDS.isEnabled(mContext)).isTrue(); } @Test @@ -297,10 +303,10 @@ public class DesktopModeFlagsUtilTest extends WindowTestsBase { FLAG_ENABLE_WINDOWING_DYNAMIC_INITIAL_BOUNDS }) public void isEnabled_dwFlagOff_overrideOn_featureFlagOff_returnFalse() { - setOverride(OVERRIDE_ON.getSetting()); + setOverride(OVERRIDE_ON_SETTING); // Follow override if they exist, and is not equal to default toggle state (dw flag) - assertThat(DesktopModeFlagsUtil.DYNAMIC_INITIAL_BOUNDS.isEnabled(mContext)).isFalse(); + assertThat(DesktopModeFlags.DYNAMIC_INITIAL_BOUNDS.isEnabled(mContext)).isFalse(); } @Test @@ -310,10 +316,10 @@ public class DesktopModeFlagsUtilTest extends WindowTestsBase { }) @DisableFlags(FLAG_ENABLE_DESKTOP_WINDOWING_MODE) public void isEnabled_dwFlagOff_overrideOff_featureFlagOn_returnsTrue() { - setOverride(OVERRIDE_OFF.getSetting()); + setOverride(OVERRIDE_OFF_SETTING); // When toggle override matches its default state (dw flag), don't override flags - assertThat(DesktopModeFlagsUtil.DYNAMIC_INITIAL_BOUNDS.isEnabled(mContext)).isTrue(); + assertThat(DesktopModeFlags.DYNAMIC_INITIAL_BOUNDS.isEnabled(mContext)).isTrue(); } @Test @@ -323,10 +329,10 @@ public class DesktopModeFlagsUtilTest extends WindowTestsBase { FLAG_ENABLE_WINDOWING_DYNAMIC_INITIAL_BOUNDS }) public void isEnabled_dwFlagOff_overrideOff_featureFlagOff_returnsFalse() { - setOverride(OVERRIDE_OFF.getSetting()); + setOverride(OVERRIDE_OFF_SETTING); // When toggle override matches its default state (dw flag), don't override flags - assertThat(DesktopModeFlagsUtil.DYNAMIC_INITIAL_BOUNDS.isEnabled(mContext)).isFalse(); + assertThat(DesktopModeFlags.DYNAMIC_INITIAL_BOUNDS.isEnabled(mContext)).isFalse(); } private void setOverride(Integer setting) { @@ -341,7 +347,7 @@ public class DesktopModeFlagsUtilTest extends WindowTestsBase { } private void resetCache() throws Exception { - Field cachedToggleOverride = DesktopModeFlagsUtil.class.getDeclaredField( + Field cachedToggleOverride = DesktopModeFlags.class.getDeclaredField( "sCachedToggleOverride"); cachedToggleOverride.setAccessible(true); cachedToggleOverride.set(null, null); diff --git a/core/tests/coretests/src/com/android/internal/widget/ViewGroupFaderTest.java b/core/tests/coretests/src/com/android/internal/widget/ViewGroupFaderTest.java new file mode 100644 index 0000000000000000000000000000000000000000..eeabc2f4e0edb4f4747d90e715e2a667af9f5364 --- /dev/null +++ b/core/tests/coretests/src/com/android/internal/widget/ViewGroupFaderTest.java @@ -0,0 +1,107 @@ +/* + * 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.internal.widget; + +import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation; + +import android.content.Context; +import android.content.res.Resources; +import android.platform.test.annotations.EnableFlags; +import android.platform.test.flag.junit.SetFlagsRule; +import android.test.AndroidTestCase; +import android.view.View; +import android.view.ViewGroup; +import android.widget.flags.Flags; + +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; + +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +/** + * Tests for {@link ViewGroupFader}. + */ +public class ViewGroupFaderTest extends AndroidTestCase { + + private Context mContext; + private ViewGroupFader mViewGroupFader; + private Resources mResources; + + @Mock + private ViewGroup mViewGroup,mViewGroup1; + + @Mock + private ViewGroupFader mockViewGroupFader; + + @Mock + private ViewGroupFader.AnimationCallback mAnimationCallback; + + @Mock + private ViewGroupFader.ChildViewBoundsProvider mChildViewBoundsProvider; + + @Rule public final SetFlagsRule mSetFlagsRule = new SetFlagsRule(); + + @Before + public void setUp() throws Exception { + MockitoAnnotations.initMocks(this); + final Context mContext = getInstrumentation().getContext(); + mResources = spy(mContext.getResources()); + when(mResources.getBoolean(com.android.internal.R.bool.config_enableViewGroupScalingFading)) + .thenReturn(true); + when(mViewGroup.getResources()).thenReturn(mResources); + + mViewGroupFader = new ViewGroupFader( + mViewGroup, + mAnimationCallback, + mChildViewBoundsProvider); + } + + /** This test checks that for each child of the parent viewgroup, + * updateListElementFades is called for each of its child, when the Flag is set to true + */ + @Test + @EnableFlags(Flags.FLAG_ENABLE_FADING_VIEW_GROUP) + public void testFadingAndScrollingAnimationWorking_FlagOn() { + mViewGroup.addView(mViewGroup1); + mViewGroupFader.updateFade(); + + for (int i = 0; i < mViewGroup.getChildCount(); i++) { + View child = mViewGroup.getChildAt(i); + verify(mockViewGroupFader).updateListElementFades((ViewGroup)child,true); + } + } + + /** This test checks that for each child of the parent viewgroup, + * updateListElementFades is never called for each of its child, when the Flag is set to false + */ + @Test + public void testFadingAndScrollingAnimationNotWorking_FlagOff() { + mViewGroup.addView(mViewGroup1); + mViewGroupFader.updateFade(); + + for (int i = 0; i < mViewGroup.getChildCount(); i++) { + View child = mViewGroup.getChildAt(i); + verify(mockViewGroupFader,never()).updateListElementFades((ViewGroup)child,true); + } + } +} \ No newline at end of file diff --git a/core/tests/devicestatetests/Android.bp b/core/tests/devicestatetests/Android.bp index 60848b31eaec90060839ce35274a452dc10a71c6..a3303c6ca6d7cf45510a2acaee3affcec5e1b157 100644 --- a/core/tests/devicestatetests/Android.bp +++ b/core/tests/devicestatetests/Android.bp @@ -32,7 +32,7 @@ android_test { "platform-test-annotations", "testng", ], - libs: ["android.test.runner"], + libs: ["android.test.runner.stubs.system"], platform_apis: true, certificate: "platform", } diff --git a/core/tests/featureflagtests/Android.bp b/core/tests/featureflagtests/Android.bp index d9f608ea34c4df7f0b9f8939e9e12205867242d6..c08066720477f89dfdda717b4f2130be800b4b78 100644 --- a/core/tests/featureflagtests/Android.bp +++ b/core/tests/featureflagtests/Android.bp @@ -19,8 +19,8 @@ android_test { "androidx.test.rules", ], libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", ], platform_apis: true, certificate: "platform", diff --git a/core/tests/hdmitests/Android.bp b/core/tests/hdmitests/Android.bp index e11bc552cf1508a5754330e344ab2ac883d9f011..7a5757cc7a85d95d2b237106001b5e41df59ecf5 100644 --- a/core/tests/hdmitests/Android.bp +++ b/core/tests/hdmitests/Android.bp @@ -32,7 +32,7 @@ android_test { "platform-test-annotations", "truth", ], - libs: ["android.test.runner"], + libs: ["android.test.runner.stubs.system"], platform_apis: true, certificate: "platform", test_suites: ["device-tests"], diff --git a/core/tests/hosttests/test-apps/DownloadManagerTestApp/Android.bp b/core/tests/hosttests/test-apps/DownloadManagerTestApp/Android.bp index d439124c72cb7ec29819bba624c699d76b62acdc..c9fdec0e61fd675bdfd53c4bce5b14980514fef9 100644 --- a/core/tests/hosttests/test-apps/DownloadManagerTestApp/Android.bp +++ b/core/tests/hosttests/test-apps/DownloadManagerTestApp/Android.bp @@ -27,8 +27,8 @@ android_test { "junit", ], libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", ], platform_apis: true, diff --git a/core/tests/mockingcoretests/Android.bp b/core/tests/mockingcoretests/Android.bp index 7fd813a7421a3a1bbbed89c18c7eb00a8ba44f09..8657b8ca52e18554e2771298fa48f6eb680dfe40 100644 --- a/core/tests/mockingcoretests/Android.bp +++ b/core/tests/mockingcoretests/Android.bp @@ -44,9 +44,9 @@ android_test { ], libs: [ - "android.test.base", - "android.test.mock", - "android.test.runner", + "android.test.base.stubs.system", + "android.test.mock.stubs.system", + "android.test.runner.stubs.system", ], // These are not normally accessible from apps so they must be explicitly included. diff --git a/core/tests/overlaytests/handle_config_change/test-apps/OverlayResApp/Android.bp b/core/tests/overlaytests/handle_config_change/test-apps/OverlayResApp/Android.bp index e0f101229080338bcc4799df30782b2ebc9abf60..74c7b4ca4206fe0d7bca38ce10263c17f9c256cd 100644 --- a/core/tests/overlaytests/handle_config_change/test-apps/OverlayResApp/Android.bp +++ b/core/tests/overlaytests/handle_config_change/test-apps/OverlayResApp/Android.bp @@ -32,8 +32,8 @@ android_test_helper_app { "truth", ], libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", ], test_suites: [ "device-tests", diff --git a/core/tests/packagemanagertests/Android.bp b/core/tests/packagemanagertests/Android.bp index 5ce71c902c7cfae83af515c01aef2ccbf3e55081..8ff4998268662a74c175857c9380eb27f8de3db8 100644 --- a/core/tests/packagemanagertests/Android.bp +++ b/core/tests/packagemanagertests/Android.bp @@ -17,7 +17,7 @@ android_test { "frameworks-base-testutils", "mockito-target-minus-junit4", ], - libs: ["android.test.runner"], + libs: ["android.test.runner.stubs.system"], platform_apis: true, certificate: "platform", } diff --git a/core/tests/packagemonitortests/Android.bp b/core/tests/packagemonitortests/Android.bp index b08850e90d28fa9d899fc1fe3f6c5c8808d2f0fa..c3b084e4368e18d65e4c0694b13b08c01c86c8d9 100644 --- a/core/tests/packagemonitortests/Android.bp +++ b/core/tests/packagemonitortests/Android.bp @@ -34,7 +34,7 @@ android_test { "mockito-target-minus-junit4", "truth", ], - libs: ["android.test.runner"], + libs: ["android.test.runner.stubs.system"], platform_apis: true, certificate: "platform", test_suites: ["device-tests"], @@ -52,7 +52,7 @@ android_test { "compatibility-device-util-axt", "frameworks-base-testutils", ], - libs: ["android.test.runner"], + libs: ["android.test.runner.stubs.system"], platform_apis: true, certificate: "platform", test_suites: ["device-tests"], diff --git a/core/tests/privacytests/Android.bp b/core/tests/privacytests/Android.bp index 4e24cd5d91cb6acf00d774cb49a1687184f0dc26..ac9cede84483b420451b6454a3506dba923daca6 100644 --- a/core/tests/privacytests/Android.bp +++ b/core/tests/privacytests/Android.bp @@ -16,7 +16,7 @@ android_test { "androidx.test.rules", "truth", ], - libs: ["android.test.runner"], + libs: ["android.test.runner.stubs.system"], platform_apis: true, certificate: "platform", test_suites: ["device-tests"], diff --git a/core/tests/screenshothelpertests/Android.bp b/core/tests/screenshothelpertests/Android.bp index 3c71e6e4247b733236a8d1eacdb0887a1cace15d..49c3ee94bfd013156b9c356a859e52b291714e05 100644 --- a/core/tests/screenshothelpertests/Android.bp +++ b/core/tests/screenshothelpertests/Android.bp @@ -25,9 +25,9 @@ android_test { ], libs: [ - "android.test.runner", - "android.test.base", - "android.test.mock", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", + "android.test.mock.stubs.system", ], platform_apis: true, diff --git a/core/tests/systemproperties/Android.bp b/core/tests/systemproperties/Android.bp index ed52cccfb9b9434dbb27c2fff78a1a236d134d9b..ed99a1f5cc4a92ed3f1f386bc8d371b22a3352c4 100644 --- a/core/tests/systemproperties/Android.bp +++ b/core/tests/systemproperties/Android.bp @@ -20,8 +20,8 @@ android_test { "ravenwood-junit", ], libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", ], platform_apis: true, certificate: "platform", @@ -37,8 +37,8 @@ android_ravenwood_test { "ravenwood-junit", ], libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", ], srcs: [ "src/**/*.java", diff --git a/core/tests/timetests/Android.bp b/core/tests/timetests/Android.bp index c33d5ee5008bb0bcf34ae2825d8833c93aaa26ba..04bbe692e48834361e4a80347e8a131430fe4eb9 100644 --- a/core/tests/timetests/Android.bp +++ b/core/tests/timetests/Android.bp @@ -19,7 +19,7 @@ android_test { "platform-test-annotations", "truth", ], - libs: ["android.test.runner"], + libs: ["android.test.runner.stubs.system"], certificate: "platform", test_suites: ["device-tests"], } diff --git a/core/tests/utillib/Android.bp b/core/tests/utillib/Android.bp index 1d5c16c7a536bd3973a19b888840fa19190e253d..b6f046bd12d5e0a7bdc57d848d1c72f30e201a66 100644 --- a/core/tests/utillib/Android.bp +++ b/core/tests/utillib/Android.bp @@ -28,5 +28,5 @@ java_library { srcs: ["**/*.java"], static_libs: ["junit"], - libs: ["android.test.base"], + libs: ["android.test.base.stubs"], } diff --git a/core/tests/utiltests/Android.bp b/core/tests/utiltests/Android.bp index f5563a710563477bc1c25e4ae4d807c9ffca5be5..cdc8a9e06d0be6b05f6ce400f94cc5043f0c8d94 100644 --- a/core/tests/utiltests/Android.bp +++ b/core/tests/utiltests/Android.bp @@ -39,9 +39,9 @@ android_test { ], libs: [ - "android.test.runner", - "android.test.base", - "android.test.mock", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", + "android.test.mock.stubs.system", ], platform_apis: true, @@ -55,7 +55,7 @@ android_test { android_ravenwood_test { name: "FrameworksUtilTestsRavenwood", libs: [ - "android.test.mock", + "android.test.mock.stubs.system", ], static_libs: [ "androidx.annotation_annotation", diff --git a/core/tests/vibrator/Android.bp b/core/tests/vibrator/Android.bp index 920ab59145480080f36dbca848fe33c2cfec99d4..848e079a227049293052b5586c6cc8a64f661b84 100644 --- a/core/tests/vibrator/Android.bp +++ b/core/tests/vibrator/Android.bp @@ -25,9 +25,9 @@ android_test { ], libs: [ - "android.test.runner", - "android.test.base", - "android.test.mock", + "android.test.runner.stubs", + "android.test.base.stubs", + "android.test.mock.stubs", "framework", "framework-res", ], diff --git a/core/tests/vibrator/src/android/os/VibratorInfoTest.java b/core/tests/vibrator/src/android/os/VibratorInfoTest.java index 73cd4647415db8bd7be4cac7f8b7c5fc4747407a..c8108107585965a75d439d7466fc74bc3c9c2da8 100644 --- a/core/tests/vibrator/src/android/os/VibratorInfoTest.java +++ b/core/tests/vibrator/src/android/os/VibratorInfoTest.java @@ -138,6 +138,35 @@ public class VibratorInfoTest { assertEquals(0, emptyInfo.getPwleSizeMax()); } + @Test + public void testAreEnvelopeEffectsSupported() { + VibratorInfo noCapabilities = new VibratorInfo.Builder(TEST_VIBRATOR_ID).build(); + assertFalse(noCapabilities.areEnvelopeEffectsSupported()); + VibratorInfo envelopeEffectCapability = new VibratorInfo.Builder(TEST_VIBRATOR_ID) + .setCapabilities(IVibrator.CAP_COMPOSE_PWLE_EFFECTS_V2) + .build(); + assertTrue(envelopeEffectCapability.areEnvelopeEffectsSupported()); + } + + @Test + public void testEnvelopeEffectLimits() { + VibratorInfo info = new VibratorInfo.Builder(TEST_VIBRATOR_ID) + .setMaxEnvelopeEffectSize(16) + .setMinEnvelopeEffectControlPointDurationMillis(20) + .setMaxEnvelopeEffectControlPointDurationMillis(1_000) + .build(); + assertEquals(16, info.getMaxEnvelopeEffectSize()); + assertEquals(20, info.getMinEnvelopeEffectControlPointDurationMillis()); + assertEquals(1_000, info.getMaxEnvelopeEffectControlPointDurationMillis()); + assertEquals(16_000, info.getMaxEnvelopeEffectDurationMillis()); + + VibratorInfo emptyInfo = new VibratorInfo.Builder(TEST_VIBRATOR_ID).build(); + assertEquals(0, emptyInfo.getMaxEnvelopeEffectSize()); + assertEquals(0, emptyInfo.getMinEnvelopeEffectControlPointDurationMillis()); + assertEquals(0, emptyInfo.getMaxEnvelopeEffectControlPointDurationMillis()); + assertEquals(0, emptyInfo.getMaxEnvelopeEffectDurationMillis()); + } + @Test public void testGetDefaultBraking_returnsFirstSupportedBraking() { assertEquals(Braking.NONE, new VibratorInfo.Builder( @@ -262,17 +291,20 @@ public class VibratorInfoTest { VibratorInfo.Builder completeBuilder2 = new VibratorInfo.Builder(TEST_VIBRATOR_ID + 2); for (VibratorInfo.Builder builder : - new VibratorInfo.Builder[] {completeBuilder, completeBuilder2}) { + new VibratorInfo.Builder[]{completeBuilder, completeBuilder2}) { builder.setCapabilities(IVibrator.CAP_AMPLITUDE_CONTROL) - .setSupportedEffects(VibrationEffect.EFFECT_CLICK) - .setSupportedPrimitive(VibrationEffect.Composition.PRIMITIVE_CLICK, 20) - .setPrimitiveDelayMax(100) - .setCompositionSizeMax(10) - .setSupportedBraking(Braking.CLAB) - .setPwlePrimitiveDurationMax(50) - .setPwleSizeMax(20) - .setQFactor(2f) - .setFrequencyProfile(TEST_FREQUENCY_PROFILE); + .setSupportedEffects(VibrationEffect.EFFECT_CLICK) + .setSupportedPrimitive(VibrationEffect.Composition.PRIMITIVE_CLICK, 20) + .setPrimitiveDelayMax(100) + .setCompositionSizeMax(10) + .setSupportedBraking(Braking.CLAB) + .setPwlePrimitiveDurationMax(50) + .setPwleSizeMax(20) + .setQFactor(2f) + .setFrequencyProfile(TEST_FREQUENCY_PROFILE) + .setMaxEnvelopeEffectSize(16) + .setMinEnvelopeEffectControlPointDurationMillis(20) + .setMaxEnvelopeEffectControlPointDurationMillis(1_000); } VibratorInfo complete = completeBuilder.build(); diff --git a/graphics/java/android/graphics/OWNERS b/graphics/java/android/graphics/OWNERS index 9fa8f1b284bb5d4d649070afc7c9e94fad97c9d1..ef8d26cc65b9b1de2c5369d1c16284b941502c35 100644 --- a/graphics/java/android/graphics/OWNERS +++ b/graphics/java/android/graphics/OWNERS @@ -11,3 +11,4 @@ per-file BLASTBufferQueue.java = file:/services/core/java/com/android/server/wm/ per-file FontFamily.java = file:fonts/OWNERS per-file FontListParser.java = file:fonts/OWNERS per-file Typeface.java = file:fonts/OWNERS +per-file Paint.java = file:fonts/OWNERS diff --git a/graphics/java/android/graphics/Paint.java b/graphics/java/android/graphics/Paint.java index df95a91d72d7d5fcf0c3e17202517a761a30aa3d..b866382e40613c978deb771e7739e332fcb858ca 100644 --- a/graphics/java/android/graphics/Paint.java +++ b/graphics/java/android/graphics/Paint.java @@ -1805,16 +1805,7 @@ public class Paint { * @return true if elegant metrics are enabled for text drawing. */ public boolean isElegantTextHeight() { - int rawValue = nGetElegantTextHeight(mNativePaint); - switch (rawValue) { - case ELEGANT_TEXT_HEIGHT_DISABLED: - return false; - case ELEGANT_TEXT_HEIGHT_ENABLED: - return true; - case ELEGANT_TEXT_HEIGHT_UNSET: - default: - return com.android.text.flags.Flags.deprecateUiFonts(); - } + return nGetElegantTextHeight(mNativePaint) != ELEGANT_TEXT_HEIGHT_DISABLED; } // Note: the following three values must be equal to the ones in the JNI file: Paint.cpp diff --git a/graphics/java/android/graphics/fonts/SystemFonts.java b/graphics/java/android/graphics/fonts/SystemFonts.java index f727f5b076a13d245783bd023af5458523dd45c7..0e25c346064c51eca9603d0d884c6ca326e7b6fd 100644 --- a/graphics/java/android/graphics/fonts/SystemFonts.java +++ b/graphics/java/android/graphics/fonts/SystemFonts.java @@ -306,13 +306,7 @@ public final class SystemFonts { long lastModifiedDate, int configVersion ) { - final String fontsXml; - if (com.android.text.flags.Flags.newFontsFallbackXml()) { - fontsXml = FONTS_XML; - } else { - fontsXml = LEGACY_FONTS_XML; - } - return getSystemFontConfigInternal(fontsXml, SYSTEM_FONT_DIR, OEM_XML, OEM_FONT_DIR, + return getSystemFontConfigInternal(FONTS_XML, SYSTEM_FONT_DIR, OEM_XML, OEM_FONT_DIR, updatableFontMap, lastModifiedDate, configVersion); } @@ -337,13 +331,7 @@ public final class SystemFonts { * @hide */ public static @NonNull FontConfig getSystemPreinstalledFontConfig() { - final String fontsXml; - if (com.android.text.flags.Flags.newFontsFallbackXml()) { - fontsXml = FONTS_XML; - } else { - fontsXml = LEGACY_FONTS_XML; - } - return getSystemFontConfigInternal(fontsXml, SYSTEM_FONT_DIR, OEM_XML, OEM_FONT_DIR, null, + return getSystemFontConfigInternal(FONTS_XML, SYSTEM_FONT_DIR, OEM_XML, OEM_FONT_DIR, null, 0, 0); } diff --git a/keystore/tests/Android.bp b/keystore/tests/Android.bp index 7de45233494bf0735533719147be15a4645f0f54..0dcf597644ee0a8f968268ae77fee1a6988a9c6a 100644 --- a/keystore/tests/Android.bp +++ b/keystore/tests/Android.bp @@ -31,6 +31,6 @@ android_test { "mockito-target-minus-junit4", ], platform_apis: true, - libs: ["android.test.runner"], + libs: ["android.test.runner.stubs.system"], certificate: "platform", } diff --git a/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/BackupHelper.java b/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/BackupHelper.java index 4ce294213526f7d383d64657d4963c95a5c803f5..bfccb29bc95253c961dd3c7a322eee8881ba4b00 100644 --- a/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/BackupHelper.java +++ b/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/BackupHelper.java @@ -16,16 +16,26 @@ package androidx.window.extensions.embedding; +import static android.window.TaskFragmentOrganizer.KEY_RESTORE_TASK_FRAGMENTS_INFO; +import static android.window.TaskFragmentOrganizer.KEY_RESTORE_TASK_FRAGMENT_PARENT_INFO; + import android.os.Build; import android.os.Bundle; +import android.os.IBinder; import android.os.Looper; import android.os.MessageQueue; +import android.util.ArrayMap; import android.util.Log; +import android.util.SparseArray; +import android.window.TaskFragmentInfo; +import android.window.TaskFragmentParentInfo; +import android.window.WindowContainerTransaction; import androidx.annotation.NonNull; import java.util.ArrayList; import java.util.List; +import java.util.Set; /** * Helper class to back up and restore the TaskFragmentOrganizer state, in order to resume @@ -40,11 +50,21 @@ class BackupHelper { @NonNull private final SplitController mController; @NonNull + private final SplitPresenter mPresenter; + @NonNull private final BackupIdler mBackupIdler = new BackupIdler(); private boolean mBackupIdlerScheduled; - BackupHelper(@NonNull SplitController splitController, @NonNull Bundle savedState) { + private final List mParcelableTaskContainerDataList = + new ArrayList<>(); + private final ArrayMap mTaskFragmentInfos = new ArrayMap<>(); + private final SparseArray mTaskFragmentParentInfos = + new SparseArray<>(); + + BackupHelper(@NonNull SplitController splitController, @NonNull SplitPresenter splitPresenter, + @NonNull Bundle savedState) { mController = splitController; + mPresenter = splitPresenter; if (!savedState.isEmpty()) { restoreState(savedState); @@ -67,13 +87,13 @@ class BackupHelper { public boolean queueIdle() { synchronized (mController.mLock) { mBackupIdlerScheduled = false; - startBackup(); + saveState(); } return false; } } - private void startBackup() { + private void saveState() { final List taskContainers = mController.getTaskContainers(); if (taskContainers.isEmpty()) { Log.w(TAG, "No task-container to back up"); @@ -97,13 +117,92 @@ class BackupHelper { return; } - final List parcelableTaskContainerDataList = - savedState.getParcelableArrayList(KEY_TASK_CONTAINERS, - ParcelableTaskContainerData.class); - for (ParcelableTaskContainerData data : parcelableTaskContainerDataList) { - final TaskContainer taskContainer = new TaskContainer(data, mController); - if (DEBUG) Log.d(TAG, "Restoring task " + taskContainer.getTaskId()); - // TODO(b/289875940): implement the TaskContainer restoration. + if (DEBUG) Log.d(TAG, "Start restoring saved-state"); + mParcelableTaskContainerDataList.addAll(savedState.getParcelableArrayList( + KEY_TASK_CONTAINERS, ParcelableTaskContainerData.class)); + if (DEBUG) Log.d(TAG, "Retrieved tasks : " + mParcelableTaskContainerDataList.size()); + if (mParcelableTaskContainerDataList.isEmpty()) { + return; + } + + final List infos = savedState.getParcelableArrayList( + KEY_RESTORE_TASK_FRAGMENTS_INFO, TaskFragmentInfo.class); + for (TaskFragmentInfo info : infos) { + if (DEBUG) Log.d(TAG, "Retrieved: " + info); + mTaskFragmentInfos.put(info.getFragmentToken(), info); + mPresenter.updateTaskFragmentInfo(info); + } + + final List parentInfos = savedState.getParcelableArrayList( + KEY_RESTORE_TASK_FRAGMENT_PARENT_INFO, + TaskFragmentParentInfo.class); + for (TaskFragmentParentInfo info : parentInfos) { + if (DEBUG) Log.d(TAG, "Retrieved: " + info); + mTaskFragmentParentInfos.put(info.getTaskId(), info); + } + } + + boolean hasPendingStateToRestore() { + return !mParcelableTaskContainerDataList.isEmpty(); + } + + /** + * Returns {@code true} if any of the {@link TaskContainer} is restored. + * Otherwise, returns {@code false}. + */ + boolean rebuildTaskContainers(@NonNull WindowContainerTransaction wct, + @NonNull Set rules) { + if (mParcelableTaskContainerDataList.isEmpty()) { + return false; + } + + if (DEBUG) Log.d(TAG, "Rebuilding TaskContainers."); + final ArrayMap embeddingRuleMap = new ArrayMap<>(); + for (EmbeddingRule rule : rules) { + embeddingRuleMap.put(rule.getTag(), rule); + } + + boolean restoredAny = false; + for (int i = mParcelableTaskContainerDataList.size() - 1; i >= 0; i--) { + final ParcelableTaskContainerData parcelableTaskContainerData = + mParcelableTaskContainerDataList.get(i); + final List tags = parcelableTaskContainerData.getSplitRuleTags(); + if (!embeddingRuleMap.containsAll(tags)) { + // has unknown tag, unable to restore. + if (DEBUG) { + Log.d(TAG, "Rebuilding TaskContainer abort! Unknown Tag. Task#" + + parcelableTaskContainerData.mTaskId); + } + continue; + } + + mParcelableTaskContainerDataList.remove(parcelableTaskContainerData); + final TaskContainer taskContainer = new TaskContainer(parcelableTaskContainerData, + mController, mTaskFragmentInfos); + if (DEBUG) Log.d(TAG, "Created TaskContainer " + taskContainer); + mController.addTaskContainer(taskContainer.getTaskId(), taskContainer); + + for (ParcelableSplitContainerData splitData : + parcelableTaskContainerData.getParcelableSplitContainerDataList()) { + final SplitRule rule = (SplitRule) embeddingRuleMap.get(splitData.mSplitRuleTag); + assert rule != null; + if (mController.getContainer(splitData.getPrimaryContainerToken()) != null + && mController.getContainer(splitData.getSecondaryContainerToken()) + != null) { + taskContainer.addSplitContainer( + new SplitContainer(splitData, mController, rule)); + } + } + + mController.onTaskFragmentParentRestored(wct, taskContainer.getTaskId(), + mTaskFragmentParentInfos.get(taskContainer.getTaskId())); + restoredAny = true; + } + + if (mParcelableTaskContainerDataList.isEmpty()) { + mTaskFragmentParentInfos.clear(); + mTaskFragmentInfos.clear(); } + return restoredAny; } -} +} \ No newline at end of file diff --git a/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/ParcelableSplitContainerData.java b/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/ParcelableSplitContainerData.java index 817cfce69b2e15457e8d8cf60697fb753aeed0be..cb280c530c1b5900afd65c15ca11c83f1d8644c4 100644 --- a/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/ParcelableSplitContainerData.java +++ b/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/ParcelableSplitContainerData.java @@ -89,13 +89,13 @@ class ParcelableSplitContainerData implements Parcelable { }; @NonNull - private IBinder getPrimaryContainerToken() { + IBinder getPrimaryContainerToken() { return mSplitContainer != null ? mSplitContainer.getPrimaryContainer().getToken() : mPrimaryContainerToken; } @NonNull - private IBinder getSecondaryContainerToken() { + IBinder getSecondaryContainerToken() { return mSplitContainer != null ? mSplitContainer.getSecondaryContainer().getToken() : mSecondaryContainerToken; } diff --git a/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/ParcelableTaskContainerData.java b/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/ParcelableTaskContainerData.java index 7377d005cda493de149688b2fa947467f4c976c1..97aa69985907f3820e8a4057385c3a5ae5c0bf24 100644 --- a/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/ParcelableTaskContainerData.java +++ b/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/ParcelableTaskContainerData.java @@ -108,6 +108,15 @@ class ParcelableTaskContainerData implements Parcelable { : mParcelableSplitContainerDataList; } + @NonNull + List getSplitRuleTags() { + final List tags = new ArrayList<>(); + for (ParcelableSplitContainerData data : getParcelableSplitContainerDataList()) { + tags.add(data.mSplitRuleTag); + } + return tags; + } + @Override public int describeContents() { return 0; diff --git a/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/SplitContainer.java b/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/SplitContainer.java index 6d436ec01d98b68051f4b09568903fe82c7ef8d6..faf73c24073f09ac1a9ce3d0d2c3e3e38c516eaa 100644 --- a/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/SplitContainer.java +++ b/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/SplitContainer.java @@ -86,6 +86,25 @@ class SplitContainer { } } + /** This is only used when restoring it from a {@link ParcelableSplitContainerData}. */ + SplitContainer(@NonNull ParcelableSplitContainerData parcelableData, + @NonNull SplitController splitController, @NonNull SplitRule splitRule) { + mParcelableData = parcelableData; + mPrimaryContainer = splitController.getContainer(parcelableData.getPrimaryContainerToken()); + mSecondaryContainer = splitController.getContainer( + parcelableData.getSecondaryContainerToken()); + mSplitRule = splitRule; + mDefaultSplitAttributes = splitRule.getDefaultSplitAttributes(); + mCurrentSplitAttributes = mDefaultSplitAttributes; + + if (shouldFinishPrimaryWithSecondary(splitRule)) { + mSecondaryContainer.addContainerToFinishOnExit(mPrimaryContainer); + } + if (shouldFinishSecondaryWithPrimary(splitRule)) { + mPrimaryContainer.addContainerToFinishOnExit(mSecondaryContainer); + } + } + void setPrimaryContainer(@NonNull TaskFragmentContainer primaryContainer) { if (!mParcelableData.mIsPrimaryContainerMutable) { throw new IllegalStateException("Cannot update primary TaskFragmentContainer"); diff --git a/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/SplitController.java b/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/SplitController.java index f2f2b7ea71741c0692a3607ee13c90e561734582..db4bb0e5e75eb5ffab1d32750146b100e11a8765 100644 --- a/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/SplitController.java +++ b/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/SplitController.java @@ -279,6 +279,26 @@ public class SplitController implements JetpackTaskFragmentOrganizer.TaskFragmen Log.i(TAG, "Setting embedding rules. Size: " + rules.size()); mSplitRules.clear(); mSplitRules.addAll(rules); + + if (!Flags.aeBackStackRestore() || !mPresenter.isRebuildTaskContainersNeeded()) { + return; + } + + try { + final TransactionRecord transactionRecord = + mTransactionManager.startNewTransaction(); + final WindowContainerTransaction wct = transactionRecord.getTransaction(); + if (mPresenter.rebuildTaskContainers(wct, rules)) { + transactionRecord.apply(false /* shouldApplyIndependently */); + updateCallbackIfNecessary(); + } else { + transactionRecord.abort(); + } + } catch (IllegalStateException ex) { + Log.e(TAG, "Having an existing transaction while running restoration with" + + "new rules!! It is likely too late to perform the restoration " + + "already!?", ex); + } } } @@ -902,6 +922,12 @@ public class SplitController implements JetpackTaskFragmentOrganizer.TaskFragmen updateContainersInTask(wct, taskContainer); } + @GuardedBy("mLock") + void onTaskFragmentParentRestored(@NonNull WindowContainerTransaction wct, int taskId, + @NonNull TaskFragmentParentInfo parentInfo) { + onTaskFragmentParentInfoChanged(wct, taskId, parentInfo); + } + @GuardedBy("mLock") void updateContainersInTaskIfVisible(@NonNull WindowContainerTransaction wct, int taskId) { final TaskContainer taskContainer = getTaskContainer(taskId); diff --git a/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/SplitPresenter.java b/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/SplitPresenter.java index abc7b291fc32bdab0d664c75534dbbe86629ea96..0c0ded9bad742f89565a66e3d15b7c8ae2e2bbd9 100644 --- a/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/SplitPresenter.java +++ b/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/SplitPresenter.java @@ -24,6 +24,7 @@ import static androidx.window.extensions.embedding.SplitController.TAG; import static androidx.window.extensions.embedding.WindowAttributes.DIM_AREA_ON_TASK; import android.annotation.AnimRes; +import android.annotation.NonNull; import android.app.Activity; import android.app.ActivityThread; import android.app.WindowConfiguration; @@ -47,7 +48,6 @@ import android.window.TaskFragmentCreationParams; import android.window.WindowContainerTransaction; import androidx.annotation.IntDef; -import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.window.extensions.core.util.function.Function; import androidx.window.extensions.embedding.SplitAttributes.SplitType; @@ -67,6 +67,7 @@ import com.android.window.flags.Flags; import java.util.ArrayList; import java.util.List; import java.util.Objects; +import java.util.Set; import java.util.concurrent.Executor; /** @@ -174,7 +175,7 @@ class SplitPresenter extends JetpackTaskFragmentOrganizer { } else { registerOrganizer(); } - mBackupHelper = new BackupHelper(controller, outSavedState); + mBackupHelper = new BackupHelper(controller, this, outSavedState); if (!SplitController.ENABLE_SHELL_TRANSITIONS) { // TODO(b/207070762): cleanup with legacy app transition // Animation will be handled by WM Shell when Shell transition is enabled. @@ -186,6 +187,15 @@ class SplitPresenter extends JetpackTaskFragmentOrganizer { mBackupHelper.scheduleBackup(); } + boolean isRebuildTaskContainersNeeded() { + return mBackupHelper.hasPendingStateToRestore(); + } + + boolean rebuildTaskContainers(@NonNull WindowContainerTransaction wct, + @NonNull Set rules) { + return mBackupHelper.rebuildTaskContainers(wct, rules); + } + /** * Deletes the specified container and all other associated and dependent containers in the same * transaction. diff --git a/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/TaskContainer.java b/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/TaskContainer.java index 608a3bee7509bfd2273be5e69552d3cd3278990c..74cce68f270b0a8f55c2bbd4d277f43175a97a26 100644 --- a/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/TaskContainer.java +++ b/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/TaskContainer.java @@ -31,6 +31,7 @@ import android.app.WindowConfiguration.WindowingMode; import android.content.res.Configuration; import android.graphics.Rect; import android.os.IBinder; +import android.util.ArrayMap; import android.util.ArraySet; import android.util.DisplayMetrics; import android.util.Log; @@ -147,14 +148,23 @@ class TaskContainer { /** This is only used when restoring it from a {@link ParcelableTaskContainerData}. */ TaskContainer(@NonNull ParcelableTaskContainerData data, - @NonNull SplitController splitController) { + @NonNull SplitController splitController, + @NonNull ArrayMap taskFragmentInfoMap) { mParcelableTaskContainerData = new ParcelableTaskContainerData(data, this); + mInfo = new TaskFragmentParentInfo(new Configuration(), 0 /* displayId */, -1 /* taskId */, + false /* visible */, false /* hasDirectActivity */, null /* decorSurface */); mSplitController = splitController; for (ParcelableTaskFragmentContainerData tfData : data.getParcelableTaskFragmentContainerDataList()) { - final TaskFragmentContainer container = - new TaskFragmentContainer(tfData, splitController, this); - mContainers.add(container); + final TaskFragmentInfo info = taskFragmentInfoMap.get(tfData.mToken); + if (info != null && !info.isEmpty()) { + final TaskFragmentContainer container = + new TaskFragmentContainer(tfData, splitController, this); + container.setInfo(new WindowContainerTransaction(), info); + mContainers.add(container); + } else { + Log.d(TAG, "Drop " + tfData + " while restoring Task " + data.mTaskId); + } } } diff --git a/libs/WindowManager/Jetpack/tests/unittest/Android.bp b/libs/WindowManager/Jetpack/tests/unittest/Android.bp index 139ddda5af3cfce0d6ad85159da6f1d15794baeb..bd430c0e610b28b504ee0c972d38e1b6deace1d8 100644 --- a/libs/WindowManager/Jetpack/tests/unittest/Android.bp +++ b/libs/WindowManager/Jetpack/tests/unittest/Android.bp @@ -47,9 +47,9 @@ android_test { ], libs: [ - "android.test.mock", - "android.test.base", - "android.test.runner", + "android.test.mock.stubs.system", + "android.test.base.stubs.system", + "android.test.runner.stubs.system", ], // These are not normally accessible from apps so they must be explicitly included. @@ -62,3 +62,10 @@ android_test { enabled: false, }, } + +test_module_config { + name: "WMJetpackUnitTests_Presubmit", + base: "WMJetpackUnitTests", + test_suites: ["device-tests"], + include_annotations: ["android.platform.test.annotations.Presubmit"], +} diff --git a/libs/WindowManager/Shell/Android.bp b/libs/WindowManager/Shell/Android.bp index a79bc97c440c329c1d509c69f701d913af6bfcb3..94809f2d258fcb407fb41962152c588e040ebd80 100644 --- a/libs/WindowManager/Shell/Android.bp +++ b/libs/WindowManager/Shell/Android.bp @@ -187,6 +187,9 @@ java_library { "shared/**/desktopmode/*.java", "shared/**/desktopmode/*.kt", ], + static_libs: [ + "com.android.window.flags.window-aconfig-java", + ], } android_library { diff --git a/libs/WindowManager/Shell/OWNERS b/libs/WindowManager/Shell/OWNERS index c6044a45200de96c53b0ff0b510d8b92ab396953..394093c6ab302b1913fa9196fa5b724ee7920f08 100644 --- a/libs/WindowManager/Shell/OWNERS +++ b/libs/WindowManager/Shell/OWNERS @@ -1,4 +1,6 @@ xutan@google.com +pbdr@google.com +pragyabajoria@google.com # Give submodule owners in shell resource approval per-file res*/*/*.xml = atsjenk@google.com, hwwang@google.com, jorgegil@google.com, lbill@google.com, madym@google.com, vaniadesmonda@google.com, pbdr@google.com, tkachenkoi@google.com, mpodolian@google.com, liranb@google.com, pragyabajoria@google.com, uysalorhan@google.com, gsennton@google.com, mattsziklay@google.com, mdehaini@google.com diff --git a/libs/WindowManager/Shell/multivalentScreenshotTests/Android.bp b/libs/WindowManager/Shell/multivalentScreenshotTests/Android.bp index 1871203c760021b250e1d1e7a77ac31813e1a65f..b6db6d93499d88d03048e504656b4882b3a20784 100644 --- a/libs/WindowManager/Shell/multivalentScreenshotTests/Android.bp +++ b/libs/WindowManager/Shell/multivalentScreenshotTests/Android.bp @@ -72,8 +72,8 @@ android_test { "platform-screenshot-diff-core", ], libs: [ - "android.test.base", - "android.test.runner", + "android.test.base.stubs.system", + "android.test.runner.stubs.system", ], jni_libs: [ "libdexmakerjvmtiagent", diff --git a/libs/WindowManager/Shell/multivalentTests/Android.bp b/libs/WindowManager/Shell/multivalentTests/Android.bp index 1ad19c9f3033e67dc7ab2bd4d8a4593e2f649dee..ee0d5bbed324aef830bf14d71fb1b21f4cb2d04c 100644 --- a/libs/WindowManager/Shell/multivalentTests/Android.bp +++ b/libs/WindowManager/Shell/multivalentTests/Android.bp @@ -77,8 +77,8 @@ android_test { "platform-test-rules", ], libs: [ - "android.test.base", - "android.test.runner", + "android.test.base.stubs.system", + "android.test.runner.stubs.system", ], jni_libs: [ "libdexmakerjvmtiagent", diff --git a/libs/WindowManager/Shell/res/drawable/desktop_mode_ic_handle_menu_manage_windows.xml b/libs/WindowManager/Shell/res/drawable/desktop_mode_ic_handle_menu_manage_windows.xml new file mode 100644 index 0000000000000000000000000000000000000000..7d912a24c443674383780606c17bfc00000b06a6 --- /dev/null +++ b/libs/WindowManager/Shell/res/drawable/desktop_mode_ic_handle_menu_manage_windows.xml @@ -0,0 +1,19 @@ + + + + + diff --git a/libs/WindowManager/Shell/res/layout/desktop_mode_window_decor_handle_menu.xml b/libs/WindowManager/Shell/res/layout/desktop_mode_window_decor_handle_menu.xml index eea3de8e30cafd4fda13e805289561caf9144768..64f71c713d1c92ac5812b86ad8ca6e374d5e0825 100644 --- a/libs/WindowManager/Shell/res/layout/desktop_mode_window_decor_handle_menu.xml +++ b/libs/WindowManager/Shell/res/layout/desktop_mode_window_decor_handle_menu.xml @@ -147,6 +147,14 @@ android:drawableStart="@drawable/desktop_mode_ic_handle_menu_new_window" android:drawableTint="?androidprv:attr/materialColorOnSurface" style="@style/DesktopModeHandleMenuActionButton" /> + +