Merge "Add tweek@ to android.security OWNERS" into main
diff --git a/Android.bp b/Android.bp
index 68fc474..e688bff 100644
--- a/Android.bp
+++ b/Android.bp
@@ -261,7 +261,6 @@
"devicepolicyprotosnano",
"ImmutabilityAnnotation",
- "com.android.sysprop.init",
"com.android.sysprop.localization",
"PlatformProperties",
],
diff --git a/INPUT_OWNERS b/INPUT_OWNERS
index 06ead06..9b1016e 100644
--- a/INPUT_OWNERS
+++ b/INPUT_OWNERS
@@ -1,4 +1,5 @@
# Bug component: 136048
+# Please assign bugs to android-framework-input-triage@.
arpitks@google.com
asmitapoddar@google.com
hcutts@google.com
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 d7b1c9a2..f20b170 100644
--- a/apct-tests/perftests/core/src/android/conscrypt/conscrypt/ClientSocketPerfTest.java
+++ b/apct-tests/perftests/core/src/android/conscrypt/conscrypt/ClientSocketPerfTest.java
@@ -43,7 +43,6 @@
import javax.crypto.Cipher;
import javax.crypto.NoSuchPaddingException;
-import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -143,7 +142,7 @@
// Always use the same server for consistency across the benchmarks.
server = config.serverFactory().newServer(
- ChannelType.CHANNEL, config.messageSize(), config.protocol().getProtocols(),
+ config.messageSize(), config.protocol().getProtocols(),
ciphers(config));
server.setMessageProcessor(new ServerEndpoint.MessageProcessor() {
@@ -197,7 +196,6 @@
*/
@Test
@Parameters(method = "getParams")
- @Ignore("b/351034205")
public void time(Config config) throws Exception {
reset();
setup(config);
diff --git a/apct-tests/perftests/core/src/android/conscrypt/conscrypt/EndpointFactory.java b/apct-tests/perftests/core/src/android/conscrypt/conscrypt/EndpointFactory.java
index 0655f45..ba2acb8 100644
--- a/apct-tests/perftests/core/src/android/conscrypt/conscrypt/EndpointFactory.java
+++ b/apct-tests/perftests/core/src/android/conscrypt/conscrypt/EndpointFactory.java
@@ -43,10 +43,10 @@
factories.clientFactory, channelType, port, protocols, ciphers);
}
- public ServerEndpoint newServer(ChannelType channelType, int messageSize,
+ public ServerEndpoint newServer(int messageSize,
String[] protocols, String[] ciphers) throws IOException {
return new ServerEndpoint(factories.serverFactory, factories.serverSocketFactory,
- channelType, messageSize, protocols, ciphers);
+ messageSize, protocols, ciphers);
}
private static final class Factories {
diff --git a/apct-tests/perftests/core/src/android/conscrypt/conscrypt/ServerEndpoint.java b/apct-tests/perftests/core/src/android/conscrypt/conscrypt/ServerEndpoint.java
index 3631c3f..1e4f124 100644
--- a/apct-tests/perftests/core/src/android/conscrypt/conscrypt/ServerEndpoint.java
+++ b/apct-tests/perftests/core/src/android/conscrypt/conscrypt/ServerEndpoint.java
@@ -34,8 +34,6 @@
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
-import org.conscrypt.ChannelType;
-
/**
* A simple socket-based test server.
*/
@@ -63,7 +61,6 @@
}
private final ServerSocket serverSocket;
- private final ChannelType channelType;
private final SSLSocketFactory socketFactory;
private final int messageSize;
private final String[] protocols;
@@ -78,11 +75,10 @@
private volatile Future<?> processFuture;
ServerEndpoint(SSLSocketFactory socketFactory, SSLServerSocketFactory serverSocketFactory,
- ChannelType channelType, int messageSize, String[] protocols,
+ int messageSize, String[] protocols,
String[] cipherSuites) throws IOException {
- this.serverSocket = channelType.newServerSocket(serverSocketFactory);
+ this.serverSocket = serverSocketFactory.createServerSocket();
this.socketFactory = socketFactory;
- this.channelType = channelType;
this.messageSize = messageSize;
this.protocols = protocols;
this.cipherSuites = cipherSuites;
@@ -134,7 +130,7 @@
if (stopping) {
return;
}
- socket = channelType.accept(serverSocket, socketFactory);
+ socket = (SSLSocket) serverSocket.accept();
socket.setEnabledProtocols(protocols);
socket.setEnabledCipherSuites(cipherSuites);
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 8916a3c..af3c405 100644
--- a/apct-tests/perftests/core/src/android/conscrypt/conscrypt/ServerSocketPerfTest.java
+++ b/apct-tests/perftests/core/src/android/conscrypt/conscrypt/ServerSocketPerfTest.java
@@ -43,7 +43,6 @@
import junitparams.JUnitParamsRunner;
import junitparams.Parameters;
-import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -131,8 +130,7 @@
final ChannelType channelType = config.channelType();
- server = config.serverFactory().newServer(
- channelType, config.messageSize(),
+ server = config.serverFactory().newServer(config.messageSize(),
new String[] {"TLSv1.3", "TLSv1.2"}, ciphers(config));
server.setMessageProcessor(new MessageProcessor() {
@Override
@@ -202,7 +200,6 @@
@Test
@Parameters(method = "getParams")
- @Ignore("b/351034205")
public void throughput(Config config) throws Exception {
setup(config);
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
diff --git a/apct-tests/perftests/core/src/android/libcore/AdditionPerfTest.java b/apct-tests/perftests/core/src/android/libcore/AdditionPerfTest.java
index 80cd86c..237c747 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -34,11 +34,11 @@
public class AdditionPerfTest {
@Rule
- public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
@Test
public void timeAddConstantToLocalInt() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
int result = 0;
while (state.keepRunning()) {
result += 123;
@@ -46,7 +46,7 @@
}
@Test
public void timeAddTwoLocalInts() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
int result = 0;
int constant = 123;
while (state.keepRunning()) {
@@ -55,7 +55,7 @@
}
@Test
public void timeAddConstantToLocalLong() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
long result = 0;
while (state.keepRunning()) {
result += 123L;
@@ -63,7 +63,7 @@
}
@Test
public void timeAddTwoLocalLongs() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
long result = 0;
long constant = 123L;
while (state.keepRunning()) {
@@ -72,7 +72,7 @@
}
@Test
public void timeAddConstantToLocalFloat() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
float result = 0.0f;
while (state.keepRunning()) {
result += 123.0f;
@@ -80,7 +80,7 @@
}
@Test
public void timeAddTwoLocalFloats() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
float result = 0.0f;
float constant = 123.0f;
while (state.keepRunning()) {
@@ -89,7 +89,7 @@
}
@Test
public void timeAddConstantToLocalDouble() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
double result = 0.0;
while (state.keepRunning()) {
result += 123.0;
@@ -97,7 +97,7 @@
}
@Test
public void timeAddTwoLocalDoubles() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 2f6c378..1222bc2 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -33,11 +33,11 @@
public class ArrayCopyPerfTest {
@Rule
- public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
@Test
public void timeManualArrayCopy() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
char[] src = new char[8192];
while (state.keepRunning()) {
char[] dst = new char[8192];
@@ -49,7 +49,7 @@
@Test
public void time_System_arrayCopy() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
char[] src = new char[8192];
while (state.keepRunning()) {
char[] dst = new char[8192];
@@ -59,7 +59,7 @@
@Test
public void time_Arrays_copyOf() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
char[] src = new char[8192];
while (state.keepRunning()) {
char[] dst = Arrays.copyOf(src, 8192);
@@ -68,7 +68,7 @@
@Test
public void time_Arrays_copyOfRange() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 d17add7..3f95e3e 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -38,7 +38,7 @@
}
@Rule
- public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
Foo[] mArray = new Foo[27];
{
@@ -46,7 +46,7 @@
}
@Test
public void timeArrayIteration() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
int sum = 0;
for (int i = 0; i < mArray.length; i++) {
@@ -56,7 +56,7 @@
}
@Test
public void timeArrayIterationCached() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
int sum = 0;
Foo[] localArray = mArray;
@@ -69,7 +69,7 @@
}
@Test
public void timeArrayIterationForEach() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 3a57db8..1423a13 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -39,7 +39,7 @@
int mSplat;
}
@Rule
- public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
ArrayList<Foo> mList = new ArrayList<Foo>();
{
@@ -47,7 +47,7 @@
}
@Test
public void timeArrayListIterationIndexed() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
int sum = 0;
ArrayList<Foo> list = mList;
@@ -59,7 +59,7 @@
}
@Test
public void timeArrayListIterationForEach() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 3fb3bc8..0283105 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -38,7 +38,8 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class BigIntegerPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule
+ public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
// 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,
@@ -61,7 +62,7 @@
// Execute the above rep times, optionally timing it.
@Test
public void repeatInner() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
for (int i = 10; i <= 10_000; i *= 10) {
inner(100, i);
@@ -85,7 +86,7 @@
// Check results for equality, and print one, to compaare against reference.
@Test
public void repeatHarmonic1000() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
for (int i = 5; i <= 5_000; i *= 10) {
BigInteger refRes = harmonic1000(i);
@@ -106,7 +107,7 @@
// us to time and check it for consistency as well.
@Test
public void repeatToString() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
for (int i = 5; i <= 5_000; i *= 10) {
BigInteger refRes = harmonic1000(i);
@@ -146,7 +147,7 @@
// to compare to reference.
@Test
public void repeatEApprox() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
for (int i = 10; i <= 10_000; i *= 10) {
BigInteger refRes = eApprox(100_000, i);
@@ -165,7 +166,7 @@
// Test / time modPow()
@Test
public void repeatModPow() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
for (int i = 5; i <= 500; i *= 10) {
BigInteger odd1 = BigInteger.TEN.pow(i / 2).add(BigInteger.ONE);
@@ -198,7 +199,7 @@
// Test / time modInverse()
@Test
public void repeatModInverse() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 2a1b5d1..11ca73a 100644
--- a/apct-tests/perftests/core/src/android/libcore/BufferedZipFilePerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/BufferedZipFilePerfTest.java
@@ -16,8 +16,9 @@
package android.libcore;
-import android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
+
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -39,7 +40,8 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public final class BufferedZipFilePerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule
+ public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
int[] mReadSize = new int[] {4, 32, 128};
int[] mCompressedSize = new int[] {128, 1024, 8192, 65536};
@@ -67,7 +69,7 @@
@Test
public void timeUnbufferedRead() throws Exception {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
for (int i = 0; i < mCompressedSize.length; i++) {
for (int j = 0; j < mReadSize.length; j++) {
@@ -87,7 +89,7 @@
@Test
public void timeBufferedRead() throws Exception {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 5f599ea..0abe194 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -30,7 +30,8 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class ClassLoaderResourcePerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule
+ public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
private static final String EXISTENT_RESOURCE = "java/util/logging/logging.properties";
private static final String MISSING_RESOURCE = "missing_entry";
@@ -40,7 +41,7 @@
ClassLoader currentClassLoader = getClass().getClassLoader();
Assert.assertNotNull(currentClassLoader.getResource(EXISTENT_RESOURCE));
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
currentClassLoader.getResource(EXISTENT_RESOURCE);
}
@@ -51,7 +52,7 @@
ClassLoader currentClassLoader = getClass().getClassLoader();
Assert.assertNull(currentClassLoader.getResource(MISSING_RESOURCE));
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 ea24984..52441d1 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -29,7 +29,8 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class ClonePerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule
+ public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static class CloneableObject implements Cloneable {
public Object clone() throws CloneNotSupportedException {
@@ -1127,7 +1128,7 @@
public void time_Object_clone() {
try {
CloneableObject o = new CloneableObject();
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
o.clone();
}
@@ -1140,7 +1141,7 @@
public void time_Object_manyFieldClone() {
try {
CloneableManyFieldObject o = new CloneableManyFieldObject();
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
o.clone();
}
@@ -1153,7 +1154,7 @@
public void time_Object_deepClone() {
try {
DeepCloneable o = new DeepCloneable();
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
o.clone();
}
@@ -1165,7 +1166,7 @@
@Test
public void time_Array_clone() {
int[] o = new int[32];
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
o.clone();
}
@@ -1177,7 +1178,7 @@
for (int i = 0; i < o.length / 2; ++i) {
o[i] = new Object();
}
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
o.clone();
}
@@ -1189,7 +1190,7 @@
for (int i = 0; i < o.length / 2; ++i) {
o[i] = new Object();
}
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 82247dc..e6c5aca 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
@@ -36,7 +36,8 @@
@RunWith(JUnitParamsRunner.class)
@LargeTest
public class DeepArrayOpsPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule
+ public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
private Object[] mArray;
private Object[] mArray2;
@@ -99,7 +100,7 @@
@Parameters(method = "getData")
public void deepHashCode(int arrayLength) throws Exception {
setUp(arrayLength);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
Arrays.deepHashCode(mArray);
}
@@ -109,7 +110,7 @@
@Parameters(method = "getData")
public void deepEquals(int arrayLength) throws Exception {
setUp(arrayLength);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 0bebf04..378137b 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -30,7 +30,8 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class FieldAccessPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule
+ public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
private static class Inner {
public int mPublicInnerIntVal;
@@ -47,7 +48,7 @@
@Test
public void timeField() {
int result = 0;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = mIntVal;
}
@@ -56,7 +57,7 @@
@Test
public void timeFieldFinal() {
int result = 0;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = mFinalIntVal;
}
@@ -65,7 +66,7 @@
@Test
public void timeFieldStatic() {
int result = 0;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = sStaticIntVal;
}
@@ -74,7 +75,7 @@
@Test
public void timeFieldStaticFinal() {
int result = 0;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = FINAL_INT_VAL;
}
@@ -84,7 +85,7 @@
public void timeFieldCached() {
int result = 0;
int cachedIntVal = this.mIntVal;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = cachedIntVal;
}
@@ -94,7 +95,7 @@
public void timeFieldPrivateInnerClassPublicField() {
int result = 0;
Inner inner = new Inner();
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = inner.mPublicInnerIntVal;
}
@@ -104,7 +105,7 @@
public void timeFieldPrivateInnerClassProtectedField() {
int result = 0;
Inner inner = new Inner();
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = inner.mProtectedInnerIntVal;
}
@@ -114,7 +115,7 @@
public void timeFieldPrivateInnerClassPrivateField() {
int result = 0;
Inner inner = new Inner();
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = inner.mPrivateInnerIntVal;
}
@@ -124,7 +125,7 @@
public void timeFieldPrivateInnerClassPackageField() {
int result = 0;
Inner inner = new Inner();
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 55c1027..610e8e5 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -35,13 +35,14 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class HashedCollectionsPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule
+ public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
@Test
public void timeHashMapGet() {
HashMap<String, String> map = new HashMap<String, String>();
map.put("hello", "world");
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
map.get("hello");
}
@@ -53,7 +54,7 @@
synchronized (map) {
map.put("hello", "world");
}
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
synchronized (map) {
map.get("hello");
@@ -65,7 +66,7 @@
public void timeHashtableGet() {
Hashtable<String, String> map = new Hashtable<String, String>();
map.put("hello", "world");
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
map.get("hello");
}
@@ -75,7 +76,7 @@
public void timeLinkedHashMapGet() {
LinkedHashMap<String, String> map = new LinkedHashMap<String, String>();
map.put("hello", "world");
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
map.get("hello");
}
@@ -85,7 +86,7 @@
public void timeConcurrentHashMapGet() {
ConcurrentHashMap<String, String> map = new ConcurrentHashMap<String, String>();
map.put("hello", "world");
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 da60a77..40c07e0 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -41,7 +41,8 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class ImtConflictPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule
+ public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
@Before
public void setup() {
@@ -280,7 +281,7 @@
@Test
public void timeConflictDepth01() {
C0 c0 = new C0();
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
callF0(c0);
callF0(c0);
@@ -308,7 +309,7 @@
@Test
public void timeConflictDepth02() {
C1 c1 = new C1();
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
callF0(c1);
callF19(c1);
@@ -336,7 +337,7 @@
@Test
public void timeConflictDepth03() {
C2 c2 = new C2();
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
callF0(c2);
callF19(c2);
@@ -364,7 +365,7 @@
@Test
public void timeConflictDepth04() {
C3 c3 = new C3();
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
callF0(c3);
callF19(c3);
@@ -392,7 +393,7 @@
@Test
public void timeConflictDepth05() {
C4 c4 = new C4();
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
callF0(c4);
callF19(c4);
@@ -420,7 +421,7 @@
@Test
public void timeConflictDepth06() {
C5 c5 = new C5();
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
callF0(c5);
callF19(c5);
@@ -448,7 +449,7 @@
@Test
public void timeConflictDepth07() {
C6 c6 = new C6();
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
callF0(c6);
callF19(c6);
@@ -476,7 +477,7 @@
@Test
public void timeConflictDepth08() {
C7 c7 = new C7();
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
callF0(c7);
callF19(c7);
@@ -504,7 +505,7 @@
@Test
public void timeConflictDepth09() {
C8 c8 = new C8();
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
callF0(c8);
callF19(c8);
@@ -532,7 +533,7 @@
@Test
public void timeConflictDepth10() {
C9 c9 = new C9();
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
callF0(c9);
callF19(c9);
@@ -560,7 +561,7 @@
@Test
public void timeConflictDepth11() {
C10 c10 = new C10();
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
callF0(c10);
callF19(c10);
@@ -588,7 +589,7 @@
@Test
public void timeConflictDepth12() {
C11 c11 = new C11();
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
callF0(c11);
callF19(c11);
@@ -616,7 +617,7 @@
@Test
public void timeConflictDepth13() {
C12 c12 = new C12();
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
callF0(c12);
callF19(c12);
@@ -644,7 +645,7 @@
@Test
public void timeConflictDepth14() {
C13 c13 = new C13();
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
callF0(c13);
callF19(c13);
@@ -672,7 +673,7 @@
@Test
public void timeConflictDepth15() {
C14 c14 = new C14();
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
callF0(c14);
callF19(c14);
@@ -700,7 +701,7 @@
@Test
public void timeConflictDepth16() {
C15 c15 = new C15();
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
callF0(c15);
callF19(c15);
@@ -728,7 +729,7 @@
@Test
public void timeConflictDepth17() {
C16 c16 = new C16();
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
callF0(c16);
callF19(c16);
@@ -756,7 +757,7 @@
@Test
public void timeConflictDepth18() {
C17 c17 = new C17();
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
callF0(c17);
callF19(c17);
@@ -784,7 +785,7 @@
@Test
public void timeConflictDepth19() {
C18 c18 = new C18();
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
callF0(c18);
callF19(c18);
@@ -812,7 +813,7 @@
@Test
public void timeConflictDepth20() {
C19 c19 = new C19();
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 6d9d0c9..e1d0bf2 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -30,7 +30,8 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class MethodInvocationPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule
+ public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
interface I {
void emptyInterface();
@@ -65,12 +66,12 @@
}
public void timeInternalGetter() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
new C().timeInternalGetter(state);
}
public void timeInternalFieldAccess() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
new C().timeInternalFieldAccess(state);
}
@@ -78,7 +79,7 @@
@Test
public void timeStringLength() {
int result = 0;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = "hello, world!".length();
}
@@ -87,7 +88,7 @@
@Test
public void timeEmptyStatic() {
C c = new C();
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
c.emptyStatic();
}
@@ -96,7 +97,7 @@
@Test
public void timeEmptyVirtual() {
C c = new C();
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
c.emptyVirtual();
}
@@ -105,7 +106,7 @@
@Test
public void timeEmptyInterface() {
I c = new C();
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
c.emptyInterface();
}
@@ -138,7 +139,7 @@
@Test
public void timePrivateInnerPublicMethod() {
Inner inner = new Inner();
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
inner.publicMethod();
}
@@ -147,7 +148,7 @@
@Test
public void timePrivateInnerProtectedMethod() {
Inner inner = new Inner();
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
inner.protectedMethod();
}
@@ -156,7 +157,7 @@
@Test
public void timePrivateInnerPrivateMethod() {
Inner inner = new Inner();
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
inner.privateMethod();
}
@@ -165,7 +166,7 @@
@Test
public void timePrivateInnerPackageMethod() {
Inner inner = new Inner();
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
inner.packageMethod();
}
@@ -174,7 +175,7 @@
@Test
public void timePrivateInnerFinalPackageMethod() {
Inner inner = new Inner();
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 09b0977..c5e9d1e 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -30,12 +30,13 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class MultiplicationPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule
+ public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
@Test
public void timeMultiplyIntByConstant10() {
int result = 1;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result *= 10;
}
@@ -44,7 +45,7 @@
@Test
public void timeMultiplyIntByConstant8() {
int result = 1;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result *= 8;
}
@@ -54,7 +55,7 @@
public void timeMultiplyIntByVariable10() {
int result = 1;
int factor = 10;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result *= factor;
}
@@ -64,7 +65,7 @@
public void timeMultiplyIntByVariable8() {
int result = 1;
int factor = 8;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 ba21ed3..d073f91 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -35,7 +35,8 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class ReferenceGetPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule
+ public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
boolean mIntrinsicDisabled;
@@ -51,7 +52,7 @@
@Test
public void timeSoftReferenceGet() throws Exception {
Reference soft = new SoftReference(mObj);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
Object o = soft.get();
}
@@ -60,7 +61,7 @@
@Test
public void timeWeakReferenceGet() throws Exception {
Reference weak = new WeakReference(mObj);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
Object o = weak.get();
}
@@ -71,7 +72,7 @@
Reference weak = new WeakReference(mObj);
mObj = null;
Runtime.getRuntime().gc();
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 293752e..af13773 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -34,7 +34,8 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class ReferencePerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule
+ public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
private Object mObject;
@@ -42,7 +43,7 @@
@Test
public void timeAlloc() {
ReferenceQueue<Object> queue = new ReferenceQueue<Object>();
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
new PhantomReference(mObject, queue);
}
@@ -52,7 +53,7 @@
@Test
public void timeAllocAndEnqueue() {
ReferenceQueue<Object> queue = new ReferenceQueue<Object>();
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
(new PhantomReference<Object>(mObject, queue)).enqueue();
}
@@ -62,7 +63,7 @@
@Test
public void timeAllocEnqueueAndPoll() {
ReferenceQueue<Object> queue = new ReferenceQueue<Object>();
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
(new PhantomReference<Object>(mObject, queue)).enqueue();
queue.poll();
@@ -73,7 +74,7 @@
@Test
public void timeAllocEnqueueAndRemove() {
ReferenceQueue<Object> queue = new ReferenceQueue<Object>();
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
(new PhantomReference<Object>(mObject, queue)).enqueue();
try {
@@ -102,7 +103,7 @@
// Allocate a bunch of finalizable objects.
int n = 0;
AtomicInteger count = new AtomicInteger(0);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 528b751..cf573fa 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -41,7 +41,9 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class SmallBigIntegerPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule
+ public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+
// 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);
@@ -51,7 +53,7 @@
public void testSmallBigInteger() {
final Random r = new Random();
BigInteger x = new BigInteger(20, r);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 1f301ac..d28154c 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -30,13 +30,14 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class StringDexCachePerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule
+ public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
@Test
public void timeStringDexCacheAccess() {
int v = 0;
int count = 0;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 4268325..40a8db0 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -30,12 +30,13 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class StringIterationPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule
+ public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
@Test
public void timeStringIteration0() {
String s = "hello, world!";
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
char ch;
for (int i = 0; i < s.length(); ++i) {
@@ -47,7 +48,7 @@
@Test
public void timeStringIteration1() {
String s = "hello, world!";
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
char ch;
for (int i = 0, length = s.length(); i < length; ++i) {
@@ -59,7 +60,7 @@
@Test
public void timeStringIteration2() {
String s = "hello, world!";
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
char ch;
char[] chars = s.toCharArray();
@@ -72,7 +73,7 @@
@Test
public void timeStringToCharArray() {
String s = "hello, world!";
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
char[] chars = s.toCharArray();
}
diff --git a/apct-tests/perftests/core/src/android/libcore/SystemArrayCopyPerfTest.java b/apct-tests/perftests/core/src/android/libcore/SystemArrayCopyPerfTest.java
index 6363e9c..25e4c43 100644
--- a/apct-tests/perftests/core/src/android/libcore/SystemArrayCopyPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/SystemArrayCopyPerfTest.java
@@ -16,7 +16,8 @@
package android.libcore;
-import android.perftests.utils.BenchmarkState;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
@@ -34,7 +35,8 @@
@RunWith(JUnitParamsRunner.class)
@LargeTest
public class SystemArrayCopyPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule
+ public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
public static Collection<Object[]> getData() {
return Arrays.asList(
@@ -51,7 +53,7 @@
final int len = arrayLength;
char[] src = new char[len];
char[] dst = new char[len];
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
System.arraycopy(src, 0, dst, 0, len);
}
@@ -63,7 +65,7 @@
final int len = arrayLength;
byte[] src = new byte[len];
byte[] dst = new byte[len];
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
System.arraycopy(src, 0, dst, 0, len);
}
@@ -75,7 +77,7 @@
final int len = arrayLength;
short[] src = new short[len];
short[] dst = new short[len];
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
System.arraycopy(src, 0, dst, 0, len);
}
@@ -87,7 +89,7 @@
final int len = arrayLength;
int[] src = new int[len];
int[] dst = new int[len];
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
System.arraycopy(src, 0, dst, 0, len);
}
@@ -99,7 +101,7 @@
final int len = arrayLength;
long[] src = new long[len];
long[] dst = new long[len];
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
System.arraycopy(src, 0, dst, 0, len);
}
@@ -111,7 +113,7 @@
final int len = arrayLength;
float[] src = new float[len];
float[] dst = new float[len];
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
System.arraycopy(src, 0, dst, 0, len);
}
@@ -123,7 +125,7 @@
final int len = arrayLength;
double[] src = new double[len];
double[] dst = new double[len];
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
System.arraycopy(src, 0, dst, 0, len);
}
@@ -135,7 +137,7 @@
final int len = arrayLength;
boolean[] src = new boolean[len];
boolean[] dst = new boolean[len];
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
System.arraycopy(src, 0, dst, 0, len);
}
diff --git a/apct-tests/perftests/core/src/android/libcore/VirtualVersusInterfacePerfTest.java b/apct-tests/perftests/core/src/android/libcore/VirtualVersusInterfacePerfTest.java
index cb3d3ac..147ea50 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -36,12 +36,13 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VirtualVersusInterfacePerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule
+ public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
@Test
public void timeMapPut() {
Map<String, String> map = new HashMap<String, String>();
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
map.put("hello", "world");
}
@@ -50,7 +51,7 @@
@Test
public void timeHashMapPut() {
HashMap<String, String> map = new HashMap<String, String>();
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 5be8ee6..bb1c298 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
@@ -36,7 +36,8 @@
@RunWith(JUnitParamsRunner.class)
@LargeTest
public class XmlSerializePerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule
+ public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
private Object[] getParams() {
return new Object[][] {
@@ -108,7 +109,7 @@
private void internalTimeSerializer(Constructor<? extends XmlSerializer> ctor, int seed)
throws Exception {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 a37b89d..9360a25 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import android.util.Xml;
import androidx.test.filters.LargeTest;
@@ -44,11 +44,11 @@
public class XmlSerializerPerfTest {
@Rule
- public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
@Test
public void timeFastSerializer_nonIndent_depth100() throws IOException {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
XmlSerializer serializer = Xml.newFastSerializer();
runTest(serializer, 100);
@@ -57,7 +57,7 @@
@Test
public void timeFastSerializer_indent_depth100() throws IOException {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
XmlSerializer serializer = Xml.newFastSerializer();
serializer.setFeature("http://xmlpull.org/v1/doc/features.html#indent-output", true);
@@ -67,7 +67,7 @@
@Test
public void timeKXmlSerializer_nonIndent_depth100() throws IOException {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
XmlSerializer serializer = XmlObjectFactory.newXmlSerializer();
runTest(serializer, 100);
@@ -76,7 +76,7 @@
@Test
public void timeKXmlSerializer_indent_depth100() throws IOException {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 ed669be..03f183a 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
@@ -42,7 +42,8 @@
@RunWith(JUnitParamsRunner.class)
@LargeTest
public class ZipFilePerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule
+ public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
private File mFile;
@@ -65,7 +66,7 @@
@Parameters(method = "getData")
public void timeZipFileOpen(int numEntries) throws Exception {
setUp(numEntries);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 d239a05..3614061 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
@@ -44,7 +44,8 @@
@RunWith(JUnitParamsRunner.class)
@LargeTest
public class ZipFileReadPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule
+ public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
public static Collection<Object[]> getData() {
return Arrays.asList(new Object[][] {{1024}, {16384}, {65536}});
@@ -91,7 +92,7 @@
@Parameters(method = "getData")
public void timeZipFileRead(int readBufferSize) throws Exception {
byte[] readBuffer = new byte[readBufferSize];
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
ZipFile zipFile = new ZipFile(mFile);
for (Enumeration<? extends ZipEntry> 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 487295c..8890f51 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -35,7 +35,8 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class AnnotatedElementPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule
+ public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
private Class<?> mType;
private Field mField;
@@ -52,7 +53,7 @@
@Test
public void timeGetTypeAnnotations() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
mType.getAnnotations();
}
@@ -60,7 +61,7 @@
@Test
public void timeGetFieldAnnotations() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
mField.getAnnotations();
}
@@ -68,7 +69,7 @@
@Test
public void timeGetMethodAnnotations() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
mMethod.getAnnotations();
}
@@ -76,7 +77,7 @@
@Test
public void timeGetParameterAnnotations() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
mMethod.getParameterAnnotations();
}
@@ -84,7 +85,7 @@
@Test
public void timeGetTypeAnnotation() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
mType.getAnnotation(Marker.class);
}
@@ -92,7 +93,7 @@
@Test
public void timeGetFieldAnnotation() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
mField.getAnnotation(Marker.class);
}
@@ -100,7 +101,7 @@
@Test
public void timeGetMethodAnnotation() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
mMethod.getAnnotation(Marker.class);
}
@@ -108,7 +109,7 @@
@Test
public void timeIsTypeAnnotationPresent() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
mType.isAnnotationPresent(Marker.class);
}
@@ -116,7 +117,7 @@
@Test
public void timeIsFieldAnnotationPresent() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
mField.isAnnotationPresent(Marker.class);
}
@@ -124,7 +125,7 @@
@Test
public void timeIsMethodAnnotationPresent() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
mMethod.isAnnotationPresent(Marker.class);
}
@@ -134,7 +135,7 @@
@Test
public void timeGetAllReturnsLargeAnnotation() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
HasLargeAnnotation.class.getAnnotations();
}
@@ -142,7 +143,7 @@
@Test
public void timeGetAllReturnsSmallAnnotation() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
HasSmallAnnotation.class.getAnnotations();
}
@@ -150,7 +151,7 @@
@Test
public void timeGetAllReturnsMarkerAnnotation() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
HasMarkerAnnotation.class.getAnnotations();
}
@@ -158,7 +159,7 @@
@Test
public void timeGetAllReturnsNoAnnotation() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
HasNoAnnotations.class.getAnnotations();
}
@@ -166,7 +167,7 @@
@Test
public void timeGetAllReturnsThreeAnnotations() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
HasThreeAnnotations.class.getAnnotations();
}
@@ -176,7 +177,7 @@
@Test
public void timeGetAnnotationsOnSubclass() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
ExtendsHasThreeAnnotations.class.getAnnotations();
}
@@ -184,7 +185,7 @@
@Test
public void timeGetDeclaredAnnotationsOnSubclass() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
ExtendsHasThreeAnnotations.class.getDeclaredAnnotations();
}
@@ -194,7 +195,7 @@
@Test
public void timeGetDeclaredClasses() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
AnnotatedElementPerfTest.class.getDeclaredClasses();
}
@@ -202,7 +203,7 @@
@Test
public void timeGetDeclaringClass() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
HasSmallAnnotation.class.getDeclaringClass();
}
@@ -211,7 +212,7 @@
@Test
public void timeGetEnclosingClass() {
Object anonymousClass = new Object() {};
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
anonymousClass.getClass().getEnclosingClass();
}
@@ -220,7 +221,7 @@
@Test
public void timeGetEnclosingConstructor() {
Object anonymousClass = new Object() {};
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
anonymousClass.getClass().getEnclosingConstructor();
}
@@ -229,7 +230,7 @@
@Test
public void timeGetEnclosingMethod() {
Object anonymousClass = new Object() {};
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
anonymousClass.getClass().getEnclosingMethod();
}
@@ -237,7 +238,7 @@
@Test
public void timeGetModifiers() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
HasSmallAnnotation.class.getModifiers();
}
@@ -245,7 +246,7 @@
@Test
public void timeGetSimpleName() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
HasSmallAnnotation.class.getSimpleName();
}
@@ -254,7 +255,7 @@
@Test
public void timeIsAnonymousClass() {
Object anonymousClass = new Object() {};
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
anonymousClass.getClass().isAnonymousClass();
}
@@ -262,7 +263,7 @@
@Test
public void timeIsLocalClass() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 adc5d8c..baab860 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -34,14 +34,14 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class BidiPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
private static final AttributedCharacterIterator CHAR_ITER =
DecimalFormat.getInstance().formatToCharacterIterator(new BigDecimal(Math.PI));
@Test
public void time_createBidiFromIter() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
Bidi bidi = new Bidi(CHAR_ITER);
}
@@ -49,7 +49,7 @@
@Test
public void time_createBidiFromCharArray() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
Bidi bd =
new Bidi(
@@ -64,7 +64,7 @@
@Test
public void time_createBidiFromString() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
Bidi bidi = new Bidi("Hello", Bidi.DIRECTION_LEFT_TO_RIGHT);
}
@@ -72,7 +72,7 @@
@Test
public void time_reorderVisually() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 @@
@Test
public void time_hebrewBidi() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
Bidi bd =
new Bidi(
@@ -104,7 +104,7 @@
@Test
public void time_complicatedOverrideBidi() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
Bidi bd =
new Bidi(
@@ -119,7 +119,7 @@
@Test
public void time_requiresBidi() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 286d703..8a539f8 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -32,14 +32,14 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class BigIntegerPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
@Test
public void timeRandomDivision() throws Exception {
Random r = new Random();
BigInteger x = new BigInteger(1024, r);
BigInteger y = new BigInteger(1024, r);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
x.divide(y);
}
@@ -50,7 +50,7 @@
Random r = new Random();
BigInteger x = new BigInteger(1024, r);
BigInteger y = new BigInteger(1024, r);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
x.gcd(y);
}
@@ -61,7 +61,7 @@
Random r = new Random();
BigInteger x = new BigInteger(1024, r);
BigInteger y = new BigInteger(1024, r);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 d646202..1b46ff4 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
@@ -35,7 +35,7 @@
@RunWith(JUnitParamsRunner.class)
@LargeTest
public class BitSetPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
public static Collection<Object[]> getData() {
return Arrays.asList(new Object[][] {{1000}, {10000}});
@@ -45,7 +45,7 @@
@Parameters(method = "getData")
public void timeIsEmptyTrue(int size) {
BitSet bitSet = new BitSet(size);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
if (!bitSet.isEmpty()) throw new RuntimeException();
}
@@ -56,7 +56,7 @@
public void timeIsEmptyFalse(int size) {
BitSet bitSet = new BitSet(size);
bitSet.set(bitSet.size() - 1);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
if (bitSet.isEmpty()) throw new RuntimeException();
}
@@ -66,7 +66,7 @@
@Parameters(method = "getData")
public void timeGet(int size) {
BitSet bitSet = new BitSet(size);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
int i = 1;
while (state.keepRunning()) {
bitSet.get(++i % size);
@@ -77,7 +77,7 @@
@Parameters(method = "getData")
public void timeClear(int size) {
BitSet bitSet = new BitSet(size);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
int i = 1;
while (state.keepRunning()) {
bitSet.clear(++i % size);
@@ -89,7 +89,7 @@
public void timeSet(int size) {
BitSet bitSet = new BitSet(size);
int i = 1;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
bitSet.set(++i % size);
}
@@ -100,7 +100,7 @@
public void timeSetOn(int size) {
BitSet bitSet = new BitSet(size);
int i = 1;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
bitSet.set(++i % size, true);
}
@@ -111,7 +111,7 @@
public void timeSetOff(int size) {
BitSet bitSet = new BitSet(size);
int i = 1;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 b887f40..3c5e4fd 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
@@ -36,7 +36,7 @@
@RunWith(JUnitParamsRunner.class)
@LargeTest
public final class BreakIteratorPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
public enum Text {
LIPSUM(
@@ -165,7 +165,7 @@
@Test
@Parameters(method = "getData")
public void timeBreakIterator(Text text) {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
BreakIterator it = BreakIterator.getLineInstance(text.mLocale);
it.setText(text.mText);
@@ -179,7 +179,7 @@
@Test
@Parameters(method = "getData")
public void timeIcuBreakIterator(Text text) {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 e4eaf12..6df67bc 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
@@ -39,7 +39,7 @@
@RunWith(JUnitParamsRunner.class)
@LargeTest
public class BulkPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
public static Collection<Object[]> getData() {
return Arrays.asList(
@@ -120,7 +120,7 @@
throws Exception {
ByteBuffer src = BulkPerfTest.newBuffer(align, sBuf, size);
ByteBuffer data = BulkPerfTest.newBuffer(align, dBuf, size);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 cb2438e..4cf46e5 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
@@ -46,7 +46,7 @@
@RunWith(JUnitParamsRunner.class)
@LargeTest
public class ByteBufferPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
public enum MyByteOrder {
BIG(ByteOrder.BIG_ENDIAN),
@@ -121,7 +121,7 @@
public void timeByteBuffer_getByte(
MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception {
ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
src.position(aligned ? 0 : 1);
for (int i = 0; i < 1024; ++i) {
@@ -136,7 +136,7 @@
MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception {
ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType);
byte[] dst = new byte[1024];
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
for (int i = 0; i < 1024; ++i) {
src.position(aligned ? 0 : 1);
@@ -150,7 +150,7 @@
public void timeByteBuffer_getByte_indexed(
MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception {
ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
src.position(aligned ? 0 : 1);
for (int i = 0; i < 1024; ++i) {
@@ -164,7 +164,7 @@
public void timeByteBuffer_getChar(
MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception {
ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
src.position(aligned ? 0 : 1);
for (int i = 0; i < 1024; ++i) {
@@ -180,7 +180,7 @@
CharBuffer src =
ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType).asCharBuffer();
char[] dst = new char[1024];
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
for (int i = 0; i < 1024; ++i) {
src.position(0);
@@ -194,7 +194,7 @@
public void timeByteBuffer_getChar_indexed(
MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception {
ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
src.position(aligned ? 0 : 1);
for (int i = 0; i < 1024; ++i) {
@@ -208,7 +208,7 @@
public void timeByteBuffer_getDouble(
MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception {
ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
src.position(aligned ? 0 : 1);
for (int i = 0; i < 1024; ++i) {
@@ -224,7 +224,7 @@
DoubleBuffer src =
ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType).asDoubleBuffer();
double[] dst = new double[1024];
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
for (int i = 0; i < 1024; ++i) {
src.position(0);
@@ -238,7 +238,7 @@
public void timeByteBuffer_getFloat(
MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception {
ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
src.position(aligned ? 0 : 1);
for (int i = 0; i < 1024; ++i) {
@@ -254,7 +254,7 @@
FloatBuffer src =
ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType).asFloatBuffer();
float[] dst = new float[1024];
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
for (int i = 0; i < 1024; ++i) {
src.position(0);
@@ -268,7 +268,7 @@
public void timeByteBuffer_getInt(
MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception {
ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
src.position(aligned ? 0 : 1);
for (int i = 0; i < 1024; ++i) {
@@ -283,7 +283,7 @@
MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception {
IntBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType).asIntBuffer();
int[] dst = new int[1024];
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
for (int i = 0; i < 1024; ++i) {
src.position(0);
@@ -297,7 +297,7 @@
public void timeByteBuffer_getLong(
MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception {
ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
src.position(aligned ? 0 : 1);
for (int i = 0; i < 1024; ++i) {
@@ -313,7 +313,7 @@
LongBuffer src =
ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType).asLongBuffer();
long[] dst = new long[1024];
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
for (int i = 0; i < 1024; ++i) {
src.position(0);
@@ -327,7 +327,7 @@
public void timeByteBuffer_getShort(
MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception {
ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
src.position(aligned ? 0 : 1);
for (int i = 0; i < 1024; ++i) {
@@ -343,7 +343,7 @@
ShortBuffer src =
ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType).asShortBuffer();
short[] dst = new short[1024];
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
for (int i = 0; i < 1024; ++i) {
src.position(0);
@@ -361,7 +361,7 @@
public void timeByteBuffer_putByte(
MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception {
ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
src.position(0);
for (int i = 0; i < 1024; ++i) {
@@ -376,7 +376,7 @@
MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception {
ByteBuffer dst = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType);
byte[] src = new byte[1024];
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
for (int i = 0; i < 1024; ++i) {
dst.position(aligned ? 0 : 1);
@@ -390,7 +390,7 @@
public void timeByteBuffer_putChar(
MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception {
ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
src.position(aligned ? 0 : 1);
for (int i = 0; i < 1024; ++i) {
@@ -406,7 +406,7 @@
CharBuffer dst =
ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType).asCharBuffer();
char[] src = new char[1024];
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
for (int i = 0; i < 1024; ++i) {
dst.position(0);
@@ -420,7 +420,7 @@
public void timeByteBuffer_putDouble(
MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception {
ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
src.position(aligned ? 0 : 1);
for (int i = 0; i < 1024; ++i) {
@@ -436,7 +436,7 @@
DoubleBuffer dst =
ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType).asDoubleBuffer();
double[] src = new double[1024];
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
for (int i = 0; i < 1024; ++i) {
dst.position(0);
@@ -450,7 +450,7 @@
public void timeByteBuffer_putFloat(
MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception {
ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
src.position(aligned ? 0 : 1);
for (int i = 0; i < 1024; ++i) {
@@ -466,7 +466,7 @@
FloatBuffer dst =
ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType).asFloatBuffer();
float[] src = new float[1024];
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
for (int i = 0; i < 1024; ++i) {
dst.position(0);
@@ -480,7 +480,7 @@
public void timeByteBuffer_putInt(
MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception {
ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
src.position(aligned ? 0 : 1);
for (int i = 0; i < 1024; ++i) {
@@ -495,7 +495,7 @@
MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception {
IntBuffer dst = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType).asIntBuffer();
int[] src = new int[1024];
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
for (int i = 0; i < 1024; ++i) {
dst.position(0);
@@ -509,7 +509,7 @@
public void timeByteBuffer_putLong(
MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception {
ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
src.position(aligned ? 0 : 1);
for (int i = 0; i < 1024; ++i) {
@@ -525,7 +525,7 @@
LongBuffer dst =
ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType).asLongBuffer();
long[] src = new long[1024];
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
for (int i = 0; i < 1024; ++i) {
dst.position(0);
@@ -539,7 +539,7 @@
public void timeByteBuffer_putShort(
MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception {
ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
src.position(aligned ? 0 : 1);
for (int i = 0; i < 1024; ++i) {
@@ -555,7 +555,7 @@
ShortBuffer dst =
ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType).asShortBuffer();
short[] src = new short[1024];
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
for (int i = 0; i < 1024; ++i) {
dst.position(0);
@@ -567,7 +567,7 @@
@Test
@Parameters(method = "getData")
public void time_new_byteArray() throws Exception {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
byte[] bs = new byte[8192];
}
@@ -576,7 +576,7 @@
@Test
@Parameters(method = "getData")
public void time_ByteBuffer_allocate() throws Exception {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 9ee927c..8c318cd 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
@@ -35,7 +35,7 @@
@RunWith(JUnitParamsRunner.class)
@LargeTest
public class ByteBufferScalarVersusVectorPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
public static Collection<Object[]> getData() {
return Arrays.asList(
@@ -112,7 +112,7 @@
throws Exception {
ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType);
ByteBuffer dst = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
src.position(0);
dst.position(0);
@@ -127,7 +127,7 @@
public void timeByteBufferBulkGet(boolean aligned) throws Exception {
ByteBuffer src = ByteBuffer.allocate(aligned ? 8192 : 8192 + 1);
byte[] dst = new byte[8192];
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
src.position(aligned ? 0 : 1);
src.get(dst, 0, dst.length);
@@ -139,7 +139,7 @@
public void timeDirectByteBufferBulkGet(boolean aligned) throws Exception {
ByteBuffer src = ByteBuffer.allocateDirect(aligned ? 8192 : 8192 + 1);
byte[] dst = new byte[8192];
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 e4a4db7..12c1f8c 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
@@ -38,7 +38,7 @@
@RunWith(JUnitParamsRunner.class)
@LargeTest
public class CharacterPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
public static Collection<Object[]> getData() {
return Arrays.asList(
@@ -84,7 +84,7 @@
public void timeIsSpace(CharacterSet characterSet, Overload overload) {
setUp(characterSet);
boolean fake = false;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
if (overload == Overload.CHAR) {
while (state.keepRunning()) {
for (int ch = 0; ch < 65536; ++ch) {
@@ -104,7 +104,7 @@
@Parameters(method = "getData")
public void timeDigit(CharacterSet characterSet, Overload overload) {
setUp(characterSet);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
if (overload == Overload.CHAR) {
while (state.keepRunning()) {
for (int ch = 0; ch < 65536; ++ch) {
@@ -124,7 +124,7 @@
@Parameters(method = "getData")
public void timeGetNumericValue(CharacterSet characterSet, Overload overload) {
setUp(characterSet);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
if (overload == Overload.CHAR) {
while (state.keepRunning()) {
for (int ch = 0; ch < 65536; ++ch) {
@@ -144,7 +144,7 @@
@Parameters(method = "getData")
public void timeIsDigit(CharacterSet characterSet, Overload overload) {
setUp(characterSet);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
if (overload == Overload.CHAR) {
while (state.keepRunning()) {
for (int ch = 0; ch < 65536; ++ch) {
@@ -164,7 +164,7 @@
@Parameters(method = "getData")
public void timeIsIdentifierIgnorable(CharacterSet characterSet, Overload overload) {
setUp(characterSet);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
if (overload == Overload.CHAR) {
while (state.keepRunning()) {
for (int ch = 0; ch < 65536; ++ch) {
@@ -184,7 +184,7 @@
@Parameters(method = "getData")
public void timeIsJavaIdentifierPart(CharacterSet characterSet, Overload overload) {
setUp(characterSet);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
if (overload == Overload.CHAR) {
while (state.keepRunning()) {
for (int ch = 0; ch < 65536; ++ch) {
@@ -204,7 +204,7 @@
@Parameters(method = "getData")
public void timeIsJavaIdentifierStart(CharacterSet characterSet, Overload overload) {
setUp(characterSet);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
if (overload == Overload.CHAR) {
while (state.keepRunning()) {
for (int ch = 0; ch < 65536; ++ch) {
@@ -224,7 +224,7 @@
@Parameters(method = "getData")
public void timeIsLetter(CharacterSet characterSet, Overload overload) {
setUp(characterSet);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
if (overload == Overload.CHAR) {
while (state.keepRunning()) {
for (int ch = 0; ch < 65536; ++ch) {
@@ -244,7 +244,7 @@
@Parameters(method = "getData")
public void timeIsLetterOrDigit(CharacterSet characterSet, Overload overload) {
setUp(characterSet);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
if (overload == Overload.CHAR) {
while (state.keepRunning()) {
for (int ch = 0; ch < 65536; ++ch) {
@@ -264,7 +264,7 @@
@Parameters(method = "getData")
public void timeIsLowerCase(CharacterSet characterSet, Overload overload) {
setUp(characterSet);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
if (overload == Overload.CHAR) {
while (state.keepRunning()) {
for (int ch = 0; ch < 65536; ++ch) {
@@ -284,7 +284,7 @@
@Parameters(method = "getData")
public void timeIsSpaceChar(CharacterSet characterSet, Overload overload) {
setUp(characterSet);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
if (overload == Overload.CHAR) {
while (state.keepRunning()) {
for (int ch = 0; ch < 65536; ++ch) {
@@ -304,7 +304,7 @@
@Parameters(method = "getData")
public void timeIsUpperCase(CharacterSet characterSet, Overload overload) {
setUp(characterSet);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
if (overload == Overload.CHAR) {
while (state.keepRunning()) {
for (int ch = 0; ch < 65536; ++ch) {
@@ -324,7 +324,7 @@
@Parameters(method = "getData")
public void timeIsWhitespace(CharacterSet characterSet, Overload overload) {
setUp(characterSet);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
if (overload == Overload.CHAR) {
while (state.keepRunning()) {
for (int ch = 0; ch < 65536; ++ch) {
@@ -344,7 +344,7 @@
@Parameters(method = "getData")
public void timeToLowerCase(CharacterSet characterSet, Overload overload) {
setUp(characterSet);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
if (overload == Overload.CHAR) {
while (state.keepRunning()) {
for (int ch = 0; ch < 65536; ++ch) {
@@ -364,7 +364,7 @@
@Parameters(method = "getData")
public void timeToUpperCase(CharacterSet characterSet, Overload overload) {
setUp(characterSet);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 858c101..4dd890a 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
@@ -33,7 +33,7 @@
@RunWith(JUnitParamsRunner.class)
@LargeTest
public class CharsetForNamePerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
public static String[] charsetNames() {
return new String[] {
@@ -52,7 +52,7 @@
@Test
@Parameters(method = "charsetNames")
public void timeCharsetForName(String charsetName) throws Exception {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 a2fb7d7..3a71ce9 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
@@ -34,7 +34,7 @@
@RunWith(JUnitParamsRunner.class)
@LargeTest
public class CharsetPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
public static Collection<Object[]> getData() {
return Arrays.asList(
@@ -91,7 +91,7 @@
@Parameters(method = "getData")
public void time_new_String_BString(int length, String name) throws Exception {
byte[] bytes = makeBytes(makeString(length));
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
new String(bytes, name);
}
@@ -101,7 +101,7 @@
@Parameters(method = "getData")
public void time_new_String_BII(int length, String name) throws Exception {
byte[] bytes = makeBytes(makeString(length));
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
new String(bytes, 0, bytes.length);
}
@@ -111,7 +111,7 @@
@Parameters(method = "getData")
public void time_new_String_BIIString(int length, String name) throws Exception {
byte[] bytes = makeBytes(makeString(length));
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
new String(bytes, 0, bytes.length, name);
}
@@ -121,7 +121,7 @@
@Parameters(method = "getData")
public void time_String_getBytes(int length, String name) throws Exception {
String string = makeString(length);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 2047444..6c30a16 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -35,7 +35,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class CharsetUtf8PerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
private void makeUnicodeRange(int startingCodePoint, int endingCodePoint) {
StringBuilder builder = new StringBuilder();
@@ -46,7 +46,7 @@
}
String str = builder.toString();
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 4ce8b41..dcdfd37 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -32,13 +32,13 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class ChecksumPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
@Test
public void timeAdler_block() throws Exception {
byte[] bytes = new byte[10000];
Adler32 adler = new Adler32();
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
adler.update(bytes);
}
@@ -47,7 +47,7 @@
@Test
public void timeAdler_byte() throws Exception {
Adler32 adler = new Adler32();
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
adler.update(1);
}
@@ -57,7 +57,7 @@
public void timeCrc_block() throws Exception {
byte[] bytes = new byte[10000];
CRC32 crc = new CRC32();
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
crc.update(bytes);
}
@@ -66,7 +66,7 @@
@Test
public void timeCrc_byte() throws Exception {
CRC32 crc = new CRC32();
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 6a7ec1a..6c175b1 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -41,7 +41,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class CipherInputStreamPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
private static final int DATA_SIZE = 1024 * 1024;
private static final byte[] DATA = new byte[DATA_SIZE];
@@ -80,7 +80,7 @@
@Test
public void timeEncrypt() throws Exception {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 238c028..136822e 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
@@ -47,7 +47,7 @@
@RunWith(JUnitParamsRunner.class)
@LargeTest
public class CipherPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
public static Collection getCases() {
int[] keySizes = new int[] {128, 192, 256};
@@ -180,7 +180,7 @@
Mode mode, Padding padding, int keySize, int inputSize, Implementation implementation)
throws Exception {
setUp(mode, padding, keySize, implementation);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
mCipherEncrypt.doFinal(DATA, 0, inputSize, mOutput);
}
@@ -192,7 +192,7 @@
Mode mode, Padding padding, int keySize, int inputSize, Implementation implementation)
throws Exception {
setUp(mode, padding, keySize, implementation);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 7e55660..9efb7ce 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -33,7 +33,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class CollatorPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
private static final RuleBasedCollator COLLATOR =
(RuleBasedCollator) Collator.getInstance(Locale.US);
@@ -41,7 +41,7 @@
@Test
public void timeCollatorPrimary() {
COLLATOR.setStrength(Collator.PRIMARY);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
COLLATOR.compare("abcde", "abcdf");
COLLATOR.compare("abcde", "abcde");
@@ -52,7 +52,7 @@
@Test
public void timeCollatorSecondary() {
COLLATOR.setStrength(Collator.SECONDARY);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
COLLATOR.compare("abcdÂ", "abcdÄ");
COLLATOR.compare("abcdÂ", "abcdÂ");
@@ -63,7 +63,7 @@
@Test
public void timeCollatorTertiary() {
COLLATOR.setStrength(Collator.TERTIARY);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
COLLATOR.compare("abcdE", "abcde");
COLLATOR.compare("abcde", "abcde");
@@ -74,7 +74,7 @@
@Test
public void timeCollatorIdentical() {
COLLATOR.setStrength(Collator.IDENTICAL);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 100798a..4e5ceaf 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
@@ -40,7 +40,7 @@
@RunWith(JUnitParamsRunner.class)
@LargeTest
public class CollectionsPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
public static Collection<Object[]> getData() {
return Arrays.asList(new Object[][] {{4}, {16}, {64}, {256}, {1024}});
@@ -60,7 +60,7 @@
@Parameters(method = "getData")
public void timeSort_arrayList(int arrayListLength) throws Exception {
List<Integer> input = buildList(arrayListLength, ArrayList.class);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
Collections.sort(input);
}
@@ -70,7 +70,7 @@
@Parameters(method = "getData")
public void timeSortWithComparator_arrayList(int arrayListLength) throws Exception {
List<Integer> input = buildList(arrayListLength, ArrayList.class);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
Collections.sort(input, REVERSE);
}
@@ -80,7 +80,7 @@
@Parameters(method = "getData")
public void timeSort_vector(int arrayListLength) throws Exception {
List<Integer> input = buildList(arrayListLength, Vector.class);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
Collections.sort(input);
}
@@ -90,7 +90,7 @@
@Parameters(method = "getData")
public void timeSortWithComparator_vector(int arrayListLength) throws Exception {
List<Integer> input = buildList(arrayListLength, Vector.class);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 b6784a8..b0ccd99 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -33,7 +33,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public final class DateFormatPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
private Locale mLocale1;
private Locale mLocale2;
@@ -50,7 +50,7 @@
@Test
public void timeGetDateTimeInstance() throws Exception {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
DateFormat.getDateTimeInstance();
}
@@ -58,7 +58,7 @@
@Test
public void timeGetDateTimeInstance_multiple() throws Exception {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 52f9873..3a2f6fa 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -34,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class DecimalFormatPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
private static final String EXP_PATTERN = "##E0";
@@ -58,7 +58,7 @@
public void formatWithGrouping(Object obj) {
DF.setGroupingSize(3);
DF.setGroupingUsed(true);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
DF.format(obj);
}
@@ -66,21 +66,21 @@
public void format(String pattern, Object obj) {
PATTERN_INSTANCE.applyPattern(pattern);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
PATTERN_INSTANCE.format(obj);
}
}
public void format(Object obj) {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
DF.format(obj);
}
}
public void formatToCharacterIterator(Object obj) {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
DF.formatToCharacterIterator(obj);
}
@@ -88,14 +88,14 @@
public void formatCurrencyUS(Object obj) {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
DF_CURRENCY_US.format(obj);
}
}
public void formatCurrencyFR(Object obj) {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
DF_CURRENCY_FR.format(obj);
}
@@ -213,7 +213,7 @@
@Test
public void time_instantiation() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 6105420..4bc550e 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -31,13 +31,13 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class DecimalFormatSymbolsPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
private static Locale sLocale = Locale.getDefault(Locale.Category.FORMAT);
@Test
public void time_instantiation() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 fae74a5..597447b 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -31,11 +31,11 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class DefaultCharsetPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
@Test
public void time_defaultCharset() throws Exception {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 2915363..b17d0f4 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -32,7 +32,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class DnsPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
@Test
public void timeDns() throws Exception {
@@ -53,7 +53,7 @@
"www.cnn.com",
"bad.host.mtv.corp.google.com",
};
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 dd7e5cc..4c8a8ea 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -32,11 +32,11 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class DoPrivilegedPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
@Test
public void timeDirect() throws Exception {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
String lineSeparator = System.getProperty("line.separator");
}
@@ -44,7 +44,7 @@
@Test
public void timeFastAndSlow() throws Exception {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
String lineSeparator;
if (System.getSecurityManager() == null) {
@@ -61,7 +61,7 @@
@Test
public void timeNewAction() throws Exception {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
String lineSeparator = AccessController.doPrivileged(new PrivilegedAction<String>() {
public String run() {
@@ -74,7 +74,7 @@
@Test
public void timeReusedAction() throws Exception {
final PrivilegedAction<String> action = new ReusableAction("line.separator");
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 e034a47..4ff65b1 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -29,7 +29,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class DoublePerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
private double mD = 1.2;
private long mL = 4608083138725491507L;
@@ -37,7 +37,7 @@
@Test
public void timeDoubleToLongBits() {
long result = 123;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = Double.doubleToLongBits(mD);
}
@@ -49,7 +49,7 @@
@Test
public void timeDoubleToRawLongBits() {
long result = 123;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = Double.doubleToRawLongBits(mD);
}
@@ -61,7 +61,7 @@
@Test
public void timeLongBitsToDouble() {
double result = 123.0;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 fe1b599..aacdcee1 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
@@ -37,7 +37,7 @@
@RunWith(JUnitParamsRunner.class)
@LargeTest
public final class EqualsHashCodePerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
private enum Type {
URI() {
@@ -82,7 +82,7 @@
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");
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
mA1.equals(mB1);
mA1.equals(mA2);
@@ -95,7 +95,7 @@
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");
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
mA1.hashCode();
mB1.hashCode();
@@ -112,7 +112,7 @@
"http://developer.android.com/query?q="
+ QUERY.substring(0, QUERY.length() - 3)
+ "%AF");
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 ecbfc71..9a6864e 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -41,11 +41,11 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class ExpensiveObjectsPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
@Test
public void timeNewDateFormatTimeInstance() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
DateFormat df = DateFormat.getTimeInstance(DateFormat.SHORT);
df.format(System.currentTimeMillis());
@@ -55,7 +55,7 @@
@Test(timeout = 900000)
public void timeClonedDateFormatTimeInstance() {
DateFormat df = DateFormat.getTimeInstance(DateFormat.SHORT);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
((DateFormat) df.clone()).format(System.currentTimeMillis());
}
@@ -64,7 +64,7 @@
@Test
public void timeReusedDateFormatTimeInstance() {
DateFormat df = DateFormat.getTimeInstance(DateFormat.SHORT);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
synchronized (df) {
df.format(System.currentTimeMillis());
@@ -74,7 +74,7 @@
@Test(timeout = 900000)
public void timeNewCollator() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
Collator.getInstance(Locale.US);
}
@@ -83,7 +83,7 @@
@Test
public void timeClonedCollator() {
Collator c = Collator.getInstance(Locale.US);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
c.clone();
}
@@ -91,7 +91,7 @@
@Test
public void timeNewDateFormatSymbols() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
new DateFormatSymbols(Locale.US);
}
@@ -100,7 +100,7 @@
@Test
public void timeClonedDateFormatSymbols() {
DateFormatSymbols dfs = new DateFormatSymbols(Locale.US);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
dfs.clone();
}
@@ -108,7 +108,7 @@
@Test
public void timeNewDecimalFormatSymbols() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
new DecimalFormatSymbols(Locale.US);
}
@@ -117,7 +117,7 @@
@Test
public void timeClonedDecimalFormatSymbols() {
DecimalFormatSymbols dfs = new DecimalFormatSymbols(Locale.US);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
dfs.clone();
}
@@ -125,7 +125,7 @@
@Test
public void timeNewNumberFormat() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
NumberFormat.getInstance(Locale.US);
}
@@ -134,7 +134,7 @@
@Test
public void timeClonedNumberFormat() {
NumberFormat nf = NumberFormat.getInstance(Locale.US);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
nf.clone();
}
@@ -142,7 +142,7 @@
@Test
public void timeLongToString() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
Long.toString(1024L);
}
@@ -151,7 +151,7 @@
@Test
public void timeNumberFormatTrivialFormatDouble() {
NumberFormat nf = NumberFormat.getInstance(Locale.US);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
nf.format(1024.0);
}
@@ -159,7 +159,7 @@
@Test
public void timeNewSimpleDateFormat() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
new SimpleDateFormat();
}
@@ -167,7 +167,7 @@
@Test
public void timeNewGregorianCalendar() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
new GregorianCalendar();
}
@@ -176,7 +176,7 @@
@Test
public void timeClonedGregorianCalendar() {
GregorianCalendar gc = new GregorianCalendar();
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 0c14d64..cef7e8c7 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -31,11 +31,11 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public final class FilePerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
@Test
public void timeFileCreationWithEmptyChild() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
new File("/foo", "/");
}
@@ -43,7 +43,7 @@
@Test
public void timeFileCreationWithNormalizationNecessary() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 7d7d83b..645c023 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -29,7 +29,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class FloatPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
private float mFloat = 1.2f;
private int mInt = 1067030938;
@@ -37,7 +37,7 @@
@Test
public void timeFloatToIntBits() {
int result = 123;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = Float.floatToIntBits(mFloat);
}
@@ -49,7 +49,7 @@
@Test
public void timeFloatToRawIntBits() {
int result = 123;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = Float.floatToRawIntBits(mFloat);
}
@@ -61,7 +61,7 @@
@Test
public void timeIntBitsToFloat() {
float result = 123.0f;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 08dda53..cf76137 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -35,11 +35,11 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class FormatterPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
@Test
public void timeFormatter_NoFormatting() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 @@
@Test
public void timeStringBuilder_NoFormatting() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 @@
@Test
public void timeFormatter_OneInt() {
Integer value = Integer.valueOf(1024); // We're not trying to benchmark boxing here.
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 void timeFormatter_OneIntArabic() {
Locale arabic = new Locale("ar");
Integer value = Integer.valueOf(1024); // We're not trying to benchmark boxing here.
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 @@
@Test
public void timeStringBuilder_OneInt() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
StringBuilder sb = new StringBuilder();
sb.append("this is a reasonably short string that has an int ");
@@ -90,7 +90,7 @@
@Test
public void timeFormatter_OneHexInt() {
Integer value = Integer.valueOf(1024); // We're not trying to benchmark boxing here.
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 @@
@Test
public void timeStringBuilder_OneHexInt() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
StringBuilder sb = new StringBuilder();
sb.append("this is a reasonably short string that has an int ");
@@ -111,7 +111,7 @@
@Test
public void timeFormatter_OneFloat() {
Float value = Float.valueOf(10.24f); // We're not trying to benchmark boxing here.
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 @@
@Test
public void timeFormatter_OneFloat_dot2f() {
Float value = Float.valueOf(10.24f); // We're not trying to benchmark boxing here.
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 @@
@Test
public void timeFormatter_TwoFloats() {
Float value = Float.valueOf(10.24f); // We're not trying to benchmark boxing here.
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 @@
@Test
public void timeStringBuilder_OneFloat() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
StringBuilder sb = new StringBuilder();
sb.append("this is a reasonably short string that has a float ");
@@ -151,7 +151,7 @@
@Test
public void timeFormatter_OneString() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 @@
@Test
public void timeStringBuilder_OneString() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 a09ad80..833575a 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -31,11 +31,11 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class IdnPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
@Test
public void timeToUnicode() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
IDN.toASCII("fass.de");
IDN.toASCII("faß.de");
@@ -51,7 +51,7 @@
@Test
public void timeToAscii() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 be22814..1c901c8 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -29,12 +29,12 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class IntConstantDivisionPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
@Test
public void timeDivideIntByConstant2() {
int result = 1;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result /= 2;
}
@@ -43,7 +43,7 @@
@Test
public void timeDivideIntByConstant8() {
int result = 1;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result /= 8;
}
@@ -52,7 +52,7 @@
@Test
public void timeDivideIntByConstant10() {
int result = 1;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result /= 10;
}
@@ -61,7 +61,7 @@
@Test
public void timeDivideIntByConstant100() {
int result = 1;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result /= 100;
}
@@ -70,7 +70,7 @@
@Test
public void timeDivideIntByConstant100_HandOptimized() {
int result = 1;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = (int) ((0x51eb851fL * result) >>> 37);
}
@@ -79,7 +79,7 @@
@Test
public void timeDivideIntByConstant2048() {
int result = 1;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result /= 2048;
}
@@ -89,7 +89,7 @@
public void timeDivideIntByVariable2() {
int result = 1;
int factor = 2;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result /= factor;
}
@@ -99,7 +99,7 @@
public void timeDivideIntByVariable10() {
int result = 1;
int factor = 10;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 4337c90..3d3af4c 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -29,12 +29,12 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class IntConstantMultiplicationPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
@Test
public void timeMultiplyIntByConstant6() {
int result = 1;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result *= 6;
}
@@ -43,7 +43,7 @@
@Test
public void timeMultiplyIntByConstant7() {
int result = 1;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result *= 7;
}
@@ -52,7 +52,7 @@
@Test
public void timeMultiplyIntByConstant8() {
int result = 1;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result *= 8;
}
@@ -61,7 +61,7 @@
@Test
public void timeMultiplyIntByConstant8_Shift() {
int result = 1;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result <<= 3;
}
@@ -70,7 +70,7 @@
@Test
public void timeMultiplyIntByConstant10() {
int result = 1;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result *= 10;
}
@@ -79,7 +79,7 @@
@Test
public void timeMultiplyIntByConstant10_Shift() {
int result = 1;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = (result + (result << 2)) << 1;
}
@@ -88,7 +88,7 @@
@Test
public void timeMultiplyIntByConstant2047() {
int result = 1;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result *= 2047;
}
@@ -97,7 +97,7 @@
@Test
public void timeMultiplyIntByConstant2048() {
int result = 1;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result *= 2048;
}
@@ -106,7 +106,7 @@
@Test
public void timeMultiplyIntByConstant2049() {
int result = 1;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result *= 2049;
}
@@ -116,7 +116,7 @@
public void timeMultiplyIntByVariable10() {
int result = 1;
int factor = 10;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result *= factor;
}
@@ -126,7 +126,7 @@
public void timeMultiplyIntByVariable8() {
int result = 1;
int factor = 8;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 1b6c502..7c86633 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -29,12 +29,12 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class IntConstantRemainderPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
@Test
public void timeRemainderIntByConstant2() {
int result = 1;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result %= 2;
}
@@ -43,7 +43,7 @@
@Test
public void timeRemainderIntByConstant8() {
int result = 1;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result %= 8;
}
@@ -52,7 +52,7 @@
@Test
public void timeRemainderIntByConstant10() {
int result = 1;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result %= 10;
}
@@ -61,7 +61,7 @@
@Test
public void timeRemainderIntByConstant100() {
int result = 1;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result %= 100;
}
@@ -70,7 +70,7 @@
@Test
public void timeRemainderIntByConstant2048() {
int result = 1;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result %= 2048;
}
@@ -80,7 +80,7 @@
public void timeRemainderIntByVariable2() {
int result = 1;
int factor = 2;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result %= factor;
}
@@ -90,7 +90,7 @@
public void timeRemainderIntByVariable10() {
int result = 1;
int factor = 10;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 170bb58..e2a9dcc 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import org.junit.Rule;
import org.junit.Test;
public class IntegerPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
@Test
public void timeLongSignumBranch() {
int t = 0;
int i = 0;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
t += signum1(-(++i));
t += signum1(0);
@@ -41,7 +41,7 @@
public void timeLongSignumBranchFree() {
int t = 0;
int i = 0;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
t += signum2(-(++i));
t += signum2(0);
@@ -61,7 +61,7 @@
public void timeLongBitCount_BitSet() {
int t = 0;
int i = 0;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
t += pop((long) ++i);
}
@@ -89,7 +89,7 @@
public void timeLongBitCount_2Int() {
int t = 0;
int i = 0;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
t += pop2((long) ++i);
}
@@ -105,7 +105,7 @@
public void timeLongBitCount_Long() {
int t = 0;
int i = 0;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
t += Long.bitCount((long) ++i);
}
@@ -140,7 +140,7 @@
public void timeNumberOfTrailingZerosHD() {
int t = 0;
int i = 0;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
t += numberOfTrailingZerosHD(++i);
}
@@ -150,7 +150,7 @@
public void timeNumberOfTrailingZerosOL() {
int t = 0;
int i = 0;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
t += numberOfTrailingZerosOL(++i);
}
@@ -163,7 +163,7 @@
"0", "1", "12", "123", "1234", "12345", "123456", "1234567", "12345678"
};
int t = 0;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 0aa854e..669bfbf 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -29,7 +29,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class IntegralToStringPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
private static final int SMALL = 12;
private static final int MEDIUM = 12345;
@@ -37,7 +37,7 @@
@Test
public void time_IntegerToString_small() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
Integer.toString(SMALL);
}
@@ -45,7 +45,7 @@
@Test
public void time_IntegerToString_medium() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
Integer.toString(MEDIUM);
}
@@ -53,7 +53,7 @@
@Test
public void time_IntegerToString_large() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
Integer.toString(LARGE);
}
@@ -61,7 +61,7 @@
@Test
public void time_IntegerToString2_small() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
Integer.toString(SMALL, 2);
}
@@ -69,7 +69,7 @@
@Test
public void time_IntegerToString2_medium() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
Integer.toString(MEDIUM, 2);
}
@@ -77,7 +77,7 @@
@Test
public void time_IntegerToString2_large() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
Integer.toString(LARGE, 2);
}
@@ -85,7 +85,7 @@
@Test
public void time_IntegerToString10_small() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
Integer.toString(SMALL, 10);
}
@@ -93,7 +93,7 @@
@Test
public void time_IntegerToString10_medium() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
Integer.toString(MEDIUM, 10);
}
@@ -101,7 +101,7 @@
@Test
public void time_IntegerToString10_large() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
Integer.toString(LARGE, 10);
}
@@ -109,7 +109,7 @@
@Test
public void time_IntegerToString16_small() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
Integer.toString(SMALL, 16);
}
@@ -117,7 +117,7 @@
@Test
public void time_IntegerToString16_medium() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
Integer.toString(MEDIUM, 16);
}
@@ -125,7 +125,7 @@
@Test
public void time_IntegerToString16_large() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
Integer.toString(LARGE, 16);
}
@@ -133,7 +133,7 @@
@Test
public void time_IntegerToBinaryString_small() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
Integer.toBinaryString(SMALL);
}
@@ -141,7 +141,7 @@
@Test
public void time_IntegerToBinaryString_medium() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
Integer.toBinaryString(MEDIUM);
}
@@ -149,7 +149,7 @@
@Test
public void time_IntegerToBinaryString_large() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
Integer.toBinaryString(LARGE);
}
@@ -157,7 +157,7 @@
@Test
public void time_IntegerToHexString_small() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
Integer.toHexString(SMALL);
}
@@ -165,7 +165,7 @@
@Test
public void time_IntegerToHexString_medium() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
Integer.toHexString(MEDIUM);
}
@@ -173,7 +173,7 @@
@Test
public void time_IntegerToHexString_large() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
Integer.toHexString(LARGE);
}
@@ -181,7 +181,7 @@
@Test
public void time_StringBuilder_small() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
new StringBuilder().append(SMALL);
}
@@ -189,7 +189,7 @@
@Test
public void time_StringBuilder_medium() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
new StringBuilder().append(MEDIUM);
}
@@ -197,7 +197,7 @@
@Test
public void time_StringBuilder_large() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
new StringBuilder().append(LARGE);
}
@@ -205,7 +205,7 @@
@Test
public void time_Formatter_small() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
String.format("%d", SMALL);
}
@@ -213,7 +213,7 @@
@Test
public void time_Formatter_medium() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
String.format("%d", MEDIUM);
}
@@ -221,7 +221,7 @@
@Test
public void time_Formatter_large() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 9b3d7a0..cda8512 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
@@ -36,7 +36,7 @@
@RunWith(JUnitParamsRunner.class)
@LargeTest
public class KeyPairGeneratorPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
public static Collection<Object[]> getData() {
return Arrays.asList(
@@ -78,7 +78,7 @@
@Parameters(method = "getData")
public void time(Algorithm algorithm, Implementation implementation) throws Exception {
setUp(algorithm, implementation);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 1a9e19a..8b062d3 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
@@ -39,7 +39,7 @@
@RunWith(JUnitParamsRunner.class)
@LargeTest
public class LoopingBackwardsPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
public static Collection<Object[]> getData() {
return Arrays.asList(new Object[][] {{2}, {20}, {2000}, {20000000}});
@@ -49,7 +49,7 @@
@Parameters(method = "getData")
public void timeForwards(int max) {
int fake = 0;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
for (int j = 0; j < max; j++) {
fake += j;
@@ -61,7 +61,7 @@
@Parameters(method = "getData")
public void timeBackwards(int max) {
int fake = 0;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 a8a704c..bcf556c 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -33,7 +33,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class MathPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
private final double mDouble = 1.2;
private final float mFloat = 1.2f;
@@ -48,7 +48,7 @@
@Test
public void timeAbsD() {
double result = mDouble;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = Math.abs(mDouble);
}
@@ -57,7 +57,7 @@
@Test
public void timeAbsF() {
float result = mFloat;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = Math.abs(mFloat);
}
@@ -66,7 +66,7 @@
@Test
public void timeAbsI() {
int result = mInt;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = Math.abs(mInt);
}
@@ -75,7 +75,7 @@
@Test
public void timeAbsL() {
long result = mLong;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = Math.abs(mLong);
}
@@ -84,7 +84,7 @@
@Test
public void timeAcos() {
double result = mDouble;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = Math.acos(mDouble);
}
@@ -93,7 +93,7 @@
@Test
public void timeAsin() {
double result = mDouble;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = Math.asin(mDouble);
}
@@ -102,7 +102,7 @@
@Test
public void timeAtan() {
double result = mDouble;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = Math.atan(mDouble);
}
@@ -111,7 +111,7 @@
@Test
public void timeAtan2() {
double result = mDouble;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = Math.atan2(3, 4);
}
@@ -120,7 +120,7 @@
@Test
public void timeCbrt() {
double result = mDouble;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = Math.cbrt(mDouble);
}
@@ -129,7 +129,7 @@
@Test
public void timeCeil() {
double result = mDouble;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = Math.ceil(mDouble);
}
@@ -138,7 +138,7 @@
@Test
public void timeCopySignD() {
double result = mDouble;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = Math.copySign(mDouble, mDouble);
}
@@ -147,7 +147,7 @@
@Test
public void timeCopySignF() {
float result = mFloat;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = Math.copySign(mFloat, mFloat);
}
@@ -156,7 +156,7 @@
@Test
public void timeCopySignD_strict() {
double result = mDouble;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = StrictMath.copySign(mDouble, mDouble);
}
@@ -165,7 +165,7 @@
@Test
public void timeCopySignF_strict() {
float result = mFloat;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = StrictMath.copySign(mFloat, mFloat);
}
@@ -174,7 +174,7 @@
@Test
public void timeCos() {
double result = mDouble;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = Math.cos(mDouble);
}
@@ -183,7 +183,7 @@
@Test
public void timeCosh() {
double result = mDouble;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = Math.cosh(mDouble);
}
@@ -192,7 +192,7 @@
@Test
public void timeExp() {
double result = mDouble;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = Math.exp(mDouble);
}
@@ -201,7 +201,7 @@
@Test
public void timeExpm1() {
double result = mDouble;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = Math.expm1(mDouble);
}
@@ -210,7 +210,7 @@
@Test
public void timeFloor() {
double result = mDouble;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = Math.floor(mDouble);
}
@@ -219,7 +219,7 @@
@Test
public void timeGetExponentD() {
int result = mInt;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = Math.getExponent(mDouble);
}
@@ -228,7 +228,7 @@
@Test
public void timeGetExponentF() {
int result = mInt;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = Math.getExponent(mFloat);
}
@@ -237,7 +237,7 @@
@Test
public void timeHypot() {
double result = mDouble;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = Math.hypot(mDouble, mDouble);
}
@@ -246,7 +246,7 @@
@Test
public void timeIEEEremainder() {
double result = mDouble;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = Math.IEEEremainder(mDouble, mDouble);
}
@@ -255,7 +255,7 @@
@Test
public void timeLog() {
double result = mDouble;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = Math.log(mDouble);
}
@@ -264,7 +264,7 @@
@Test
public void timeLog10() {
double result = mDouble;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = Math.log10(mDouble);
}
@@ -273,7 +273,7 @@
@Test
public void timeLog1p() {
double result = mDouble;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = Math.log1p(mDouble);
}
@@ -282,7 +282,7 @@
@Test
public void timeMaxD() {
double result = mDouble;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = Math.max(mDouble, mDouble);
}
@@ -291,7 +291,7 @@
@Test
public void timeMaxF() {
float result = mFloat;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = Math.max(mFloat, mFloat);
}
@@ -300,7 +300,7 @@
@Test
public void timeMaxI() {
int result = mInt;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = Math.max(mInt, mInt);
}
@@ -309,7 +309,7 @@
@Test
public void timeMaxL() {
long result = mLong;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = Math.max(mLong, mLong);
}
@@ -318,7 +318,7 @@
@Test
public void timeMinD() {
double result = mDouble;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = Math.min(mDouble, mDouble);
}
@@ -327,7 +327,7 @@
@Test
public void timeMinF() {
float result = mFloat;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = Math.min(mFloat, mFloat);
}
@@ -336,7 +336,7 @@
@Test
public void timeMinI() {
int result = mInt;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = Math.min(mInt, mInt);
}
@@ -345,7 +345,7 @@
@Test
public void timeMinL() {
long result = mLong;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = Math.min(mLong, mLong);
}
@@ -354,7 +354,7 @@
@Test
public void timeNextAfterD() {
double result = mDouble;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = Math.nextAfter(mDouble, mDouble);
}
@@ -363,7 +363,7 @@
@Test
public void timeNextAfterF() {
float result = mFloat;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = Math.nextAfter(mFloat, mFloat);
}
@@ -372,7 +372,7 @@
@Test
public void timeNextUpD() {
double result = mDouble;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = Math.nextUp(mDouble);
}
@@ -381,7 +381,7 @@
@Test
public void timeNextUpF() {
float result = mFloat;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = Math.nextUp(mFloat);
}
@@ -390,7 +390,7 @@
@Test
public void timePow() {
double result = mDouble;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = Math.pow(mDouble, mDouble);
}
@@ -399,7 +399,7 @@
@Test
public void timeRandom() {
double result = mDouble;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = Math.random();
}
@@ -408,7 +408,7 @@
@Test
public void timeRint() {
double result = mDouble;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = Math.rint(mDouble);
}
@@ -417,7 +417,7 @@
@Test
public void timeRoundD() {
long result = mLong;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = Math.round(mDouble);
}
@@ -426,7 +426,7 @@
@Test
public void timeRoundF() {
int result = mInt;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = Math.round(mFloat);
}
@@ -435,7 +435,7 @@
@Test
public void timeScalbD() {
double result = mDouble;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = Math.scalb(mDouble, 5);
}
@@ -444,7 +444,7 @@
@Test
public void timeScalbF() {
float result = mFloat;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = Math.scalb(mFloat, 5);
}
@@ -453,7 +453,7 @@
@Test
public void timeSignumD() {
double result = mDouble;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = Math.signum(mDouble);
}
@@ -462,7 +462,7 @@
@Test
public void timeSignumF() {
float result = mFloat;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = Math.signum(mFloat);
}
@@ -471,7 +471,7 @@
@Test
public void timeSin() {
double result = mDouble;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = Math.sin(mDouble);
}
@@ -480,7 +480,7 @@
@Test
public void timeSinh() {
double result = mDouble;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = Math.sinh(mDouble);
}
@@ -489,7 +489,7 @@
@Test
public void timeSqrt() {
double result = mDouble;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = Math.sqrt(mDouble);
}
@@ -498,7 +498,7 @@
@Test
public void timeTan() {
double result = mDouble;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = Math.tan(mDouble);
}
@@ -507,7 +507,7 @@
@Test
public void timeTanh() {
double result = mDouble;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = Math.tanh(mDouble);
}
@@ -516,7 +516,7 @@
@Test
public void timeToDegrees() {
double result = mDouble;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = Math.toDegrees(mDouble);
}
@@ -525,7 +525,7 @@
@Test
public void timeToRadians() {
double result = mDouble;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = Math.toRadians(mDouble);
}
@@ -534,7 +534,7 @@
@Test
public void timeUlpD() {
double result = mDouble;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result = Math.ulp(mDouble);
}
@@ -543,7 +543,7 @@
@Test
public void timeUlpF() {
float result = mFloat;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 6da9666..8325dae 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
@@ -36,7 +36,7 @@
@RunWith(JUnitParamsRunner.class)
@LargeTest
public class MessageDigestPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
public static Collection<Object[]> getData() {
return Arrays.asList(
@@ -97,7 +97,7 @@
@Test
@Parameters(method = "getData")
public void time(Algorithm algorithm) throws Exception {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
MessageDigest digest = MessageDigest.getInstance(algorithm.toString(), mProvider);
digest.update(DATA, 0, DATA_SIZE);
@@ -108,7 +108,7 @@
@Test
@Parameters(method = "getData")
public void timeLargeArray(Algorithm algorithm) throws Exception {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
MessageDigest digest = MessageDigest.getInstance(algorithm.toString(), mProvider);
digest.update(LARGE_DATA, 0, LARGE_DATA_SIZE);
@@ -119,7 +119,7 @@
@Test
@Parameters(method = "getData")
public void timeSmallChunkOfLargeArray(Algorithm algorithm) throws Exception {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
MessageDigest digest = MessageDigest.getInstance(algorithm.toString(), mProvider);
digest.update(LARGE_DATA, LARGE_DATA_SIZE / 2, DATA_SIZE);
@@ -130,7 +130,7 @@
@Test
@Parameters(method = "getData")
public void timeSmallByteBuffer(Algorithm algorithm) throws Exception {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
MessageDigest digest = MessageDigest.getInstance(algorithm.toString(), mProvider);
SMALL_BUFFER.position(0);
@@ -143,7 +143,7 @@
@Test
@Parameters(method = "getData")
public void timeSmallDirectByteBuffer(Algorithm algorithm) throws Exception {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
MessageDigest digest = MessageDigest.getInstance(algorithm.toString(), mProvider);
SMALL_DIRECT_BUFFER.position(0);
@@ -156,7 +156,7 @@
@Test
@Parameters(method = "getData")
public void timeLargeByteBuffer(Algorithm algorithm) throws Exception {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
MessageDigest digest = MessageDigest.getInstance(algorithm.toString(), mProvider);
LARGE_BUFFER.position(0);
@@ -169,7 +169,7 @@
@Test
@Parameters(method = "getData")
public void timeLargeDirectByteBuffer(Algorithm algorithm) throws Exception {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
MessageDigest digest = MessageDigest.getInstance(algorithm.toString(), mProvider);
LARGE_DIRECT_BUFFER.position(0);
@@ -182,7 +182,7 @@
@Test
@Parameters(method = "getData")
public void timeSmallChunkOfLargeByteBuffer(Algorithm algorithm) throws Exception {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
MessageDigest digest = MessageDigest.getInstance(algorithm.toString(), mProvider);
LARGE_BUFFER.position(LARGE_BUFFER.capacity() / 2);
@@ -195,7 +195,7 @@
@Test
@Parameters(method = "getData")
public void timeSmallChunkOfLargeDirectByteBuffer(Algorithm algorithm) throws Exception {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 060d18f..266d42c 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
@@ -35,7 +35,7 @@
@RunWith(JUnitParamsRunner.class)
@LargeTest
public final class MutableIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
enum Kind {
ARRAY() {
@@ -105,21 +105,21 @@
@Test
@Parameters(method = "getData")
public void timeCreate(Kind kind) {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
kind.timeCreate(state);
}
@Test
@Parameters(method = "getData")
public void timeIncrement(Kind kind) {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
kind.timeIncrement(state);
}
@Test
@Parameters(method = "getData")
public void timeGet(Kind kind) {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 7cb3b22..c2f84fb 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -32,13 +32,13 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class NumberFormatPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
private static Locale sLocale = Locale.getDefault(Locale.Category.FORMAT);
@Test
public void time_instantiation() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 272b45a..cdf0911 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -36,12 +36,12 @@
@LargeTest
public class NumberFormatTrivialFormatLongPerfTest {
@Rule
- public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
@Test
public void timeNumberFormatTrivialFormatLong() {
NumberFormat nf = NumberFormat.getInstance(Locale.US);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 c3a0966..51f47bb 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
@@ -39,7 +39,7 @@
@RunWith(JUnitParamsRunner.class)
@LargeTest
public class PriorityQueuePerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
public static Collection<Object[]> getData() {
return Arrays.asList(
@@ -108,7 +108,7 @@
// At most allow the queue to empty 10%.
int resizingThreshold = queueSize / 10;
int i = 0;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 2ac56be..1f20cae 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -33,7 +33,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public final class PropertyAccessPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
private View mView = new View();
private Method mSetX;
@@ -50,7 +50,7 @@
@Test
public void timeDirectSetter() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
mView.mSetX(0.1f);
}
@@ -58,7 +58,7 @@
@Test
public void timeDirectFieldSet() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
mView.mX = 0.1f;
}
@@ -66,7 +66,7 @@
@Test
public void timeDirectSetterAndBomXing() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
Float value = 0.1f;
mView.mSetX(value);
@@ -75,7 +75,7 @@
@Test
public void timeDirectFieldSetAndBomXing() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
Float value = 0.1f;
mView.mX = value;
@@ -84,7 +84,7 @@
@Test
public void timeReflectionSetterAndTwoBomXes() throws Exception {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
mSetX.invoke(mView, 0.1f);
}
@@ -92,7 +92,7 @@
@Test
public void timeReflectionSetterAndOneBomX() throws Exception {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
mArgsBomX[0] = 0.1f;
mSetX.invoke(mView, mArgsBomX);
@@ -101,7 +101,7 @@
@Test
public void timeReflectionFieldSet() throws Exception {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
mX.setFloat(mView, 0.1f);
}
@@ -109,7 +109,7 @@
@Test
public void timeGeneratedSetter() throws Exception {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
mGeneratedSetter.setFloat(mView, 0.1f);
}
@@ -117,7 +117,7 @@
@Test
public void timeGeneratedFieldSet() throws Exception {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 7ad0141..0c16265 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -34,11 +34,11 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class ProviderPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
@Test
public void timeStableProviders() throws Exception {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
Cipher c = Cipher.getInstance("RSA");
}
@@ -46,7 +46,7 @@
@Test
public void timeWithNewProvider() throws Exception {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 c7b6cb5..5f1bfc2 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -32,11 +32,11 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class RandomPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
@Test
public void timeNewRandom() throws Exception {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
Random rng = new Random();
rng.nextInt();
@@ -46,7 +46,7 @@
@Test
public void timeReusedRandom() throws Exception {
Random rng = new Random();
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
rng.nextInt();
}
@@ -55,7 +55,7 @@
@Test
public void timeReusedSecureRandom() throws Exception {
SecureRandom rng = new SecureRandom();
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
rng.nextInt();
}
@@ -63,7 +63,7 @@
@Test
public void timeNewSecureRandom() throws Exception {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 44e5f22..008c94c 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -29,7 +29,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class RealToStringPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
private static final float SMALL = -123.45f;
private static final float MEDIUM = -123.45e8f;
@@ -37,7 +37,7 @@
@Test
public void timeFloat_toString_NaN() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
Float.toString(Float.NaN);
}
@@ -45,7 +45,7 @@
@Test
public void timeFloat_toString_NEGATIVE_INFINITY() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
Float.toString(Float.NEGATIVE_INFINITY);
}
@@ -53,7 +53,7 @@
@Test
public void timeFloat_toString_POSITIVE_INFINITY() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
Float.toString(Float.POSITIVE_INFINITY);
}
@@ -61,7 +61,7 @@
@Test
public void timeFloat_toString_zero() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
Float.toString(0.0f);
}
@@ -69,7 +69,7 @@
@Test
public void timeFloat_toString_minusZero() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
Float.toString(-0.0f);
}
@@ -77,7 +77,7 @@
@Test
public void timeFloat_toString_small() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
Float.toString(SMALL);
}
@@ -85,7 +85,7 @@
@Test
public void timeFloat_toString_medium() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
Float.toString(MEDIUM);
}
@@ -93,7 +93,7 @@
@Test
public void timeFloat_toString_large() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
Float.toString(LARGE);
}
@@ -101,7 +101,7 @@
@Test
public void timeStringBuilder_small() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
new StringBuilder().append(SMALL);
}
@@ -109,7 +109,7 @@
@Test
public void timeStringBuilder_medium() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
new StringBuilder().append(MEDIUM);
}
@@ -117,7 +117,7 @@
@Test
public void timeStringBuilder_large() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
new StringBuilder().append(LARGE);
}
@@ -125,7 +125,7 @@
@Test
public void timeFormatter_small() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
String.format("%f", SMALL);
}
@@ -133,7 +133,7 @@
@Test
public void timeFormatter_medium() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
String.format("%f", MEDIUM);
}
@@ -141,7 +141,7 @@
@Test
public void timeFormatter_large() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
String.format("%f", LARGE);
}
@@ -149,7 +149,7 @@
@Test
public void timeFormatter_dot2f_small() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
String.format("%.2f", SMALL);
}
@@ -157,7 +157,7 @@
@Test
public void timeFormatter_dot2f_medium() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
String.format("%.2f", MEDIUM);
}
@@ -165,7 +165,7 @@
@Test
public void timeFormatter_dot2f_large() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 6e00b1083..45b623d 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -33,12 +33,12 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class ReflectionPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
@Test
public void timeObject_getClass() throws Exception {
C c = new C();
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
c.getClass();
}
@@ -47,7 +47,7 @@
@Test
public void timeClass_getField() throws Exception {
Class<?> klass = C.class;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
klass.getField("f");
}
@@ -56,7 +56,7 @@
@Test
public void timeClass_getDeclaredField() throws Exception {
Class<?> klass = C.class;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
klass.getDeclaredField("f");
}
@@ -65,7 +65,7 @@
@Test
public void timeClass_getConstructor() throws Exception {
Class<?> klass = C.class;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
klass.getConstructor();
}
@@ -75,7 +75,7 @@
public void timeClass_newInstance() throws Exception {
Class<?> klass = C.class;
Constructor constructor = klass.getConstructor();
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
constructor.newInstance();
}
@@ -84,7 +84,7 @@
@Test
public void timeClass_getMethod() throws Exception {
Class<?> klass = C.class;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
klass.getMethod("m");
}
@@ -93,7 +93,7 @@
@Test
public void timeClass_getDeclaredMethod() throws Exception {
Class<?> klass = C.class;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
klass.getDeclaredMethod("m");
}
@@ -104,7 +104,7 @@
Class<?> klass = C.class;
Field f = klass.getDeclaredField("f");
C instance = new C();
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
f.setInt(instance, 1);
}
@@ -115,7 +115,7 @@
Class<?> klass = C.class;
Field f = klass.getDeclaredField("f");
C instance = new C();
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
f.getInt(instance);
}
@@ -126,7 +126,7 @@
Class<?> klass = C.class;
Method m = klass.getDeclaredMethod("m");
C instance = new C();
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
m.invoke(instance);
}
@@ -136,7 +136,7 @@
public void timeMethod_invokeStaticV() throws Exception {
Class<?> klass = C.class;
Method m = klass.getDeclaredMethod("sm");
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
m.invoke(null);
}
@@ -147,7 +147,7 @@
Class<?> klass = C.class;
Method m = klass.getDeclaredMethod("setField", int.class);
C instance = new C();
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
m.invoke(instance, 1);
}
@@ -159,7 +159,7 @@
Method m = klass.getDeclaredMethod("setField", int.class);
C instance = new C();
Integer one = Integer.valueOf(1);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
m.invoke(instance, one);
}
@@ -169,7 +169,7 @@
public void timeMethod_invokeStaticI() throws Exception {
Class<?> klass = C.class;
Method m = klass.getDeclaredMethod("setStaticField", int.class);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
m.invoke(null, 1);
}
@@ -180,7 +180,7 @@
Class<?> klass = C.class;
Method m = klass.getDeclaredMethod("setStaticField", int.class);
Integer one = Integer.valueOf(1);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
m.invoke(null, one);
}
@@ -189,7 +189,7 @@
@Test
public void timeRegularMethodInvocation() throws Exception {
C instance = new C();
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
instance.setField(1);
}
@@ -197,7 +197,7 @@
@Test
public void timeRegularConstructor() throws Exception {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
new C();
}
@@ -206,7 +206,7 @@
@Test
public void timeClass_classNewInstance() throws Exception {
Class<?> klass = C.class;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
klass.newInstance();
}
@@ -216,7 +216,7 @@
public void timeClass_isInstance() throws Exception {
D d = new D();
Class<?> klass = IC.class;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
klass.isInstance(d);
}
@@ -224,7 +224,7 @@
@Test
public void timeGetInstanceField() throws Exception {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 @@
@Test
public void timeGetStaticField() throws Exception {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
R.class.getField("WEEK_NUMBER_COLOR");
}
@@ -242,7 +242,7 @@
@Test
public void timeGetInterfaceStaticField() throws Exception {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
F.class.getField("SF");
}
@@ -250,7 +250,7 @@
@Test
public void timeGetSuperClassField() throws Exception {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 5a9b5c3..da69f9f 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -35,11 +35,11 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class SSLLoopbackPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
@Test
public void time() throws Exception {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 6d48cf2..9f2c312 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -31,11 +31,11 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class SSLSocketFactoryPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
@Test
public void time() throws Exception {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 8641629..7c60c05 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
@@ -37,7 +37,7 @@
@RunWith(JUnitParamsRunner.class)
@LargeTest
public final class SchemePrefixPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
enum Strategy {
JAVA() {
@@ -94,7 +94,7 @@
@Test
@Parameters(method = "getData")
public void timeSchemePrefix(Strategy strategy) {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 afd1191..1812983 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -37,7 +37,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class SerializationPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
private static byte[] bytes(Object o) throws Exception {
ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
@@ -110,7 +110,7 @@
public void timeWriteNoObjects() throws Exception {
ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
ObjectOutputStream out = new ObjectOutputStream(baos);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
out.reset();
baos.reset();
@@ -121,7 +121,7 @@
private void readSingleObject(Object object) throws Exception {
byte[] bytes = bytes(object);
ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
ObjectInputStream in = new ObjectInputStream(bais);
in.readObject();
@@ -133,7 +133,7 @@
private void writeSingleObject(Object o) throws Exception {
ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
ObjectOutputStream out = new ObjectOutputStream(baos);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 6c26133..34e9bfb 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
@@ -41,7 +41,7 @@
@RunWith(JUnitParamsRunner.class)
@LargeTest
public class SignaturePerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
public static Collection<Object[]> getData() {
return Arrays.asList(
@@ -117,7 +117,7 @@
@Parameters(method = "getData")
public void timeSign(Algorithm algorithm, Implementation implementation) throws Exception {
setUp(algorithm);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
Signature signer;
switch (implementation) {
@@ -140,7 +140,7 @@
@Parameters(method = "getData")
public void timeVerify(Algorithm algorithm, Implementation implementation) throws Exception {
setUp(algorithm);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 274b51f..2fe6798 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -37,11 +37,11 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class SimpleDateFormatPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
@Test
public void time_createFormatWithTimeZone() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd z");
}
@@ -50,7 +50,7 @@
@Test
public void time_parseWithTimeZoneShort() throws ParseException {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd z");
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
sdf.parse("2000.01.01 PST");
}
@@ -59,7 +59,7 @@
@Test
public void time_parseWithTimeZoneLong() throws ParseException {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd zzzz");
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
sdf.parse("2000.01.01 Pacific Standard Time");
}
@@ -68,7 +68,7 @@
@Test
public void time_parseWithoutTimeZone() throws ParseException {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd");
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
sdf.parse("2000.01.01");
}
@@ -76,7 +76,7 @@
@Test
public void time_createAndParseWithTimeZoneShort() throws ParseException {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd z");
sdf.parse("2000.01.01 PST");
@@ -85,7 +85,7 @@
@Test
public void time_createAndParseWithTimeZoneLong() throws ParseException {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd zzzz");
sdf.parse("2000.01.01 Pacific Standard Time");
@@ -95,7 +95,7 @@
@Test
public void time_formatWithTimeZoneShort() {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd z");
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
sdf.format(new Date());
}
@@ -104,7 +104,7 @@
@Test
public void time_formatWithTimeZoneLong() {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd zzzz");
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 b4c427b..fbe3cef 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -33,7 +33,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class StrictMathPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
private final double mDouble = 1.2;
private final float mFloat = 1.2f;
@@ -74,7 +74,7 @@
@Test
public void timeAbsD() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
StrictMath.abs(mDouble);
}
@@ -82,7 +82,7 @@
@Test
public void timeAbsF() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
StrictMath.abs(mFloat);
}
@@ -90,7 +90,7 @@
@Test
public void timeAbsI() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
StrictMath.abs(mInt);
}
@@ -98,7 +98,7 @@
@Test
public void timeAbsL() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
StrictMath.abs(mLong);
}
@@ -106,7 +106,7 @@
@Test
public void timeAcos() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
StrictMath.acos(mDouble);
}
@@ -114,7 +114,7 @@
@Test
public void timeAsin() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
StrictMath.asin(mDouble);
}
@@ -122,7 +122,7 @@
@Test
public void timeAtan() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
StrictMath.atan(mDouble);
}
@@ -130,7 +130,7 @@
@Test
public void timeAtan2() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
StrictMath.atan2(3, 4);
}
@@ -138,7 +138,7 @@
@Test
public void timeCbrt() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
StrictMath.cbrt(mDouble);
}
@@ -146,7 +146,7 @@
@Test
public void timeCeilOverInterestingValues() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
for (int i = 0; i < CEIL_DOUBLES.length; ++i) {
StrictMath.ceil(CEIL_DOUBLES[i]);
@@ -156,7 +156,7 @@
@Test
public void timeCopySignD() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
StrictMath.copySign(mDouble, mDouble);
}
@@ -164,7 +164,7 @@
@Test
public void timeCopySignF() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
StrictMath.copySign(mFloat, mFloat);
}
@@ -172,7 +172,7 @@
@Test
public void timeCos() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
StrictMath.cos(mDouble);
}
@@ -180,7 +180,7 @@
@Test
public void timeCosh() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
StrictMath.cosh(mDouble);
}
@@ -188,7 +188,7 @@
@Test
public void timeExp() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
StrictMath.exp(mDouble);
}
@@ -196,7 +196,7 @@
@Test
public void timeExpm1() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
StrictMath.expm1(mDouble);
}
@@ -204,7 +204,7 @@
@Test
public void timeFloorOverInterestingValues() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
for (int i = 0; i < FLOOR_DOUBLES.length; ++i) {
StrictMath.floor(FLOOR_DOUBLES[i]);
@@ -214,7 +214,7 @@
@Test
public void timeGetExponentD() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
StrictMath.getExponent(mDouble);
}
@@ -222,7 +222,7 @@
@Test
public void timeGetExponentF() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
StrictMath.getExponent(mFloat);
}
@@ -230,7 +230,7 @@
@Test
public void timeHypot() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
StrictMath.hypot(mDouble, mDouble);
}
@@ -238,7 +238,7 @@
@Test
public void timeIEEEremainder() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
StrictMath.IEEEremainder(mDouble, mDouble);
}
@@ -246,7 +246,7 @@
@Test
public void timeLog() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
StrictMath.log(mDouble);
}
@@ -254,7 +254,7 @@
@Test
public void timeLog10() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
StrictMath.log10(mDouble);
}
@@ -262,7 +262,7 @@
@Test
public void timeLog1p() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
StrictMath.log1p(mDouble);
}
@@ -270,7 +270,7 @@
@Test
public void timeMaxD() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
StrictMath.max(mDouble, mDouble);
}
@@ -278,7 +278,7 @@
@Test
public void timeMaxF() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
StrictMath.max(mFloat, mFloat);
}
@@ -286,7 +286,7 @@
@Test
public void timeMaxI() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
StrictMath.max(mInt, mInt);
}
@@ -294,7 +294,7 @@
@Test
public void timeMaxL() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
StrictMath.max(mLong, mLong);
}
@@ -302,7 +302,7 @@
@Test
public void timeMinD() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
StrictMath.min(mDouble, mDouble);
}
@@ -310,7 +310,7 @@
@Test
public void timeMinF() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
StrictMath.min(mFloat, mFloat);
}
@@ -318,7 +318,7 @@
@Test
public void timeMinI() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
StrictMath.min(mInt, mInt);
}
@@ -326,7 +326,7 @@
@Test
public void timeMinL() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
StrictMath.min(mLong, mLong);
}
@@ -334,7 +334,7 @@
@Test
public void timeNextAfterD() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
StrictMath.nextAfter(mDouble, mDouble);
}
@@ -342,7 +342,7 @@
@Test
public void timeNextAfterF() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
StrictMath.nextAfter(mFloat, mFloat);
}
@@ -350,7 +350,7 @@
@Test
public void timeNextUpD() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
StrictMath.nextUp(mDouble);
}
@@ -358,7 +358,7 @@
@Test
public void timeNextUpF() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
StrictMath.nextUp(mFloat);
}
@@ -366,7 +366,7 @@
@Test
public void timePow() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
StrictMath.pow(mDouble, mDouble);
}
@@ -374,7 +374,7 @@
@Test
public void timeRandom() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
StrictMath.random();
}
@@ -382,7 +382,7 @@
@Test
public void timeRint() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
StrictMath.rint(mDouble);
}
@@ -390,7 +390,7 @@
@Test
public void timeRoundD() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
StrictMath.round(mDouble);
}
@@ -398,7 +398,7 @@
@Test
public void timeRoundF() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
StrictMath.round(mFloat);
}
@@ -406,7 +406,7 @@
@Test
public void timeScalbD() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
StrictMath.scalb(mDouble, 5);
}
@@ -414,7 +414,7 @@
@Test
public void timeScalbF() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
StrictMath.scalb(mFloat, 5);
}
@@ -422,7 +422,7 @@
@Test
public void timeSignumD() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
StrictMath.signum(mDouble);
}
@@ -430,7 +430,7 @@
@Test
public void timeSignumF() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
StrictMath.signum(mFloat);
}
@@ -438,7 +438,7 @@
@Test
public void timeSin() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
StrictMath.sin(mDouble);
}
@@ -446,7 +446,7 @@
@Test
public void timeSinh() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
StrictMath.sinh(mDouble);
}
@@ -454,7 +454,7 @@
@Test
public void timeSqrt() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
StrictMath.sqrt(mDouble);
}
@@ -462,7 +462,7 @@
@Test
public void timeTan() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
StrictMath.tan(mDouble);
}
@@ -470,7 +470,7 @@
@Test
public void timeTanh() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
StrictMath.tanh(mDouble);
}
@@ -478,7 +478,7 @@
@Test
public void timeToDegrees() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
StrictMath.toDegrees(mDouble);
}
@@ -486,7 +486,7 @@
@Test
public void timeToRadians() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
StrictMath.toRadians(mDouble);
}
@@ -494,7 +494,7 @@
@Test
public void timeUlpD() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
StrictMath.ulp(mDouble);
}
@@ -502,7 +502,7 @@
@Test
public void timeUlpF() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 2235cc5..0155154 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -30,13 +30,13 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class StringBuilderPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
public int mLength = 100;
@Test
public void timeAppendBoolean() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
StringBuilder sb = new StringBuilder();
for (int j = 0; j < mLength; ++j) {
@@ -47,7 +47,7 @@
@Test
public void timeAppendChar() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
StringBuilder sb = new StringBuilder();
for (int j = 0; j < mLength; ++j) {
@@ -59,7 +59,7 @@
@Test
public void timeAppendCharArray() {
char[] chars = "chars".toCharArray();
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
StringBuilder sb = new StringBuilder();
for (int j = 0; j < mLength; ++j) {
@@ -71,7 +71,7 @@
@Test
public void timeAppendCharSequence() {
CharSequence cs = "chars";
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
StringBuilder sb = new StringBuilder();
for (int j = 0; j < mLength; ++j) {
@@ -83,7 +83,7 @@
@Test
public void timeAppendSubCharSequence() {
CharSequence cs = "chars";
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
StringBuilder sb = new StringBuilder();
for (int j = 0; j < mLength; ++j) {
@@ -95,7 +95,7 @@
@Test
public void timeAppendDouble() {
double d = 1.2;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
StringBuilder sb = new StringBuilder();
for (int j = 0; j < mLength; ++j) {
@@ -107,7 +107,7 @@
@Test
public void timeAppendFloat() {
float f = 1.2f;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
StringBuilder sb = new StringBuilder();
for (int j = 0; j < mLength; ++j) {
@@ -119,7 +119,7 @@
@Test
public void timeAppendInt() {
int n = 123;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
StringBuilder sb = new StringBuilder();
for (int j = 0; j < mLength; ++j) {
@@ -131,7 +131,7 @@
@Test
public void timeAppendLong() {
long l = 123;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
StringBuilder sb = new StringBuilder();
for (int j = 0; j < mLength; ++j) {
@@ -150,7 +150,7 @@
return "constant";
}
};
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
StringBuilder sb = new StringBuilder();
for (int j = 0; j < mLength; ++j) {
@@ -162,7 +162,7 @@
@Test
public void timeAppendString() {
String s = "chars";
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 9ab5000..5533745 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -38,7 +38,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class StringEqualsPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
private final String mLong1 =
"Ahead-of-time compilation is possible as the compiler may just convert an instruction"
@@ -226,7 +226,7 @@
// Benchmark cases of String.equals(null)
@Test
public void timeEqualsNull() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
for (int i = 0; i < mMediumStrings.length; i++) {
mMediumStrings[i][0].equals(null);
@@ -237,7 +237,7 @@
// Benchmark cases with very short (<5 character) Strings
@Test
public void timeEqualsShort() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
for (int i = 0; i < mShortStrings.length; i++) {
mShortStrings[i][0].equals(mShortStrings[i][1]);
@@ -248,7 +248,7 @@
// Benchmark cases with medium length (10-15 character) Strings
@Test
public void timeEqualsMedium() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
for (int i = 0; i < mMediumStrings.length; i++) {
mMediumStrings[i][0].equals(mMediumStrings[i][1]);
@@ -259,7 +259,7 @@
// Benchmark cases with long (>100 character) Strings
@Test
public void timeEqualsLong() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
for (int i = 0; i < mLongStrings.length; i++) {
mLongStrings[i][0].equals(mLongStrings[i][1]);
@@ -270,7 +270,7 @@
// Benchmark cases with very long (>1000 character) Strings
@Test
public void timeEqualsVeryLong() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
for (int i = 0; i < mVeryLongStrings.length; i++) {
mVeryLongStrings[i][0].equals(mVeryLongStrings[i][1]);
@@ -281,7 +281,7 @@
// Benchmark cases with non-word aligned Strings
@Test
public void timeEqualsNonWordAligned() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
for (int i = 0; i < mNonalignedStrings.length; i++) {
mNonalignedStrings[i][0].equals(mNonalignedStrings[i][1]);
@@ -292,7 +292,7 @@
// Benchmark cases with slight differences in the endings
@Test
public void timeEqualsEnd() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
for (int i = 0; i < mEndStrings.length; i++) {
mEndStrings[i][0].equals(mEndStrings[i][1]);
@@ -303,7 +303,7 @@
// Benchmark cases of comparing a string to a non-string object
@Test
public void timeEqualsNonString() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 b1e749c..a5662b0 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -29,12 +29,12 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class StringIsEmptyPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
@Test
public void timeIsEmpty_NonEmpty() {
boolean result = true;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result &= !("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx".isEmpty());
}
@@ -44,7 +44,7 @@
@Test
public void timeIsEmpty_Empty() {
boolean result = true;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result &= ("".isEmpty());
}
@@ -54,7 +54,7 @@
@Test
public void timeLengthEqualsZero() {
boolean result = true;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
result &= !("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx".length() == 0);
}
@@ -64,7 +64,7 @@
@Test
public void timeEqualsEmpty() {
boolean result = true;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 9e57591..41e64f2 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -29,12 +29,12 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class StringLengthPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
@Test
public void timeLength() {
int length = 0;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 a80514c..2cd2a09 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
@@ -34,7 +34,7 @@
@RunWith(JUnitParamsRunner.class)
@LargeTest
public class StringPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
enum StringLengths {
EMPTY(""),
@@ -69,7 +69,7 @@
@Test
@Parameters(method = "getData")
public void timeHashCode(StringLengths stringLengths) {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 78ae395..219dccf 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
@@ -34,7 +34,7 @@
@RunWith(JUnitParamsRunner.class)
@LargeTest
public class StringReplaceAllPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
// 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 @@
@Test
@Parameters(method = "getData")
public void timeReplaceAllTrivialPatternNonExistent(StringLengths stringLengths) {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
stringLengths.mValue.replaceAll("fish", "0");
}
@@ -95,7 +95,7 @@
@Test
@Parameters(method = "getData")
public void timeReplaceTrivialPatternAllRepeated(StringLengths stringLengths) {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
stringLengths.mValue.replaceAll("jklm", "0");
}
@@ -104,7 +104,7 @@
@Test
@Parameters(method = "getData")
public void timeReplaceAllTrivialPatternSingleOccurrence(StringLengths stringLengths) {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 73911c7..d6fef5e 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
@@ -34,7 +34,7 @@
@RunWith(JUnitParamsRunner.class)
@LargeTest
public class StringReplacePerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
enum StringLengths {
EMPTY(""),
@@ -80,7 +80,7 @@
@Test
@Parameters(method = "getData")
public void timeReplaceCharNonExistent(StringLengths stringLengths) {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
stringLengths.mValue.replace('z', '0');
}
@@ -89,7 +89,7 @@
@Test
@Parameters(method = "getData")
public void timeReplaceCharRepeated(StringLengths stringLengths) {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
stringLengths.mValue.replace('a', '0');
}
@@ -98,7 +98,7 @@
@Test
@Parameters(method = "getData")
public void timeReplaceSingleChar(StringLengths stringLengths) {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
stringLengths.mValue.replace('q', '0');
}
@@ -107,7 +107,7 @@
@Test
@Parameters(method = "getData")
public void timeReplaceSequenceNonExistent(StringLengths stringLengths) {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
stringLengths.mValue.replace("fish", "0");
}
@@ -116,7 +116,7 @@
@Test
@Parameters(method = "getData")
public void timeReplaceSequenceRepeated(StringLengths stringLengths) {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
stringLengths.mValue.replace("jklm", "0");
}
@@ -125,7 +125,7 @@
@Test
@Parameters(method = "getData")
public void timeReplaceSingleSequence(StringLengths stringLengths) {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 1539271..9d0ec2f 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -31,11 +31,11 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class StringSplitPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
@Test
public void timeStringSplitComma() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
"this,is,a,simple,example".split(",");
}
@@ -43,7 +43,7 @@
@Test
public void timeStringSplitLiteralDot() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
"this.is.a.simple.example".split("\\.");
}
@@ -51,7 +51,7 @@
@Test
public void timeStringSplitNewline() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
"this\nis\na\nsimple\nexample\n".split("\n");
}
@@ -60,7 +60,7 @@
@Test
public void timePatternSplitComma() {
Pattern p = Pattern.compile(",");
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
p.split("this,is,a,simple,example");
}
@@ -69,7 +69,7 @@
@Test
public void timePatternSplitLiteralDot() {
Pattern p = Pattern.compile("\\.");
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
p.split("this.is.a.simple.example");
}
@@ -77,7 +77,7 @@
@Test
public void timeStringSplitHard() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 0d5e62b..11950b7 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
@@ -35,7 +35,7 @@
@RunWith(JUnitParamsRunner.class)
@LargeTest
public class StringToBytesPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
enum StringLengths {
EMPTY(""),
@@ -89,7 +89,7 @@
@Test
@Parameters(method = "getData")
public void timeGetBytesUtf8(StringLengths stringLengths) {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
stringLengths.mValue.getBytes(StandardCharsets.UTF_8);
}
@@ -98,7 +98,7 @@
@Test
@Parameters(method = "getData")
public void timeGetBytesIso88591(StringLengths stringLengths) {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
stringLengths.mValue.getBytes(StandardCharsets.ISO_8859_1);
}
@@ -107,7 +107,7 @@
@Test
@Parameters(method = "getData")
public void timeGetBytesAscii(StringLengths stringLengths) {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 ecdf809..4b27a16 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
@@ -34,7 +34,7 @@
@RunWith(JUnitParamsRunner.class)
@LargeTest
public class StringToRealPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
public static Collection<Object[]> getData() {
return Arrays.asList(
@@ -53,7 +53,7 @@
@Test
@Parameters(method = "getData")
public void timeFloat_parseFloat(String string) {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
Float.parseFloat(string);
}
@@ -62,7 +62,7 @@
@Test
@Parameters(method = "getData")
public void timeDouble_parseDouble(String string) {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 2b2a6b5..0ab012d 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -29,7 +29,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class ThreadLocalPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
private static final ThreadLocal<char[]> BUFFER =
new ThreadLocal<char[]>() {
@@ -41,7 +41,7 @@
@Test
public void timeThreadLocal_get() {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 6eb8fcc..ddf410e 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -31,11 +31,11 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class TimeZonePerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
@Test
public void timeTimeZone_getDefault() throws Exception {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
TimeZone.getDefault();
}
@@ -43,7 +43,7 @@
@Test
public void timeTimeZone_getTimeZoneUTC() throws Exception {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
TimeZone.getTimeZone("UTC");
}
@@ -52,7 +52,7 @@
@Test
public void timeTimeZone_getTimeZone_default() throws Exception {
String defaultId = TimeZone.getDefault().getID();
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
TimeZone.getTimeZone(defaultId);
}
@@ -61,7 +61,7 @@
// A time zone with relatively few transitions.
@Test
public void timeTimeZone_getTimeZone_America_Caracas() throws Exception {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
TimeZone.getTimeZone("America/Caracas");
}
@@ -70,7 +70,7 @@
// A time zone with a lot of transitions.
@Test
public void timeTimeZone_getTimeZone_America_Santiago() throws Exception {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
TimeZone.getTimeZone("America/Santiago");
}
@@ -78,7 +78,7 @@
@Test
public void timeTimeZone_getTimeZone_GMT_plus_10() throws Exception {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 288c646..a38763b 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
import androidx.test.filters.LargeTest;
@@ -42,7 +42,7 @@
@RunWith(JUnitParamsRunner.class)
@LargeTest
public final class XMLEntitiesPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
public static Collection<Object[]> getData() {
return Arrays.asList(
@@ -85,7 +85,7 @@
@Parameters(method = "getData")
public void timeXmlParser(int length, float entityFraction) throws Exception {
setUp(length, entityFraction);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
while (state.keepRunning()) {
XmlPullParser parser = mXmlPullParserFactory.newPullParser();
parser.setInput(new StringReader(mXml));
@@ -99,7 +99,7 @@
@Parameters(method = "getData")
public void timeDocumentBuilder(int length, float entityFraction) throws Exception {
setUp(length, entityFraction);
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 003c957..4076c9d 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetFieldLittleEndianIntPerfTest.java
@@ -13,25 +13,30 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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 PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
Field mField;
int mValue;
@@ -42,7 +47,7 @@
@Test
public void run() throws Throwable {
int x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 4f21618..2c65dd4 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetFieldLittleEndianStringPerfTest.java
@@ -13,25 +13,30 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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 PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
Field mField;
String mValue;
@@ -42,7 +47,7 @@
@Test
public void run() throws Throwable {
String x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 210014a..dcd25db 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetStaticFieldLittleEndianIntPerfTest.java
@@ -13,25 +13,30 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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 PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
Field mField;
static int sValue;
@@ -42,7 +47,7 @@
@Test
public void run() throws Throwable {
int x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 22c6827..c938a4c 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetStaticFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetStaticFieldLittleEndianStringPerfTest.java
@@ -13,25 +13,30 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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 PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
Field mField;
static String sValue;
@@ -42,7 +47,7 @@
@Test
public void run() throws Throwable {
String x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 5b39109..618e1b5 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetFieldLittleEndianIntPerfTest.java
@@ -13,25 +13,30 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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 PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
Field mField;
int mValue;
@@ -41,7 +46,7 @@
@Test
public void run() throws Throwable {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 883e8a7..8c2e3ca 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetFieldLittleEndianStringPerfTest.java
@@ -13,25 +13,30 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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 PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
Field mField;
String mValue;
@@ -41,7 +46,7 @@
@Test
public void run() throws Throwable {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 50bc85c..e888cc68 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetStaticFieldLittleEndianIntPerfTest.java
@@ -13,25 +13,30 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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 PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
Field mField;
static int sValue;
@@ -41,7 +46,7 @@
@Test
public void run() throws Throwable {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 13fa2bf..7016611 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetStaticFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetStaticFieldLittleEndianStringPerfTest.java
@@ -13,25 +13,30 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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 PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
Field mField;
static String sValue;
@@ -41,7 +46,7 @@
@Test
public void run() throws Throwable {
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 85c9bae9..65c82cc 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireFieldLittleEndianIntPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleCompareandexchangeAcquireFieldLittleEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final int FIELD_VALUE = 42;
int mField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
int x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 2b8f430..a350b61 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireFieldLittleEndianStringPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleCompareandexchangeAcquireFieldLittleEndianStringPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final String FIELD_VALUE = "qwerty";
String mField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
String x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 246fa43..34f596e 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireStaticFieldLittleEndianIntPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleCompareandexchangeAcquireStaticFieldLittleEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final int FIELD_VALUE = 42;
static int sField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
int x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 d12ffae..2216d7b 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireStaticFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireStaticFieldLittleEndianStringPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,20 +34,19 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleCompareandexchangeAcquireStaticFieldLittleEndianStringPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
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;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 5ced115..bda551f 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeFieldLittleEndianIntPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleCompareandexchangeFieldLittleEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final int FIELD_VALUE = 42;
int mField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
int x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 b955d50..f4d7893 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeFieldLittleEndianStringPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleCompareandexchangeFieldLittleEndianStringPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final String FIELD_VALUE = "qwerty";
String mField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
String x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 601ff34..f438087 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseFieldLittleEndianIntPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleCompareandexchangeReleaseFieldLittleEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final int FIELD_VALUE = 42;
int mField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
int x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 0e567f9..78df5c0 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseFieldLittleEndianStringPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleCompareandexchangeReleaseFieldLittleEndianStringPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final String FIELD_VALUE = "qwerty";
String mField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
String x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 6be2870..f45cc62 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseStaticFieldLittleEndianIntPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleCompareandexchangeReleaseStaticFieldLittleEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final int FIELD_VALUE = 42;
static int sField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
int x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 84c186b..08aa7e2 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseStaticFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseStaticFieldLittleEndianStringPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,20 +34,19 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleCompareandexchangeReleaseStaticFieldLittleEndianStringPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
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;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 b093234..5d4b2e0 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeStaticFieldLittleEndianIntPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleCompareandexchangeStaticFieldLittleEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final int FIELD_VALUE = 42;
static int sField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
int x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 0d2037b4..ba4f2c8 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeStaticFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeStaticFieldLittleEndianStringPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleCompareandexchangeStaticFieldLittleEndianStringPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final String FIELD_VALUE = "qwerty";
static String sField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
String x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 ee31973..7fca450 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetFieldLittleEndianIntPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleCompareandsetFieldLittleEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final int FIELD_VALUE = 42;
int mField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
boolean success;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 0571fef..7eb7ac0 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetFieldLittleEndianStringPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleCompareandsetFieldLittleEndianStringPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final String FIELD_VALUE = "qwerty";
String mField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
boolean success;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 f619dab..ddfd407 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetStaticFieldLittleEndianIntPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleCompareandsetStaticFieldLittleEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final int FIELD_VALUE = 42;
static int sField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
boolean success;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 fc443fa..f1f3968 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetStaticFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetStaticFieldLittleEndianStringPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleCompareandsetStaticFieldLittleEndianStringPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final String FIELD_VALUE = "qwerty";
static String sField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
boolean success;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 bf3d58b..09127c4 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireFieldLittleEndianIntPerfTest.java
@@ -13,15 +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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -33,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetAcquireFieldLittleEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final int FIELD_VALUE = 42;
int mField = FIELD_VALUE;
VarHandle mVh;
@@ -53,7 +54,7 @@
@Test
public void run() {
int x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 1f4bc31..87be4a6 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireFieldLittleEndianStringPerfTest.java
@@ -13,15 +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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -33,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetAcquireFieldLittleEndianStringPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final String FIELD_VALUE = "qwerty";
String mField = FIELD_VALUE;
VarHandle mVh;
@@ -53,7 +54,7 @@
@Test
public void run() {
String x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 2085552..5d5fc11 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireStaticFieldLittleEndianIntPerfTest.java
@@ -13,15 +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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -33,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetAcquireStaticFieldLittleEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final int FIELD_VALUE = 42;
static int sField = FIELD_VALUE;
VarHandle mVh;
@@ -53,7 +54,7 @@
@Test
public void run() {
int x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 d9c7d7b..c7034b8 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireStaticFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireStaticFieldLittleEndianStringPerfTest.java
@@ -13,15 +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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -33,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetAcquireStaticFieldLittleEndianStringPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final String FIELD_VALUE = "qwerty";
static String sField = FIELD_VALUE;
VarHandle mVh;
@@ -53,7 +54,7 @@
@Test
public void run() {
String x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 acd2533..f22865b 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetArrayLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetArrayLittleEndianIntPerfTest.java
@@ -13,15 +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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -33,9 +34,9 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetArrayLittleEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final int ELEMENT_VALUE = 42;
- int[] mArray = {ELEMENT_VALUE};
+ int[] mArray = { ELEMENT_VALUE };
VarHandle mVh;
public VarHandleGetArrayLittleEndianIntPerfTest() throws Throwable {
@@ -54,7 +55,7 @@
public void run() {
int[] a = mArray;
int x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 de9944a..fdb9e84 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetArrayLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetArrayLittleEndianStringPerfTest.java
@@ -13,15 +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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -33,9 +34,9 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetArrayLittleEndianStringPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final String ELEMENT_VALUE = "qwerty";
- String[] mArray = {ELEMENT_VALUE};
+ String[] mArray = { ELEMENT_VALUE };
VarHandle mVh;
public VarHandleGetArrayLittleEndianStringPerfTest() throws Throwable {
@@ -54,7 +55,7 @@
public void run() {
String[] a = mArray;
String x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 a863929..347b0cf 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetByteArrayViewBigEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetByteArrayViewBigEndianIntPerfTest.java
@@ -13,15 +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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -29,22 +30,22 @@
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 PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
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() {
@@ -58,7 +59,7 @@
public void run() {
byte[] a = mArray1;
int x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 4999b9b..dedc94f 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetByteArrayViewLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetByteArrayViewLittleEndianIntPerfTest.java
@@ -13,15 +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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -29,22 +30,22 @@
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 PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
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() {
@@ -58,7 +59,7 @@
public void run() {
byte[] a = mArray1;
int x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 ee80a6f..3f0f624 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetFieldLittleEndianIntPerfTest.java
@@ -13,15 +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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -33,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetFieldLittleEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final int FIELD_VALUE = 42;
int mField = FIELD_VALUE;
VarHandle mVh;
@@ -53,7 +54,7 @@
@Test
public void run() {
int x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 ec29f7a..9db6328 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetFieldLittleEndianStringPerfTest.java
@@ -13,15 +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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -33,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetFieldLittleEndianStringPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final String FIELD_VALUE = "qwerty";
String mField = FIELD_VALUE;
VarHandle mVh;
@@ -53,7 +54,7 @@
@Test
public void run() {
String x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 ee6a669..17b74a8 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueFieldLittleEndianIntPerfTest.java
@@ -13,15 +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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -33,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetOpaqueFieldLittleEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final int FIELD_VALUE = 42;
int mField = FIELD_VALUE;
VarHandle mVh;
@@ -53,7 +54,7 @@
@Test
public void run() {
int x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 1702b84..5df1380 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueFieldLittleEndianStringPerfTest.java
@@ -13,15 +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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -33,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetOpaqueFieldLittleEndianStringPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final String FIELD_VALUE = "qwerty";
String mField = FIELD_VALUE;
VarHandle mVh;
@@ -53,7 +54,7 @@
@Test
public void run() {
String x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 514ddb9..f656ef2 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueStaticFieldLittleEndianIntPerfTest.java
@@ -13,15 +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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -33,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetOpaqueStaticFieldLittleEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final int FIELD_VALUE = 42;
static int sField = FIELD_VALUE;
VarHandle mVh;
@@ -53,7 +54,7 @@
@Test
public void run() {
int x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 fbcee69..1087df3 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueStaticFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueStaticFieldLittleEndianStringPerfTest.java
@@ -13,15 +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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -33,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetOpaqueStaticFieldLittleEndianStringPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final String FIELD_VALUE = "qwerty";
static String sField = FIELD_VALUE;
VarHandle mVh;
@@ -53,7 +54,7 @@
@Test
public void run() {
String x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 2c56588..0043451 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetStaticFieldLittleEndianIntPerfTest.java
@@ -13,15 +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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -33,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetStaticFieldLittleEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final int FIELD_VALUE = 42;
static int sField = FIELD_VALUE;
VarHandle mVh;
@@ -53,7 +54,7 @@
@Test
public void run() {
int x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 8fce69e..0162637 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetStaticFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetStaticFieldLittleEndianStringPerfTest.java
@@ -13,15 +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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -33,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetStaticFieldLittleEndianStringPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final String FIELD_VALUE = "qwerty";
static String sField = FIELD_VALUE;
VarHandle mVh;
@@ -53,7 +54,7 @@
@Test
public void run() {
String x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 ef530607..b0c4631 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileFieldLittleEndianIntPerfTest.java
@@ -13,15 +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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -33,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetVolatileFieldLittleEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final int FIELD_VALUE = 42;
int mField = FIELD_VALUE;
VarHandle mVh;
@@ -53,7 +54,7 @@
@Test
public void run() {
int x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 64c0898..5cbbc08 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileFieldLittleEndianStringPerfTest.java
@@ -13,15 +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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -33,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetVolatileFieldLittleEndianStringPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final String FIELD_VALUE = "qwerty";
String mField = FIELD_VALUE;
VarHandle mVh;
@@ -53,7 +54,7 @@
@Test
public void run() {
String x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 939100c..368ae69 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileStaticFieldLittleEndianIntPerfTest.java
@@ -13,15 +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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -33,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetVolatileStaticFieldLittleEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final int FIELD_VALUE = 42;
static int sField = FIELD_VALUE;
VarHandle mVh;
@@ -53,7 +54,7 @@
@Test
public void run() {
int x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 728b199..3387a8d 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileStaticFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileStaticFieldLittleEndianStringPerfTest.java
@@ -13,15 +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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -33,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetVolatileStaticFieldLittleEndianStringPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final String FIELD_VALUE = "qwerty";
static String sField = FIELD_VALUE;
VarHandle mVh;
@@ -53,7 +54,7 @@
@Test
public void run() {
String x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 bf5ef99..781e04f 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireFieldLittleEndianFloatPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireFieldLittleEndianFloatPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandaddAcquireFieldLittleEndianFloatPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final float FIELD_VALUE = 3.14f;
float mField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
float x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 d15705e..97f29ba 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireFieldLittleEndianIntPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandaddAcquireFieldLittleEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final int FIELD_VALUE = 42;
int mField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
int x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 222a60d..e108f7f 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireStaticFieldLittleEndianFloatPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireStaticFieldLittleEndianFloatPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandaddAcquireStaticFieldLittleEndianFloatPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final float FIELD_VALUE = 3.14f;
static float sField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
float x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 7436476..d0ae322 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireStaticFieldLittleEndianIntPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandaddAcquireStaticFieldLittleEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final int FIELD_VALUE = 42;
static int sField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
int x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 cca97f4..1b80c40 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddFieldLittleEndianFloatPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddFieldLittleEndianFloatPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandaddFieldLittleEndianFloatPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final float FIELD_VALUE = 3.14f;
float mField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
float x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 170ee73..edacf181 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddFieldLittleEndianIntPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandaddFieldLittleEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final int FIELD_VALUE = 42;
int mField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
int x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 184f796..0e86b0d 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseFieldLittleEndianFloatPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseFieldLittleEndianFloatPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandaddReleaseFieldLittleEndianFloatPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final float FIELD_VALUE = 3.14f;
float mField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
float x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 7e75c44..83446ff 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseFieldLittleEndianIntPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandaddReleaseFieldLittleEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final int FIELD_VALUE = 42;
int mField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
int x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 39c386b..c1f1e6f 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseStaticFieldLittleEndianFloatPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseStaticFieldLittleEndianFloatPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandaddReleaseStaticFieldLittleEndianFloatPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final float FIELD_VALUE = 3.14f;
static float sField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
float x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 04ab531..1b154a1 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseStaticFieldLittleEndianIntPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandaddReleaseStaticFieldLittleEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final int FIELD_VALUE = 42;
static int sField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
int x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 b71351f..7de128d 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddStaticFieldLittleEndianFloatPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddStaticFieldLittleEndianFloatPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandaddStaticFieldLittleEndianFloatPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final float FIELD_VALUE = 3.14f;
static float sField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
float x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 e3955c0..c9a0926 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddStaticFieldLittleEndianIntPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandaddStaticFieldLittleEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final int FIELD_VALUE = 42;
static int sField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
int x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 adf05a6..fd9d9b1 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndAcquireFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndAcquireFieldLittleEndianIntPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandbitwiseAndAcquireFieldLittleEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final int FIELD_VALUE = 42;
int mField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
int x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 4d657d9..c3c367f 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndAcquireStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndAcquireStaticFieldLittleEndianIntPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandbitwiseAndAcquireStaticFieldLittleEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final int FIELD_VALUE = 42;
static int sField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
int x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 dc64174..e073d28 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndFieldLittleEndianIntPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandbitwiseAndFieldLittleEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final int FIELD_VALUE = 42;
int mField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
int x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 25d5631..ca78f5a 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndReleaseFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndReleaseFieldLittleEndianIntPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandbitwiseAndReleaseFieldLittleEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final int FIELD_VALUE = 42;
int mField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
int x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 de2d548..599f186 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndReleaseStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndReleaseStaticFieldLittleEndianIntPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandbitwiseAndReleaseStaticFieldLittleEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final int FIELD_VALUE = 42;
static int sField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
int x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 36544c6..71fc0ae 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndStaticFieldLittleEndianIntPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandbitwiseAndStaticFieldLittleEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final int FIELD_VALUE = 42;
static int sField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
int x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 fb36d0c..8fc4eab 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrAcquireFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrAcquireFieldLittleEndianIntPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandbitwiseOrAcquireFieldLittleEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final int FIELD_VALUE = 42;
int mField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
int x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 4194b12..3368953 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrAcquireStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrAcquireStaticFieldLittleEndianIntPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandbitwiseOrAcquireStaticFieldLittleEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final int FIELD_VALUE = 42;
static int sField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
int x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 355c6e8..583a3a0 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrFieldLittleEndianIntPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandbitwiseOrFieldLittleEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final int FIELD_VALUE = 42;
int mField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
int x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 401079d..1592fa6 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrReleaseFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrReleaseFieldLittleEndianIntPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandbitwiseOrReleaseFieldLittleEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final int FIELD_VALUE = 42;
int mField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
int x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 322dcbf..d496083 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrReleaseStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrReleaseStaticFieldLittleEndianIntPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandbitwiseOrReleaseStaticFieldLittleEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final int FIELD_VALUE = 42;
static int sField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
int x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 c982814..87276a5 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrStaticFieldLittleEndianIntPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandbitwiseOrStaticFieldLittleEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final int FIELD_VALUE = 42;
static int sField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
int x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 0b1cb32..f7a372f 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorAcquireFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorAcquireFieldLittleEndianIntPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandbitwiseXorAcquireFieldLittleEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final int FIELD_VALUE = 42;
int mField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
int x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 4737072..22726fc 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorAcquireStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorAcquireStaticFieldLittleEndianIntPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandbitwiseXorAcquireStaticFieldLittleEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final int FIELD_VALUE = 42;
static int sField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
int x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 204cd70..d071d6e 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorFieldLittleEndianIntPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandbitwiseXorFieldLittleEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final int FIELD_VALUE = 42;
int mField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
int x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 b3ffed7..be2aa9c 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorReleaseFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorReleaseFieldLittleEndianIntPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandbitwiseXorReleaseFieldLittleEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final int FIELD_VALUE = 42;
int mField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
int x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 d0ab8de..b0a7dcf 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorReleaseStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorReleaseStaticFieldLittleEndianIntPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandbitwiseXorReleaseStaticFieldLittleEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final int FIELD_VALUE = 42;
static int sField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
int x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 b378b68..c5f99de 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorStaticFieldLittleEndianIntPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandbitwiseXorStaticFieldLittleEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final int FIELD_VALUE = 42;
static int sField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
int x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 c7c66fe..572e0c8 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireFieldLittleEndianIntPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandsetAcquireFieldLittleEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final int FIELD_VALUE = 42;
int mField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
int x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 98d6bd7..09be6d9 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireFieldLittleEndianStringPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandsetAcquireFieldLittleEndianStringPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final String FIELD_VALUE = "qwerty";
String mField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
String x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 206358f..4e0554a 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireStaticFieldLittleEndianIntPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandsetAcquireStaticFieldLittleEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final int FIELD_VALUE = 42;
static int sField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
int x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 0532e73..5491522 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireStaticFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireStaticFieldLittleEndianStringPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandsetAcquireStaticFieldLittleEndianStringPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final String FIELD_VALUE = "qwerty";
static String sField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
String x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 f192d71..a9303c6 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetFieldLittleEndianIntPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandsetFieldLittleEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final int FIELD_VALUE = 42;
int mField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
int x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 0a8909c..bd4703f 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetFieldLittleEndianStringPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandsetFieldLittleEndianStringPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final String FIELD_VALUE = "qwerty";
String mField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
String x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 bfcb0f4..d9aee00 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseFieldLittleEndianIntPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandsetReleaseFieldLittleEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final int FIELD_VALUE = 42;
int mField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
int x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 c6b0509..2c79ca2 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseFieldLittleEndianStringPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandsetReleaseFieldLittleEndianStringPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final String FIELD_VALUE = "qwerty";
String mField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
String x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 45a01ed..ceff8163 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseStaticFieldLittleEndianIntPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandsetReleaseStaticFieldLittleEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final int FIELD_VALUE = 42;
static int sField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
int x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 3047281..9b83504 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseStaticFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseStaticFieldLittleEndianStringPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandsetReleaseStaticFieldLittleEndianStringPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final String FIELD_VALUE = "qwerty";
static String sField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
String x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 6f1f1a0..638da6f 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetStaticFieldLittleEndianIntPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandsetStaticFieldLittleEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final int FIELD_VALUE = 42;
static int sField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
int x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 c4d279f..25d41141 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetStaticFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetStaticFieldLittleEndianStringPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandsetStaticFieldLittleEndianStringPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final String FIELD_VALUE = "qwerty";
static String sField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
String x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 c4f6005..64ea9f3 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetArrayLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetArrayLittleEndianIntPerfTest.java
@@ -13,16 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -33,9 +34,9 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleSetArrayLittleEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final int ELEMENT_VALUE = 42;
- int[] mArray = {ELEMENT_VALUE};
+ int[] mArray = { ELEMENT_VALUE };
VarHandle mVh;
public VarHandleSetArrayLittleEndianIntPerfTest() throws Throwable {
@@ -53,7 +54,7 @@
public void run() {
int[] a = mArray;
int x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 a6858c2..989d682 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetArrayLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetArrayLittleEndianStringPerfTest.java
@@ -13,16 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -33,9 +34,9 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleSetArrayLittleEndianStringPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final String ELEMENT_VALUE = "qwerty";
- String[] mArray = {ELEMENT_VALUE};
+ String[] mArray = { ELEMENT_VALUE };
VarHandle mVh;
public VarHandleSetArrayLittleEndianStringPerfTest() throws Throwable {
@@ -53,7 +54,7 @@
public void run() {
String[] a = mArray;
String x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 a994cbe..9d6d6b8 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetByteArrayViewBigEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetByteArrayViewBigEndianIntPerfTest.java
@@ -13,59 +13,52 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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.nio.ByteOrder;
+
import java.util.Arrays;
+import java.nio.ByteOrder;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleSetByteArrayViewBigEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
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;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 65412ec..e8c3fa3 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetByteArrayViewLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetByteArrayViewLittleEndianIntPerfTest.java
@@ -13,59 +13,52 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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.nio.ByteOrder;
+
import java.util.Arrays;
+import java.nio.ByteOrder;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleSetByteArrayViewLittleEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
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;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 573b0ff..08294c0 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetFieldLittleEndianIntPerfTest.java
@@ -13,16 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -33,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleSetFieldLittleEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final int FIELD_VALUE = 42;
int mField = FIELD_VALUE;
VarHandle mVh;
@@ -52,7 +53,7 @@
@Test
public void run() {
int x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 fe3c0fc..1e8a5bf 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetFieldLittleEndianStringPerfTest.java
@@ -13,16 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -33,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleSetFieldLittleEndianStringPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final String FIELD_VALUE = "qwerty";
String mField = FIELD_VALUE;
VarHandle mVh;
@@ -52,7 +53,7 @@
@Test
public void run() {
String x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 f398899..2e5fb18 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueFieldLittleEndianIntPerfTest.java
@@ -13,16 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -33,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleSetOpaqueFieldLittleEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final int FIELD_VALUE = 42;
int mField = FIELD_VALUE;
VarHandle mVh;
@@ -52,7 +53,7 @@
@Test
public void run() {
int x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 7493120..86a771f 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueFieldLittleEndianStringPerfTest.java
@@ -13,16 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -33,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleSetOpaqueFieldLittleEndianStringPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final String FIELD_VALUE = "qwerty";
String mField = FIELD_VALUE;
VarHandle mVh;
@@ -52,7 +53,7 @@
@Test
public void run() {
String x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 5e73269..903b310 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueStaticFieldLittleEndianIntPerfTest.java
@@ -13,16 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -33,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleSetOpaqueStaticFieldLittleEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final int FIELD_VALUE = 42;
static int sField = FIELD_VALUE;
VarHandle mVh;
@@ -52,7 +53,7 @@
@Test
public void run() {
int x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 9a217d1..63cf7d2 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueStaticFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueStaticFieldLittleEndianStringPerfTest.java
@@ -13,16 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -33,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleSetOpaqueStaticFieldLittleEndianStringPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final String FIELD_VALUE = "qwerty";
static String sField = FIELD_VALUE;
VarHandle mVh;
@@ -52,7 +53,7 @@
@Test
public void run() {
String x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 1ce2270..d1a358d 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseFieldLittleEndianIntPerfTest.java
@@ -13,16 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -33,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleSetReleaseFieldLittleEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final int FIELD_VALUE = 42;
int mField = FIELD_VALUE;
VarHandle mVh;
@@ -52,7 +53,7 @@
@Test
public void run() {
int x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 ed84528..b658324 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseFieldLittleEndianStringPerfTest.java
@@ -13,16 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -33,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleSetReleaseFieldLittleEndianStringPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final String FIELD_VALUE = "qwerty";
String mField = FIELD_VALUE;
VarHandle mVh;
@@ -52,7 +53,7 @@
@Test
public void run() {
String x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 aeb9640..47cb779 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseStaticFieldLittleEndianIntPerfTest.java
@@ -13,16 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -33,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleSetReleaseStaticFieldLittleEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final int FIELD_VALUE = 42;
static int sField = FIELD_VALUE;
VarHandle mVh;
@@ -52,7 +53,7 @@
@Test
public void run() {
int x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 8959a0c..e48374e 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseStaticFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseStaticFieldLittleEndianStringPerfTest.java
@@ -13,16 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -33,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleSetReleaseStaticFieldLittleEndianStringPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final String FIELD_VALUE = "qwerty";
static String sField = FIELD_VALUE;
VarHandle mVh;
@@ -52,7 +53,7 @@
@Test
public void run() {
String x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 4007722..0470d67 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetStaticFieldLittleEndianIntPerfTest.java
@@ -13,16 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -33,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleSetStaticFieldLittleEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final int FIELD_VALUE = 42;
static int sField = FIELD_VALUE;
VarHandle mVh;
@@ -52,7 +53,7 @@
@Test
public void run() {
int x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 7323158..00abb0b 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetStaticFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetStaticFieldLittleEndianStringPerfTest.java
@@ -13,16 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -33,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleSetStaticFieldLittleEndianStringPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final String FIELD_VALUE = "qwerty";
static String sField = FIELD_VALUE;
VarHandle mVh;
@@ -52,7 +53,7 @@
@Test
public void run() {
String x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 f4119c2..c66b23b 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileFieldLittleEndianIntPerfTest.java
@@ -13,16 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -33,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleSetVolatileFieldLittleEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final int FIELD_VALUE = 42;
int mField = FIELD_VALUE;
VarHandle mVh;
@@ -52,7 +53,7 @@
@Test
public void run() {
int x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 9b9c261..1b36450 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileFieldLittleEndianStringPerfTest.java
@@ -13,16 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -33,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleSetVolatileFieldLittleEndianStringPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final String FIELD_VALUE = "qwerty";
String mField = FIELD_VALUE;
VarHandle mVh;
@@ -52,7 +53,7 @@
@Test
public void run() {
String x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 f125384..75f9274 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileStaticFieldLittleEndianIntPerfTest.java
@@ -13,16 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -33,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleSetVolatileStaticFieldLittleEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final int FIELD_VALUE = 42;
static int sField = FIELD_VALUE;
VarHandle mVh;
@@ -52,7 +53,7 @@
@Test
public void run() {
int x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 2ad605d..8289d4f 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileStaticFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileStaticFieldLittleEndianStringPerfTest.java
@@ -13,16 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -33,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleSetVolatileStaticFieldLittleEndianStringPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final String FIELD_VALUE = "qwerty";
static String sField = FIELD_VALUE;
VarHandle mVh;
@@ -52,7 +53,7 @@
@Test
public void run() {
String x;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 5ef3bf0..9fac842 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireFieldLittleEndianIntPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleWeakcompareandsetAcquireFieldLittleEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final int FIELD_VALUE = 42;
int mField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
boolean success;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 0c4ed66..2f60127 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireFieldLittleEndianStringPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleWeakcompareandsetAcquireFieldLittleEndianStringPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final String FIELD_VALUE = "qwerty";
String mField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
boolean success;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 db6bd24..4efbd3e 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireStaticFieldLittleEndianIntPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleWeakcompareandsetAcquireStaticFieldLittleEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final int FIELD_VALUE = 42;
static int sField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
boolean success;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 d2b0bf7..099640c 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireStaticFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireStaticFieldLittleEndianStringPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,20 +34,19 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleWeakcompareandsetAcquireStaticFieldLittleEndianStringPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
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;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 3cd5ae6..ce8f0f0 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetFieldLittleEndianIntPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleWeakcompareandsetFieldLittleEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final int FIELD_VALUE = 42;
int mField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
boolean success;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 6ddfc25..c4119dc 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetFieldLittleEndianStringPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleWeakcompareandsetFieldLittleEndianStringPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final String FIELD_VALUE = "qwerty";
String mField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
boolean success;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 375f0bc..abd981c 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainFieldLittleEndianIntPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleWeakcompareandsetPlainFieldLittleEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final int FIELD_VALUE = 42;
int mField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
boolean success;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 7e2492a..c71e65f 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainFieldLittleEndianStringPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleWeakcompareandsetPlainFieldLittleEndianStringPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final String FIELD_VALUE = "qwerty";
String mField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
boolean success;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 190118c..f3c8f3a 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainStaticFieldLittleEndianIntPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleWeakcompareandsetPlainStaticFieldLittleEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final int FIELD_VALUE = 42;
static int sField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
boolean success;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 484ba1b..5c943a4 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainStaticFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainStaticFieldLittleEndianStringPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleWeakcompareandsetPlainStaticFieldLittleEndianStringPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final String FIELD_VALUE = "qwerty";
static String sField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
boolean success;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 80e4e15..1755a15 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseFieldLittleEndianIntPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleWeakcompareandsetReleaseFieldLittleEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final int FIELD_VALUE = 42;
int mField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
boolean success;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 fa26c59..77175b0 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseFieldLittleEndianStringPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleWeakcompareandsetReleaseFieldLittleEndianStringPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final String FIELD_VALUE = "qwerty";
String mField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
boolean success;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 16bf2a20..985519e 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseStaticFieldLittleEndianIntPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleWeakcompareandsetReleaseStaticFieldLittleEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final int FIELD_VALUE = 42;
static int sField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
boolean success;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 e1716de..69e6ca7 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseStaticFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseStaticFieldLittleEndianStringPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,20 +34,19 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleWeakcompareandsetReleaseStaticFieldLittleEndianStringPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
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;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 dc6f2ad..88df5ff 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetStaticFieldLittleEndianIntPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleWeakcompareandsetStaticFieldLittleEndianIntPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final int FIELD_VALUE = 42;
static int sField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
boolean success;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 d1096c6..c296f668 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetStaticFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetStaticFieldLittleEndianStringPerfTest.java
@@ -13,15 +13,17 @@
* 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 android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
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;
@@ -32,7 +34,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleWeakcompareandsetStaticFieldLittleEndianStringPerfTest {
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final String FIELD_VALUE = "qwerty";
static String sField = FIELD_VALUE;
VarHandle mVh;
@@ -44,7 +46,7 @@
@Test
public void run() {
boolean success;
- BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ final BenchmarkState state = mBenchmarkRule.getState();
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 f3a1fff..bea4008 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
@@ -31,7 +31,6 @@
import io
import sys
-
class MemLoc(Enum):
FIELD = 0
ARRAY = 1
@@ -42,7 +41,7 @@
return ''.join(c for c in word.title() if not c == '_')
-LOOP ="BenchmarkState state = mPerfStatusReporter.getBenchmarkState();\n while (state.keepRunning())"
+LOOP ="final BenchmarkState state = mBenchmarkRule.getState();\n while (state.keepRunning())"
class Benchmark:
def __init__(self, code, static, vartype, flavour, klass, method, memloc,
@@ -158,10 +157,10 @@
VH_IMPORTS = """
package android.libcore.varhandles;
-import android.perftests.utils.BenchmarkState;
-import android.perftests.utils.PerfStatusReporter;
-import android.test.suitebuilder.annotation.LargeTest;
+import androidx.benchmark.BenchmarkState;
+import androidx.benchmark.junit4.BenchmarkRule;
+import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
import org.junit.After;
@@ -179,7 +178,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class {name} {{
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final {vartype} FIELD_VALUE = {value1};
{static_kwd}{vartype} {static_prefix}Field = FIELD_VALUE;
VarHandle mVh;
@@ -273,7 +272,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class {name} {{
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final {vartype} ELEMENT_VALUE = {value1};
{vartype}[] mArray = {{ ELEMENT_VALUE }};
VarHandle mVh;
@@ -324,7 +323,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class {name} {{
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
static final {vartype} VALUE = {value1};
byte[] mArray1 = {value1_byte_array};
byte[] mArray2 = {value2_byte_array};
@@ -375,7 +374,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class {name} {{
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
Field mField;
{static_kwd}{vartype} {static_prefix}Value;
@@ -407,7 +406,7 @@
@RunWith(AndroidJUnit4.class)
@LargeTest
public class {name} {{
- @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+ @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
long mOffset;
public {static_kwd}{vartype} {static_prefix}Value = {value1};
diff --git a/apct-tests/perftests/multiuser/Android.bp b/apct-tests/perftests/multiuser/Android.bp
index 856dba3..9eea712 100644
--- a/apct-tests/perftests/multiuser/Android.bp
+++ b/apct-tests/perftests/multiuser/Android.bp
@@ -45,3 +45,8 @@
"trace_configs/trace_config_multi_user.textproto",
],
}
+
+prebuilt_etc {
+ name: "trace_config_multi_user.textproto",
+ src: ":multi_user_trace_config",
+}
diff --git a/apex/blobstore/TEST_MAPPING b/apex/blobstore/TEST_MAPPING
index 6d3c0d7..5157ce4 100644
--- a/apex/blobstore/TEST_MAPPING
+++ b/apex/blobstore/TEST_MAPPING
@@ -7,12 +7,7 @@
"name": "CtsBlobStoreHostTestCases"
},
{
- "name": "FrameworksMockingServicesTests",
- "options": [
- {
- "include-filter": "com.android.server.blob"
- }
- ]
+ "name": "FrameworksMockingServicesTests_blob"
}
]
}
diff --git a/apex/jobscheduler/service/java/com/android/server/DeviceIdleController.java b/apex/jobscheduler/service/java/com/android/server/DeviceIdleController.java
index 11d3e96..a21d810c 100644
--- a/apex/jobscheduler/service/java/com/android/server/DeviceIdleController.java
+++ b/apex/jobscheduler/service/java/com/android/server/DeviceIdleController.java
@@ -2628,8 +2628,13 @@
for (int i=0; i<allowPowerExceptIdle.size(); i++) {
String pkg = allowPowerExceptIdle.valueAt(i);
try {
+ // On some devices (eg. HSUM), some apps may
+ // be not be pre-installed on user 0, but may be
+ // pre-installed on FULL users. Look for pre-installed system
+ // apps across all users to make sure they're properly
+ // allowlisted.
ApplicationInfo ai = pm.getApplicationInfo(pkg,
- PackageManager.MATCH_SYSTEM_ONLY);
+ PackageManager.MATCH_ANY_USER | PackageManager.MATCH_SYSTEM_ONLY);
int appid = UserHandle.getAppId(ai.uid);
mPowerSaveWhitelistAppsExceptIdle.put(ai.packageName, appid);
mPowerSaveWhitelistSystemAppIdsExceptIdle.put(appid, true);
@@ -2640,8 +2645,13 @@
for (int i=0; i<allowPower.size(); i++) {
String pkg = allowPower.valueAt(i);
try {
+ // On some devices (eg. HSUM), some apps may
+ // be not be pre-installed on user 0, but may be
+ // pre-installed on FULL users. Look for pre-installed system
+ // apps across all users to make sure they're properly
+ // allowlisted.
ApplicationInfo ai = pm.getApplicationInfo(pkg,
- PackageManager.MATCH_SYSTEM_ONLY);
+ PackageManager.MATCH_ANY_USER | PackageManager.MATCH_SYSTEM_ONLY);
int appid = UserHandle.getAppId(ai.uid);
// These apps are on both the whitelist-except-idle as well
// as the full whitelist, so they apply in all cases.
diff --git a/apex/jobscheduler/service/java/com/android/server/TEST_MAPPING b/apex/jobscheduler/service/java/com/android/server/TEST_MAPPING
index 6924cb2..b58cb88 100644
--- a/apex/jobscheduler/service/java/com/android/server/TEST_MAPPING
+++ b/apex/jobscheduler/service/java/com/android/server/TEST_MAPPING
@@ -1,23 +1,12 @@
{
"presubmit": [
{
- "name": "FrameworksMockingServicesTests",
- "file_patterns": [
- "DeviceIdleController\\.java"
- ],
- "options": [
- {"include-filter": "com.android.server.DeviceIdleControllerTest"},
- {"exclude-annotation": "androidx.test.filters.FlakyTest"}
- ]
+ "name": "FrameworksMockingServicesTests_IdleController",
+ "file_patterns": ["DeviceIdleController\\.java"]
},
{
- "name": "FrameworksMockingServicesTests",
- "file_patterns": ["AppStateTrackerImpl\\.java"],
- "options": [
- {"include-filter": "com.android.server.AppStateTrackerTest"},
- {"include-annotation": "android.platform.test.annotations.Presubmit"},
- {"exclude-annotation": "androidx.test.filters.FlakyTest"}
- ]
+ "name": "FrameworksMockingServicesTests_AppStateTracker",
+ "file_patterns": ["AppStateTrackerImpl\\.java"]
}
],
"postsubmit": [
diff --git a/apex/jobscheduler/service/java/com/android/server/alarm/TEST_MAPPING b/apex/jobscheduler/service/java/com/android/server/alarm/TEST_MAPPING
index d76ce74..ab0f178 100644
--- a/apex/jobscheduler/service/java/com/android/server/alarm/TEST_MAPPING
+++ b/apex/jobscheduler/service/java/com/android/server/alarm/TEST_MAPPING
@@ -1,18 +1,7 @@
{
"presubmit": [
{
- "name": "FrameworksMockingServicesTests",
- "options": [
- {
- "include-filter": "com.android.server.alarm"
- },
- {
- "include-annotation": "android.platform.test.annotations.Presubmit"
- },
- {
- "exclude-annotation": "androidx.test.filters.FlakyTest"
- }
- ]
+ "name": "FrameworksMockingServicesTests_com_android_server_alarm"
}
],
diff --git a/apex/jobscheduler/service/java/com/android/server/deviceidle/TEST_MAPPING b/apex/jobscheduler/service/java/com/android/server/deviceidle/TEST_MAPPING
index c0686116..afa509c 100644
--- a/apex/jobscheduler/service/java/com/android/server/deviceidle/TEST_MAPPING
+++ b/apex/jobscheduler/service/java/com/android/server/deviceidle/TEST_MAPPING
@@ -1,11 +1,7 @@
{
"presubmit": [
{
- "name": "FrameworksMockingServicesTests",
- "options": [
- {"include-filter": "com.android.server.DeviceIdleControllerTest"},
- {"exclude-annotation": "androidx.test.filters.FlakyTest"}
- ]
+ "name": "FrameworksMockingServicesTests_IdleController"
}
],
"postsubmit": [
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 e82df12..16c2fd4 100644
--- a/apex/jobscheduler/service/java/com/android/server/job/TEST_MAPPING
+++ b/apex/jobscheduler/service/java/com/android/server/job/TEST_MAPPING
@@ -8,20 +8,10 @@
]
},
{
- "name": "FrameworksMockingServicesTests",
- "options": [
- {"include-filter": "com.android.server.job"},
- {"exclude-annotation": "androidx.test.filters.FlakyTest"},
- {"exclude-annotation": "androidx.test.filters.LargeTest"}
- ]
+ "name": "FrameworksMockingServicesTests_com_android_server_job_Presubmit"
},
{
- "name": "FrameworksServicesTests",
- "options": [
- {"include-filter": "com.android.server.job"},
- {"exclude-annotation": "androidx.test.filters.FlakyTest"},
- {"exclude-annotation": "androidx.test.filters.LargeTest"}
- ]
+ "name": "FrameworksServicesTests_com_android_server_job_Presubmit"
}
],
"postsubmit": [
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 a75415e..52670a2 100644
--- a/apex/jobscheduler/service/java/com/android/server/usage/TEST_MAPPING
+++ b/apex/jobscheduler/service/java/com/android/server/usage/TEST_MAPPING
@@ -17,11 +17,7 @@
]
},
{
- "name": "FrameworksServicesTests",
- "options": [
- {"include-filter": "com.android.server.usage"},
- {"exclude-annotation": "androidx.test.filters.FlakyTest"}
- ]
+ "name": "FrameworksServicesTests_com_android_server_usage_Presubmit"
}
],
"postsubmit": [
diff --git a/core/TEST_MAPPING b/core/TEST_MAPPING
index fd571c9..b78659c 100644
--- a/core/TEST_MAPPING
+++ b/core/TEST_MAPPING
@@ -1,18 +1,7 @@
{
"presubmit": [
{
- "name": "FrameworksCoreTests",
- "options": [
- {
- "include-filter": "android.view.inputmethod"
- },
- {
- "include-filter": "com.android.internal.inputmethod"
- },
- {
- "exclude-annotation": "androidx.test.filters.FlakyTest"
- }
- ],
+ "name": "FrameworksCoreTests_inputmethod",
"file_patterns": [
"core/java/com/android/internal/inputmethod/.*",
"core/java/android/view/inputmethod/.*",
diff --git a/core/api/system-current.txt b/core/api/system-current.txt
index 02c88e2..ccae2ba 100644
--- a/core/api/system-current.txt
+++ b/core/api/system-current.txt
@@ -11883,6 +11883,7 @@
field public static final String ACTION_MANAGE_APP_OVERLAY_PERMISSION = "android.settings.MANAGE_APP_OVERLAY_PERMISSION";
field public static final String ACTION_MANAGE_DOMAIN_URLS = "android.settings.MANAGE_DOMAIN_URLS";
field public static final String ACTION_MANAGE_MORE_DEFAULT_APPS_SETTINGS = "android.settings.MANAGE_MORE_DEFAULT_APPS_SETTINGS";
+ field @FlaggedApi("android.nfc.nfc_action_manage_services_settings") public static final String ACTION_MANAGE_OTHER_NFC_SERVICES_SETTINGS = "android.settings.MANAGE_OTHER_NFC_SERVICES_SETTINGS";
field public static final String ACTION_NOTIFICATION_POLICY_ACCESS_DETAIL_SETTINGS = "android.settings.NOTIFICATION_POLICY_ACCESS_DETAIL_SETTINGS";
field public static final String ACTION_REQUEST_ENABLE_CONTENT_CAPTURE = "android.settings.REQUEST_ENABLE_CONTENT_CAPTURE";
field public static final String ACTION_SHOW_ADMIN_SUPPORT_DETAILS = "android.settings.SHOW_ADMIN_SUPPORT_DETAILS";
diff --git a/core/java/android/app/TEST_MAPPING b/core/java/android/app/TEST_MAPPING
index a29c196..5f618f6 100644
--- a/core/java/android/app/TEST_MAPPING
+++ b/core/java/android/app/TEST_MAPPING
@@ -29,12 +29,7 @@
},
{
"file_patterns": ["(/|^)AppOpsManager.java"],
- "name": "FrameworksServicesTests",
- "options": [
- {
- "include-filter": "com.android.server.appop"
- }
- ]
+ "name": "FrameworksServicesTests_android_server_appop"
},
{
"file_patterns": ["(/|^)AppOpsManager.java"],
@@ -153,18 +148,7 @@
"file_patterns": ["(/|^)ContextImpl.java"]
},
{
- "name": "FrameworksCoreTests",
- "options": [
- {
- "exclude-annotation": "androidx.test.filters.FlakyTest"
- },
- {
- "exclude-annotation": "org.junit.Ignore"
- },
- {
- "include-filter": "android.content.ContextTest"
- }
- ],
+ "name": "FrameworksCoreTests_context",
"file_patterns": ["(/|^)ContextImpl.java"]
},
{
@@ -177,35 +161,13 @@
]
},
{
- "name": "FrameworksCoreTests",
- "options": [
- {
- "exclude-annotation": "androidx.test.filters.FlakyTest"
- },
- {
- "exclude-annotation": "org.junit.Ignore"
- },
- {
- "include-filter": "android.app.KeyguardManagerTest"
- }
- ],
+ "name": "FrameworksCoreTests_keyguard_manager",
"file_patterns": [
"(/|^)KeyguardManager.java"
]
},
{
- "name": "FrameworksCoreTests",
- "options": [
- {
- "exclude-annotation": "androidx.test.filters.FlakyTest"
- },
- {
- "exclude-annotation": "org.junit.Ignore"
- },
- {
- "include-filter": "android.app.PropertyInvalidatedCacheTests"
- }
- ],
+ "name": "FrameworksCoreTests_property_invalidated_cache",
"file_patterns": [
"(/|^)PropertyInvalidatedCache.java"
]
diff --git a/core/java/android/app/usage/OWNERS b/core/java/android/app/usage/OWNERS
index 57d958f..745e724 100644
--- a/core/java/android/app/usage/OWNERS
+++ b/core/java/android/app/usage/OWNERS
@@ -1,9 +1 @@
-# Bug component: 532296
-
-yamasani@google.com
-mwachens@google.com
-varunshah@google.com
-guanxin@google.com
-
-per-file *StorageStats* = file:/core/java/android/os/storage/OWNERS
-per-file *Broadcast* = sudheersai@google.com
+include /services/usage/OWNERS
\ No newline at end of file
diff --git a/core/java/android/content/TEST_MAPPING b/core/java/android/content/TEST_MAPPING
index a2cfbf5..baf32a5 100644
--- a/core/java/android/content/TEST_MAPPING
+++ b/core/java/android/content/TEST_MAPPING
@@ -22,24 +22,7 @@
"file_patterns": ["(/|^)Context.java", "(/|^)ContextWrapper.java"]
},
{
- "name": "FrameworksCoreTests",
- "options": [
- {
- "exclude-annotation": "androidx.test.filters.FlakyTest"
- },
- {
- "exclude-annotation": "org.junit.Ignore"
- },
- {
- "include-filter": "android.content.ContextTest"
- },
- {
- "include-filter": "android.content.ComponentCallbacksControllerTest"
- },
- {
- "include-filter": "android.content.ContextWrapperTest"
- }
- ],
+ "name": "FrameworksCoreTests_android_content",
"file_patterns": ["(/|^)Context.java", "(/|^)ContextWrapper.java", "(/|^)ComponentCallbacksController.java"]
},
{
diff --git a/core/java/android/database/OWNERS b/core/java/android/database/OWNERS
index 53f5bb0..50b7015 100644
--- a/core/java/android/database/OWNERS
+++ b/core/java/android/database/OWNERS
@@ -1,6 +1,2 @@
include /SQLITE_OWNERS
-omakoto@google.com
-jsharkey@android.com
-yamasani@google.com
-
diff --git a/core/java/android/database/sqlite/TEST_MAPPING b/core/java/android/database/sqlite/TEST_MAPPING
index 9dcf4e5..659cf6c 100644
--- a/core/java/android/database/sqlite/TEST_MAPPING
+++ b/core/java/android/database/sqlite/TEST_MAPPING
@@ -1,18 +1,7 @@
{
"presubmit": [
{
- "name": "FrameworksCoreTests",
- "options": [
- {
- "exclude-annotation": "androidx.test.filters.FlakyTest"
- },
- {
- "exclude-annotation": "org.junit.Ignore"
- },
- {
- "include-filter": "android.database.sqlite.SQLiteRawStatementTest"
- }
- ],
+ "name": "FrameworksCoreTests_sqlite",
"file_patterns": [
"(/|^)SQLiteRawStatement.java",
"(/|^)SQLiteDatabase.java",
diff --git a/core/java/android/os/TEST_MAPPING b/core/java/android/os/TEST_MAPPING
index b5029a6..ce8a580 100644
--- a/core/java/android/os/TEST_MAPPING
+++ b/core/java/android/os/TEST_MAPPING
@@ -73,11 +73,7 @@
"PowerComponents\\.java",
"[^/]*BatteryConsumer[^/]*\\.java"
],
- "name": "FrameworksCoreTests",
- "options": [
- { "include-filter": "com.android.internal.os.BatteryStatsTests" },
- { "exclude-annotation": "com.android.internal.os.SkipPresubmit" }
- ]
+ "name": "FrameworksCoreTests_battery_stats"
},
{
"file_patterns": [
@@ -86,10 +82,7 @@
"PowerComponents\\.java",
"[^/]*BatteryConsumer[^/]*\\.java"
],
- "name": "FrameworksServicesTests",
- "options": [
- { "include-filter": "com.android.server.am.BatteryStatsServiceTest" }
- ]
+ "name": "FrameworksServicesTests_battery_stats"
},
{
"file_patterns": [
@@ -132,12 +125,7 @@
},
{
"file_patterns": ["Environment[^/]*\\.java"],
- "name": "FrameworksCoreTests",
- "options": [
- {
- "include-filter": "android.os.EnvironmentTest"
- }
- ]
+ "name": "FrameworksCoreTests_environment"
}
],
"postsubmit": [
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 51585af..beeab14 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -2256,6 +2256,26 @@
"android.settings.MANAGE_MORE_DEFAULT_APPS_SETTINGS";
/**
+ * Activity Action: Show Other NFC services settings.
+ * <p>
+ * If a Settings activity handles this intent action, an "Other NFC services" entry will be
+ * shown in the Default payment app settings, and clicking it will launch that activity.
+ * <p>
+ * In some cases, a matching Activity may not exist, so ensure you safeguard against this.
+ * <p>
+ * Input: Nothing.
+ * <p>
+ * Output: Nothing.
+ *
+ * @hide
+ */
+ @FlaggedApi(android.nfc.Flags.FLAG_NFC_ACTION_MANAGE_SERVICES_SETTINGS)
+ @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
+ @SystemApi
+ public static final String ACTION_MANAGE_OTHER_NFC_SERVICES_SETTINGS =
+ "android.settings.MANAGE_OTHER_NFC_SERVICES_SETTINGS";
+
+ /**
* Activity Action: Show app screen size list settings for user to override app aspect
* ratio.
* <p>
diff --git a/core/java/android/security/advancedprotection/OWNERS b/core/java/android/security/advancedprotection/OWNERS
new file mode 100644
index 0000000..ddac8ed
--- /dev/null
+++ b/core/java/android/security/advancedprotection/OWNERS
@@ -0,0 +1,12 @@
+# Bug component: 315013
+
+achim@google.com
+azharaa@google.com
+cpinelli@google.com
+eranm@google.com
+hanikazmi@google.com
+haok@google.com
+lus@google.com
+mattgilbride@google.com
+mpgroover@google.com
+wnan@google.com
diff --git a/core/java/android/service/games/TEST_MAPPING b/core/java/android/service/games/TEST_MAPPING
index 3e551ef..9767bcd 100644
--- a/core/java/android/service/games/TEST_MAPPING
+++ b/core/java/android/service/games/TEST_MAPPING
@@ -2,15 +2,7 @@
"presubmit": [
// TODO(b/245615658): fix flaky CTS test CtsGameServiceTestCases and add it as presubmit
{
- "name": "FrameworksMockingServicesTests",
- "options": [
- {
- "include-filter": "android.service.games"
- },
- {
- "exclude-annotation": "androidx.test.filters.FlakyTest"
- }
- ]
+ "name": "FrameworksMockingServicesTests_games_Presubmit"
}
]
}
\ No newline at end of file
diff --git a/core/java/android/util/NtpTrustedTime.java b/core/java/android/util/NtpTrustedTime.java
index 3adbd68..9f54d9f 100644
--- a/core/java/android/util/NtpTrustedTime.java
+++ b/core/java/android/util/NtpTrustedTime.java
@@ -24,7 +24,7 @@
import android.content.res.Resources;
import android.net.ConnectivityManager;
import android.net.Network;
-import android.net.NetworkInfo;
+import android.net.NetworkCapabilities;
import android.net.SntpClient;
import android.os.Build;
import android.os.SystemClock;
@@ -687,8 +687,16 @@
if (connectivityManager == null) {
return false;
}
- final NetworkInfo ni = connectivityManager.getNetworkInfo(network);
-
+ final NetworkCapabilities networkCapabilities =
+ connectivityManager.getNetworkCapabilities(network);
+ if (networkCapabilities == null) {
+ if (LOGD) Log.d(TAG, "getNetwork: failed to get network capabilities");
+ return false;
+ }
+ final boolean isConnectedToInternet = networkCapabilities.hasCapability(
+ NetworkCapabilities.NET_CAPABILITY_INTERNET)
+ && networkCapabilities.hasCapability(
+ NetworkCapabilities.NET_CAPABILITY_VALIDATED);
// This connectivity check is to avoid performing a DNS lookup for the time server on a
// unconnected network. There are races to obtain time in Android when connectivity
// changes, which means that forceRefresh() can be called by various components before
@@ -698,8 +706,8 @@
// A side effect of check is that tests that run a fake NTP server on the device itself
// will only be able to use it if the active network is connected, even though loopback
// addresses are actually reachable.
- if (ni == null || !ni.isConnected()) {
- if (LOGD) Log.d(TAG, "getNetwork: no connectivity");
+ if (!isConnectedToInternet) {
+ if (LOGD) Log.d(TAG, "getNetwork: no internet connectivity");
return false;
}
return true;
diff --git a/core/java/android/util/TEST_MAPPING b/core/java/android/util/TEST_MAPPING
index c681f86..64b2e6e 100644
--- a/core/java/android/util/TEST_MAPPING
+++ b/core/java/android/util/TEST_MAPPING
@@ -1,27 +1,11 @@
{
"presubmit": [
{
- "name": "FrameworksCoreTests",
- "options": [
- {
- "include-filter": "android.util.CharsetUtilsTest"
- },
- {
- "include-filter": "com.android.internal.util.FastDataTest"
- }
- ],
+ "name": "FrameworksCoreTests_util_data_charset",
"file_patterns": ["CharsetUtils|FastData"]
},
{
- "name": "FrameworksCoreTests",
- "options": [
- {
- "include-filter": "android.util.XmlTest"
- },
- {
- "include-filter": "android.util.BinaryXmlTest"
- }
- ],
+ "name": "FrameworksCoreTests_xml",
"file_patterns": ["Xml"]
}
],
diff --git a/core/java/android/util/apk/TEST_MAPPING b/core/java/android/util/apk/TEST_MAPPING
index 7668eec..3ae470a 100644
--- a/core/java/android/util/apk/TEST_MAPPING
+++ b/core/java/android/util/apk/TEST_MAPPING
@@ -1,12 +1,7 @@
{
"presubmit": [
{
- "name": "FrameworksCoreTests",
- "options": [
- {
- "include-filter": "android.util.apk.SourceStampVerifierTest"
- }
- ]
+ "name": "FrameworksCoreTests_util_apk"
}
],
"presubmit-large": [
diff --git a/core/java/android/view/contentprotection/OWNERS b/core/java/android/view/contentprotection/OWNERS
index b3583a7..48052c6 100644
--- a/core/java/android/view/contentprotection/OWNERS
+++ b/core/java/android/view/contentprotection/OWNERS
@@ -1,4 +1,6 @@
-# Bug component: 544200
+# Bug component: 1040349
-include /core/java/android/view/contentcapture/OWNERS
+njagar@google.com
+williamluh@google.com
+aaronjosephs@google.com
diff --git a/core/java/android/view/textclassifier/TEST_MAPPING b/core/java/android/view/textclassifier/TEST_MAPPING
index 2f9e737..050c651 100644
--- a/core/java/android/view/textclassifier/TEST_MAPPING
+++ b/core/java/android/view/textclassifier/TEST_MAPPING
@@ -1,15 +1,7 @@
{
"presubmit": [
{
- "name": "FrameworksCoreTests",
- "options": [
- {
- "include-filter": "android.view.textclassifier"
- },
- {
- "exclude-annotation": "androidx.test.filters.FlakyTest"
- }
- ]
+ "name": "FrameworksCoreTests_textclassifier"
},
{
"name": "CtsTextClassifierTestCases",
diff --git a/core/java/com/android/internal/app/TEST_MAPPING b/core/java/com/android/internal/app/TEST_MAPPING
index 08e1d57..b7930bc 100644
--- a/core/java/com/android/internal/app/TEST_MAPPING
+++ b/core/java/com/android/internal/app/TEST_MAPPING
@@ -5,19 +5,7 @@
"file_patterns": ["(/|^)SuspendedAppActivity\\.java"]
},
{
- "name": "FrameworksCoreTests",
- "options": [
- {
- "include-filter": "com.android.internal.app."
- },
- // Exclude currently failing tests from presubmit
- {
- "exclude-filter": "com.android.internal.app.IntentForwarderActivityTest"
- },
- {
- "exclude-filter": "com.android.internal.app.WindowDecorActionBarTest"
- }
- ]
+ "name": "FrameworksCoreTests_internal_app"
}
]
}
diff --git a/core/java/com/android/internal/content/om/TEST_MAPPING b/core/java/com/android/internal/content/om/TEST_MAPPING
index ab3abb1..c27c325 100644
--- a/core/java/com/android/internal/content/om/TEST_MAPPING
+++ b/core/java/com/android/internal/content/om/TEST_MAPPING
@@ -1,12 +1,7 @@
{
"presubmit": [
{
- "name": "FrameworksCoreTests",
- "options": [
- {
- "include-filter": "com.android.internal.content."
- }
- ]
+ "name": "FrameworksCoreTests_internal_content"
},
{
"name": "SelfTargetingOverlayDeviceTests"
diff --git a/core/java/com/android/internal/infra/TEST_MAPPING b/core/java/com/android/internal/infra/TEST_MAPPING
index c09181f..e4550c0 100644
--- a/core/java/com/android/internal/infra/TEST_MAPPING
+++ b/core/java/com/android/internal/infra/TEST_MAPPING
@@ -20,12 +20,7 @@
]
},
{
- "name": "FrameworksCoreTests",
- "options": [
- {
- "include-filter": "com.android.internal.infra."
- }
- ]
+ "name": "FrameworksCoreTests_internal_infra"
}
]
}
diff --git a/core/java/com/android/internal/jank/TEST_MAPPING b/core/java/com/android/internal/jank/TEST_MAPPING
index 4e00ff1..e7f3dc3 100644
--- a/core/java/com/android/internal/jank/TEST_MAPPING
+++ b/core/java/com/android/internal/jank/TEST_MAPPING
@@ -1,18 +1,7 @@
{
"presubmit": [
{
- "name": "FrameworksCoreTests",
- "options": [
- {
- "include-filter": "com.android.internal.jank"
- },
- {
- "exclude-annotation": "androidx.test.filters.FlakyTest"
- },
- {
- "exclude-annotation": "org.junit.Ignore"
- }
- ],
+ "name": "FrameworksCoreTests_internal_jank",
"file_patterns": [
"core/java/com/android/internal/jank/.*",
"core/tests/coretests/src/com/android/internal/jank/.*"
diff --git a/core/java/com/android/internal/os/TEST_MAPPING b/core/java/com/android/internal/os/TEST_MAPPING
index d552e0b..467cd77 100644
--- a/core/java/com/android/internal/os/TEST_MAPPING
+++ b/core/java/com/android/internal/os/TEST_MAPPING
@@ -6,11 +6,7 @@
"Kernel[^/]*\\.java",
"[^/]*Power[^/]*\\.java"
],
- "name": "FrameworksCoreTests",
- "options": [
- { "include-filter": "com.android.internal.os.BatteryStatsTests" },
- { "exclude-annotation": "com.android.internal.os.SkipPresubmit" }
- ]
+ "name": "FrameworksCoreTests_battery_stats"
},
{
"file_patterns": [
@@ -24,11 +20,7 @@
"file_patterns": [
"BinderDeathDispatcher\\.java"
],
- "name": "FrameworksCoreTests",
- "options": [
- { "include-filter": "com.android.internal.os.BinderDeathDispatcherTest" },
- { "exclude-annotation": "com.android.internal.os.SkipPresubmit" }
- ]
+ "name": "FrameworksCoreTests_internal_os_binder"
},
{
"file_patterns": [
@@ -36,10 +28,7 @@
"Kernel[^/]*\\.java",
"[^/]*Power[^/]*\\.java"
],
- "name": "FrameworksServicesTests",
- "options": [
- { "include-filter": "com.android.server.am.BatteryStatsServiceTest" }
- ]
+ "name": "FrameworksServicesTests_battery_stats"
},
{
"file_patterns": [
@@ -50,25 +39,7 @@
"name": "PowerStatsTests"
},
{
- "name": "FrameworksCoreTests",
- "options": [
- {
- "include-filter": "com.android.internal.os.KernelCpuUidFreqTimeReaderTest"
- },
- {
- "include-filter": "com.android.internal.os.KernelCpuUidActiveTimeReaderTest"
- },
- {
- "include-filter": "com.android.internal.os.KernelCpuUidClusterTimeReaderTest"
- },
- {
- "include-filter": "com.android.internal.os.KernelSingleUidTimeReaderTest"
- },
- {
- "include-filter": "com.android.internal.os.KernelCpuUidBpfMapReaderTest"
- }
-
- ],
+ "name": "FrameworksCoreTests_internal_os_kernel",
"file_patterns": [
"KernelCpuUidTimeReader\\.java",
"KernelCpuUidBpfMapReader\\.java",
@@ -78,7 +49,7 @@
],
"postsubmit": [
{
- "name": "FrameworksCoreTests",
+ "name": "PowerStatsTests",
"options": [
{
"include-filter": "com.android.server.power.stats.BstatsCpuTimesValidationTest"
diff --git a/core/java/com/android/internal/power/TEST_MAPPING b/core/java/com/android/internal/power/TEST_MAPPING
index 1946f5c..3f184b2 100644
--- a/core/java/com/android/internal/power/TEST_MAPPING
+++ b/core/java/com/android/internal/power/TEST_MAPPING
@@ -1,11 +1,7 @@
{
"presubmit": [
{
- "name": "FrameworksCoreTests",
- "options": [
- { "include-filter": "com.android.internal.os.BatteryStatsTests" },
- { "exclude-annotation": "com.android.internal.os.SkipPresubmit" }
- ]
+ "name": "FrameworksCoreTests_battery_stats"
},
{
"name": "PowerStatsTests"
diff --git a/core/java/com/android/internal/security/TEST_MAPPING b/core/java/com/android/internal/security/TEST_MAPPING
index 0af3b03..5bd9d2e 100644
--- a/core/java/com/android/internal/security/TEST_MAPPING
+++ b/core/java/com/android/internal/security/TEST_MAPPING
@@ -1,15 +1,7 @@
{
"presubmit": [
{
- "name": "FrameworksCoreTests",
- "options": [
- {
- "include-filter": "com.android.internal.security."
- },
- {
- "include-annotation": "android.platform.test.annotations.Presubmit"
- }
- ]
+ "name": "FrameworksCoreTests_internal_security"
},
{
"name": "UpdatableSystemFontTest",
diff --git a/core/java/com/android/internal/util/TEST_MAPPING b/core/java/com/android/internal/util/TEST_MAPPING
index 00a8118..a0221f3b 100644
--- a/core/java/com/android/internal/util/TEST_MAPPING
+++ b/core/java/com/android/internal/util/TEST_MAPPING
@@ -5,30 +5,11 @@
"file_patterns": ["ScreenshotHelper"]
},
{
- "name": "FrameworksCoreTests",
- "options": [
- {
- "include-filter": "android.util.XmlTest"
- },
- {
- "include-filter": "android.util.BinaryXmlTest"
- }
- ],
+ "name": "FrameworksCoreTests_xml",
"file_patterns": ["Xml"]
},
{
- "name": "FrameworksCoreTests",
- "options": [
- {
- "include-filter": "com.android.internal.util.LatencyTrackerTest"
- },
- {
- "exclude-annotation": "androidx.test.filters.FlakyTest"
- },
- {
- "exclude-annotation": "org.junit.Ignore"
- }
- ],
+ "name": "FrameworksCoreTests_internal_util_latency_tracker",
"file_patterns": ["LatencyTracker.java"]
}
]
diff --git a/core/jni/OWNERS b/core/jni/OWNERS
index 30ce63c..6e67c37 100644
--- a/core/jni/OWNERS
+++ b/core/jni/OWNERS
@@ -50,6 +50,10 @@
# Sensor
per-file android_hardware_SensorManager* = arthuri@google.com, bduddie@google.com, stange@google.com
+# Security
+per-file android_os_SELinux.cpp = file:/core/java/android/security/OWNERS
+per-file android_security_* = file:/core/java/android/security/OWNERS
+
per-file *Zygote* = file:/ZYGOTE_OWNERS
per-file core_jni_helpers.* = file:/ZYGOTE_OWNERS
per-file fd_utils.* = file:/ZYGOTE_OWNERS
@@ -66,7 +70,6 @@
per-file android_os_storage_* = file:/core/java/android/os/storage/OWNERS
per-file android_os_Trace* = file:/TRACE_OWNERS
per-file android_se_* = file:/omapi/java/android/se/OWNERS
-per-file android_security_* = file:/core/java/android/security/OWNERS
per-file android_view_* = file:/core/java/android/view/OWNERS
per-file com_android_internal_net_* = file:/services/core/java/com/android/server/net/OWNERS
diff --git a/core/jni/TEST_MAPPING b/core/jni/TEST_MAPPING
index ea0b01e..fa73a4d 100644
--- a/core/jni/TEST_MAPPING
+++ b/core/jni/TEST_MAPPING
@@ -1,15 +1,7 @@
{
"presubmit": [
{
- "name": "FrameworksCoreTests",
- "options": [
- {
- "include-filter": "android.util.CharsetUtilsTest"
- },
- {
- "include-filter": "com.android.internal.util.FastDataTest"
- }
- ],
+ "name": "FrameworksCoreTests_util_data_charset",
"file_patterns": ["CharsetUtils|FastData"]
},
{
diff --git a/core/jni/android_os_SELinux.cpp b/core/jni/android_os_SELinux.cpp
index 84ca1ba..7a4670f4 100644
--- a/core/jni/android_os_SELinux.cpp
+++ b/core/jni/android_os_SELinux.cpp
@@ -53,7 +53,7 @@
}
struct SecurityContext_Delete {
- void operator()(security_context_t p) const {
+ void operator()(char* p) const {
freecon(p);
}
};
@@ -111,7 +111,7 @@
return NULL;
}
- security_context_t tmp = NULL;
+ char* tmp = NULL;
if (selabel_lookup(selabel_handle, &tmp, path_c_str, S_IFREG) != 0) {
ALOGE("fileSelabelLookup => selabel_lookup for %s failed: %d", path_c_str, errno);
return NULL;
@@ -138,7 +138,7 @@
return NULL;
}
- security_context_t tmp = NULL;
+ char* tmp = NULL;
int ret;
if (isSocket) {
ret = getpeercon(fd, &tmp);
@@ -184,7 +184,7 @@
* Function: setFSCreateCon
* Purpose: set security context used for creating a new file system object
* Parameters:
- * context: security_context_t representing the new context of a file system object,
+ * context: char* representing the new context of a file system object,
* set to NULL to return to the default policy behavior
* Returns: true on success, false on error
* Exception: none
@@ -267,7 +267,7 @@
return NULL;
}
- security_context_t tmp = NULL;
+ char* tmp = NULL;
int ret = getfilecon(path.c_str(), &tmp);
Unique_SecurityContext context(tmp);
@@ -293,7 +293,7 @@
return NULL;
}
- security_context_t tmp = NULL;
+ char* tmp = NULL;
int ret = getcon(&tmp);
Unique_SecurityContext context(tmp);
@@ -320,7 +320,7 @@
return NULL;
}
- security_context_t tmp = NULL;
+ char* tmp = NULL;
int ret = getpidcon(static_cast<pid_t>(pid), &tmp);
Unique_SecurityContext context(tmp);
diff --git a/core/jni/com_android_internal_os_Zygote.cpp b/core/jni/com_android_internal_os_Zygote.cpp
index dbbcbad..f1c1d92 100644
--- a/core/jni/com_android_internal_os_Zygote.cpp
+++ b/core/jni/com_android_internal_os_Zygote.cpp
@@ -19,14 +19,6 @@
#include "com_android_internal_os_Zygote.h"
-#include <async_safe/log.h>
-
-// sys/mount.h has to come before linux/fs.h due to redefinition of MS_RDONLY, MS_BIND, etc
-#include <sys/mount.h>
-#include <linux/fs.h>
-#include <sys/types.h>
-#include <dirent.h>
-
#include <algorithm>
#include <array>
#include <atomic>
@@ -41,32 +33,31 @@
#include <android/fdsan.h>
#include <arpa/inet.h>
+#include <dirent.h>
#include <fcntl.h>
#include <grp.h>
#include <inttypes.h>
#include <malloc.h>
#include <mntent.h>
-#include <paths.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
-#include <sys/auxv.h>
#include <sys/capability.h>
-#include <sys/cdefs.h>
#include <sys/eventfd.h>
+#include <sys/mount.h>
#include <sys/personality.h>
#include <sys/prctl.h>
#include <sys/resource.h>
#include <sys/socket.h>
#include <sys/stat.h>
-#define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_
-#include <sys/_system_properties.h>
+#include <sys/system_properties.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/un.h>
#include <sys/wait.h>
#include <unistd.h>
+#include <async_safe/log.h>
#include <android-base/file.h>
#include <android-base/logging.h>
#include <android-base/properties.h>
diff --git a/core/res/OWNERS b/core/res/OWNERS
index 22ea9da..27376cd 100644
--- a/core/res/OWNERS
+++ b/core/res/OWNERS
@@ -75,6 +75,11 @@
per-file res/values/config_telephony.xml = file:/platform/frameworks/opt/telephony:/OWNERS
per-file res/xml/sms_short_codes.xml = file:/platform/frameworks/opt/telephony:/OWNERS
+# Input Method Framework
+per-file res/*/*input_method* = file:/services/core/java/com/android/server/inputmethod/OWNERS
+per-file res/*/*_ime* = file:/services/core/java/com/android/server/inputmethod/OWNERS
+per-file res/*/ime_* = file:/services/core/java/com/android/server/inputmethod/OWNERS
+
# TV Input Framework
per-file res/values/config_tv_external_input_logging.xml = file:/services/core/java/com/android/server/tv/OWNERS
diff --git a/core/tests/coretests/src/android/content/TEST_MAPPING b/core/tests/coretests/src/android/content/TEST_MAPPING
index bbc2458..fd9fda3a 100644
--- a/core/tests/coretests/src/android/content/TEST_MAPPING
+++ b/core/tests/coretests/src/android/content/TEST_MAPPING
@@ -1,18 +1,7 @@
{
"presubmit": [
{
- "name": "FrameworksCoreTests",
- "options": [
- {
- "include-filter": "android.content.ContentCaptureOptionsTest"
- },
- {
- "exclude-annotation": "androidx.test.filters.FlakyTest"
- },
- {
- "exclude-annotation": "org.junit.Ignore"
- }
- ]
+ "name": "FrameworksCoreTests_content_capture_options"
}
]
}
diff --git a/core/tests/coretests/src/android/content/integrity/TEST_MAPPING b/core/tests/coretests/src/android/content/integrity/TEST_MAPPING
index 2920716..d22fe84 100644
--- a/core/tests/coretests/src/android/content/integrity/TEST_MAPPING
+++ b/core/tests/coretests/src/android/content/integrity/TEST_MAPPING
@@ -1,12 +1,7 @@
{
"presubmit": [
{
- "name": "FrameworksCoreTests",
- "options": [
- {
- "include-filter": "android.content.integrity."
- }
- ]
+ "name": "FrameworksCoreTests_android_content_integrity"
}
]
}
diff --git a/core/tests/coretests/src/android/content/pm/TEST_MAPPING b/core/tests/coretests/src/android/content/pm/TEST_MAPPING
index 978d80c..9ab438e 100644
--- a/core/tests/coretests/src/android/content/pm/TEST_MAPPING
+++ b/core/tests/coretests/src/android/content/pm/TEST_MAPPING
@@ -1,21 +1,7 @@
{
"presubmit": [
{
- "name": "FrameworksCoreTests",
- "options": [
- {
- "include-filter": "android.content.pm."
- },
- {
- "include-annotation": "android.platform.test.annotations.Presubmit"
- },
- {
- "exclude-annotation": "androidx.test.filters.FlakyTest"
- },
- {
- "exclude-annotation": "org.junit.Ignore"
- }
- ]
+ "name": "FrameworksCoreTests_android_content_pm_PreSubmit"
}
],
"postsubmit": [
diff --git a/core/tests/coretests/src/android/content/res/TEST_MAPPING b/core/tests/coretests/src/android/content/res/TEST_MAPPING
index 4ea6e40..4cce70e 100644
--- a/core/tests/coretests/src/android/content/res/TEST_MAPPING
+++ b/core/tests/coretests/src/android/content/res/TEST_MAPPING
@@ -1,43 +1,12 @@
{
"presubmit": [
{
- "name": "FrameworksCoreTests",
- "options": [
- {
- "include-filter": "android.content.res."
- },
- {
- "include-annotation": "android.platform.test.annotations.Presubmit"
- },
- {
- "exclude-annotation": "android.platform.test.annotations.Postsubmit"
- },
- {
- "exclude-annotation": "androidx.test.filters.FlakyTest"
- },
- {
- "exclude-annotation": "org.junit.Ignore"
- }
- ]
+ "name": "FrameworksCoreTests_android_content_res"
}
],
"postsubmit": [
{
- "name": "FrameworksCoreTests",
- "options": [
- {
- "include-filter": "android.content.res."
- },
- {
- "include-annotation": "android.platform.test.annotations.Postsubmit"
- },
- {
- "exclude-annotation": "androidx.test.filters.FlakyTest"
- },
- {
- "exclude-annotation": "org.junit.Ignore"
- }
- ]
+ "name": "FrameworksCoreTests_android_content_res_PostSubmit"
}
]
}
diff --git a/core/tests/coretests/src/android/service/TEST_MAPPING b/core/tests/coretests/src/android/service/TEST_MAPPING
index bec72d9..21f248d 100644
--- a/core/tests/coretests/src/android/service/TEST_MAPPING
+++ b/core/tests/coretests/src/android/service/TEST_MAPPING
@@ -1,17 +1,7 @@
{
"presubmit": [
{
- "name": "FrameworksCoreTests",
- "options": [
- {"include-filter": "android.service.controls"},
- {"include-filter": "android.service.controls.actions"},
- {"include-filter": "android.service.controls.templates"},
- {"include-filter": "android.service.euicc"},
- {"include-filter": "android.service.notification"},
- {"include-filter": "android.service.quicksettings"},
- {"include-filter": "android.service.settings.suggestions"},
- {"exclude-annotation": "org.junit.Ignore"}
- ]
+ "name": "FrameworksCoreTests_android_service"
}
]
}
diff --git a/core/tests/coretests/src/android/view/contentcapture/TEST_MAPPING b/core/tests/coretests/src/android/view/contentcapture/TEST_MAPPING
index f8beac2..c2cf40d 100644
--- a/core/tests/coretests/src/android/view/contentcapture/TEST_MAPPING
+++ b/core/tests/coretests/src/android/view/contentcapture/TEST_MAPPING
@@ -1,18 +1,7 @@
{
"presubmit": [
{
- "name": "FrameworksCoreTests",
- "options": [
- {
- "include-filter": "android.view.contentcapture"
- },
- {
- "exclude-annotation": "androidx.test.filters.FlakyTest"
- },
- {
- "exclude-annotation": "org.junit.Ignore"
- }
- ]
+ "name": "FrameworksCoreTests_android_view_contentcapture"
}
]
}
diff --git a/core/tests/coretests/src/android/view/contentprotection/OWNERS b/core/tests/coretests/src/android/view/contentprotection/OWNERS
index b3583a7..3d09da3 100644
--- a/core/tests/coretests/src/android/view/contentprotection/OWNERS
+++ b/core/tests/coretests/src/android/view/contentprotection/OWNERS
@@ -1,4 +1,4 @@
-# Bug component: 544200
+# Bug component: 1040349
-include /core/java/android/view/contentcapture/OWNERS
+include /core/java/android/view/contentprotection/OWNERS
diff --git a/core/tests/coretests/src/android/view/contentprotection/TEST_MAPPING b/core/tests/coretests/src/android/view/contentprotection/TEST_MAPPING
index 3cd4e17..3ef1ac1 100644
--- a/core/tests/coretests/src/android/view/contentprotection/TEST_MAPPING
+++ b/core/tests/coretests/src/android/view/contentprotection/TEST_MAPPING
@@ -1,18 +1,7 @@
{
"presubmit": [
{
- "name": "FrameworksCoreTests",
- "options": [
- {
- "include-filter": "android.view.contentprotection"
- },
- {
- "exclude-annotation": "androidx.test.filters.FlakyTest"
- },
- {
- "exclude-annotation": "org.junit.Ignore"
- }
- ]
+ "name": "FrameworksCoreTests_android_view_contentprotection"
}
]
}
diff --git a/core/tests/coretests/src/com/android/internal/content/res/TEST_MAPPING b/core/tests/coretests/src/com/android/internal/content/res/TEST_MAPPING
index 9aed8be..4a46244 100644
--- a/core/tests/coretests/src/com/android/internal/content/res/TEST_MAPPING
+++ b/core/tests/coretests/src/com/android/internal/content/res/TEST_MAPPING
@@ -1,21 +1,7 @@
{
"presubmit": [
{
- "name": "FrameworksCoreTests",
- "options": [
- {
- "include-filter": "com.android.internal.content."
- },
- {
- "include-annotation": "android.platform.test.annotations.Presubmit"
- },
- {
- "exclude-annotation": "androidx.test.filters.FlakyTest"
- },
- {
- "exclude-annotation": "org.junit.Ignore"
- }
- ]
+ "name": "FrameworksCoreTests_com_android_internal_content_Presubmit"
}
]
}
diff --git a/data/etc/Android.bp b/data/etc/Android.bp
index 1410950..564b87b 100644
--- a/data/etc/Android.bp
+++ b/data/etc/Android.bp
@@ -78,6 +78,12 @@
src: "package-shareduid-allowlist.xml",
}
+prebuilt_etc {
+ name: "oem-defined-uids.xml",
+ sub_dir: "sysconfig",
+ src: "oem-defined-uids.xml",
+}
+
// Privapp permission whitelist files
prebuilt_etc {
diff --git a/data/etc/oem-defined-uids.xml b/data/etc/oem-defined-uids.xml
new file mode 100644
index 0000000..87435b9
--- /dev/null
+++ b/data/etc/oem-defined-uids.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ 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.
+ -->
+
+<!--
+This XML defines a list of UIDs for OEMs to register as shared UIDs. They will be registered at the
+start of the system, which allows OEMs to create services with these UIDs. The range of these UIDs
+must be in the OEM reserved range.
+
+OEM must provide a preloaded app that is installed at boot time to retain the newly registered UID
+by adding a android:sharedUserId tag in the manifest of the preloaded app, with the value of the tag
+set to the name of the UID defined in this config file. Otherwise, the uid will be cleared at the
+end of the boot and this config file will take no effect.
+
+- The "name" XML attribute refers to the name of the shared UID. It must start with "android.uid.".
+- The "uid" XML attribute refers to the value of the shared UID. It must be in range [2900, 2999].
+
+Example usage
+ <oem-defined-uid name="android.uid.vendordata" uid="2918"/>
+ Indicates that a shared UID named "android.uid.vendordata" will be added to the system with the
+ UID of 2918.
+-->
+
+<config>
+</config>
diff --git a/graphics/java/android/graphics/drawable/TEST_MAPPING b/graphics/java/android/graphics/drawable/TEST_MAPPING
index 1018702..4f06452 100644
--- a/graphics/java/android/graphics/drawable/TEST_MAPPING
+++ b/graphics/java/android/graphics/drawable/TEST_MAPPING
@@ -12,13 +12,7 @@
},
{
- "name": "FrameworksCoreTests",
- "file_patterns": ["(/|^)Icon\\.java"],
- "options" : [
- {
- "include-filter": "android.graphics.drawable.IconTest"
- }
- ]
+ "name": "FrameworksCoreTests_drawable"
}
]
}
diff --git a/libs/WindowManager/Shell/OWNERS b/libs/WindowManager/Shell/OWNERS
index 2e19d52..c6044a4 100644
--- a/libs/WindowManager/Shell/OWNERS
+++ b/libs/WindowManager/Shell/OWNERS
@@ -1,5 +1,5 @@
xutan@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
+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
per-file res*/*/tv_*.xml = bronger@google.com
diff --git a/libs/WindowManager/Shell/res/drawable/decor_back_button_dark.xml b/libs/WindowManager/Shell/res/drawable/decor_back_button_dark.xml
index 5ecba38..a36b21f 100644
--- a/libs/WindowManager/Shell/res/drawable/decor_back_button_dark.xml
+++ b/libs/WindowManager/Shell/res/drawable/decor_back_button_dark.xml
@@ -15,6 +15,7 @@
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:autoMirrored="true"
android:width="32.0dp"
android:height="32.0dp"
android:viewportWidth="32.0"
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/freeform/OWNERS b/libs/WindowManager/Shell/src/com/android/wm/shell/freeform/OWNERS
index 93351c3..83b5bf6 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/freeform/OWNERS
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/freeform/OWNERS
@@ -9,3 +9,5 @@
pragyabajoria@google.com
uysalorhan@google.com
gsennton@google.com
+mattsziklay@google.com
+mdehaini@google.com
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/OneShotRemoteHandler.java b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/OneShotRemoteHandler.java
index 94519a0..055b355 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/OneShotRemoteHandler.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/OneShotRemoteHandler.java
@@ -134,7 +134,6 @@
t.clear();
mMainExecutor.execute(() -> {
finishCallback.onTransitionFinished(wct);
- mRemote = null;
});
}
};
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/Transitions.java b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/Transitions.java
index 888105d..5aef520 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/Transitions.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/Transitions.java
@@ -667,7 +667,11 @@
Log.e(TAG, "Got duplicate transitionReady for " + transitionToken);
// The transition is already somewhere else in the pipeline, so just return here.
t.apply();
- existing.mFinishT.merge(finishT);
+ if (existing.mFinishT != null) {
+ existing.mFinishT.merge(finishT);
+ } else {
+ existing.mFinishT = finishT;
+ }
return;
}
// This usually means the system is in a bad state and may not recover; however,
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/OWNERS b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/OWNERS
index 4417209..3f828f5 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/OWNERS
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/OWNERS
@@ -1 +1,3 @@
jorgegil@google.com
+mattsziklay@google.com
+mdehaini@google.com
diff --git a/libs/WindowManager/Shell/tests/OWNERS b/libs/WindowManager/Shell/tests/OWNERS
index fdec969..a7206fa 100644
--- a/libs/WindowManager/Shell/tests/OWNERS
+++ b/libs/WindowManager/Shell/tests/OWNERS
@@ -16,3 +16,5 @@
pragyabajoria@google.com
uysalorhan@google.com
gsennton@google.com
+mattsziklay@google.com
+mdehaini@google.com
diff --git a/libs/androidfw/PosixUtils.cpp b/libs/androidfw/PosixUtils.cpp
index 8ddc572..49ee8f7 100644
--- a/libs/androidfw/PosixUtils.cpp
+++ b/libs/androidfw/PosixUtils.cpp
@@ -119,7 +119,7 @@
auto err = ReadFile(stderr[0]);
result.stderr_str = err ? std::move(*err) : "";
close(stderr[0]);
- return std::move(result);
+ return result;
}
}
diff --git a/location/TEST_MAPPING b/location/TEST_MAPPING
index 10da632..256affd 100644
--- a/location/TEST_MAPPING
+++ b/location/TEST_MAPPING
@@ -11,10 +11,7 @@
"name": "CtsLocationNoneTestCases"
},
{
- "name": "FrameworksMockingServicesTests",
- "options": [{
- "include-filter": "com.android.server.location"
- }]
+ "name": "FrameworksMockingServicesTests_location"
}
]
}
diff --git a/media/java/android/media/tv/TvView.java b/media/java/android/media/tv/TvView.java
index e604cb7..82e6ed3 100644
--- a/media/java/android/media/tv/TvView.java
+++ b/media/java/android/media/tv/TvView.java
@@ -91,7 +91,7 @@
private static final Object sMainTvViewLock = new Object();
private static WeakReference<TvView> sMainTvView = NULL_TV_VIEW;
- private final Handler mHandler = new Handler();
+ private Handler mHandler = new Handler();
private Session mSession;
private SurfaceView mSurfaceView;
private Surface mSurface;
@@ -207,6 +207,17 @@
mCallback = callback;
}
+ /**
+ * Sets the handler to be invoked when an event is dispatched to this TvView.
+ * If handler is not set by this function, TvView will use its default handler.
+ *
+ * @param handler The handler to handle events.
+ * @hide
+ */
+ public void setHandler(@NonNull Handler handler) {
+ mHandler = handler;
+ }
+
/** @hide */
public Session getInputSession() {
return mSession;
diff --git a/media/jni/android_media_MediaCodecLinearBlock.h b/media/jni/android_media_MediaCodecLinearBlock.h
index 060abfd..ffbf0a8 100644
--- a/media/jni/android_media_MediaCodecLinearBlock.h
+++ b/media/jni/android_media_MediaCodecLinearBlock.h
@@ -62,7 +62,7 @@
std::shared_ptr<C2Buffer> buffer =
C2Buffer::CreateLinearBuffer(block.subBlock(offset, size));
for (const std::shared_ptr<const C2Info> &info : mBuffer->info()) {
- std::shared_ptr<C2Param> param = std::move(C2Param::Copy(*info));
+ std::shared_ptr<C2Param> param = C2Param::Copy(*info);
buffer->setInfo(std::static_pointer_cast<C2Info>(param));
}
return buffer;
diff --git a/nfc/api/current.txt b/nfc/api/current.txt
index cf7aea4..447e980 100644
--- a/nfc/api/current.txt
+++ b/nfc/api/current.txt
@@ -220,11 +220,14 @@
field @Deprecated public static final String ACTION_CHANGE_DEFAULT = "android.nfc.cardemulation.action.ACTION_CHANGE_DEFAULT";
field public static final String CATEGORY_OTHER = "other";
field public static final String CATEGORY_PAYMENT = "payment";
+ field @FlaggedApi("android.nfc.nfc_override_recover_routing_table") public static final String DH = "DH";
+ field @FlaggedApi("android.nfc.nfc_override_recover_routing_table") public static final String ESE = "ESE";
field public static final String EXTRA_CATEGORY = "category";
field public static final String EXTRA_SERVICE_COMPONENT = "component";
field public static final int SELECTION_MODE_ALWAYS_ASK = 1; // 0x1
field public static final int SELECTION_MODE_ASK_IF_CONFLICT = 2; // 0x2
field public static final int SELECTION_MODE_PREFER_DEFAULT = 0; // 0x0
+ field @FlaggedApi("android.nfc.nfc_override_recover_routing_table") public static final String UICC = "UICC";
}
public abstract class HostApduService extends android.app.Service {
@@ -232,6 +235,8 @@
method public final void notifyUnhandled();
method public final android.os.IBinder onBind(android.content.Intent);
method public abstract void onDeactivated(int);
+ method @FlaggedApi("android.nfc.nfc_event_listener") public void onObserveModeStateChanged(boolean);
+ method @FlaggedApi("android.nfc.nfc_event_listener") public void onPreferredServiceChanged(boolean);
method public abstract byte[] processCommandApdu(byte[], android.os.Bundle);
method @FlaggedApi("android.nfc.nfc_read_polling_loop") public void processPollingFrames(@NonNull java.util.List<android.nfc.cardemulation.PollingFrame>);
method public final void sendResponseApdu(byte[]);
diff --git a/nfc/api/system-current.txt b/nfc/api/system-current.txt
index 3375e18c..25a01b9 100644
--- a/nfc/api/system-current.txt
+++ b/nfc/api/system-current.txt
@@ -57,14 +57,34 @@
@FlaggedApi("android.nfc.nfc_oem_extension") public final class NfcOemExtension {
method @FlaggedApi("android.nfc.nfc_oem_extension") @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public void clearPreference();
+ method @FlaggedApi("android.nfc.nfc_oem_extension") @NonNull public java.util.List<java.lang.String> getActiveNfceeList();
method @FlaggedApi("android.nfc.nfc_oem_extension") @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public void maybeTriggerFirmwareUpdate();
method @FlaggedApi("android.nfc.nfc_oem_extension") @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public void registerCallback(@NonNull java.util.concurrent.Executor, @NonNull android.nfc.NfcOemExtension.Callback);
method @FlaggedApi("android.nfc.nfc_oem_extension") @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public void synchronizeScreenState();
method @FlaggedApi("android.nfc.nfc_oem_extension") @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public void unregisterCallback(@NonNull android.nfc.NfcOemExtension.Callback);
+ field public static final int HCE_ACTIVATE = 1; // 0x1
+ field public static final int HCE_DATA_TRANSFERRED = 2; // 0x2
+ field public static final int HCE_DEACTIVATE = 3; // 0x3
+ field public static final int STATUS_OK = 0; // 0x0
+ field public static final int STATUS_UNKNOWN_ERROR = 1; // 0x1
}
public static interface NfcOemExtension.Callback {
+ method public void onApplyRouting(@NonNull java.util.function.Consumer<java.lang.Boolean>);
+ method public void onBootFinished(int);
+ method public void onBootStarted();
+ method public void onDisable(@NonNull java.util.function.Consumer<java.lang.Boolean>);
+ method public void onDisableFinished(int);
+ method public void onDisableStarted();
+ method public void onEnable(@NonNull java.util.function.Consumer<java.lang.Boolean>);
+ method public void onEnableFinished(int);
+ method public void onEnableStarted();
+ method public void onHceEventReceived(int);
+ method public void onNdefRead(@NonNull java.util.function.Consumer<java.lang.Boolean>);
+ method public void onRoutingChanged();
+ method public void onStateUpdated(int);
method public void onTagConnected(boolean, @NonNull android.nfc.Tag);
+ method public void onTagDispatch(@NonNull java.util.function.Consumer<java.lang.Boolean>);
}
}
@@ -74,6 +94,8 @@
public final class CardEmulation {
method @FlaggedApi("android.permission.flags.wallet_role_enabled") @Nullable @RequiresPermission(android.Manifest.permission.NFC_PREFERRED_PAYMENT_INFO) public static android.content.ComponentName getPreferredPaymentService(@NonNull android.content.Context);
method @FlaggedApi("android.nfc.enable_nfc_mainline") @NonNull public java.util.List<android.nfc.cardemulation.ApduServiceInfo> getServices(@NonNull String, int);
+ method @FlaggedApi("android.nfc.nfc_override_recover_routing_table") public void overrideRoutingTable(@NonNull android.app.Activity, @Nullable String, @Nullable String);
+ method @FlaggedApi("android.nfc.nfc_override_recover_routing_table") public void recoverRoutingTable(@NonNull android.app.Activity);
}
}
diff --git a/nfc/api/system-lint-baseline.txt b/nfc/api/system-lint-baseline.txt
index 761c8e6..c7a6181 100644
--- a/nfc/api/system-lint-baseline.txt
+++ b/nfc/api/system-lint-baseline.txt
@@ -9,6 +9,18 @@
Field 'ACTION_TRANSACTION_DETECTED' is missing @BroadcastBehavior
+CallbackMethodName: android.nfc.NfcOemExtension.Callback#shouldSkipRoutingChange():
+ Callback method names must follow the on<Something> style: shouldSkipRoutingChange
+
+
+MethodNameTense: android.nfc.NfcOemExtension.Callback#onEnable():
+ Unexpected tense; probably meant `enabled`, was `onEnable`
+
+
+MissingNullability: android.nfc.cardemulation.CardEmulation#overrideRoutingTable(android.app.Activity, String, String) parameter #1:
+ Missing nullability on parameter `protocol` in method `overrideRoutingTable`
+MissingNullability: android.nfc.cardemulation.CardEmulation#overrideRoutingTable(android.app.Activity, String, String) parameter #2:
+ Missing nullability on parameter `technology` in method `overrideRoutingTable`
MissingNullability: android.nfc.cardemulation.OffHostApduService#onBind(android.content.Intent):
Missing nullability on method `onBind` return
MissingNullability: android.nfc.cardemulation.OffHostApduService#onBind(android.content.Intent) parameter #0:
@@ -96,10 +108,12 @@
RequiresPermission: android.nfc.tech.TagTechnology#connect():
Method 'connect' documentation mentions permissions without declaring @RequiresPermission
+
SamShouldBeLast: android.nfc.NfcAdapter#enableReaderMode(android.app.Activity, android.nfc.NfcAdapter.ReaderCallback, int, android.os.Bundle):
SAM-compatible parameters (such as parameter 2, "callback", in android.nfc.NfcAdapter.enableReaderMode) should be last to improve Kotlin interoperability; see https://kotlinlang.org/docs/reference/java-interop.html#sam-conversions
SamShouldBeLast: android.nfc.NfcAdapter#ignore(android.nfc.Tag, int, android.nfc.NfcAdapter.OnTagRemovedListener, android.os.Handler):
SAM-compatible parameters (such as parameter 3, "tagRemovedListener", in android.nfc.NfcAdapter.ignore) should be last to improve Kotlin interoperability; see https://kotlinlang.org/docs/reference/java-interop.html#sam-conversions
+
SdkConstant: android.nfc.NfcAdapter#ACTION_REQUIRE_UNLOCK_FOR_NFC:
Field 'ACTION_REQUIRE_UNLOCK_FOR_NFC' is missing @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
diff --git a/nfc/java/android/nfc/INfcAdapter.aidl b/nfc/java/android/nfc/INfcAdapter.aidl
index 90ca92f..6c0f933 100644
--- a/nfc/java/android/nfc/INfcAdapter.aidl
+++ b/nfc/java/android/nfc/INfcAdapter.aidl
@@ -88,7 +88,7 @@
boolean isReaderOptionEnabled();
boolean isReaderOptionSupported();
@JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS)")
- boolean enableReaderOption(boolean enable);
+ boolean enableReaderOption(boolean enable, in String pkg);
boolean isObserveModeSupported();
boolean isObserveModeEnabled();
boolean setObserveMode(boolean enabled, String pkg);
@@ -113,4 +113,5 @@
void clearPreference();
void setScreenState();
void checkFirmware();
+ List<String> fetchActiveNfceeList();
}
diff --git a/nfc/java/android/nfc/INfcCardEmulation.aidl b/nfc/java/android/nfc/INfcCardEmulation.aidl
index cb97f23..79f1275 100644
--- a/nfc/java/android/nfc/INfcCardEmulation.aidl
+++ b/nfc/java/android/nfc/INfcCardEmulation.aidl
@@ -48,6 +48,6 @@
boolean setServiceEnabledForCategoryOther(int userHandle, in ComponentName app, boolean status);
boolean isDefaultPaymentRegistered();
- boolean overrideRoutingTable(int userHandle, String protocol, String technology);
- boolean recoverRoutingTable(int userHandle);
+ void overrideRoutingTable(int userHandle, String protocol, String technology, in String pkg);
+ void recoverRoutingTable(int userHandle);
}
diff --git a/nfc/java/android/nfc/INfcOemExtensionCallback.aidl b/nfc/java/android/nfc/INfcOemExtensionCallback.aidl
index 6c9096d..c19a44b 100644
--- a/nfc/java/android/nfc/INfcOemExtensionCallback.aidl
+++ b/nfc/java/android/nfc/INfcOemExtensionCallback.aidl
@@ -16,10 +16,25 @@
package android.nfc;
import android.nfc.Tag;
+import android.os.ResultReceiver;
/**
* @hide
*/
interface INfcOemExtensionCallback {
void onTagConnected(boolean connected, in Tag tag);
+ void onStateUpdated(int state);
+ void onApplyRouting(in ResultReceiver isSkipped);
+ void onNdefRead(in ResultReceiver isSkipped);
+ void onEnable(in ResultReceiver isAllowed);
+ void onDisable(in ResultReceiver isAllowed);
+ void onBootStarted();
+ void onEnableStarted();
+ void onDisableStarted();
+ void onBootFinished(int status);
+ void onEnableFinished(int status);
+ void onDisableFinished(int status);
+ void onTagDispatch(in ResultReceiver isSkipped);
+ void onRoutingChanged();
+ void onHceEventReceived(int action);
}
diff --git a/nfc/java/android/nfc/NfcAdapter.java b/nfc/java/android/nfc/NfcAdapter.java
index b36b705..525e2c5 100644
--- a/nfc/java/android/nfc/NfcAdapter.java
+++ b/nfc/java/android/nfc/NfcAdapter.java
@@ -2011,7 +2011,8 @@
if (!sHasNfcFeature) {
throw new UnsupportedOperationException();
}
- return callServiceReturn(() -> sService.enableReaderOption(enable), false);
+ return callServiceReturn(() ->
+ sService.enableReaderOption(enable, mContext.getPackageName()), false);
}
diff --git a/nfc/java/android/nfc/NfcOemExtension.java b/nfc/java/android/nfc/NfcOemExtension.java
index 2ec819c..6c02edd 100644
--- a/nfc/java/android/nfc/NfcOemExtension.java
+++ b/nfc/java/android/nfc/NfcOemExtension.java
@@ -18,15 +18,31 @@
import android.annotation.CallbackExecutor;
import android.annotation.FlaggedApi;
+import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.RequiresPermission;
+import android.annotation.SuppressLint;
import android.annotation.SystemApi;
import android.content.Context;
import android.os.Binder;
import android.os.RemoteException;
+import android.os.ResultReceiver;
import android.util.Log;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executor;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.FutureTask;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import java.util.function.Consumer;
+import java.util.function.Function;
+import java.util.function.Supplier;
/**
* Used for OEM extension APIs.
@@ -48,6 +64,52 @@
private final Object mLock = new Object();
/**
+ * Event that Host Card Emulation is activated.
+ */
+ public static final int HCE_ACTIVATE = 1;
+ /**
+ * Event that some data is transferred in Host Card Emulation.
+ */
+ public static final int HCE_DATA_TRANSFERRED = 2;
+ /**
+ * Event that Host Card Emulation is deactivated.
+ */
+ public static final int HCE_DEACTIVATE = 3;
+ /**
+ * Possible events from {@link Callback#onHceEventReceived}.
+ *
+ * @hide
+ */
+ @IntDef(value = {
+ HCE_ACTIVATE,
+ HCE_DATA_TRANSFERRED,
+ HCE_DEACTIVATE
+ })
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface HostCardEmulationAction {}
+
+ /**
+ * Status OK
+ */
+ public static final int STATUS_OK = 0;
+ /**
+ * Status unknown error
+ */
+ public static final int STATUS_UNKNOWN_ERROR = 1;
+
+ /**
+ * Status codes passed to OEM extension callbacks.
+ *
+ * @hide
+ */
+ @IntDef(value = {
+ STATUS_OK,
+ STATUS_UNKNOWN_ERROR
+ })
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface StatusCode {}
+
+ /**
* Interface for Oem extensions for NFC.
*/
public interface Callback {
@@ -59,21 +121,114 @@
* @param tag Tag details
*/
void onTagConnected(boolean connected, @NonNull Tag tag);
+
+ /**
+ * Update the Nfc Adapter State
+ * @param state new state that need to be updated
+ */
+ void onStateUpdated(@NfcAdapter.AdapterState int state);
+ /**
+ * Check if NfcService apply routing method need to be skipped for
+ * some feature.
+ * @param isSkipped The {@link Consumer} to be completed. If apply routing can be skipped,
+ * the {@link Consumer#accept(Object)} should be called with
+ * {@link Boolean#TRUE}, otherwise call with {@link Boolean#FALSE}.
+ */
+ void onApplyRouting(@NonNull Consumer<Boolean> isSkipped);
+ /**
+ * Check if NfcService ndefRead method need to be skipped To skip
+ * and start checking for presence of tag
+ * @param isSkipped The {@link Consumer} to be completed. If Ndef read can be skipped,
+ * the {@link Consumer#accept(Object)} should be called with
+ * {@link Boolean#TRUE}, otherwise call with {@link Boolean#FALSE}.
+ */
+ void onNdefRead(@NonNull Consumer<Boolean> isSkipped);
+ /**
+ * Method to check if Nfc is allowed to be enabled by OEMs.
+ * @param isAllowed The {@link Consumer} to be completed. If enabling NFC is allowed,
+ * the {@link Consumer#accept(Object)} should be called with
+ * {@link Boolean#TRUE}, otherwise call with {@link Boolean#FALSE}.
+ * false if NFC cannot be enabled at this time.
+ */
+ @SuppressLint("MethodNameTense")
+ void onEnable(@NonNull Consumer<Boolean> isAllowed);
+ /**
+ * Method to check if Nfc is allowed to be disabled by OEMs.
+ * @param isAllowed The {@link Consumer} to be completed. If disabling NFC is allowed,
+ * the {@link Consumer#accept(Object)} should be called with
+ * {@link Boolean#TRUE}, otherwise call with {@link Boolean#FALSE}.
+ * false if NFC cannot be disabled at this time.
+ */
+ void onDisable(@NonNull Consumer<Boolean> isAllowed);
+
+ /**
+ * Callback to indicate that Nfc starts to boot.
+ */
+ void onBootStarted();
+
+ /**
+ * Callback to indicate that Nfc starts to enable.
+ */
+ void onEnableStarted();
+
+ /**
+ * Callback to indicate that Nfc starts to enable.
+ */
+ void onDisableStarted();
+
+ /**
+ * Callback to indicate if NFC boots successfully or not.
+ * @param status the status code indicating if boot finished successfully
+ */
+ void onBootFinished(@StatusCode int status);
+
+ /**
+ * Callback to indicate if NFC is successfully enabled.
+ * @param status the status code indicating if enable finished successfully
+ */
+ void onEnableFinished(@StatusCode int status);
+
+ /**
+ * Callback to indicate if NFC is successfully disabled.
+ * @param status the status code indicating if disable finished successfully
+ */
+ void onDisableFinished(@StatusCode int status);
+
+ /**
+ * Check if NfcService tag dispatch need to be skipped.
+ * @param isSkipped The {@link Consumer} to be completed. If tag dispatch can be skipped,
+ * the {@link Consumer#accept(Object)} should be called with
+ * {@link Boolean#TRUE}, otherwise call with {@link Boolean#FALSE}.
+ */
+ void onTagDispatch(@NonNull Consumer<Boolean> isSkipped);
+
+ /**
+ * Notifies routing configuration is changed.
+ */
+ void onRoutingChanged();
+
+ /**
+ * API to activate start stop cpu boost on hce event.
+ *
+ * <p>When HCE is activated, transferring data, and deactivated,
+ * must call this method to activate, start and stop cpu boost respectively.
+ * @param action Flag indicating actions to activate, start and stop cpu boost.
+ */
+ void onHceEventReceived(@HostCardEmulationAction int action);
}
/**
* Constructor to be used only by {@link NfcAdapter}.
- * @hide
*/
- public NfcOemExtension(@NonNull Context context, @NonNull NfcAdapter adapter) {
+ NfcOemExtension(@NonNull Context context, @NonNull NfcAdapter adapter) {
mContext = context;
mAdapter = adapter;
mOemNfcExtensionCallback = new NfcOemExtensionCallback();
}
/**
- * Register an {@link Callback} to listen for UWB oem extension callbacks
+ * Register an {@link Callback} to listen for NFC oem extension callbacks
* <p>The provided callback will be invoked by the given {@link Executor}.
*
* @param executor an {@link Executor} to execute given callback
@@ -153,6 +308,19 @@
NfcAdapter.callService(() -> NfcAdapter.sService.checkFirmware());
}
+ /**
+ * Get the Active NFCEE (NFC Execution Environment) List
+ *
+ * @return List of activated secure elements on success
+ * which can contain "eSE" and "UICC", otherwise empty list.
+ */
+ @NonNull
+ @FlaggedApi(Flags.FLAG_NFC_OEM_EXTENSION)
+ public List<String> getActiveNfceeList() {
+ return NfcAdapter.callServiceReturn(() ->
+ NfcAdapter.sService.fetchActiveNfceeList(), new ArrayList<String>());
+ }
+
private final class NfcOemExtensionCallback extends INfcOemExtensionCallback.Stub {
@Override
public void onTagConnected(boolean connected, Tag tag) throws RemoteException {
@@ -168,5 +336,162 @@
}
}
}
+ @Override
+ public void onStateUpdated(int state) throws RemoteException {
+ handleVoidCallback(state, mCallback::onStateUpdated);
+ }
+ @Override
+ public void onApplyRouting(ResultReceiver isSkipped) throws RemoteException {
+ handleVoidCallback(
+ new ReceiverWrapper(isSkipped), mCallback::onApplyRouting);
+ }
+ @Override
+ public void onNdefRead(ResultReceiver isSkipped) throws RemoteException {
+ handleVoidCallback(
+ new ReceiverWrapper(isSkipped), mCallback::onNdefRead);
+ }
+ @Override
+ public void onEnable(ResultReceiver isAllowed) throws RemoteException {
+ handleVoidCallback(
+ new ReceiverWrapper(isAllowed), mCallback::onEnable);
+ }
+ @Override
+ public void onDisable(ResultReceiver isAllowed) throws RemoteException {
+ handleVoidCallback(
+ new ReceiverWrapper(isAllowed), mCallback::onDisable);
+ }
+ @Override
+ public void onBootStarted() throws RemoteException {
+ handleVoidCallback(null, (Object input) -> mCallback.onBootStarted());
+ }
+ @Override
+ public void onEnableStarted() throws RemoteException {
+ handleVoidCallback(null, (Object input) -> mCallback.onEnableStarted());
+ }
+ @Override
+ public void onDisableStarted() throws RemoteException {
+ handleVoidCallback(null, (Object input) -> mCallback.onDisableStarted());
+ }
+ @Override
+ public void onBootFinished(int status) throws RemoteException {
+ handleVoidCallback(status, mCallback::onBootFinished);
+ }
+ @Override
+ public void onEnableFinished(int status) throws RemoteException {
+ handleVoidCallback(status, mCallback::onEnableFinished);
+ }
+ @Override
+ public void onDisableFinished(int status) throws RemoteException {
+ handleVoidCallback(status, mCallback::onDisableFinished);
+ }
+ @Override
+ public void onTagDispatch(ResultReceiver isSkipped) throws RemoteException {
+ handleVoidCallback(
+ new ReceiverWrapper(isSkipped), mCallback::onTagDispatch);
+ }
+ @Override
+ public void onRoutingChanged() throws RemoteException {
+ handleVoidCallback(null, (Object input) -> mCallback.onRoutingChanged());
+ }
+ @Override
+ public void onHceEventReceived(int action) throws RemoteException {
+ handleVoidCallback(action, mCallback::onHceEventReceived);
+ }
+
+ private <T> void handleVoidCallback(T input, Consumer<T> callbackMethod) {
+ synchronized (mLock) {
+ if (mCallback == null || mExecutor == null) {
+ return;
+ }
+ final long identity = Binder.clearCallingIdentity();
+ try {
+ mExecutor.execute(() -> callbackMethod.accept(input));
+ } finally {
+ Binder.restoreCallingIdentity(identity);
+ }
+ }
+ }
+
+ private <S, T> S handleNonVoidCallbackWithInput(
+ S defaultValue, T input, Function<T, S> callbackMethod) throws RemoteException {
+ synchronized (mLock) {
+ if (mCallback == null) {
+ return defaultValue;
+ }
+ final long identity = Binder.clearCallingIdentity();
+ S result = defaultValue;
+ try {
+ ExecutorService executor = Executors.newSingleThreadExecutor();
+ FutureTask<S> futureTask = new FutureTask<>(
+ () -> callbackMethod.apply(input)
+ );
+ executor.submit(futureTask);
+ try {
+ result = futureTask.get(
+ OEM_EXTENSION_RESPONSE_THRESHOLD_MS, TimeUnit.MILLISECONDS);
+ } catch (ExecutionException | InterruptedException e) {
+ e.printStackTrace();
+ } catch (TimeoutException e) {
+ Log.w(TAG, "Callback timed out: " + callbackMethod);
+ e.printStackTrace();
+ } finally {
+ executor.shutdown();
+ }
+ } finally {
+ Binder.restoreCallingIdentity(identity);
+ }
+ return result;
+ }
+ }
+
+ private <T> T handleNonVoidCallbackWithoutInput(T defaultValue, Supplier<T> callbackMethod)
+ throws RemoteException {
+ synchronized (mLock) {
+ if (mCallback == null) {
+ return defaultValue;
+ }
+ final long identity = Binder.clearCallingIdentity();
+ T result = defaultValue;
+ try {
+ ExecutorService executor = Executors.newSingleThreadExecutor();
+ FutureTask<T> futureTask = new FutureTask<>(
+ callbackMethod::get
+ );
+ executor.submit(futureTask);
+ try {
+ result = futureTask.get(
+ OEM_EXTENSION_RESPONSE_THRESHOLD_MS, TimeUnit.MILLISECONDS);
+ } catch (ExecutionException | InterruptedException e) {
+ e.printStackTrace();
+ } catch (TimeoutException e) {
+ Log.w(TAG, "Callback timed out: " + callbackMethod);
+ e.printStackTrace();
+ } finally {
+ executor.shutdown();
+ }
+ } finally {
+ Binder.restoreCallingIdentity(identity);
+ }
+ return result;
+ }
+ }
+ }
+
+ private class ReceiverWrapper implements Consumer<Boolean> {
+ private final ResultReceiver mResultReceiver;
+
+ ReceiverWrapper(ResultReceiver resultReceiver) {
+ mResultReceiver = resultReceiver;
+ }
+
+ @Override
+ public void accept(Boolean result) {
+ mResultReceiver.send(result ? 1 : 0, null);
+ }
+
+ @Override
+ public Consumer<Boolean> andThen(Consumer<? super Boolean> after) {
+ return Consumer.super.andThen(after);
+ }
}
}
diff --git a/nfc/java/android/nfc/cardemulation/CardEmulation.java b/nfc/java/android/nfc/cardemulation/CardEmulation.java
index e0438ce..0605dbe 100644
--- a/nfc/java/android/nfc/cardemulation/CardEmulation.java
+++ b/nfc/java/android/nfc/cardemulation/CardEmulation.java
@@ -23,6 +23,7 @@
import android.annotation.RequiresPermission;
import android.annotation.SdkConstant;
import android.annotation.SdkConstant.SdkConstantType;
+import android.annotation.StringDef;
import android.annotation.SystemApi;
import android.annotation.UserHandleAware;
import android.annotation.UserIdInt;
@@ -43,6 +44,8 @@
import android.provider.Settings.SettingNotFoundException;
import android.util.Log;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
import java.util.HashMap;
import java.util.HexFormat;
import java.util.List;
@@ -148,6 +151,21 @@
* that service will be invoked directly.
*/
public static final int SELECTION_MODE_ASK_IF_CONFLICT = 2;
+ /**
+ * Route to Device Host (DH).
+ */
+ @FlaggedApi(Flags.FLAG_NFC_OVERRIDE_RECOVER_ROUTING_TABLE)
+ public static final String DH = "DH";
+ /**
+ * Route to eSE.
+ */
+ @FlaggedApi(Flags.FLAG_NFC_OVERRIDE_RECOVER_ROUTING_TABLE)
+ public static final String ESE = "ESE";
+ /**
+ * Route to UICC.
+ */
+ @FlaggedApi(Flags.FLAG_NFC_OVERRIDE_RECOVER_ROUTING_TABLE)
+ public static final String UICC = "UICC";
static boolean sIsInitialized = false;
static HashMap<Context, CardEmulation> sCardEmus = new HashMap<Context, CardEmulation>();
@@ -865,11 +883,22 @@
sService.setServiceEnabledForCategoryOther(userId, service, status), false);
}
+ /** @hide */
+ @StringDef({
+ DH,
+ ESE,
+ UICC
+ })
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface ProtocolAndTechnologyRoute {}
+
/**
* Setting NFC controller routing table, which includes Protocol Route and Technology Route,
* while this Activity is in the foreground.
*
- * The parameter set to null can be used to keep current values for that entry.
+ * The parameter set to null can be used to keep current values for that entry. Either
+ * Protocol Route or Technology Route should be override when calling this API, otherwise
+ * throw {@link IllegalArgumentException}.
* <p>
* Example usage in an Activity that requires to set proto route to "ESE" and keep tech route:
* <pre>
@@ -877,26 +906,40 @@
* mNfcAdapter.overrideRoutingTable(this , "ESE" , null);
* }</pre>
* </p>
- * Also activities must call this method when it goes to the background,
- * with all parameters set to null.
+ * Also activities must call {@link #recoverRoutingTable(Activity)}
+ * when it goes to the background. Only the package of the
+ * currently preferred service (the service set as preferred by the current foreground
+ * application via {@link CardEmulation#setPreferredService(Activity, ComponentName)} or the
+ * current Default Wallet Role Holder {@link android.app.role.RoleManager#ROLE_WALLET}),
+ * otherwise a call to this method will fail and throw {@link SecurityException}.
* @param activity The Activity that requests NFC controller routing table to be changed.
* @param protocol ISO-DEP route destination, which can be "DH" or "UICC" or "ESE".
- * @param technology Tech-A, Tech-B route destination, which can be "DH" or "UICC" or "ESE".
- * @return true if operation is successful and false otherwise
- *
+ * @param technology Tech-A, Tech-B and Tech-F route destination, which can be "DH" or "UICC"
+ * or "ESE".
+ * @throws SecurityException if the caller is not the preferred NFC service
+ * @throws IllegalArgumentException if the activity is not resumed or the caller is not in the
+ * foreground, or both protocol route and technology route are null.
+ * <p>
* This is a high risk API and only included to support mainline effort
* @hide
*/
- public boolean overrideRoutingTable(Activity activity, String protocol, String technology) {
- if (activity == null) {
- throw new NullPointerException("activity or service or category is null");
- }
+ @SystemApi
+ @FlaggedApi(Flags.FLAG_NFC_OVERRIDE_RECOVER_ROUTING_TABLE)
+ public void overrideRoutingTable(
+ @NonNull Activity activity, @ProtocolAndTechnologyRoute @Nullable String protocol,
+ @ProtocolAndTechnologyRoute @Nullable String technology) {
if (!activity.isResumed()) {
throw new IllegalArgumentException("Activity must be resumed.");
}
- return callServiceReturn(() ->
+ if (protocol == null && technology == null) {
+ throw new IllegalArgumentException(("Both Protocol and Technology are null."));
+ }
+ callService(() ->
sService.overrideRoutingTable(
- mContext.getUser().getIdentifier(), protocol, technology), false);
+ mContext.getUser().getIdentifier(),
+ protocol,
+ technology,
+ mContext.getPackageName()));
}
/**
@@ -904,20 +947,19 @@
* which was changed by {@link #overrideRoutingTable(Activity, String, String)}
*
* @param activity The Activity that requested NFC controller routing table to be changed.
- * @return true if operation is successful and false otherwise
+ * @throws IllegalArgumentException if the caller is not in the foreground.
*
* @hide
*/
- public boolean recoverRoutingTable(Activity activity) {
- if (activity == null) {
- throw new NullPointerException("activity is null");
- }
+ @SystemApi
+ @FlaggedApi(Flags.FLAG_NFC_OVERRIDE_RECOVER_ROUTING_TABLE)
+ public void recoverRoutingTable(@NonNull Activity activity) {
if (!activity.isResumed()) {
throw new IllegalArgumentException("Activity must be resumed.");
}
- return callServiceReturn(() ->
+ callService(() ->
sService.recoverRoutingTable(
- mContext.getUser().getIdentifier()), false);
+ mContext.getUser().getIdentifier()));
}
/**
diff --git a/nfc/java/android/nfc/cardemulation/HostApduService.java b/nfc/java/android/nfc/cardemulation/HostApduService.java
index c3c74a6..cd8e19c 100644
--- a/nfc/java/android/nfc/cardemulation/HostApduService.java
+++ b/nfc/java/android/nfc/cardemulation/HostApduService.java
@@ -242,6 +242,16 @@
/**
* @hide
*/
+ public static final int MSG_OBSERVE_MODE_CHANGE = 5;
+
+ /**
+ * @hide
+ */
+ public static final int MSG_PREFERRED_SERVICE_CHANGED = 6;
+
+ /**
+ * @hide
+ */
public static final String KEY_DATA = "data";
/**
@@ -333,7 +343,17 @@
processPollingFrames(pollingFrames);
}
break;
- default:
+ case MSG_OBSERVE_MODE_CHANGE:
+ if (android.nfc.Flags.nfcEventListener()) {
+ onObserveModeStateChanged(msg.arg1 == 1);
+ }
+ break;
+ case MSG_PREFERRED_SERVICE_CHANGED:
+ if (android.nfc.Flags.nfcEventListener()) {
+ onPreferredServiceChanged(msg.arg1 == 1);
+ }
+ break;
+ default:
super.handleMessage(msg);
}
}
@@ -441,4 +461,26 @@
* @param reason Either {@link #DEACTIVATION_LINK_LOSS} or {@link #DEACTIVATION_DESELECTED}
*/
public abstract void onDeactivated(int reason);
+
+
+ /**
+ * This method is called when this service is the preferred Nfc service and
+ * Observe mode has been enabled or disabled.
+ *
+ * @param isEnabled true if observe mode has been enabled, false if it has been disabled
+ */
+ @FlaggedApi(android.nfc.Flags.FLAG_NFC_EVENT_LISTENER)
+ public void onObserveModeStateChanged(boolean isEnabled) {
+
+ }
+
+ /**
+ * This method is called when this service gains or loses preferred Nfc service status.
+ *
+ * @param isPreferred true is this service has become the preferred Nfc service,
+ * false if it is no longer the preferred service
+ */
+ @FlaggedApi(android.nfc.Flags.FLAG_NFC_EVENT_LISTENER)
+ public void onPreferredServiceChanged(boolean isPreferred) {
+ }
}
diff --git a/nfc/java/android/nfc/flags.aconfig b/nfc/java/android/nfc/flags.aconfig
index 45036a5..468147f 100644
--- a/nfc/java/android/nfc/flags.aconfig
+++ b/nfc/java/android/nfc/flags.aconfig
@@ -2,6 +2,14 @@
container: "system"
flag {
+ name: "nfc_event_listener"
+ is_exported: true
+ namespace: "nfc"
+ description: "Enable NFC Event listener APIs"
+ bug: "356447790"
+}
+
+flag {
name: "enable_nfc_mainline"
is_exported: true
namespace: "nfc"
@@ -117,3 +125,18 @@
bug: "321310044"
}
+flag {
+ name: "nfc_action_manage_services_settings"
+ is_exported: true
+ namespace: "nfc"
+ description: "Add Settings.ACTION_MANAGE_OTHER_NFC_SERVICES_SETTINGS"
+ bug: "358129872"
+}
+
+flag {
+ name: "nfc_override_recover_routing_table"
+ is_exported: true
+ namespace: "nfc"
+ description: "Enable override and recover routing table"
+ bug: "329043523"
+}
diff --git a/packages/CredentialManager/src/com/android/credentialmanager/DataConverter.kt b/packages/CredentialManager/src/com/android/credentialmanager/DataConverter.kt
index 6a1998a..707b4e2 100644
--- a/packages/CredentialManager/src/com/android/credentialmanager/DataConverter.kt
+++ b/packages/CredentialManager/src/com/android/credentialmanager/DataConverter.kt
@@ -45,8 +45,8 @@
import androidx.credentials.CreateCustomCredentialRequest
import androidx.credentials.CreatePasswordRequest
import androidx.credentials.CreatePublicKeyCredentialRequest
+import androidx.credentials.CredentialOption
import androidx.credentials.PasswordCredential
-import androidx.credentials.PriorityHints
import androidx.credentials.PublicKeyCredential
import androidx.credentials.provider.CreateEntry
import androidx.credentials.provider.RemoteEntry
@@ -175,9 +175,9 @@
"androidx.credentials.BUNDLE_KEY_TYPE_PRIORITY_VALUE",
when (option.type) {
PasswordCredential.TYPE_PASSWORD_CREDENTIAL ->
- PriorityHints.PRIORITY_PASSWORD_OR_SIMILAR
+ CredentialOption.PRIORITY_PASSWORD_OR_SIMILAR
PublicKeyCredential.TYPE_PUBLIC_KEY_CREDENTIAL -> 100
- else -> PriorityHints.PRIORITY_DEFAULT
+ else -> CredentialOption.PRIORITY_DEFAULT
}
)
typePriorityMap[option.type] = priority
@@ -344,8 +344,8 @@
}
is CreateCustomCredentialRequest -> {
// TODO: directly use the display info once made public
- val displayInfo = CreateCredentialRequest.DisplayInfo
- .parseFromCredentialDataBundle(createCredentialRequest.credentialData)
+ val displayInfo = CreateCredentialRequest.DisplayInfo.createFrom(
+ createCredentialRequest.credentialData)
?: return null
RequestDisplayInfo(
title = displayInfo.userId.toString(),
diff --git a/packages/CredentialManager/src/com/android/credentialmanager/getflow/GetModel.kt b/packages/CredentialManager/src/com/android/credentialmanager/getflow/GetModel.kt
index ef40188..bdb20c1 100644
--- a/packages/CredentialManager/src/com/android/credentialmanager/getflow/GetModel.kt
+++ b/packages/CredentialManager/src/com/android/credentialmanager/getflow/GetModel.kt
@@ -18,7 +18,7 @@
import android.credentials.flags.Flags.selectorUiImprovementsEnabled
import android.graphics.drawable.Drawable
-import androidx.credentials.PriorityHints
+import androidx.credentials.CredentialOption
import com.android.credentialmanager.model.get.ProviderInfo
import com.android.credentialmanager.model.EntryInfo
import com.android.credentialmanager.model.get.AuthenticationEntryInfo
@@ -214,10 +214,10 @@
// First prefer passkey type for its security benefits
if (p0.rawCredentialType != p1.rawCredentialType) {
val p0Priority = typePriorityMap.getOrDefault(
- p0.rawCredentialType, PriorityHints.PRIORITY_DEFAULT
+ p0.rawCredentialType, CredentialOption.PRIORITY_DEFAULT
)
val p1Priority = typePriorityMap.getOrDefault(
- p1.rawCredentialType, PriorityHints.PRIORITY_DEFAULT
+ p1.rawCredentialType, CredentialOption.PRIORITY_DEFAULT
)
if (p0Priority < p1Priority) {
return -1
diff --git a/packages/PackageInstaller/src/com/android/packageinstaller/UnarchiveErrorFragment.java b/packages/PackageInstaller/src/com/android/packageinstaller/UnarchiveErrorFragment.java
index d33433f..2fb32a7 100644
--- a/packages/PackageInstaller/src/com/android/packageinstaller/UnarchiveErrorFragment.java
+++ b/packages/PackageInstaller/src/com/android/packageinstaller/UnarchiveErrorFragment.java
@@ -16,10 +16,12 @@
package com.android.packageinstaller;
+import static android.app.ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED;
import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
import android.app.Activity;
import android.app.AlertDialog;
+import android.app.BroadcastOptions;
import android.app.Dialog;
import android.app.DialogFragment;
import android.app.PendingIntent;
@@ -161,25 +163,31 @@
return;
}
+ // Allow the error handling actvities to start in the background.
+ final BroadcastOptions options = BroadcastOptions.makeBasic();
+ options.setPendingIntentBackgroundActivityStartMode(
+ MODE_BACKGROUND_ACTIVITY_START_ALLOWED);
switch (mStatus) {
case PackageInstaller.UNARCHIVAL_ERROR_USER_ACTION_NEEDED:
activity.startIntentSender(mExtraIntent.getIntentSender(), /* fillInIntent= */
- null, /* flagsMask= */ 0, FLAG_ACTIVITY_NEW_TASK, /* extraFlags= */ 0);
+ null, /* flagsMask= */ 0, FLAG_ACTIVITY_NEW_TASK, /* extraFlags= */ 0,
+ options.toBundle());
break;
case PackageInstaller.UNARCHIVAL_ERROR_INSUFFICIENT_STORAGE:
if (mExtraIntent != null) {
activity.startIntentSender(mExtraIntent.getIntentSender(), /* fillInIntent= */
- null, /* flagsMask= */ 0, FLAG_ACTIVITY_NEW_TASK, /* extraFlags= */ 0);
+ null, /* flagsMask= */ 0, FLAG_ACTIVITY_NEW_TASK, /* extraFlags= */ 0,
+ options.toBundle());
} else {
Intent intent = new Intent("android.intent.action.MANAGE_PACKAGE_STORAGE");
- startActivity(intent);
+ startActivity(intent, options.toBundle());
}
break;
case PackageInstaller.UNARCHIVAL_ERROR_INSTALLER_DISABLED:
Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
Uri uri = Uri.fromParts("package", mInstallerPackageName, null);
intent.setData(uri);
- startActivity(intent);
+ startActivity(intent, options.toBundle());
break;
default:
// Do nothing. The rest of the dialogs are purely informational.
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/OWNERS b/packages/SystemUI/src/com/android/systemui/keyguard/OWNERS
new file mode 100644
index 0000000..443e9876
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/OWNERS
@@ -0,0 +1,11 @@
+set noparent
+
+# Bug component: 78010
+
+amiko@google.com
+beverlyt@google.com
+bhinegardner@google.com
+chandruis@google.com
+jglazier@google.com
+mpietal@google.com
+tsuji@google.com
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/OWNERS b/packages/SystemUI/src/com/android/systemui/statusbar/OWNERS
index 69ebb76..c4f539a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/OWNERS
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/OWNERS
@@ -5,3 +5,12 @@
caitlinshk@google.com
evanlaird@google.com
pixel@google.com
+
+per-file *Biometrics* = set noparent
+per-file *Biometrics* = file:../keyguard/OWNERS
+per-file *Doze* = set noparent
+per-file *Doze* = file:../keyguard/OWNERS
+per-file *Keyboard* = set noparent
+per-file *Keyboard* = file:../keyguard/OWNERS
+per-file *Keyguard* = set noparent
+per-file *Keyguard* = file:../keyguard/OWNERS
\ No newline at end of file
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/lockscreen/OWNERS b/packages/SystemUI/src/com/android/systemui/statusbar/lockscreen/OWNERS
new file mode 100644
index 0000000..4c349c4
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/lockscreen/OWNERS
@@ -0,0 +1,3 @@
+set noparent
+
+file:../../keyguard/OWNERS
diff --git a/ravenwood/tools/ravenizer-fake/Android.bp b/ravenwood/tools/ravenizer-fake/Android.bp
new file mode 100644
index 0000000..7e2c407
--- /dev/null
+++ b/ravenwood/tools/ravenizer-fake/Android.bp
@@ -0,0 +1,14 @@
+package {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "frameworks_base_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-Apache-2.0
+ default_applicable_licenses: ["frameworks_base_license"],
+}
+
+sh_binary_host {
+ name: "ravenizer",
+ src: "ravenizer",
+ visibility: ["//visibility:public"],
+}
diff --git a/ravenwood/tools/ravenizer-fake/ravenizer b/ravenwood/tools/ravenizer-fake/ravenizer
new file mode 100755
index 0000000..84b3c8e
--- /dev/null
+++ b/ravenwood/tools/ravenizer-fake/ravenizer
@@ -0,0 +1,31 @@
+#!/bin/bash
+# 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.
+
+# "Fake" ravenizer, which just copies the file.
+# We need it to add ravenizer support to Soong on AOSP,
+# when the actual ravenizer is not in AOSP yet.
+
+invalid_arg() {
+ echo "Ravenizer(fake): invalid args" 1>&2
+ exit 1
+}
+
+(( $# >= 4 )) || invalid_arg
+[[ "$1" == "--in-jar" ]] || invalid_arg
+[[ "$3" == "--out-jar" ]] || invalid_arg
+
+echo "Ravenizer(fake): copiyng $2 to $4"
+
+cp "$2" "$4"
diff --git a/services/accessibility/TEST_MAPPING b/services/accessibility/TEST_MAPPING
index 299d33f..3f85a90 100644
--- a/services/accessibility/TEST_MAPPING
+++ b/services/accessibility/TEST_MAPPING
@@ -25,32 +25,10 @@
]
},
{
- "name": "FrameworksServicesTests",
- "options": [
- {
- "include-filter": "com.android.server.accessibility"
- },
- {
- "exclude-annotation": "androidx.test.filters.FlakyTest"
- }
- ]
+ "name": "FrameworksServicesTests_accessibility_Presubmit"
},
{
- "name": "FrameworksCoreTests",
- "options": [
- {
- "include-filter": "android.accessibilityservice"
- },
- {
- "include-filter": "android.view.accessibility"
- },
- {
- "include-filter": "com.android.internal.accessibility"
- },
- {
- "exclude-annotation": "androidx.test.filters.FlakyTest"
- }
- ]
+ "name": "FrameworksCoreTests_accessibility_NO_FLAKES"
}
],
"postsubmit": [
@@ -75,18 +53,7 @@
]
},
{
- "name": "FrameworksCoreTests",
- "options": [
- {
- "include-filter": "android.accessibilityservice"
- },
- {
- "include-filter": "android.view.accessibility"
- },
- {
- "include-filter": "com.android.internal.accessibility"
- }
- ]
+ "name": "FrameworksCoreTests_accessibility"
}
]
}
diff --git a/services/contentcapture/java/com/android/server/contentprotection/OWNERS b/services/contentcapture/java/com/android/server/contentprotection/OWNERS
new file mode 100644
index 0000000..3d09da3
--- /dev/null
+++ b/services/contentcapture/java/com/android/server/contentprotection/OWNERS
@@ -0,0 +1,4 @@
+# Bug component: 1040349
+
+include /core/java/android/view/contentprotection/OWNERS
+
diff --git a/services/core/java/com/android/server/OWNERS b/services/core/java/com/android/server/OWNERS
index a627a39..f230646 100644
--- a/services/core/java/com/android/server/OWNERS
+++ b/services/core/java/com/android/server/OWNERS
@@ -10,9 +10,6 @@
# Zram writeback
per-file ZramWriteback.java = minchan@google.com, rajekumar@google.com
-# Userspace reboot
-per-file UserspaceRebootLogger.java = ioffe@google.com, dvander@google.com
-
# ServiceWatcher
per-file ServiceWatcher.java = sooniln@google.com
diff --git a/services/core/java/com/android/server/SystemConfig.java b/services/core/java/com/android/server/SystemConfig.java
index 6f45f2a..95fb187 100644
--- a/services/core/java/com/android/server/SystemConfig.java
+++ b/services/core/java/com/android/server/SystemConfig.java
@@ -371,6 +371,10 @@
// exempt from ECM (i.e., they will never be considered "restricted").
private final ArraySet<SignedPackage> mEnhancedConfirmationTrustedInstallers = new ArraySet<>();
+ // A map of UIDs defined by OEMs, mapping from name to value. The UIDs will be registered at the
+ // start of the system which allows OEMs to create and register their system services.
+ @NonNull private final ArrayMap<String, Integer> mOemDefinedUids = new ArrayMap<>();
+
/**
* Map of system pre-defined, uniquely named actors; keys are namespace,
* value maps actor name to package name.
@@ -594,6 +598,10 @@
return mEnhancedConfirmationTrustedInstallers;
}
+ @NonNull
+ public ArrayMap<String, Integer> getOemDefinedUids() {
+ return mOemDefinedUids;
+ }
/**
* Only use for testing. Do NOT use in production code.
* @param readPermissions false to create an empty SystemConfig; true to read the permissions.
@@ -1622,6 +1630,26 @@
}
}
} break;
+ case "oem-defined-uid": {
+ final String uidName = parser.getAttributeValue(null, "name");
+ final String uidValue = parser.getAttributeValue(null, "uid");
+ if (TextUtils.isEmpty(uidName)) {
+ Slog.w(TAG, "<" + name + "> without valid uid name in " + permFile
+ + " at " + parser.getPositionDescription());
+ } else if (TextUtils.isEmpty(uidValue)) {
+ Slog.w(TAG, "<" + name + "> without valid uid value in " + permFile
+ + " at " + parser.getPositionDescription());
+ } else {
+ try {
+ final int oemDefinedUid = Integer.parseInt(uidValue);
+ mOemDefinedUids.put(uidName, oemDefinedUid);
+ } catch (NumberFormatException e) {
+ Slog.w(TAG, "<" + name + "> with invalid uid value: "
+ + uidValue + " in " + permFile
+ + " at " + parser.getPositionDescription());
+ }
+ }
+ } break;
case "enhanced-confirmation-trusted-package": {
if (android.permission.flags.Flags.enhancedConfirmationModeApisEnabled()) {
SignedPackage signedPackage = parseEnhancedConfirmationTrustedPackage(
diff --git a/services/core/java/com/android/server/TEST_MAPPING b/services/core/java/com/android/server/TEST_MAPPING
index 25337a4..4a61a69 100644
--- a/services/core/java/com/android/server/TEST_MAPPING
+++ b/services/core/java/com/android/server/TEST_MAPPING
@@ -53,12 +53,7 @@
"file_patterns": ["StorageManagerService\\.java"]
},
{
- "name": "FrameworksMockingServicesTests",
- "options": [
- {
- "include-filter": "com.android.server.sensorprivacy"
- }
- ],
+ "name": "FrameworksMockingServicesTests_sensorprivacy",
"file_patterns": ["SensorPrivacyService\\.java"]
},
{
diff --git a/services/core/java/com/android/server/UserspaceRebootLogger.java b/services/core/java/com/android/server/UserspaceRebootLogger.java
deleted file mode 100644
index 89327b5..0000000
--- a/services/core/java/com/android/server/UserspaceRebootLogger.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Copyright (C) 2020 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.server;
-
-import static com.android.internal.util.FrameworkStatsLog.USERSPACE_REBOOT_REPORTED__OUTCOME__FAILED_SHUTDOWN_SEQUENCE_ABORTED;
-import static com.android.internal.util.FrameworkStatsLog.USERSPACE_REBOOT_REPORTED__OUTCOME__FAILED_USERDATA_REMOUNT;
-import static com.android.internal.util.FrameworkStatsLog.USERSPACE_REBOOT_REPORTED__OUTCOME__FAILED_USERSPACE_REBOOT_WATCHDOG_TRIGGERED;
-import static com.android.internal.util.FrameworkStatsLog.USERSPACE_REBOOT_REPORTED__OUTCOME__OUTCOME_UNKNOWN;
-import static com.android.internal.util.FrameworkStatsLog.USERSPACE_REBOOT_REPORTED__OUTCOME__SUCCESS;
-import static com.android.internal.util.FrameworkStatsLog.USERSPACE_REBOOT_REPORTED__USER_ENCRYPTION_STATE__LOCKED;
-import static com.android.internal.util.FrameworkStatsLog.USERSPACE_REBOOT_REPORTED__USER_ENCRYPTION_STATE__UNLOCKED;
-
-import android.os.PowerManager;
-import android.os.SystemClock;
-import android.os.SystemProperties;
-import android.text.TextUtils;
-import android.util.Slog;
-
-import com.android.internal.util.FrameworkStatsLog;
-
-import java.util.concurrent.Executor;
-
-/**
- * Utility class to help abstract logging {@code UserspaceRebootReported} atom.
- */
-public final class UserspaceRebootLogger {
-
- private static final String TAG = "UserspaceRebootLogger";
-
- private static final String USERSPACE_REBOOT_SHOULD_LOG_PROPERTY =
- "persist.sys.userspace_reboot.log.should_log";
- private static final String USERSPACE_REBOOT_LAST_STARTED_PROPERTY =
- "sys.userspace_reboot.log.last_started";
- private static final String USERSPACE_REBOOT_LAST_FINISHED_PROPERTY =
- "sys.userspace_reboot.log.last_finished";
- private static final String LAST_BOOT_REASON_PROPERTY = "sys.boot.reason.last";
-
- private UserspaceRebootLogger() {}
-
- /**
- * Modifies internal state to note that {@code UserspaceRebootReported} atom needs to be
- * logged on the next successful boot.
- *
- * <p>This call should only be made on devices supporting userspace reboot.
- */
- public static void noteUserspaceRebootWasRequested() {
- if (!PowerManager.isRebootingUserspaceSupportedImpl()) {
- Slog.wtf(TAG, "noteUserspaceRebootWasRequested: Userspace reboot is not supported.");
- return;
- }
-
- SystemProperties.set(USERSPACE_REBOOT_SHOULD_LOG_PROPERTY, "1");
- SystemProperties.set(USERSPACE_REBOOT_LAST_STARTED_PROPERTY,
- String.valueOf(SystemClock.elapsedRealtime()));
- }
-
- /**
- * Updates internal state on boot after successful userspace reboot.
- *
- * <p>Should be called right before framework sets {@code sys.boot_completed} property.
- *
- * <p>This call should only be made on devices supporting userspace reboot.
- */
- public static void noteUserspaceRebootSuccess() {
- if (!PowerManager.isRebootingUserspaceSupportedImpl()) {
- Slog.wtf(TAG, "noteUserspaceRebootSuccess: Userspace reboot is not supported.");
- return;
- }
-
- SystemProperties.set(USERSPACE_REBOOT_LAST_FINISHED_PROPERTY,
- String.valueOf(SystemClock.elapsedRealtime()));
- }
-
- /**
- * Returns {@code true} if {@code UserspaceRebootReported} atom should be logged.
- *
- * <p>On devices that do not support userspace reboot this method will always return {@code
- * false}.
- */
- public static boolean shouldLogUserspaceRebootEvent() {
- if (!PowerManager.isRebootingUserspaceSupportedImpl()) {
- return false;
- }
-
- return SystemProperties.getBoolean(USERSPACE_REBOOT_SHOULD_LOG_PROPERTY, false);
- }
-
- /**
- * Asynchronously logs {@code UserspaceRebootReported} on the given {@code executor}.
- *
- * <p>Should be called in the end of {@link
- * com.android.server.am.ActivityManagerService#finishBooting()} method, after framework have
- * tried to proactivelly unlock storage of the primary user.
- *
- * <p>This call should only be made on devices supporting userspace reboot.
- */
- public static void logEventAsync(boolean userUnlocked, Executor executor) {
- if (!PowerManager.isRebootingUserspaceSupportedImpl()) {
- Slog.wtf(TAG, "logEventAsync: Userspace reboot is not supported.");
- return;
- }
-
- final int outcome = computeOutcome();
- final long durationMillis;
- if (outcome == USERSPACE_REBOOT_REPORTED__OUTCOME__SUCCESS) {
- durationMillis = SystemProperties.getLong(USERSPACE_REBOOT_LAST_FINISHED_PROPERTY, 0)
- - SystemProperties.getLong(USERSPACE_REBOOT_LAST_STARTED_PROPERTY, 0);
- } else {
- durationMillis = 0;
- }
- final int encryptionState =
- userUnlocked
- ? USERSPACE_REBOOT_REPORTED__USER_ENCRYPTION_STATE__UNLOCKED
- : USERSPACE_REBOOT_REPORTED__USER_ENCRYPTION_STATE__LOCKED;
- executor.execute(
- () -> {
- Slog.i(TAG, "Logging UserspaceRebootReported atom: { outcome: " + outcome
- + " durationMillis: " + durationMillis + " encryptionState: "
- + encryptionState + " }");
- FrameworkStatsLog.write(FrameworkStatsLog.USERSPACE_REBOOT_REPORTED, outcome,
- durationMillis, encryptionState);
- SystemProperties.set(USERSPACE_REBOOT_SHOULD_LOG_PROPERTY, "");
- });
- }
-
- private static int computeOutcome() {
- if (SystemProperties.getLong(USERSPACE_REBOOT_LAST_STARTED_PROPERTY, -1) != -1) {
- return USERSPACE_REBOOT_REPORTED__OUTCOME__SUCCESS;
- }
- String reason = TextUtils.emptyIfNull(SystemProperties.get(LAST_BOOT_REASON_PROPERTY, ""));
- if (reason.startsWith("reboot,")) {
- reason = reason.substring("reboot".length());
- }
- if (reason.startsWith("userspace_failed,watchdog_fork")) {
- return USERSPACE_REBOOT_REPORTED__OUTCOME__FAILED_SHUTDOWN_SEQUENCE_ABORTED;
- }
- if (reason.startsWith("userspace_failed,shutdown_aborted")) {
- return USERSPACE_REBOOT_REPORTED__OUTCOME__FAILED_SHUTDOWN_SEQUENCE_ABORTED;
- }
- if (reason.startsWith("mount_userdata_failed")) {
- return USERSPACE_REBOOT_REPORTED__OUTCOME__FAILED_USERDATA_REMOUNT;
- }
- if (reason.startsWith("userspace_failed,init_user0")) {
- return USERSPACE_REBOOT_REPORTED__OUTCOME__FAILED_USERDATA_REMOUNT;
- }
- if (reason.startsWith("userspace_failed,enablefilecrypto")) {
- return USERSPACE_REBOOT_REPORTED__OUTCOME__FAILED_USERDATA_REMOUNT;
- }
- if (reason.startsWith("userspace_failed,watchdog_triggered")) {
- return USERSPACE_REBOOT_REPORTED__OUTCOME__FAILED_USERSPACE_REBOOT_WATCHDOG_TRIGGERED;
- }
- return USERSPACE_REBOOT_REPORTED__OUTCOME__OUTCOME_UNKNOWN;
- }
-}
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index 30b1c6f..7395c05 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -370,7 +370,6 @@
import android.provider.DeviceConfig;
import android.provider.Settings;
import android.server.ServerProtoEnums;
-import android.sysprop.InitProperties;
import android.system.Os;
import android.system.OsConstants;
import android.telephony.TelephonyManager;
@@ -455,7 +454,6 @@
import com.android.server.SystemService;
import com.android.server.SystemServiceManager;
import com.android.server.ThreadPriorityBooster;
-import com.android.server.UserspaceRebootLogger;
import com.android.server.Watchdog;
import com.android.server.am.ComponentAliasResolver.Resolution;
import com.android.server.am.LowMemDetector.MemFactor;
@@ -2373,20 +2371,6 @@
}
}
- private void maybeLogUserspaceRebootEvent() {
- if (!UserspaceRebootLogger.shouldLogUserspaceRebootEvent()) {
- return;
- }
- final int userId = mUserController.getCurrentUserId();
- if (userId != UserHandle.USER_SYSTEM) {
- // Only log for user0.
- return;
- }
- // TODO(b/148767783): should we check all profiles under user0?
- UserspaceRebootLogger.logEventAsync(StorageManager.isCeStorageUnlocked(userId),
- BackgroundThread.getExecutor());
- }
-
/**
* Encapsulates global settings related to hidden API enforcement behaviour, including tracking
* the latest value via a content observer.
@@ -5213,12 +5197,6 @@
// Start looking for apps that are abusing wake locks.
Message nmsg = mHandler.obtainMessage(CHECK_EXCESSIVE_POWER_USE_MSG);
mHandler.sendMessageDelayed(nmsg, mConstants.POWER_CHECK_INTERVAL);
- // Check if we are performing userspace reboot before setting sys.boot_completed to
- // avoid race with init reseting sys.init.userspace_reboot.in_progress once sys
- // .boot_completed is 1.
- if (InitProperties.userspace_reboot_in_progress().orElse(false)) {
- UserspaceRebootLogger.noteUserspaceRebootSuccess();
- }
// Tell anyone interested that we are done booting!
SystemProperties.set("sys.boot_completed", "1");
SystemProperties.set("dev.bootcomplete", "1");
@@ -5242,7 +5220,6 @@
}, mConstants.FULL_PSS_MIN_INTERVAL);
}
});
- maybeLogUserspaceRebootEvent();
mUserController.scheduleStartProfiles();
}
// UART is on if init's console service is running, send a warning notification.
diff --git a/services/core/java/com/android/server/am/AppRestrictionController.java b/services/core/java/com/android/server/am/AppRestrictionController.java
index 88f6bc9..5827c7f 100644
--- a/services/core/java/com/android/server/am/AppRestrictionController.java
+++ b/services/core/java/com/android/server/am/AppRestrictionController.java
@@ -297,7 +297,7 @@
/**
* Cache the package name and information about if it's a system module.
*/
- @GuardedBy("mLock")
+ @GuardedBy("mSystemModulesCache")
private final HashMap<String, Boolean> mSystemModulesCache = new HashMap<>();
/**
@@ -1588,7 +1588,7 @@
if (moduleInfos == null) {
return;
}
- synchronized (mLock) {
+ synchronized (mSystemModulesCache) {
for (ModuleInfo info : moduleInfos) {
mSystemModulesCache.put(info.getPackageName(), Boolean.TRUE);
}
@@ -1596,7 +1596,7 @@
}
private boolean isSystemModule(String packageName) {
- synchronized (mLock) {
+ synchronized (mSystemModulesCache) {
final Boolean val = mSystemModulesCache.get(packageName);
if (val != null) {
return val.booleanValue();
@@ -1624,7 +1624,7 @@
}
}
// Update the cache.
- synchronized (mLock) {
+ synchronized (mSystemModulesCache) {
mSystemModulesCache.put(packageName, isSystemModule);
}
return isSystemModule;
diff --git a/services/core/java/com/android/server/am/TEST_MAPPING b/services/core/java/com/android/server/am/TEST_MAPPING
index feab2c05..d01d8f6 100644
--- a/services/core/java/com/android/server/am/TEST_MAPPING
+++ b/services/core/java/com/android/server/am/TEST_MAPPING
@@ -49,47 +49,18 @@
]
},
{
- "name": "FrameworksServicesTests",
- "options": [
- {
- "include-filter": "com.android.server.am."
- },
- {
- "include-annotation": "android.platform.test.annotations.Presubmit"
- },
- {
- "exclude-annotation": "androidx.test.filters.FlakyTest"
- }
- ]
+ "name": "FrameworksServicesTests_android_server_am_Presubmit"
},
{
- "name": "FrameworksMockingServicesTests",
- "options": [
- {
- "include-filter": "com.android.server.am."
- },
- {
- "include-annotation": "android.platform.test.annotations.Presubmit"
- },
- {
- "exclude-annotation": "androidx.test.filters.FlakyTest"
- }
- ]
+ "name": "FrameworksMockingServicesTests_android_server_am_Presubmit"
},
{
"file_patterns": ["Battery[^/]*\\.java", "MeasuredEnergy[^/]*\\.java"],
- "name": "FrameworksCoreTests",
- "options": [
- { "include-filter": "com.android.internal.os.BatteryStatsTests" },
- { "exclude-annotation": "com.android.internal.os.SkipPresubmit" }
- ]
+ "name": "FrameworksCoreTests_battery_stats"
},
{
"file_patterns": ["Battery[^/]*\\.java", "MeasuredEnergy[^/]*\\.java"],
- "name": "FrameworksServicesTests",
- "options": [
- { "include-filter": "com.android.server.am.BatteryStatsServiceTest" }
- ]
+ "name": "FrameworksServicesTests_battery_stats"
},
{
"file_patterns": ["Battery[^/]*\\.java", "MeasuredEnergy[^/]*\\.java"],
@@ -97,12 +68,7 @@
},
{
"file_patterns": ["Broadcast.*"],
- "name": "FrameworksMockingServicesTests",
- "options": [
- { "include-filter": "com.android.server.am.BroadcastRecordTest" },
- { "include-filter": "com.android.server.am.BroadcastQueueTest" },
- { "include-filter": "com.android.server.am.BroadcastQueueModernImplTest" }
- ]
+ "name": "FrameworksMockingServicesTests_android_server_am_broadcast"
},
{
"file_patterns": ["Broadcast.*"],
diff --git a/services/core/java/com/android/server/app/TEST_MAPPING b/services/core/java/com/android/server/app/TEST_MAPPING
index 82840ee..b718ce6 100644
--- a/services/core/java/com/android/server/app/TEST_MAPPING
+++ b/services/core/java/com/android/server/app/TEST_MAPPING
@@ -26,15 +26,7 @@
]
},
{
- "name": "FrameworksMockingServicesTests",
- "options": [
- {
- "include-filter": "com.android.server.app"
- },
- {
- "exclude-annotation": "androidx.test.filters.FlakyTest"
- }
- ]
+ "name": "FrameworksMockingServicesTests_android_server_app"
},
{
"name": "FrameworksCoreGameManagerTests",
diff --git a/services/core/java/com/android/server/appop/TEST_MAPPING b/services/core/java/com/android/server/appop/TEST_MAPPING
index 65f6af7..2a9dfa2 100644
--- a/services/core/java/com/android/server/appop/TEST_MAPPING
+++ b/services/core/java/com/android/server/appop/TEST_MAPPING
@@ -12,20 +12,10 @@
"name": "CtsAppOps2TestCases"
},
{
- "name": "FrameworksServicesTests",
- "options": [
- {
- "include-filter": "com.android.server.appop"
- }
- ]
+ "name": "FrameworksServicesTests_android_server_appop"
},
{
- "name": "FrameworksMockingServicesTests",
- "options": [
- {
- "include-filter": "com.android.server.appop"
- }
- ]
+ "name": "FrameworksMockingServicesTests_android_server_appop"
},
{
"name": "CtsPermissionTestCases",
diff --git a/services/core/java/com/android/server/audio/TEST_MAPPING b/services/core/java/com/android/server/audio/TEST_MAPPING
index 2cea32a..ca462ce0 100644
--- a/services/core/java/com/android/server/audio/TEST_MAPPING
+++ b/services/core/java/com/android/server/audio/TEST_MAPPING
@@ -26,21 +26,7 @@
]
},
{
- "name": "FrameworksServicesTests",
- "options": [
- {
- "include-filter": "com.android.server.audio"
- },
- {
- "include-annotation": "android.platform.test.annotations.Presubmit"
- },
- {
- "exclude-annotation": "androidx.test.filters.FlakyTest"
- },
- {
- "exclude-annotation": "org.junit.Ignore"
- }
- ]
+ "name": "FrameworksServicesTests_android_server_audio"
}
]
}
diff --git a/services/core/java/com/android/server/biometrics/sensors/fingerprint/hidl/FingerprintUpdateActiveUserClient.java b/services/core/java/com/android/server/biometrics/sensors/fingerprint/hidl/FingerprintUpdateActiveUserClient.java
index 59e64cd..87bd807 100644
--- a/services/core/java/com/android/server/biometrics/sensors/fingerprint/hidl/FingerprintUpdateActiveUserClient.java
+++ b/services/core/java/com/android/server/biometrics/sensors/fingerprint/hidl/FingerprintUpdateActiveUserClient.java
@@ -121,6 +121,11 @@
final int targetId = getTargetUserId();
Slog.d(TAG, "Setting active user: " + targetId);
HidlToAidlSessionAdapter sessionAdapter = (HidlToAidlSessionAdapter) getFreshDaemon();
+ if (sessionAdapter.getIBiometricsFingerprint() == null) {
+ Slog.e(TAG, "Failed to setActiveGroup: HIDL daemon is null.");
+ mCallback.onClientFinished(this, false /* success */);
+ return;
+ }
sessionAdapter.setActiveGroup(targetId, mDirectory.getAbsolutePath());
mAuthenticatorIds.put(targetId, mHasEnrolledBiometrics
? sessionAdapter.getAuthenticatorIdForUpdateClient() : 0L);
diff --git a/services/core/java/com/android/server/biometrics/sensors/fingerprint/hidl/HidlToAidlSessionAdapter.java b/services/core/java/com/android/server/biometrics/sensors/fingerprint/hidl/HidlToAidlSessionAdapter.java
index b469752..671bd87 100644
--- a/services/core/java/com/android/server/biometrics/sensors/fingerprint/hidl/HidlToAidlSessionAdapter.java
+++ b/services/core/java/com/android/server/biometrics/sensors/fingerprint/hidl/HidlToAidlSessionAdapter.java
@@ -209,6 +209,10 @@
return null;
}
+ protected IBiometricsFingerprint getIBiometricsFingerprint() {
+ return mSession.get();
+ }
+
public long getAuthenticatorIdForUpdateClient() throws RemoteException {
return mSession.get().getAuthenticatorId();
}
diff --git a/services/core/java/com/android/server/compat/TEST_MAPPING b/services/core/java/com/android/server/compat/TEST_MAPPING
index bc1c728..3997bcf 100644
--- a/services/core/java/com/android/server/compat/TEST_MAPPING
+++ b/services/core/java/com/android/server/compat/TEST_MAPPING
@@ -2,12 +2,7 @@
"presubmit": [
// Unit tests
{
- "name": "FrameworksServicesTests",
- "options": [
- {
- "include-filter": "com.android.server.compat"
- }
- ]
+ "name": "FrameworksServicesTests_android_server_compat"
},
// Tests for the TestRule
{
diff --git a/services/core/java/com/android/server/compat/overrides/TEST_MAPPING b/services/core/java/com/android/server/compat/overrides/TEST_MAPPING
index 4b8f08e..1649753 100644
--- a/services/core/java/com/android/server/compat/overrides/TEST_MAPPING
+++ b/services/core/java/com/android/server/compat/overrides/TEST_MAPPING
@@ -1,12 +1,7 @@
{
"presubmit": [
{
- "name": "FrameworksMockingServicesTests",
- "options": [
- {
- "include-filter": "com.android.server.compat.overrides"
- }
- ]
+ "name": "FrameworksMockingServicesTests_android_server_compat_overrides"
}
]
}
diff --git a/services/core/java/com/android/server/connectivity/Vpn.java b/services/core/java/com/android/server/connectivity/Vpn.java
index 5905b7d..e1bb8a1 100644
--- a/services/core/java/com/android/server/connectivity/Vpn.java
+++ b/services/core/java/com/android/server/connectivity/Vpn.java
@@ -344,7 +344,11 @@
private final AppOpsManager mAppOpsManager;
private final ConnectivityDiagnosticsManager mConnectivityDiagnosticsManager;
private final TelephonyManager mTelephonyManager;
+
+ // null if FEATURE_TELEPHONY_SUBSCRIPTION is not declared
+ @Nullable
private final CarrierConfigManager mCarrierConfigManager;
+
private final SubscriptionManager mSubscriptionManager;
// The context is for specific user which is created from mUserId
@@ -2837,8 +2841,10 @@
createUserAndRestrictedProfilesRanges(mUserId,
mConfig.allowedApplications, mConfig.disallowedApplications));
- mCarrierConfigManager.registerCarrierConfigChangeListener(mExecutor,
- mCarrierConfigChangeListener);
+ if (mCarrierConfigManager != null) {
+ mCarrierConfigManager.registerCarrierConfigChangeListener(mExecutor,
+ mCarrierConfigChangeListener);
+ }
}
@Override
@@ -3343,6 +3349,10 @@
*/
@Nullable
private CarrierConfigInfo getCarrierConfigForUnderlyingNetwork() {
+ if (mCarrierConfigManager == null) {
+ return null;
+ }
+
final int subId = getCellSubIdForNetworkCapabilities(mUnderlyingNetworkCapabilities);
if (subId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
Log.d(TAG, "Underlying network is not a cellular network");
@@ -3962,8 +3972,10 @@
resetIkeState();
- mCarrierConfigManager.unregisterCarrierConfigChangeListener(
- mCarrierConfigChangeListener);
+ if (mCarrierConfigManager != null) {
+ mCarrierConfigManager.unregisterCarrierConfigChangeListener(
+ mCarrierConfigChangeListener);
+ }
mConnectivityManager.unregisterNetworkCallback(mNetworkCallback);
mExecutor.shutdown();
diff --git a/services/core/java/com/android/server/hdmi/HdmiCecMessageValidator.java b/services/core/java/com/android/server/hdmi/HdmiCecMessageValidator.java
index 16b00de..18a6e3dd 100644
--- a/services/core/java/com/android/server/hdmi/HdmiCecMessageValidator.java
+++ b/services/core/java/com/android/server/hdmi/HdmiCecMessageValidator.java
@@ -486,6 +486,7 @@
* @return true if the hour is valid
*/
private static boolean isValidHour(int value) {
+ value = bcdToDecimal(value);
return isWithinRange(value, 0, 23);
}
@@ -497,6 +498,7 @@
* @return true if the minute is valid
*/
private static boolean isValidMinute(int value) {
+ value = bcdToDecimal(value);
return isWithinRange(value, 0, 59);
}
@@ -508,10 +510,24 @@
* @return true if the duration hours is valid
*/
private static boolean isValidDurationHours(int value) {
+ value = bcdToDecimal(value);
return isWithinRange(value, 0, 99);
}
/**
+ * Convert BCD value to decimal value.
+ *
+ * @param value BCD value
+ * @return decimal value
+ */
+ private static int bcdToDecimal(int value) {
+ int tens = (value & 0xF0) >> 4;
+ int ones = (value & 0x0F);
+
+ return tens * 10 + ones;
+ }
+
+ /**
* Check if the given value is a valid recording sequence. A valid value is adheres to range
* description defined in CEC 1.4 Specification : Operand Descriptions (Section 17)
*
diff --git a/services/core/java/com/android/server/hdmi/TEST_MAPPING b/services/core/java/com/android/server/hdmi/TEST_MAPPING
index 7245ec4..64c06a6 100644
--- a/services/core/java/com/android/server/hdmi/TEST_MAPPING
+++ b/services/core/java/com/android/server/hdmi/TEST_MAPPING
@@ -1,21 +1,7 @@
{
"presubmit": [
{
- "name": "FrameworksServicesTests",
- "options": [
- {
- "include-filter": "com.android.server.hdmi"
- },
- {
- "include-annotation": "android.platform.test.annotations.Presubmit"
- },
- {
- "exclude-annotation": "androidx.test.filters.FlakyTest"
- },
- {
- "exclude-annotation": "org.junit.Ignore"
- }
- ]
+ "name": "FrameworksServicesTests_android_server_hdmi_Presubmit"
}
],
"postsubmit": [
diff --git a/services/core/java/com/android/server/input/OWNERS b/services/core/java/com/android/server/input/OWNERS
index 4c20c4d..e2834ec 100644
--- a/services/core/java/com/android/server/input/OWNERS
+++ b/services/core/java/com/android/server/input/OWNERS
@@ -1 +1,2 @@
+# Bug component: 136048
include /INPUT_OWNERS
diff --git a/services/core/java/com/android/server/integrity/TEST_MAPPING b/services/core/java/com/android/server/integrity/TEST_MAPPING
index be8d2e1..5c05fce 100644
--- a/services/core/java/com/android/server/integrity/TEST_MAPPING
+++ b/services/core/java/com/android/server/integrity/TEST_MAPPING
@@ -1,12 +1,7 @@
{
"presubmit": [
{
- "name": "FrameworksServicesTests",
- "options": [
- {
- "include-filter": "com.android.server.integrity."
- }
- ]
+ "name": "FrameworksServicesTests_android_server_integrity"
},
{
"name": "GtsSecurityHostTestCases",
diff --git a/services/core/java/com/android/server/lights/TEST_MAPPING b/services/core/java/com/android/server/lights/TEST_MAPPING
index 17b98ce8..1d2cd3c 100644
--- a/services/core/java/com/android/server/lights/TEST_MAPPING
+++ b/services/core/java/com/android/server/lights/TEST_MAPPING
@@ -9,11 +9,7 @@
]
},
{
- "name": "FrameworksServicesTests",
- "options": [
- {"include-filter": "com.android.server.lights"},
- {"exclude-annotation": "androidx.test.filters.FlakyTest"}
- ]
+ "name": "FrameworksServicesTests_android_server_lights"
}
]
}
diff --git a/services/core/java/com/android/server/locales/TEST_MAPPING b/services/core/java/com/android/server/locales/TEST_MAPPING
index fd8cddc..26e4685 100644
--- a/services/core/java/com/android/server/locales/TEST_MAPPING
+++ b/services/core/java/com/android/server/locales/TEST_MAPPING
@@ -1,12 +1,7 @@
{
"presubmit": [
{
- "name": "FrameworksServicesTests",
- "options": [
- {
- "include-filter": "com.android.server.locales."
- }
- ]
+ "name": "FrameworksServicesTests_android_server_locales"
},
{
"name": "CtsLocaleManagerHostTestCases"
diff --git a/services/core/java/com/android/server/location/TEST_MAPPING b/services/core/java/com/android/server/location/TEST_MAPPING
index f5deb2b..64b1ed2 100644
--- a/services/core/java/com/android/server/location/TEST_MAPPING
+++ b/services/core/java/com/android/server/location/TEST_MAPPING
@@ -16,10 +16,7 @@
"name": "CtsLocationNoneTestCases"
},
{
- "name": "FrameworksMockingServicesTests",
- "options": [{
- "include-filter": "com.android.server.location"
- }]
+ "name": "FrameworksMockingServicesTests_location"
}
]
}
diff --git a/services/core/java/com/android/server/location/contexthub/TEST_MAPPING b/services/core/java/com/android/server/location/contexthub/TEST_MAPPING
index 2f6aa53..85ea5a4 100644
--- a/services/core/java/com/android/server/location/contexthub/TEST_MAPPING
+++ b/services/core/java/com/android/server/location/contexthub/TEST_MAPPING
@@ -1,21 +1,7 @@
{
"presubmit": [
{
- "name": "FrameworksServicesTests",
- "options": [
- {
- "include-filter": "com.android.server.location.contexthub."
- },
- {
- "include-annotation": "android.platform.test.annotations.Presubmit"
- },
- {
- "exclude-annotation": "androidx.test.filters.FlakyTest"
- },
- {
- "exclude-annotation": "org.junit.Ignore"
- }
- ]
+ "name": "FrameworksServicesTests_android_server_location_contexthub_Presubmit"
}
],
"imports": [
diff --git a/services/core/java/com/android/server/locksettings/TEST_MAPPING b/services/core/java/com/android/server/locksettings/TEST_MAPPING
index 256d9ba..ffbdf7f 100644
--- a/services/core/java/com/android/server/locksettings/TEST_MAPPING
+++ b/services/core/java/com/android/server/locksettings/TEST_MAPPING
@@ -14,15 +14,7 @@
],
"presubmit": [
{
- "name": "FrameworksServicesTests",
- "options": [
- {
- "include-filter": "com.android.server.locksettings."
- },
- {
- "exclude-annotation": "androidx.test.filters.FlakyTest"
- }
- ]
+ "name": "FrameworksServicesTests_android_server_locksettings"
}
],
"postsubmit": [
diff --git a/services/core/java/com/android/server/logcat/TEST_MAPPING b/services/core/java/com/android/server/logcat/TEST_MAPPING
index 9041552..5b07cd9 100644
--- a/services/core/java/com/android/server/logcat/TEST_MAPPING
+++ b/services/core/java/com/android/server/logcat/TEST_MAPPING
@@ -1,11 +1,7 @@
{
"presubmit": [
{
- "name": "FrameworksServicesTests",
- "options": [
- {"include-filter": "com.android.server.logcat"},
- {"exclude-annotation": "androidx.test.filters.FlakyTest"}
- ]
+ "name": "FrameworksServicesTests_android_server_logcat_Presubmit"
}
],
"postsubmit": [
diff --git a/services/core/java/com/android/server/om/TEST_MAPPING b/services/core/java/com/android/server/om/TEST_MAPPING
index 82e7817..ce047bb 100644
--- a/services/core/java/com/android/server/om/TEST_MAPPING
+++ b/services/core/java/com/android/server/om/TEST_MAPPING
@@ -1,12 +1,7 @@
{
"presubmit": [
{
- "name": "FrameworksServicesTests",
- "options": [
- {
- "include-filter": "com.android.server.om."
- }
- ]
+ "name": "FrameworksServicesTests_android_server_om"
},
{
"name": "OverlayDeviceTests"
diff --git a/services/core/java/com/android/server/pdb/TEST_MAPPING b/services/core/java/com/android/server/pdb/TEST_MAPPING
index 9e98023..ed6dfd8 100644
--- a/services/core/java/com/android/server/pdb/TEST_MAPPING
+++ b/services/core/java/com/android/server/pdb/TEST_MAPPING
@@ -1,12 +1,7 @@
{
"presubmit": [
{
- "name": "FrameworksServicesTests",
- "options": [
- {
- "include-filter": "com.android.server.pdb.PersistentDataBlockServiceTest"
- }
- ]
+ "name": "FrameworksServicesTests_android_server_pdb"
}
]
}
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index c814a1e..7ddec79 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -2073,6 +2073,10 @@
// CHECKSTYLE:ON IndentationCheck
t.traceEnd();
+ t.traceBegin("get system config");
+ SystemConfig systemConfig = injector.getSystemConfig();
+ t.traceEnd();
+
t.traceBegin("addSharedUsers");
mSettings.addSharedUserLPw("android.uid.system", Process.SYSTEM_UID,
ApplicationInfo.FLAG_SYSTEM, ApplicationInfo.PRIVATE_FLAG_PRIVILEGED);
@@ -2092,6 +2096,13 @@
ApplicationInfo.FLAG_SYSTEM, ApplicationInfo.PRIVATE_FLAG_PRIVILEGED);
mSettings.addSharedUserLPw("android.uid.uwb", UWB_UID,
ApplicationInfo.FLAG_SYSTEM, ApplicationInfo.PRIVATE_FLAG_PRIVILEGED);
+ final ArrayMap<String, Integer> oemDefinedUids = systemConfig.getOemDefinedUids();
+ final int numOemDefinedUids = oemDefinedUids.size();
+ for (int i = 0; i < numOemDefinedUids; i++) {
+ mSettings.addOemSharedUserLPw(oemDefinedUids.keyAt(i), oemDefinedUids.valueAt(i),
+ ApplicationInfo.FLAG_SYSTEM, ApplicationInfo.PRIVATE_FLAG_PRIVILEGED);
+ }
+
t.traceEnd();
String separateProcesses = SystemProperties.get("debug.separate_processes");
@@ -2124,10 +2135,7 @@
mContext.getSystemService(DisplayManager.class)
.getDisplay(Display.DEFAULT_DISPLAY).getMetrics(mMetrics);
- t.traceBegin("get system config");
- SystemConfig systemConfig = injector.getSystemConfig();
mAvailableFeatures = systemConfig.getAvailableFeatures();
- t.traceEnd();
mProtectedPackages = new ProtectedPackages(mContext);
diff --git a/services/core/java/com/android/server/pm/Settings.java b/services/core/java/com/android/server/pm/Settings.java
index fd99c7a..200d004 100644
--- a/services/core/java/com/android/server/pm/Settings.java
+++ b/services/core/java/com/android/server/pm/Settings.java
@@ -969,6 +969,21 @@
return null;
}
+ SharedUserSetting addOemSharedUserLPw(String name, int uid, int pkgFlags, int pkgPrivateFlags) {
+ if (!name.startsWith("android.uid")) {
+ PackageManagerService.reportSettingsProblem(Log.ERROR,
+ "Failed to add oem defined shared user because of invalid name: " + name);
+ return null;
+ }
+ // OEM defined uids must be in the OEM reserved range
+ if (uid < 2900 || uid > 2999) {
+ PackageManagerService.reportSettingsProblem(Log.ERROR,
+ "Failed to add oem defined shared user because of invalid uid: " + uid);
+ return null;
+ }
+ return addSharedUserLPw(name, uid, pkgFlags, pkgPrivateFlags);
+ }
+
SharedUserSetting addSharedUserLPw(String name, int uid, int pkgFlags, int pkgPrivateFlags) {
SharedUserSetting s = mSharedUsers.get(name);
if (s != null) {
diff --git a/services/core/java/com/android/server/pm/TEST_MAPPING b/services/core/java/com/android/server/pm/TEST_MAPPING
index e12b70f..372bbc4 100644
--- a/services/core/java/com/android/server/pm/TEST_MAPPING
+++ b/services/core/java/com/android/server/pm/TEST_MAPPING
@@ -29,12 +29,7 @@
"name": "CtsMatchFlagTestCases"
},
{
- "name": "FrameworksMockingServicesTests",
- "options": [
- {
- "include-filter": "com.android.server.pm."
- }
- ]
+ "name": "FrameworksMockingServicesTests_android_server_pm"
},
{
"file_patterns": ["(/|^)PackageManagerService\\.java","(/|^)UserManagerService\\.java"],
diff --git a/services/core/java/com/android/server/pm/dex/TEST_MAPPING b/services/core/java/com/android/server/pm/dex/TEST_MAPPING
index 1c86c4f..64bcc22 100644
--- a/services/core/java/com/android/server/pm/dex/TEST_MAPPING
+++ b/services/core/java/com/android/server/pm/dex/TEST_MAPPING
@@ -1,12 +1,7 @@
{
"presubmit": [
{
- "name": "FrameworksServicesTests",
- "options": [
- {
- "include-filter": "com.android.server.pm.dex"
- }
- ]
+ "name": "FrameworksServicesTests_android_server_pm_dex"
},
{
"name": "DynamicCodeLoggerIntegrationTests"
diff --git a/services/core/java/com/android/server/power/PowerManagerService.java b/services/core/java/com/android/server/power/PowerManagerService.java
index c654111..feaf181 100644
--- a/services/core/java/com/android/server/power/PowerManagerService.java
+++ b/services/core/java/com/android/server/power/PowerManagerService.java
@@ -96,7 +96,6 @@
import android.provider.Settings;
import android.provider.Settings.SettingNotFoundException;
import android.service.dreams.DreamManagerInternal;
-import android.sysprop.InitProperties;
import android.sysprop.PowerProperties;
import android.util.ArrayMap;
import android.util.IntArray;
@@ -127,7 +126,6 @@
import com.android.server.ServiceThread;
import com.android.server.SystemService;
import com.android.server.UiThread;
-import com.android.server.UserspaceRebootLogger;
import com.android.server.Watchdog;
import com.android.server.am.BatteryStatsService;
import com.android.server.display.feature.DeviceConfigParameterProvider;
@@ -1251,8 +1249,7 @@
mHalInteractiveModeEnabled = true;
mWakefulnessRaw = WAKEFULNESS_AWAKE;
- sQuiescent = mSystemProperties.get(SYSTEM_PROPERTY_QUIESCENT, "0").equals("1")
- || InitProperties.userspace_reboot_in_progress().orElse(false);
+ sQuiescent = mSystemProperties.get(SYSTEM_PROPERTY_QUIESCENT, "0").equals("1");
mNativeWrapper.nativeInit(this);
mNativeWrapper.nativeSetAutoSuspend(false);
@@ -3945,7 +3942,6 @@
throw new UnsupportedOperationException(
"Attempted userspace reboot on a device that doesn't support it");
}
- UserspaceRebootLogger.noteUserspaceRebootWasRequested();
}
if (mHandler == null || !mSystemReady) {
if (RescueParty.isRecoveryTriggeredReboot()) {
diff --git a/services/core/java/com/android/server/power/TEST_MAPPING b/services/core/java/com/android/server/power/TEST_MAPPING
index e64704a..4ce01d2 100644
--- a/services/core/java/com/android/server/power/TEST_MAPPING
+++ b/services/core/java/com/android/server/power/TEST_MAPPING
@@ -8,11 +8,7 @@
]
},
{
- "name": "FrameworksMockingServicesTests",
- "options": [
- {"include-filter": "com.android.server.power"},
- {"exclude-annotation": "androidx.test.filters.FlakyTest"}
- ]
+ "name": "FrameworksMockingServicesTests_android_server_power_Presubmit"
},
{
"name": "PowerServiceTests",
diff --git a/services/core/java/com/android/server/power/batterysaver/TEST_MAPPING b/services/core/java/com/android/server/power/batterysaver/TEST_MAPPING
index eb91a72..d29dbfe 100644
--- a/services/core/java/com/android/server/power/batterysaver/TEST_MAPPING
+++ b/services/core/java/com/android/server/power/batterysaver/TEST_MAPPING
@@ -11,10 +11,7 @@
"name": "CtsLocationNoneTestCases"
},
{
- "name": "FrameworksMockingServicesTests",
- "options": [
- {"include-filter": "com.android.server.location"}
- ]
+ "name": "FrameworksMockingServicesTests_location"
}
]
}
diff --git a/services/core/java/com/android/server/powerstats/TEST_MAPPING b/services/core/java/com/android/server/powerstats/TEST_MAPPING
index 79224a5..0ba1da9 100644
--- a/services/core/java/com/android/server/powerstats/TEST_MAPPING
+++ b/services/core/java/com/android/server/powerstats/TEST_MAPPING
@@ -1,12 +1,7 @@
{
"presubmit": [
{
- "name": "FrameworksServicesTests",
- "options": [
- {
- "include-filter": "com.android.server.powerstats"
- }
- ]
+ "name": "FrameworksServicesTests_android_server_powerstats"
}
]
}
diff --git a/services/core/java/com/android/server/rollback/TEST_MAPPING b/services/core/java/com/android/server/rollback/TEST_MAPPING
index 2cc931b..291b8db 100644
--- a/services/core/java/com/android/server/rollback/TEST_MAPPING
+++ b/services/core/java/com/android/server/rollback/TEST_MAPPING
@@ -1,12 +1,7 @@
{
"presubmit": [
{
- "name": "FrameworksServicesTests",
- "options": [
- {
- "include-filter": "com.android.server.rollback"
- }
- ]
+ "name": "FrameworksServicesTests_android_server_rollback"
}
],
"imports": [
diff --git a/services/core/java/com/android/server/stats/pull/StatsPullAtomService.java b/services/core/java/com/android/server/stats/pull/StatsPullAtomService.java
index 0ffd002..35003af 100644
--- a/services/core/java/com/android/server/stats/pull/StatsPullAtomService.java
+++ b/services/core/java/com/android/server/stats/pull/StatsPullAtomService.java
@@ -65,6 +65,7 @@
import static com.android.server.stats.pull.ProcfsMemoryUtil.getProcessCmdlines;
import static com.android.server.stats.pull.ProcfsMemoryUtil.readCmdlineFromProcfs;
import static com.android.server.stats.pull.ProcfsMemoryUtil.readMemorySnapshotFromProcfs;
+import static com.android.server.stats.pull.netstats.NetworkStatsUtils.fromPublicNetworkStats;
import static libcore.io.IoUtils.closeQuietly;
@@ -203,7 +204,6 @@
import com.android.internal.os.StoragedUidIoStatsReader;
import com.android.internal.util.CollectionUtils;
import com.android.internal.util.FrameworkStatsLog;
-import com.android.net.module.util.NetworkStatsUtils;
import com.android.role.RoleManagerLocal;
import com.android.server.BinderCallsStatsService;
import com.android.server.LocalManagerRegistry;
@@ -1522,7 +1522,7 @@
currentTimeInMillis);
final NetworkStats nonTaggedStats =
- NetworkStatsUtils.fromPublicNetworkStats(queryNonTaggedStats);
+ fromPublicNetworkStats(queryNonTaggedStats);
queryNonTaggedStats.close();
if (!includeTags) return nonTaggedStats;
@@ -1531,7 +1531,7 @@
currentTimeInMillis - elapsedMillisSinceBoot - bucketDuration,
currentTimeInMillis);
final NetworkStats taggedStats =
- NetworkStatsUtils.fromPublicNetworkStats(queryTaggedStats);
+ fromPublicNetworkStats(queryTaggedStats);
queryTaggedStats.close();
return nonTaggedStats.add(taggedStats);
}
diff --git a/services/core/java/com/android/server/stats/pull/netstats/NetworkStatsUtils.java b/services/core/java/com/android/server/stats/pull/netstats/NetworkStatsUtils.java
new file mode 100644
index 0000000..de58852
--- /dev/null
+++ b/services/core/java/com/android/server/stats/pull/netstats/NetworkStatsUtils.java
@@ -0,0 +1,109 @@
+/*
+ * 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.server.stats.pull.netstats;
+
+import static android.net.NetworkStats.DEFAULT_NETWORK_ALL;
+import static android.net.NetworkStats.METERED_ALL;
+import static android.net.NetworkStats.ROAMING_ALL;
+import static android.net.NetworkStats.SET_ALL;
+
+import android.app.usage.NetworkStats;
+
+import com.android.internal.annotations.VisibleForTesting;
+
+/**
+ * Utility methods for accessing {@link android.net.NetworkStats}.
+ */
+public class NetworkStatsUtils {
+
+ /**
+ * Convert structure from android.app.usage.NetworkStats to android.net.NetworkStats.
+ */
+ public static android.net.NetworkStats fromPublicNetworkStats(
+ NetworkStats publiceNetworkStats) {
+ android.net.NetworkStats stats = new android.net.NetworkStats(0L, 0);
+ while (publiceNetworkStats.hasNextBucket()) {
+ NetworkStats.Bucket bucket = new NetworkStats.Bucket();
+ publiceNetworkStats.getNextBucket(bucket);
+ final android.net.NetworkStats.Entry entry = fromBucket(bucket);
+ stats = stats.addEntry(entry);
+ }
+ return stats;
+ }
+
+ /**
+ * Convert structure from android.app.usage.NetworkStats.Bucket
+ * to android.net.NetworkStats.Entry.
+ */
+ @VisibleForTesting
+ public static android.net.NetworkStats.Entry fromBucket(NetworkStats.Bucket bucket) {
+ return new android.net.NetworkStats.Entry(
+ null /* IFACE_ALL */, bucket.getUid(), convertBucketState(bucket.getState()),
+ convertBucketTag(bucket.getTag()), convertBucketMetered(bucket.getMetered()),
+ convertBucketRoaming(bucket.getRoaming()),
+ convertBucketDefaultNetworkStatus(bucket.getDefaultNetworkStatus()),
+ bucket.getRxBytes(), bucket.getRxPackets(),
+ bucket.getTxBytes(), bucket.getTxPackets(), 0 /* operations */);
+ }
+
+ private static int convertBucketState(int networkStatsSet) {
+ switch (networkStatsSet) {
+ case NetworkStats.Bucket.STATE_ALL: return SET_ALL;
+ case NetworkStats.Bucket.STATE_DEFAULT: return android.net.NetworkStats.SET_DEFAULT;
+ case NetworkStats.Bucket.STATE_FOREGROUND:
+ return android.net.NetworkStats.SET_FOREGROUND;
+ }
+ return 0;
+ }
+
+ private static int convertBucketTag(int tag) {
+ switch (tag) {
+ case NetworkStats.Bucket.TAG_NONE: return android.net.NetworkStats.TAG_NONE;
+ }
+ return tag;
+ }
+
+ private static int convertBucketMetered(int metered) {
+ switch (metered) {
+ case NetworkStats.Bucket.METERED_ALL: return METERED_ALL;
+ case NetworkStats.Bucket.METERED_NO: return android.net.NetworkStats.METERED_NO;
+ case NetworkStats.Bucket.METERED_YES: return android.net.NetworkStats.METERED_YES;
+ }
+ return 0;
+ }
+
+ private static int convertBucketRoaming(int roaming) {
+ switch (roaming) {
+ case NetworkStats.Bucket.ROAMING_ALL: return ROAMING_ALL;
+ case NetworkStats.Bucket.ROAMING_NO: return android.net.NetworkStats.ROAMING_NO;
+ case NetworkStats.Bucket.ROAMING_YES: return android.net.NetworkStats.ROAMING_YES;
+ }
+ return 0;
+ }
+
+ private static int convertBucketDefaultNetworkStatus(int defaultNetworkStatus) {
+ switch (defaultNetworkStatus) {
+ case NetworkStats.Bucket.DEFAULT_NETWORK_ALL:
+ return DEFAULT_NETWORK_ALL;
+ case NetworkStats.Bucket.DEFAULT_NETWORK_NO:
+ return android.net.NetworkStats.DEFAULT_NETWORK_NO;
+ case NetworkStats.Bucket.DEFAULT_NETWORK_YES:
+ return android.net.NetworkStats.DEFAULT_NETWORK_YES;
+ }
+ return 0;
+ }
+}
diff --git a/services/core/java/com/android/server/tracing/TracingServiceProxy.java b/services/core/java/com/android/server/tracing/TracingServiceProxy.java
index 68eb8eb..480db25 100644
--- a/services/core/java/com/android/server/tracing/TracingServiceProxy.java
+++ b/services/core/java/com/android/server/tracing/TracingServiceProxy.java
@@ -76,8 +76,6 @@
// Keep this in sync with the definitions in TraceService
private static final String INTENT_ACTION_NOTIFY_SESSION_STOPPED =
"com.android.traceur.NOTIFY_SESSION_STOPPED";
- private static final String INTENT_ACTION_NOTIFY_SESSION_STOLEN =
- "com.android.traceur.NOTIFY_SESSION_STOLEN";
private static final int REPORT_BEGIN =
TRACING_SERVICE_REPORT_EVENT__EVENT__TRACING_SERVICE_REPORT_BEGIN;
@@ -97,13 +95,12 @@
private final ITracingServiceProxy.Stub mTracingServiceProxy = new ITracingServiceProxy.Stub() {
/**
- * Notifies system tracing app that a tracing session has ended. If a session is repurposed
- * for use in a bugreport, sessionStolen can be set to indicate that tracing has ended but
- * there is no buffer available to dump.
+ * Notifies system tracing app that a tracing session has ended. sessionStolen is ignored,
+ * as trace sessions are no longer stolen and are always cloned instead.
*/
@Override
- public void notifyTraceSessionEnded(boolean sessionStolen) {
- TracingServiceProxy.this.notifyTraceur(sessionStolen);
+ public void notifyTraceSessionEnded(boolean sessionStolen /* unused */) {
+ TracingServiceProxy.this.notifyTraceur();
}
@Override
@@ -132,7 +129,7 @@
}
}
- private void notifyTraceur(boolean sessionStolen) {
+ private void notifyTraceur() {
final Intent intent = new Intent();
try {
@@ -141,11 +138,7 @@
PackageManager.MATCH_SYSTEM_ONLY);
intent.setClassName(info.packageName, TRACING_APP_ACTIVITY);
- if (sessionStolen) {
- intent.setAction(INTENT_ACTION_NOTIFY_SESSION_STOLEN);
- } else {
- intent.setAction(INTENT_ACTION_NOTIFY_SESSION_STOPPED);
- }
+ intent.setAction(INTENT_ACTION_NOTIFY_SESSION_STOPPED);
final long identity = Binder.clearCallingIdentity();
try {
diff --git a/services/core/java/com/android/server/uri/TEST_MAPPING b/services/core/java/com/android/server/uri/TEST_MAPPING
index b42d154..0d756bb 100644
--- a/services/core/java/com/android/server/uri/TEST_MAPPING
+++ b/services/core/java/com/android/server/uri/TEST_MAPPING
@@ -1,12 +1,7 @@
{
"presubmit": [
{
- "name": "FrameworksServicesTests",
- "options": [
- {
- "include-filter": "com.android.server.uri."
- }
- ]
+ "name": "FrameworksServicesTests_android_server_uri"
},
{
"name": "CtsStorageHostTestCases",
diff --git a/services/core/java/com/android/server/utils/TEST_MAPPING b/services/core/java/com/android/server/utils/TEST_MAPPING
index bb7cea9..dcf0049 100644
--- a/services/core/java/com/android/server/utils/TEST_MAPPING
+++ b/services/core/java/com/android/server/utils/TEST_MAPPING
@@ -1,12 +1,7 @@
{
"presubmit": [
{
- "name": "FrameworksMockingServicesTests",
- "options": [
- {
- "include-filter": "com.android.server.utils"
- }
- ]
+ "name": "FrameworksMockingServicesTests_android_server_utils"
}
]
}
\ No newline at end of file
diff --git a/services/core/java/com/android/server/wm/RootWindowContainer.java b/services/core/java/com/android/server/wm/RootWindowContainer.java
index 07a03eb..762fa07 100644
--- a/services/core/java/com/android/server/wm/RootWindowContainer.java
+++ b/services/core/java/com/android/server/wm/RootWindowContainer.java
@@ -996,6 +996,7 @@
// complete configuration.
continue;
}
+ win.updateSurfacePositionIfNeeded();
win.reportResized();
mWmService.mResizingWindows.remove(i);
}
diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java
index a310992..4a2694b 100644
--- a/services/core/java/com/android/server/wm/Task.java
+++ b/services/core/java/com/android/server/wm/Task.java
@@ -4772,6 +4772,9 @@
mTransitionController.collect(topActivity);
final Task lastParentBeforePip = topActivity.getLastParentBeforePip();
+ // Reset the activity windowing mode to match the parent.
+ topActivity.getRequestedOverrideConfiguration()
+ .windowConfiguration.setWindowingMode(WINDOWING_MODE_UNDEFINED);
topActivity.reparent(lastParentBeforePip,
lastParentBeforePip.getChildCount() /* top */,
"movePinnedActivityToOriginalTask");
diff --git a/services/core/java/com/android/server/wm/Transition.java b/services/core/java/com/android/server/wm/Transition.java
index 7edc3a2..e7af870 100644
--- a/services/core/java/com/android/server/wm/Transition.java
+++ b/services/core/java/com/android/server/wm/Transition.java
@@ -1745,8 +1745,9 @@
// already been reset by the original hiding-transition's finishTransaction (we can't
// show in the finishTransaction because by then the activity doesn't hide until
// surface placement).
- for (WindowContainer p = ar.getParent(); p != null && !containsChangeFor(p, mTargets);
- p = p.getParent()) {
+ for (WindowContainer p = ar.getParent();
+ p != null && !containsChangeFor(p, mTargets) && !p.isOrganized();
+ p = p.getParent()) {
if (p.getSurfaceControl() != null) {
transaction.show(p.getSurfaceControl());
}
diff --git a/services/core/java/com/android/server/wm/WallpaperController.java b/services/core/java/com/android/server/wm/WallpaperController.java
index c2b847c..f56b68b 100644
--- a/services/core/java/com/android/server/wm/WallpaperController.java
+++ b/services/core/java/com/android/server/wm/WallpaperController.java
@@ -183,8 +183,8 @@
if (DEBUG_WALLPAPER) Slog.v(TAG, "Found recents animation wallpaper target: " + w);
mFindResults.setWallpaperTarget(w);
return true;
- } else if (hasWallpaper && w.isOnScreen()
- && (mWallpaperTarget == w || w.isDrawFinishedLw())) {
+ } else if (hasWallpaper
+ && (w.mActivityRecord != null ? w.isOnScreen() : w.isReadyForDisplay())) {
if (DEBUG_WALLPAPER) Slog.v(TAG, "Found wallpaper target: " + w);
mFindResults.setWallpaperTarget(w);
mFindResults.setIsWallpaperTargetForLetterbox(w.hasWallpaperForLetterboxBackground());
diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java
index 18ac0e7..b7446d9 100644
--- a/services/core/java/com/android/server/wm/WindowState.java
+++ b/services/core/java/com/android/server/wm/WindowState.java
@@ -2341,6 +2341,8 @@
mWmService.mDisplayManagerInternal.onPresentation(dc.getDisplay().getDisplayId(),
/*isShown=*/ false);
}
+ // Check if window provides non decor insets before clearing its provided insets.
+ final boolean windowProvidesDisplayDecorInsets = providesDisplayDecorInsets();
// Remove this window from mTapExcludeProvidingWindows. If it was not registered, this will
// not do anything.
@@ -2354,6 +2356,18 @@
mWmService.postWindowRemoveCleanupLocked(this);
consumeInsetsChange();
+
+ // Update the orientation when removing a window affecting the display orientation.
+ // Also recompute configuration if it provides screen decor insets.
+ boolean needToSendNewConfiguration = dc.getLastOrientationSource() == this
+ && dc.updateOrientation();
+ if (windowProvidesDisplayDecorInsets) {
+ needToSendNewConfiguration |= dc.getDisplayPolicy().updateDecorInsetsInfo();
+ }
+
+ if (needToSendNewConfiguration) {
+ dc.sendNewConfiguration();
+ }
}
@Override
@@ -2406,16 +2420,10 @@
mActivityRecord != null && mActivityRecord.isAnimating(PARENTS | TRANSITION),
mWmService.mDisplayFrozen, Debug.getCallers(6));
- // Visibility of the removed window. Will be used later to update orientation later on.
- boolean wasVisible = false;
-
// First, see if we need to run an animation. If we do, we have to hold off on removing the
// window until the animation is done. If the display is frozen, just remove immediately,
// since the animation wouldn't be seen.
if (mHasSurface && mToken.okToAnimate()) {
- // If we are not currently running the exit animation, we need to see about starting one
- wasVisible = isVisible();
-
// Remove immediately if there is display transition because the animation is
// usually unnoticeable (e.g. covered by rotation animation) and the animation
// bounds could be inconsistent, such as depending on when the window applies
@@ -2425,7 +2433,9 @@
// look weird if its orientation is changed.
&& !inRelaunchingActivity();
- if (wasVisible && isDisplayed()) {
+ // If we are not currently running the exit animation,
+ // we need to see about starting one
+ if (isVisible() && isDisplayed()) {
final int transit = (!startingWindow) ? TRANSIT_EXIT : TRANSIT_PREVIEW_DONE;
// Try starting an animation.
@@ -2474,21 +2484,7 @@
}
}
- // Check if window provides non decor insets before clearing its provided insets.
- final boolean windowProvidesDisplayDecorInsets = providesDisplayDecorInsets();
-
removeImmediately();
- // Removing a visible window may affect the display orientation so just update it if
- // needed. Also recompute configuration if it provides screen decor insets.
- boolean needToSendNewConfiguration = wasVisible && displayContent.updateOrientation();
- if (windowProvidesDisplayDecorInsets) {
- needToSendNewConfiguration |=
- displayContent.getDisplayPolicy().updateDecorInsetsInfo();
- }
-
- if (needToSendNewConfiguration) {
- displayContent.sendNewConfiguration();
- }
mWmService.updateFocusedWindowLocked(isFocused()
? UPDATE_FOCUS_REMOVING_FOCUS
: UPDATE_FOCUS_NORMAL,
@@ -5194,6 +5190,14 @@
super.prepareSurfaces();
}
+ void updateSurfacePositionIfNeeded() {
+ if (mWindowFrames.mRelFrame.top == mWindowFrames.mLastRelFrame.top
+ && mWindowFrames.mRelFrame.left == mWindowFrames.mLastRelFrame.left) {
+ return;
+ }
+ updateSurfacePosition(getSyncTransaction());
+ }
+
@Override
@VisibleForTesting
void updateSurfacePosition(Transaction t) {
diff --git a/services/foldables/devicestateprovider/src/com/android/server/policy/feature/Android.bp b/services/foldables/devicestateprovider/src/com/android/server/policy/feature/Android.bp
index 6393e11..1db9e8d 100644
--- a/services/foldables/devicestateprovider/src/com/android/server/policy/feature/Android.bp
+++ b/services/foldables/devicestateprovider/src/com/android/server/policy/feature/Android.bp
@@ -1,7 +1,7 @@
aconfig_declarations {
name: "device_state_flags",
package: "com.android.server.policy.feature.flags",
- container: "system",
+ container: "system_ext",
srcs: [
"device_state_flags.aconfig",
],
diff --git a/services/foldables/devicestateprovider/src/com/android/server/policy/feature/device_state_flags.aconfig b/services/foldables/devicestateprovider/src/com/android/server/policy/feature/device_state_flags.aconfig
index 21e33dd..f827b55 100644
--- a/services/foldables/devicestateprovider/src/com/android/server/policy/feature/device_state_flags.aconfig
+++ b/services/foldables/devicestateprovider/src/com/android/server/policy/feature/device_state_flags.aconfig
@@ -1,5 +1,5 @@
package: "com.android.server.policy.feature.flags"
-container: "system"
+container: "system_ext"
flag {
name: "enable_dual_display_blocking"
diff --git a/services/profcollect/src/com/android/server/profcollect/ProfcollectForwardingService.java b/services/profcollect/src/com/android/server/profcollect/ProfcollectForwardingService.java
index dab3978..105147f 100644
--- a/services/profcollect/src/com/android/server/profcollect/ProfcollectForwardingService.java
+++ b/services/profcollect/src/com/android/server/profcollect/ProfcollectForwardingService.java
@@ -46,12 +46,12 @@
import com.android.server.LocalServices;
import com.android.server.SystemService;
import com.android.server.art.ArtManagerLocal;
+import com.android.server.profcollect.Utils;
import com.android.server.wm.ActivityMetricsLaunchObserver;
import com.android.server.wm.ActivityMetricsLaunchObserverRegistry;
import com.android.server.wm.ActivityTaskManagerInternal;
import java.util.Arrays;
-import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.TimeUnit;
/**
@@ -275,30 +275,15 @@
launchObserverRegistry.registerLaunchObserver(mAppLaunchObserver);
}
- private void traceOnAppStart(String packageName) {
- if (mIProfcollect == null) {
- return;
- }
-
- // Sample for a fraction of app launches.
- int traceFrequency = DeviceConfig.getInt(DeviceConfig.NAMESPACE_PROFCOLLECT_NATIVE_BOOT,
- "applaunch_trace_freq", 2);
- int randomNum = ThreadLocalRandom.current().nextInt(100);
- if (randomNum < traceFrequency) {
- BackgroundThread.get().getThreadHandler().post(() -> {
- try {
- mIProfcollect.trace_system("applaunch");
- } catch (RemoteException e) {
- Log.e(LOG_TAG, "Failed to initiate trace: " + e.getMessage());
- }
- });
- }
- }
-
private class AppLaunchObserver extends ActivityMetricsLaunchObserver {
@Override
public void onIntentStarted(Intent intent, long timestampNanos) {
- traceOnAppStart(intent.getPackage());
+ if (mIProfcollect == null) {
+ return;
+ }
+ if (Utils.withFrequency("applaunch_trace_freq", 5)) {
+ Utils.traceSystem(mIProfcollect, "applaunch");
+ }
}
}
@@ -318,20 +303,9 @@
if (mIProfcollect == null) {
return;
}
- // Sample for a fraction of dex2oat runs.
- final int traceFrequency =
- DeviceConfig.getInt(DeviceConfig.NAMESPACE_PROFCOLLECT_NATIVE_BOOT,
- "dex2oat_trace_freq", 25);
- int randomNum = ThreadLocalRandom.current().nextInt(100);
- if (randomNum < traceFrequency) {
+ if (Utils.withFrequency("dex2oat_trace_freq", 25)) {
// Dex2oat could take a while before it starts. Add a short delay before start tracing.
- BackgroundThread.get().getThreadHandler().postDelayed(() -> {
- try {
- mIProfcollect.trace_system("dex2oat");
- } catch (RemoteException e) {
- Log.e(LOG_TAG, "Failed to initiate trace: " + e.getMessage());
- }
- }, 1000);
+ Utils.traceSystem(mIProfcollect, "dex2oat", /* delayMs */ 1000);
}
}
@@ -393,27 +367,12 @@
if (Arrays.asList(cameraSkipPackages).contains(packageId)) {
return;
}
- // Sample for a fraction of camera events.
- final int traceFrequency =
- DeviceConfig.getInt(DeviceConfig.NAMESPACE_PROFCOLLECT_NATIVE_BOOT,
- "camera_trace_freq", 10);
- int randomNum = ThreadLocalRandom.current().nextInt(100);
- if (randomNum >= traceFrequency) {
- return;
+ if (Utils.withFrequency("camera_trace_freq", 10)) {
+ Utils.traceProcess(mIProfcollect,
+ "camera",
+ "android.hardware.camera.provider",
+ /* durationMs */ 5000);
}
- final int traceDuration = 5000;
- final String traceTag = "camera";
- BackgroundThread.get().getThreadHandler().post(() -> {
- if (mIProfcollect == null) {
- return;
- }
- try {
- mIProfcollect.trace_process(traceTag, "android.hardware.camera.provider",
- traceDuration);
- } catch (RemoteException e) {
- Log.e(LOG_TAG, "Failed to initiate trace: " + e.getMessage());
- }
- });
}
}, null);
}
diff --git a/services/profcollect/src/com/android/server/profcollect/Utils.java b/services/profcollect/src/com/android/server/profcollect/Utils.java
new file mode 100644
index 0000000..8508802
--- /dev/null
+++ b/services/profcollect/src/com/android/server/profcollect/Utils.java
@@ -0,0 +1,82 @@
+/**
+ * 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.server.profcollect;
+
+import static com.android.server.profcollect.ProfcollectForwardingService.LOG_TAG;
+
+import android.os.RemoteException;
+import android.provider.DeviceConfig;
+import android.util.Log;
+
+import com.android.internal.os.BackgroundThread;
+
+import java.util.concurrent.ThreadLocalRandom;
+
+public final class Utils {
+
+ public static boolean withFrequency(String configName, int defaultFrequency) {
+ int threshold = DeviceConfig.getInt(
+ DeviceConfig.NAMESPACE_PROFCOLLECT_NATIVE_BOOT, configName, defaultFrequency);
+ int randomNum = ThreadLocalRandom.current().nextInt(100);
+ return randomNum < threshold;
+ }
+
+ public static boolean traceSystem(IProfCollectd mIProfcollect, String eventName) {
+ if (mIProfcollect == null) {
+ return false;
+ }
+ BackgroundThread.get().getThreadHandler().post(() -> {
+ try {
+ mIProfcollect.trace_system(eventName);
+ } catch (RemoteException e) {
+ Log.e(LOG_TAG, "Failed to initiate trace: " + e.getMessage());
+ }
+ });
+ return true;
+ }
+
+ public static boolean traceSystem(IProfCollectd mIProfcollect, String eventName, int delayMs) {
+ if (mIProfcollect == null) {
+ return false;
+ }
+ BackgroundThread.get().getThreadHandler().postDelayed(() -> {
+ try {
+ mIProfcollect.trace_system(eventName);
+ } catch (RemoteException e) {
+ Log.e(LOG_TAG, "Failed to initiate trace: " + e.getMessage());
+ }
+ }, delayMs);
+ return true;
+ }
+
+ public static boolean traceProcess(IProfCollectd mIProfcollect,
+ String eventName, String processName, int durationMs) {
+ if (mIProfcollect == null) {
+ return false;
+ }
+ BackgroundThread.get().getThreadHandler().post(() -> {
+ try {
+ mIProfcollect.trace_process(eventName,
+ processName,
+ durationMs);
+ } catch (RemoteException e) {
+ Log.e(LOG_TAG, "Failed to initiate trace: " + e.getMessage());
+ }
+ });
+ return true;
+ }
+}
\ No newline at end of file
diff --git a/services/proguard.flags b/services/proguard.flags
index f84eff7..1e7e9b0 100644
--- a/services/proguard.flags
+++ b/services/proguard.flags
@@ -57,9 +57,6 @@
-keep public class com.android.server.utils.Slogf { *; }
# Referenced in wear-service
-# HIDL interfaces
--keep public class android.hidl.base.** { *; }
--keep public class android.hidl.manager.** { *; }
-keep public class com.android.server.wm.WindowManagerInternal { *; }
# JNI keep rules
@@ -112,8 +109,23 @@
-keep,allowoptimization,allowaccessmodification class com.android.server.SystemService { *; }
-keep,allowoptimization,allowaccessmodification class com.android.server.SystemService$TargetUser { *; }
-keep,allowoptimization,allowaccessmodification class com.android.server.usage.StorageStatsManagerLocal { *; }
--keep,allowoptimization,allowaccessmodification class com.android.internal.util.** { *; }
--keep,allowoptimization,allowaccessmodification class android.os.** { *; }
+
+# Prevent optimizations of any statically linked code that may shadow code in
+# the bootclasspath. See also StrictJavaPackagesTest for details on exceptions.
+# TODO(b/222468116): Resolve such collisions in the build system.
+-keep public class android.gsi.** { *; }
+-keep public class android.hidl.base.** { *; }
+-keep public class android.hidl.manager.** { *; }
+-keep public class android.os.** { *; }
+-keep public class com.android.internal.util.** { *; }
+-keep public class com.android.modules.utils.build.** { *; }
+# Also suppress related duplicate type warnings for the above kept classes.
+-dontwarn android.gsi.**
+-dontwarn android.hidl.base.**
+-dontwarn android.hidl.manager.**
+-dontwarn android.os.**
+-dontwarn com.android.internal.util.**
+-dontwarn com.android.modules.utils.build.**
# CoverageService guards optional jacoco class references with a runtime guard, so we can safely
# suppress build-time warnings.
diff --git a/services/tests/mockingservicestests/Android.bp b/services/tests/mockingservicestests/Android.bp
index 7eb3441..98968ac 100644
--- a/services/tests/mockingservicestests/Android.bp
+++ b/services/tests/mockingservicestests/Android.bp
@@ -136,3 +136,199 @@
],
auto_gen_config: true,
}
+
+FLAKY = ["androidx.test.filters.FlakyTest"]
+
+test_module_config {
+ name: "FrameworksMockingServicesTests_blob",
+ base: "FrameworksMockingServicesTests",
+ test_suites: ["device-tests"],
+ include_filters: ["com.android.server.blob"],
+}
+
+test_module_config {
+ name: "FrameworksMockingServicesTests_IdleController",
+ base: "FrameworksMockingServicesTests",
+ test_suites: ["device-tests"],
+ include_filters: ["com.android.server.DeviceIdleControllerTest"],
+ exclude_annotations: FLAKY,
+}
+
+test_module_config {
+ name: "FrameworksMockingServicesTests_AppStateTracker",
+ base: "FrameworksMockingServicesTests",
+ test_suites: ["device-tests"],
+ include_filters: ["com.android.server.AppStateTrackerTest"],
+ include_annotations: ["android.platform.test.annotations.Presubmit"],
+ exclude_annotations: FLAKY,
+}
+
+test_module_config {
+ name: "FrameworksMockingServicesTests_com_android_server",
+ base: "FrameworksMockingServicesTests",
+ test_suites: ["device-tests"],
+ include_filters: ["com.android.server"],
+}
+
+test_module_config {
+ name: "FrameworksMockingServicesTests_com_android_server_alarm",
+ base: "FrameworksMockingServicesTests",
+ test_suites: ["device-tests"],
+ include_filters: ["com.android.server.alarm"],
+ include_annotations: ["android.platform.test.annotations.Presubmit"],
+ exclude_annotations: FLAKY,
+}
+
+test_module_config {
+ name: "FrameworksMockingServicesTests_com_android_server_job_Presubmit",
+ base: "FrameworksMockingServicesTests",
+ test_suites: ["device-tests"],
+ include_filters: ["com.android.server.job"],
+ exclude_annotations: FLAKY + ["androidx.test.filters.LargeTest"],
+}
+
+test_module_config {
+ name: "FrameworksMockingServicesTests_com_android_server_job",
+ base: "FrameworksMockingServicesTests",
+ test_suites: ["device-tests"],
+ include_filters: ["com.android.server.job"],
+}
+
+test_module_config {
+ name: "FrameworksMockingServicesTests_com_android_server_tare_Presubmit",
+ base: "FrameworksMockingServicesTests",
+ test_suites: ["device-tests"],
+ include_filters: ["com.android.server.tare"],
+ exclude_annotations: FLAKY,
+}
+
+test_module_config {
+ name: "FrameworksMockingServicesTests_com_android_server_tare",
+ base: "FrameworksMockingServicesTests",
+ test_suites: ["device-tests"],
+ include_filters: ["com.android.server.tare"],
+}
+
+test_module_config {
+ name: "FrameworksMockingServicesTests_games_Presubmit",
+ base: "FrameworksMockingServicesTests",
+ test_suites: ["device-tests"],
+ include_filters: ["android.service.games"],
+ exclude_annotations: FLAKY,
+}
+
+test_module_config {
+ name: "FrameworksMockingServicesTests_location",
+ base: "FrameworksMockingServicesTests",
+ test_suites: ["device-tests"],
+ include_filters: ["com.android.server.location"],
+}
+
+test_module_config {
+ name: "FrameworksMockingServicesTests_backup",
+ base: "FrameworksMockingServicesTests",
+ test_suites: ["device-tests"],
+ include_filters: ["com.android.server.backup"],
+}
+
+test_module_config {
+ name: "FrameworksMockingServicesTests_sensorprivacy",
+ base: "FrameworksMockingServicesTests",
+ test_suites: ["device-tests"],
+ include_filters: ["com.android.server.sensorprivacy"],
+}
+
+test_module_config {
+ name: "FrameworksMockingServicesTests_android_server_am_Presubmit",
+ base: "FrameworksMockingServicesTests",
+ test_suites: ["device-tests"],
+ include_filters: ["com.android.server.am."],
+ include_annotations: ["android.platform.test.annotations.Presubmit"],
+ exclude_annotations: FLAKY,
+}
+
+test_module_config {
+ name: "FrameworksMockingServicesTests_android_server_am_broadcast",
+ base: "FrameworksMockingServicesTests",
+ test_suites: ["device-tests"],
+ include_filters: [
+ "com.android.server.am.BroadcastQueueTest",
+ "com.android.server.am.BroadcastRecordTest",
+ "com.android.server.am.BroadcastQueueModernImplTest",
+ ],
+}
+
+test_module_config {
+ name: "FrameworksMockingServicesTests_android_server_app",
+ base: "FrameworksMockingServicesTests",
+ test_suites: ["device-tests"],
+ // Matches appop too
+ include_filters: ["com.android.server.app"],
+ exclude_annotations: FLAKY,
+}
+
+test_module_config {
+ name: "FrameworksMockingServicesTests_android_server_appop",
+ base: "FrameworksMockingServicesTests",
+ test_suites: ["device-tests"],
+ include_filters: ["com.android.server.appop"],
+}
+
+test_module_config {
+ name: "FrameworksMockingServicesTests_android_server_compat_overrides",
+ base: "FrameworksMockingServicesTests",
+ test_suites: ["device-tests"],
+ include_filters: ["com.android.server.compat.overrides"],
+}
+
+test_module_config {
+ name: "FrameworksMockingServicesTests_android_server_crashrecovery",
+ base: "FrameworksMockingServicesTests",
+ test_suites: ["device-tests"],
+ include_filters: ["com.android.server.RescuePartyTest"],
+}
+
+test_module_config {
+ name: "FrameworksMockingServicesTests_android_server_pm",
+ base: "FrameworksMockingServicesTests",
+ test_suites: ["device-tests"],
+ include_filters: ["com.android.server.pm."],
+}
+
+test_module_config {
+ name: "FrameworksMockingServicesTests_com_android_server_pm_Presubmit",
+ base: "FrameworksMockingServicesTests",
+ test_suites: ["device-tests"],
+ include_filters: ["com.android.server.pm"],
+ exclude_annotations: FLAKY + ["org.junit.Ignore"],
+}
+
+test_module_config {
+ name: "FrameworksMockingServicesTests_android_server_power_Presubmit",
+ base: "FrameworksMockingServicesTests",
+ test_suites: ["device-tests"],
+ include_filters: ["com.android.server.power"],
+ exclude_annotations: FLAKY,
+}
+
+test_module_config {
+ name: "FrameworksMockingServicesTests_android_server_power",
+ base: "FrameworksMockingServicesTests",
+ test_suites: ["device-tests"],
+ include_filters: ["com.android.server.power"],
+}
+
+test_module_config {
+ name: "FrameworksMockingServicesTests_android_server_trust",
+ base: "FrameworksMockingServicesTests",
+ test_suites: ["device-tests"],
+ include_filters: ["com.android.server.trust"],
+ exclude_annotations: FLAKY,
+}
+
+test_module_config {
+ name: "FrameworksMockingServicesTests_android_server_utils",
+ base: "FrameworksMockingServicesTests",
+ test_suites: ["device-tests"],
+ include_filters: ["com.android.server.utils"],
+}
diff --git a/services/tests/mockingservicestests/src/com/android/server/pm/MockSystem.kt b/services/tests/mockingservicestests/src/com/android/server/pm/MockSystem.kt
index 538c0ee..c1e2600 100644
--- a/services/tests/mockingservicestests/src/com/android/server/pm/MockSystem.kt
+++ b/services/tests/mockingservicestests/src/com/android/server/pm/MockSystem.kt
@@ -313,6 +313,7 @@
whenever(mocks.systemConfig.defaultVrComponents).thenReturn(ArraySet())
whenever(mocks.systemConfig.hiddenApiWhitelistedApps).thenReturn(ArraySet())
whenever(mocks.systemConfig.appMetadataFilePaths).thenReturn(ArrayMap())
+ whenever(mocks.systemConfig.oemDefinedUids).thenReturn(ArrayMap())
wheneverStatic { SystemProperties.set(anyString(), anyString()) }.thenDoNothing()
wheneverStatic { SystemProperties.getBoolean("fw.free_cache_v2", true) }.thenReturn(true)
wheneverStatic { Environment.getApexDirectory() }.thenReturn(apexDirectory)
diff --git a/services/tests/mockingservicestests/src/com/android/server/pm/TEST_MAPPING b/services/tests/mockingservicestests/src/com/android/server/pm/TEST_MAPPING
index 13e255fe4..1f2d11c 100644
--- a/services/tests/mockingservicestests/src/com/android/server/pm/TEST_MAPPING
+++ b/services/tests/mockingservicestests/src/com/android/server/pm/TEST_MAPPING
@@ -1,18 +1,7 @@
{
"presubmit": [
{
- "name": "FrameworksMockingServicesTests",
- "options": [
- {
- "include-filter": "com.android.server.pm"
- },
- {
- "exclude-annotation": "androidx.test.filters.FlakyTest"
- },
- {
- "exclude-annotation": "org.junit.Ignore"
- }
- ]
+ "name": "FrameworksMockingServicesTests_com_android_server_pm_Presubmit"
}
]
}
diff --git a/services/tests/servicestests/Android.bp b/services/tests/servicestests/Android.bp
index 7b7ed1d..0f10b8c 100644
--- a/services/tests/servicestests/Android.bp
+++ b/services/tests/servicestests/Android.bp
@@ -83,6 +83,7 @@
"securebox",
"flag-junit",
"ravenwood-junit",
+ "net-tests-utils",
"net_flags_lib",
"CtsVirtualDeviceCommonLib",
"com_android_server_accessibility_flags_lib",
@@ -270,6 +271,10 @@
"$(location soong_zip) -o $(out) -C $(genDir)/res -D $(genDir)/res",
}
+FLAKY = [
+ "androidx.test.filters.FlakyTest",
+]
+
FLAKY_AND_IGNORED = [
"androidx.test.filters.FlakyTest",
"org.junit.Ignore",
@@ -326,7 +331,7 @@
base: "FrameworksServicesTests",
test_suites: ["device-tests"],
include_filters: ["com.android.server.recoverysystem."],
- exclude_annotations: ["androidx.test.filters.FlakyTest"],
+ exclude_annotations: FLAKY,
}
// server pm TEST_MAPPING
@@ -355,3 +360,319 @@
test_suites: ["device-tests"],
include_filters: ["com.android.server.os."],
}
+
+test_module_config {
+ name: "FrameworksServicesTests_presubmit",
+ base: "FrameworksServicesTests",
+ test_suites: ["device-tests"],
+ include_annotations: ["android.platform.test.annotations.Presubmit"],
+ exclude_annotations: FLAKY_AND_IGNORED,
+}
+
+test_module_config {
+ name: "FrameworksServicesTests_com_android_server_job_Presubmit",
+ base: "FrameworksServicesTests",
+ test_suites: ["device-tests"],
+ include_filters: ["com.android.server.job"],
+ exclude_annotations: [
+ "androidx.test.filters.LargeTest",
+ "androidx.test.filters.FlakyTest",
+ ],
+}
+
+test_module_config {
+ name: "FrameworksServicesTests_com_android_server_job",
+ base: "FrameworksServicesTests",
+ test_suites: ["device-tests"],
+ include_filters: ["com.android.server.job"],
+}
+
+test_module_config {
+ name: "FrameworksServicesTests_com_android_server_tare_Presubmit",
+ base: "FrameworksServicesTests",
+ test_suites: ["device-tests"],
+ include_filters: ["com.android.server.tare"],
+ exclude_annotations: FLAKY,
+}
+
+test_module_config {
+ name: "FrameworksServicesTests_com_android_server_tare",
+ base: "FrameworksServicesTests",
+ test_suites: ["device-tests"],
+ include_filters: ["com.android.server.tare"],
+}
+
+test_module_config {
+ name: "FrameworksServicesTests_com_android_server_usage_Presubmit",
+ base: "FrameworksServicesTests",
+ test_suites: ["device-tests"],
+ include_filters: ["com.android.server.usage"],
+ exclude_annotations: FLAKY,
+}
+
+test_module_config {
+ name: "FrameworksServicesTests_com_android_server_usage",
+ base: "FrameworksServicesTests",
+ test_suites: ["device-tests"],
+ include_filters: ["com.android.server.usage"],
+}
+
+test_module_config {
+ name: "FrameworksServicesTests_battery_stats",
+ base: "FrameworksServicesTests",
+ test_suites: ["device-tests"],
+ include_filters: ["com.android.server.am.BatteryStatsServiceTest"],
+}
+
+test_module_config {
+ name: "FrameworksServicesTests_accessibility_Presubmit",
+ base: "FrameworksServicesTests",
+ test_suites: ["device-tests"],
+ include_filters: ["com.android.server.accessibility"],
+ exclude_annotations: FLAKY,
+}
+
+test_module_config {
+ name: "FrameworksServicesTests_accessibility",
+ base: "FrameworksServicesTests",
+ test_suites: ["device-tests"],
+ include_filters: ["com.android.server.accessibility"],
+}
+
+test_module_config {
+ name: "FrameworksServicesTests_binary_transparency",
+ base: "FrameworksServicesTests",
+ test_suites: ["device-tests"],
+ include_filters: ["com.android.server.BinaryTransparencyServiceTest"],
+}
+
+test_module_config {
+ name: "FrameworksServicesTests_pinner_service",
+ base: "FrameworksServicesTests",
+ test_suites: ["device-tests"],
+ include_filters: ["com.android.server.PinnerServiceTest"],
+ exclude_annotations: ["org.junit.Ignore"],
+}
+
+test_module_config {
+ name: "FrameworksServicesTests_android_server_am_Presubmit",
+ base: "FrameworksServicesTests",
+ test_suites: ["device-tests"],
+ include_filters: ["com.android.server.am."],
+ include_annotations: ["android.platform.test.annotations.Presubmit"],
+ exclude_annotations: FLAKY,
+}
+
+test_module_config {
+ name: "FrameworksServicesTests_android_server_am",
+ base: "FrameworksServicesTests",
+ test_suites: ["device-tests"],
+ include_filters: ["com.android.server.am."],
+}
+
+test_module_config {
+ name: "FrameworksServicesTests_android_server_appop",
+ base: "FrameworksServicesTests",
+ test_suites: ["device-tests"],
+ include_filters: ["com.android.server.appop"],
+}
+
+test_module_config {
+ name: "FrameworksServicesTests_android_server_audio",
+ base: "FrameworksServicesTests",
+ test_suites: ["device-tests"],
+ include_filters: ["com.android.server.audio"],
+ include_annotations: ["android.platform.test.annotations.Presubmit"],
+ exclude_annotations: FLAKY_AND_IGNORED,
+}
+
+test_module_config {
+ name: "FrameworksServicesTests_android_server_compat",
+ base: "FrameworksServicesTests",
+ test_suites: ["device-tests"],
+ include_filters: ["com.android.server.compat"],
+}
+
+test_module_config {
+ name: "FrameworksServicesTests_android_server_hdmi_Presubmit",
+ base: "FrameworksServicesTests",
+ test_suites: ["device-tests"],
+ include_filters: ["com.android.server.hdmi"],
+ include_annotations: ["android.platform.test.annotations.Presubmit"],
+ exclude_annotations: FLAKY_AND_IGNORED,
+}
+
+test_module_config {
+ name: "FrameworksServicesTests_android_server_hdmi",
+ base: "FrameworksServicesTests",
+ test_suites: ["device-tests"],
+ include_filters: ["com.android.server.hdmi"],
+ exclude_annotations: ["org.junit.Ignore"],
+}
+
+test_module_config {
+ name: "FrameworksServicesTests_android_server_integrity",
+ base: "FrameworksServicesTests",
+ test_suites: ["device-tests"],
+ include_filters: ["com.android.server.integrity."],
+}
+
+test_module_config {
+ name: "FrameworksServicesTests_android_server_lights",
+ base: "FrameworksServicesTests",
+ test_suites: ["device-tests"],
+ include_filters: ["com.android.server.lights"],
+ exclude_annotations: FLAKY,
+}
+
+test_module_config {
+ name: "FrameworksServicesTests_android_server_locales",
+ base: "FrameworksServicesTests",
+ test_suites: ["device-tests"],
+ include_filters: ["com.android.server.locales."],
+}
+
+test_module_config {
+ name: "FrameworksServicesTests_android_server_location_contexthub_Presubmit",
+ base: "FrameworksServicesTests",
+ test_suites: ["device-tests"],
+ include_filters: ["com.android.server.location.contexthub."],
+ include_annotations: ["android.platform.test.annotations.Presubmit"],
+ exclude_annotations: FLAKY_AND_IGNORED,
+}
+
+test_module_config {
+ name: "FrameworksServicesTests_android_server_locksettings",
+ base: "FrameworksServicesTests",
+ test_suites: ["device-tests"],
+ include_filters: ["com.android.server.locksettings."],
+ exclude_annotations: FLAKY,
+}
+
+test_module_config {
+ name: "FrameworksServicesTests_android_server_logcat_Presubmit",
+ base: "FrameworksServicesTests",
+ test_suites: ["device-tests"],
+ include_filters: ["com.android.server.logcat"],
+ exclude_annotations: FLAKY,
+}
+
+test_module_config {
+ name: "FrameworksServicesTests_android_server_logcat",
+ base: "FrameworksServicesTests",
+ test_suites: ["device-tests"],
+ include_filters: ["com.android.server.logcat"],
+}
+
+test_module_config {
+ name: "FrameworksServicesTests_android_server_net_Presubmit",
+ base: "FrameworksServicesTests",
+ test_suites: ["device-tests"],
+ include_filters: ["com.android.server.net."],
+ include_annotations: ["android.platform.test.annotations.Presubmit"],
+ exclude_annotations: FLAKY,
+}
+
+test_module_config {
+ name: "FrameworksServicesTests_android_server_om",
+ base: "FrameworksServicesTests",
+ test_suites: ["device-tests"],
+ include_filters: ["com.android.server.om."],
+}
+
+test_module_config {
+ name: "FrameworksServicesTests_android_server_pdb",
+ base: "FrameworksServicesTests",
+ test_suites: ["device-tests"],
+ include_filters: ["com.android.server.pdb.PersistentDataBlockServiceTest"],
+}
+
+test_module_config {
+ name: "FrameworksServicesTests_android_server_pm_dex",
+ base: "FrameworksServicesTests",
+ test_suites: ["device-tests"],
+ include_filters: ["com.android.server.pm.dex"],
+}
+
+test_module_config {
+ name: "FrameworksServicesTests_android_server_policy_Presubmit",
+ base: "FrameworksServicesTests",
+ test_suites: ["device-tests"],
+ include_filters: ["com.android.server.policy."],
+ include_annotations: ["android.platform.test.annotations.Presubmit"],
+ exclude_annotations: FLAKY,
+}
+
+test_module_config {
+ name: "FrameworksServicesTests_android_server_policy",
+ base: "FrameworksServicesTests",
+ test_suites: ["device-tests"],
+ include_filters: ["com.android.server.policy."],
+}
+
+test_module_config {
+ name: "FrameworksServicesTests_android_server_power",
+ base: "FrameworksServicesTests",
+ test_suites: ["device-tests"],
+ include_filters: ["com.android.server.power"],
+}
+
+test_module_config {
+ name: "FrameworksServicesTests_android_server_power_hint",
+ base: "FrameworksServicesTests",
+ test_suites: ["device-tests"],
+ include_filters: ["com.android.server.power.hint"],
+ exclude_annotations: FLAKY,
+}
+
+test_module_config {
+ name: "FrameworksServicesTests_android_server_powerstats",
+ base: "FrameworksServicesTests",
+ test_suites: ["device-tests"],
+ include_filters: ["com.android.server.powerstats"],
+}
+
+test_module_config {
+ name: "FrameworksServicesTests_android_server_rollback",
+ base: "FrameworksServicesTests",
+ test_suites: ["device-tests"],
+ include_filters: ["com.android.server.rollback"],
+}
+
+test_module_config {
+ name: "FrameworksServicesTests_android_server_uri",
+ base: "FrameworksServicesTests",
+ test_suites: ["device-tests"],
+ include_filters: ["com.android.server.uri."],
+}
+
+test_module_config {
+ name: "FrameworksServicesTests_com_android_server_location_contexthub",
+ base: "FrameworksServicesTests",
+ test_suites: ["device-tests"],
+ include_filters: ["com.android.server.location.contexthub."],
+ include_annotations: ["android.platform.test.annotations.Postsubmit"],
+ exclude_annotations: FLAKY_AND_IGNORED,
+}
+
+test_module_config {
+ name: "FrameworksServicesTests_android_server_usage",
+ base: "FrameworksServicesTests",
+ test_suites: ["device-tests"],
+ include_filters: ["com.android.server.usage"],
+ exclude_filters: ["com.android.server.usage.StorageStatsServiceTest"],
+}
+
+test_module_config {
+ name: "FrameworksServicesTests_android_server_soundtrigger_middleware",
+ base: "FrameworksServicesTests",
+ test_suites: ["device-tests"],
+ include_filters: ["com.android.server.soundtrigger_middleware"],
+}
+
+test_module_config {
+ name: "FrameworksServicesTests_android_server_input",
+ base: "FrameworksServicesTests",
+ test_suites: ["device-tests"],
+ include_filters: ["com.android.server.input"],
+}
diff --git a/services/tests/servicestests/src/com/android/server/appfunctions/OWNERS b/services/tests/servicestests/src/com/android/server/appfunctions/OWNERS
new file mode 100644
index 0000000..7fa8917
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/appfunctions/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 1627156
+include platform/frameworks/base:/core/java/android/app/appfunctions/OWNERS
diff --git a/services/tests/servicestests/src/com/android/server/contentprotection/OWNERS b/services/tests/servicestests/src/com/android/server/contentprotection/OWNERS
index 24561c5..3d09da3 100644
--- a/services/tests/servicestests/src/com/android/server/contentprotection/OWNERS
+++ b/services/tests/servicestests/src/com/android/server/contentprotection/OWNERS
@@ -1,3 +1,4 @@
-# Bug component: 544200
+# Bug component: 1040349
-include /core/java/android/view/contentcapture/OWNERS
+include /core/java/android/view/contentprotection/OWNERS
+
diff --git a/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecMessageValidatorTest.java b/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecMessageValidatorTest.java
index ce7dbda..2446d2e 100644
--- a/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecMessageValidatorTest.java
+++ b/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecMessageValidatorTest.java
@@ -249,120 +249,120 @@
assertMessageValidity("04:33:0C:08:10:1E:04:30:08:13:AD:06")
.isEqualTo(ERROR_PARAMETER_SHORT);
// Out of range Day of Month
- assertMessageValidity("04:34:20:0C:16:0F:08:37:00:02:EA:60:03").isEqualTo(ERROR_PARAMETER);
+ assertMessageValidity("04:34:20:0C:22:15:08:55:00:02:EA:60:03").isEqualTo(ERROR_PARAMETER);
// Out of range Month of Year
- assertMessageValidity("04:33:0C:00:10:1E:04:30:08:00:13:AD:06").isEqualTo(ERROR_PARAMETER);
+ assertMessageValidity("04:33:0C:00:16:30:04:48:08:00:13:AD:06").isEqualTo(ERROR_PARAMETER);
// Out of range Start Time - Hour
- assertMessageValidity("04:34:04:0C:18:0F:08:37:00:02:EA:60:03").isEqualTo(ERROR_PARAMETER);
+ assertMessageValidity("04:34:04:0C:24:15:08:55:00:02:EA:60:03").isEqualTo(ERROR_PARAMETER);
// Out of range Start Time - Minute
- assertMessageValidity("04:33:0C:08:10:50:04:30:08:00:13:AD:06").isEqualTo(ERROR_PARAMETER);
+ assertMessageValidity("04:33:0C:08:16:60:04:48:08:00:13:AD:06").isEqualTo(ERROR_PARAMETER);
// Out of range Duration - Duration Hours
- assertMessageValidity("04:34:04:0C:16:0F:64:37:00:02:EA:60:03").isEqualTo(ERROR_PARAMETER);
+ assertMessageValidity("04:34:04:0C:22:15:9A:55:00:02:EA:60:03").isEqualTo(ERROR_PARAMETER);
// Out of range Duration - Minute
- assertMessageValidity("04:33:0C:08:10:1E:04:64:08:00:13:AD:06").isEqualTo(ERROR_PARAMETER);
+ assertMessageValidity("04:33:0C:08:16:30:04:60:08:00:13:AD:06").isEqualTo(ERROR_PARAMETER);
// Invalid Recording Sequence
- assertMessageValidity("04:34:04:0C:16:0F:08:37:88:02:EA:60:03").isEqualTo(ERROR_PARAMETER);
+ assertMessageValidity("04:34:04:0C:22:15:08:55:88:02:EA:60:03").isEqualTo(ERROR_PARAMETER);
// Invalid Recording Sequence
- assertMessageValidity("04:33:0C:08:10:1E:04:30:A2:00:13:AD:06").isEqualTo(ERROR_PARAMETER);
+ assertMessageValidity("04:33:0C:08:16:30:04:48:A2:00:13:AD:06").isEqualTo(ERROR_PARAMETER);
// Out of range Analogue Broadcast Type
- assertMessageValidity("04:34:04:0C:16:0F:08:37:00:03:EA:60:03").isEqualTo(ERROR_PARAMETER);
+ assertMessageValidity("04:34:04:0C:22:15:08:55:00:03:EA:60:03").isEqualTo(ERROR_PARAMETER);
// Out of range Analogue Frequency
- assertMessageValidity("04:33:0C:08:10:1E:04:30:08:00:FF:FF:06").isEqualTo(ERROR_PARAMETER);
+ assertMessageValidity("04:33:0C:08:16:30:04:48:08:00:FF:FF:06").isEqualTo(ERROR_PARAMETER);
// Out of range Broadcast System
- assertMessageValidity("04:34:04:0C:16:0F:08:37:00:02:EA:60:20").isEqualTo(ERROR_PARAMETER);
+ assertMessageValidity("04:34:04:0C:22:15:08:55:00:02:EA:60:20").isEqualTo(ERROR_PARAMETER);
}
@Test
public void isValid_setDigitalTimer_clearDigitalTimer() {
// Services identified by Digital IDs - ARIB Broadcast System
- assertMessageValidity("04:99:0C:08:15:05:04:1E:00:00:C4:C2:11:D8:75:30").isEqualTo(OK);
+ assertMessageValidity("04:99:0C:08:21:05:04:30:00:00:C4:C2:11:D8:75:30").isEqualTo(OK);
// Service identified by Digital IDs - ATSC Broadcast System
- assertMessageValidity("04:97:1E:07:12:20:50:28:01:01:8B:5E:39:5A").isEqualTo(OK);
+ assertMessageValidity("04:97:1E:07:18:32:80:40:01:01:8B:5E:39:5A").isEqualTo(OK);
// Service identified by Digital IDs - DVB Broadcast System
- assertMessageValidity("04:99:05:0C:06:0A:19:3B:40:19:8B:44:03:11:04:FC").isEqualTo(OK);
+ assertMessageValidity("04:99:05:0C:06:10:25:59:40:19:8B:44:03:11:04:FC").isEqualTo(OK);
// Service identified by Channel - 1 part channel number
- assertMessageValidity("04:97:12:06:0C:2D:5A:19:08:91:04:00:B1").isEqualTo(OK);
+ assertMessageValidity("04:97:12:06:12:45:90:25:08:91:04:00:B1").isEqualTo(OK);
// Service identified by Channel - 2 part channel number
- assertMessageValidity("04:99:15:09:00:0F:00:2D:04:82:09:C8:72:C8").isEqualTo(OK);
+ assertMessageValidity("04:99:15:09:00:15:00:45:04:82:09:C8:72:C8").isEqualTo(OK);
- assertMessageValidity("4F:97:0C:08:15:05:04:1E:00:00:C4:C2:11:D8:75:30")
+ assertMessageValidity("4F:97:0C:08:21:05:04:30:00:00:C4:C2:11:D8:75:30")
.isEqualTo(ERROR_DESTINATION);
- assertMessageValidity("F0:99:15:09:00:0F:00:2D:04:82:09:C8:72:C8").isEqualTo(ERROR_SOURCE);
+ assertMessageValidity("F0:99:15:09:00:15:00:45:04:82:09:C8:72:C8").isEqualTo(ERROR_SOURCE);
assertMessageValidity("04:97:1E:12:20:58:01:01:8B:5E:39:5A")
.isEqualTo(ERROR_PARAMETER_SHORT);
// Out of range Day of Month
- assertMessageValidity("04:99:24:0C:06:0A:19:3B:40:19:8B:44:03:11:04:FC")
+ assertMessageValidity("04:99:24:0C:06:10:25:59:40:19:8B:44:03:11:04:FC")
.isEqualTo(ERROR_PARAMETER);
// Out of range Month of Year
- assertMessageValidity("04:97:12:10:0C:2D:5A:19:08:91:04:00:B1").isEqualTo(ERROR_PARAMETER);
+ assertMessageValidity("04:97:12:10:12:45:90:25:08:91:04:00:B1").isEqualTo(ERROR_PARAMETER);
// Out of range Start Time - Hour
- assertMessageValidity("04:99:0C:08:20:05:04:1E:00:00:C4:C2:11:D8:75:30")
+ assertMessageValidity("04:99:0C:08:24:05:04:30:00:00:C4:C2:11:D8:75:30")
.isEqualTo(ERROR_PARAMETER);
// Out of range Start Time - Minute
- assertMessageValidity("04:97:15:09:00:4B:00:2D:04:82:09:C8:72:C8")
+ assertMessageValidity("04:97:15:09:00:60:00:45:04:82:09:C8:72:C8")
.isEqualTo(ERROR_PARAMETER);
// Out of range Duration - Duration Hours
- assertMessageValidity("04:99:1E:07:12:20:78:28:01:01:8B:5E:39:5A")
+ assertMessageValidity("04:99:1E:07:18:32:9A:40:01:01:8B:5E:39:5A")
.isEqualTo(ERROR_PARAMETER);
// Out of range Duration - Minute
- assertMessageValidity("04:97:05:0C:06:0A:19:48:40:19:8B:44:03:11:04:FC")
+ assertMessageValidity("04:97:05:0C:06:10:25:60:40:19:8B:44:03:11:04:FC")
.isEqualTo(ERROR_PARAMETER);
// Invalid Recording Sequence
- assertMessageValidity("04:99:12:06:0C:2D:5A:19:90:91:04:00:B1").isEqualTo(ERROR_PARAMETER);
+ assertMessageValidity("04:99:12:06:12:45:90:25:90:91:04:00:B1").isEqualTo(ERROR_PARAMETER);
// Invalid Recording Sequence
assertMessageValidity("04:97:0C:08:15:05:04:1E:A1:00:C4:C2:11:D8:75:30")
.isEqualTo(ERROR_PARAMETER);
// Invalid Digital Broadcast System
- assertMessageValidity("04:99:1E:07:12:20:50:28:01:04:8B:5E:39:5A")
+ assertMessageValidity("04:99:1E:07:18:32:80:40:01:04:8B:5E:39:5A")
.isEqualTo(ERROR_PARAMETER);
// Invalid Digital Broadcast System
- assertMessageValidity("04:97:05:0C:06:0A:19:3B:40:93:8B:44:03:11:04:FC")
+ assertMessageValidity("04:97:05:0C:06:10:25:59:40:93:8B:44:03:11:04:FC")
.isEqualTo(ERROR_PARAMETER);
// Insufficient data for ARIB Broadcast system
- assertMessageValidity("04:99:0C:08:15:05:04:1E:00:00:C4:C2:11:D8:75")
+ assertMessageValidity("04:99:0C:08:21:05:04:30:00:00:C4:C2:11:D8:75")
.isEqualTo(ERROR_PARAMETER);
// Insufficient data for ATSC Broadcast system
- assertMessageValidity("04:97:1E:07:12:20:50:28:01:01:8B:5E:39").isEqualTo(ERROR_PARAMETER);
+ assertMessageValidity("04:97:1E:07:18:32:80:40:01:01:8B:5E:39").isEqualTo(ERROR_PARAMETER);
// Insufficient data for DVB Broadcast system
- assertMessageValidity("04:99:05:0C:06:0A:19:3B:40:19:8B:44:03:11:04")
+ assertMessageValidity("04:99:05:0C:06:10:25:59:40:19:8B:44:03:11:04")
.isEqualTo(ERROR_PARAMETER);
// Insufficient data for 2 part channel number
- assertMessageValidity("04:97:15:09:00:0F:00:2D:04:82:09:C8:72").isEqualTo(ERROR_PARAMETER);
+ assertMessageValidity("04:97:15:09:00:15:00:45:04:82:09:C8:72").isEqualTo(ERROR_PARAMETER);
// Invalid Channel Number format
- assertMessageValidity("04:99:12:06:0C:2D:5A:19:08:91:0D:00:B1").isEqualTo(ERROR_PARAMETER);
+ assertMessageValidity("04:99:12:06:12:45:90:25:08:91:0D:00:B1").isEqualTo(ERROR_PARAMETER);
}
@Test
public void isValid_setExternalTimer_clearExternalTimer() {
- assertMessageValidity("40:A1:0C:08:15:05:04:1E:02:04:20").isEqualTo(OK);
- assertMessageValidity("40:A2:14:09:12:28:4B:19:10:05:10:00").isEqualTo(OK);
+ assertMessageValidity("40:A1:0C:08:21:05:04:30:02:04:20").isEqualTo(OK);
+ assertMessageValidity("40:A2:14:09:18:40:75:25:10:05:10:00").isEqualTo(OK);
- assertMessageValidity("4F:A1:0C:08:15:05:04:1E:02:04:20").isEqualTo(ERROR_DESTINATION);
- assertMessageValidity("F4:A2:14:09:12:28:4B:19:10:05:10:00").isEqualTo(ERROR_SOURCE);
- assertMessageValidity("40:A1:0C:08:15:05:04:1E:02:04").isEqualTo(ERROR_PARAMETER_SHORT);
+ assertMessageValidity("4F:A1:0C:08:21:05:04:30:02:04:20").isEqualTo(ERROR_DESTINATION);
+ assertMessageValidity("F4:A2:14:09:18:40:75:25:10:05:10:00").isEqualTo(ERROR_SOURCE);
+ assertMessageValidity("40:A1:0C:08:21:05:04:30:02:04").isEqualTo(ERROR_PARAMETER_SHORT);
// Out of range Day of Month
- assertMessageValidity("40:A2:28:09:12:28:4B:19:10:05:10:00").isEqualTo(ERROR_PARAMETER);
+ assertMessageValidity("40:A2:28:09:18:40:75:25:10:05:10:00").isEqualTo(ERROR_PARAMETER);
// Out of range Month of Year
- assertMessageValidity("40:A1:0C:0F:15:05:04:1E:02:04:20").isEqualTo(ERROR_PARAMETER);
+ assertMessageValidity("40:A1:0C:0F:21:05:04:30:02:04:20").isEqualTo(ERROR_PARAMETER);
// Out of range Start Time - Hour
- assertMessageValidity("40:A2:14:09:1A:28:4B:19:10:05:10:00").isEqualTo(ERROR_PARAMETER);
+ assertMessageValidity("40:A2:14:09:24:40:75:25:10:05:10:00").isEqualTo(ERROR_PARAMETER);
// Out of range Start Time - Minute
- assertMessageValidity("40:A1:0C:08:15:48:04:1E:02:04:20").isEqualTo(ERROR_PARAMETER);
+ assertMessageValidity("40:A1:0C:08:21:60:04:30:02:04:20").isEqualTo(ERROR_PARAMETER);
// Out of range Duration - Duration Hours
- assertMessageValidity("40:A2:14:09:12:28:66:19:10:05:10:00").isEqualTo(ERROR_PARAMETER);
+ assertMessageValidity("40:A2:14:09:18:40:9A:25:10:05:10:00").isEqualTo(ERROR_PARAMETER);
// Out of range Duration - Minute
- assertMessageValidity("40:A1:0C:08:15:05:04:3F:02:04:20").isEqualTo(ERROR_PARAMETER);
+ assertMessageValidity("40:A1:0C:08:21:05:04:60:02:04:20").isEqualTo(ERROR_PARAMETER);
// Invalid Recording Sequence
- assertMessageValidity("40:A2:14:09:12:28:4B:19:84:05:10:00").isEqualTo(ERROR_PARAMETER);
+ assertMessageValidity("40:A2:14:09:18:40:75:25:84:05:10:00").isEqualTo(ERROR_PARAMETER);
// Invalid Recording Sequence
assertMessageValidity("40:A1:0C:08:15:05:04:1E:94:04:20").isEqualTo(ERROR_PARAMETER);
// Invalid external source specifier
- assertMessageValidity("40:A2:14:09:12:28:4B:19:10:08:10:00").isEqualTo(ERROR_PARAMETER);
+ assertMessageValidity("40:A2:14:09:18:40:75:25:10:08:10:00").isEqualTo(ERROR_PARAMETER);
// Invalid External PLug
- assertMessageValidity("04:A1:0C:08:15:05:04:1E:02:04:00").isEqualTo(ERROR_PARAMETER);
+ assertMessageValidity("04:A1:0C:08:21:05:04:30:02:04:00").isEqualTo(ERROR_PARAMETER);
// Invalid Physical Address
- assertMessageValidity("40:A2:14:09:12:28:4B:19:10:05:10:10").isEqualTo(ERROR_PARAMETER);
+ assertMessageValidity("40:A2:14:09:18:40:75:25:10:05:10:10").isEqualTo(ERROR_PARAMETER);
}
@Test
@@ -395,9 +395,9 @@
// Non programmed - Invalid not programmed error info
assertMessageValidity("40:35:DE").isEqualTo(ERROR_PARAMETER);
// Programmed - Might not be enough space available - Invalid duration hours
- assertMessageValidity("40:35:BB:96:1C").isEqualTo(ERROR_PARAMETER);
+ assertMessageValidity("40:35:BB:9A:28").isEqualTo(ERROR_PARAMETER);
// Not programmed - Duplicate - Invalid duration minutes
- assertMessageValidity("40:35:EE:52:4A").isEqualTo(ERROR_PARAMETER);
+ assertMessageValidity("40:35:EE:82:60").isEqualTo(ERROR_PARAMETER);
}
@Test
diff --git a/services/tests/servicestests/src/com/android/server/stats/pull/netstats/NetworkStatsUtilsTest.kt b/services/tests/servicestests/src/com/android/server/stats/pull/netstats/NetworkStatsUtilsTest.kt
new file mode 100644
index 0000000..c560c04
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/stats/pull/netstats/NetworkStatsUtilsTest.kt
@@ -0,0 +1,119 @@
+/*
+ * 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.server.stats.pull.netstats
+
+import android.net.NetworkStats
+import android.net.NetworkStats.DEFAULT_NETWORK_NO
+import android.net.NetworkStats.DEFAULT_NETWORK_YES
+import android.net.NetworkStats.Entry
+import android.net.NetworkStats.METERED_NO
+import android.net.NetworkStats.ROAMING_NO
+import android.net.NetworkStats.ROAMING_YES
+import android.net.NetworkStats.SET_DEFAULT
+import android.net.NetworkStats.TAG_NONE
+import androidx.test.ext.junit.runners.AndroidJUnit4
+import com.android.testutils.assertEntryEquals
+import com.android.testutils.assertNetworkStatsEquals
+import com.android.testutils.makePublicStatsFromAndroidNetStats
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.mockito.Mockito.doReturn
+import org.mockito.Mockito.mock
+import org.mockito.Mockito.`when`
+
+/**
+ * Build/Install/Run:
+ * atest FrameworksServicesTests:NetworkStatsUtilsTest
+ */
+@RunWith(AndroidJUnit4::class)
+class NetworkStatsUtilsTest {
+
+ @Test
+ fun testBucketToEntry() {
+ val bucket = makeMockBucket(android.app.usage.NetworkStats.Bucket.UID_ALL,
+ android.app.usage.NetworkStats.Bucket.TAG_NONE,
+ android.app.usage.NetworkStats.Bucket.STATE_DEFAULT,
+ android.app.usage.NetworkStats.Bucket.METERED_YES,
+ android.app.usage.NetworkStats.Bucket.ROAMING_NO,
+ android.app.usage.NetworkStats.Bucket.DEFAULT_NETWORK_ALL, 1024, 8, 2048, 12)
+ val entry = NetworkStatsUtils.fromBucket(bucket)
+ val expectedEntry = NetworkStats.Entry(null /* IFACE_ALL */, NetworkStats.UID_ALL,
+ NetworkStats.SET_DEFAULT, NetworkStats.TAG_NONE, NetworkStats.METERED_YES,
+ NetworkStats.ROAMING_NO, NetworkStats.DEFAULT_NETWORK_ALL, 1024, 8, 2048, 12,
+ 0 /* operations */)
+
+ assertEntryEquals(expectedEntry, entry)
+ }
+
+ @Test
+ fun testPublicStatsToAndroidNetStats() {
+ val uid1 = 10001
+ val uid2 = 10002
+ val testIface = "wlan0"
+ val testAndroidNetStats = NetworkStats(0L, 3)
+ .addEntry(Entry(testIface, uid1, SET_DEFAULT, TAG_NONE,
+ METERED_NO, ROAMING_NO, DEFAULT_NETWORK_YES, 20, 3, 57, 40, 3))
+ .addEntry(Entry(
+ testIface, uid2, SET_DEFAULT, TAG_NONE,
+ METERED_NO, ROAMING_YES, DEFAULT_NETWORK_NO, 2, 7, 2, 5, 7))
+ .addEntry(Entry(testIface, uid2, SET_DEFAULT, TAG_NONE,
+ METERED_NO, ROAMING_YES, DEFAULT_NETWORK_NO, 4, 5, 3, 1, 8))
+ val publicStats: android.app.usage.NetworkStats =
+ makePublicStatsFromAndroidNetStats(testAndroidNetStats)
+ val androidNetStats: NetworkStats =
+ NetworkStatsUtils.fromPublicNetworkStats(publicStats)
+
+ // 1. The public `NetworkStats` class does not include interface information.
+ // Interface details must be removed and items with duplicated
+ // keys need to be merged before making any comparisons.
+ // 2. The public `NetworkStats` class lacks an operations field.
+ // Thus, the information will not be preserved during the conversion.
+ val expectedStats = NetworkStats(0L, 2)
+ .addEntry(Entry(null, uid1, SET_DEFAULT, TAG_NONE,
+ METERED_NO, ROAMING_NO, DEFAULT_NETWORK_YES, 20, 3, 57, 40, 0))
+ .addEntry(Entry(null, uid2, SET_DEFAULT, TAG_NONE,
+ METERED_NO, ROAMING_YES, DEFAULT_NETWORK_NO, 6, 12, 5, 6, 0))
+ assertNetworkStatsEquals(expectedStats, androidNetStats)
+ }
+
+ private fun makeMockBucket(
+ uid: Int,
+ tag: Int,
+ state: Int,
+ metered: Int,
+ roaming: Int,
+ defaultNetwork: Int,
+ rxBytes: Long,
+ rxPackets: Long,
+ txBytes: Long,
+ txPackets: Long
+ ): android.app.usage.NetworkStats.Bucket {
+ val ret: android.app.usage.NetworkStats.Bucket =
+ mock(android.app.usage.NetworkStats.Bucket::class.java)
+ doReturn(uid).`when`(ret).getUid()
+ doReturn(tag).`when`(ret).getTag()
+ doReturn(state).`when`(ret).getState()
+ doReturn(metered).`when`(ret).getMetered()
+ doReturn(roaming).`when`(ret).getRoaming()
+ doReturn(defaultNetwork).`when`(ret).getDefaultNetworkStatus()
+ doReturn(rxBytes).`when`(ret).getRxBytes()
+ doReturn(rxPackets).`when`(ret).getRxPackets()
+ doReturn(txBytes).`when`(ret).getTxBytes()
+ doReturn(txPackets).`when`(ret).getTxPackets()
+ return ret
+ }
+}
\ No newline at end of file
diff --git a/services/usage/OWNERS b/services/usage/OWNERS
index 26d9b10..f825f55 100644
--- a/services/usage/OWNERS
+++ b/services/usage/OWNERS
@@ -1,7 +1,10 @@
+# Bug component: 532296
+set noparent
+
mwachens@google.com
varunshah@google.com
-huiyu@google.com
yamasani@google.com
+guanxin@google.com
per-file *StorageStats* = file:/core/java/android/os/storage/OWNERS
per-file *Broadcast* = sudheersai@google.com
\ No newline at end of file
diff --git a/services/usage/java/com/android/server/usage/TEST_MAPPING b/services/usage/java/com/android/server/usage/TEST_MAPPING
index 6e84543..c878054 100644
--- a/services/usage/java/com/android/server/usage/TEST_MAPPING
+++ b/services/usage/java/com/android/server/usage/TEST_MAPPING
@@ -1,23 +1,10 @@
{
"presubmit": [
{
- "name": "FrameworksCoreTests",
- "options": [
- {
- "include-filter": "android.app.usage"
- }
- ]
+ "name": "FrameworksCoreTests_usage"
},
{
- "name": "FrameworksServicesTests",
- "options": [
- {
- "include-filter": "com.android.server.usage"
- },
- {
- "exclude-filter": "com.android.server.usage.StorageStatsServiceTest"
- }
- ]
+ "name": "FrameworksServicesTests_android_server_usage"
},
{
"name": "CtsBRSTestCases",
diff --git a/services/voiceinteraction/java/com/android/server/soundtrigger_middleware/TEST_MAPPING b/services/voiceinteraction/java/com/android/server/soundtrigger_middleware/TEST_MAPPING
index 9ed894b..509d95e 100644
--- a/services/voiceinteraction/java/com/android/server/soundtrigger_middleware/TEST_MAPPING
+++ b/services/voiceinteraction/java/com/android/server/soundtrigger_middleware/TEST_MAPPING
@@ -1,12 +1,7 @@
{
"presubmit": [
{
- "name": "FrameworksServicesTests",
- "options": [
- {
- "include-filter": "com.android.server.soundtrigger_middleware"
- }
- ]
+ "name": "FrameworksServicesTests_android_server_soundtrigger_middleware"
}
]
}
diff --git a/tools/protologtool/src/com/android/protolog/tool/ProtoLogTool.kt b/tools/protologtool/src/com/android/protolog/tool/ProtoLogTool.kt
index 660cd47..59db66b 100644
--- a/tools/protologtool/src/com/android/protolog/tool/ProtoLogTool.kt
+++ b/tools/protologtool/src/com/android/protolog/tool/ProtoLogTool.kt
@@ -24,9 +24,10 @@
import com.github.javaparser.ParserConfiguration
import com.github.javaparser.StaticJavaParser
import com.github.javaparser.ast.CompilationUnit
+import com.github.javaparser.ast.Modifier
import com.github.javaparser.ast.NodeList
import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration
-import com.github.javaparser.ast.body.InitializerDeclaration
+import com.github.javaparser.ast.expr.AssignExpr
import com.github.javaparser.ast.expr.FieldAccessExpr
import com.github.javaparser.ast.expr.MethodCallExpr
import com.github.javaparser.ast.expr.NameExpr
@@ -34,7 +35,10 @@
import com.github.javaparser.ast.expr.ObjectCreationExpr
import com.github.javaparser.ast.expr.SimpleName
import com.github.javaparser.ast.expr.StringLiteralExpr
+import com.github.javaparser.ast.expr.VariableDeclarationExpr
import com.github.javaparser.ast.stmt.BlockStmt
+import com.github.javaparser.ast.stmt.ReturnStmt
+import com.github.javaparser.ast.type.ClassOrInterfaceType
import java.io.File
import java.io.FileInputStream
import java.io.FileNotFoundException
@@ -180,6 +184,7 @@
groups: Map<String, LogGroup>,
protoLogGroupsClassName: String
) {
+ var needsCreateLogGroupsMap = false
classDeclaration.fields.forEach { field ->
field.getAnnotationByClass(ProtoLogToolInjected::class.java)
.ifPresent { annotationExpr ->
@@ -207,39 +212,55 @@
} ?: NullLiteralExpr())
}
ProtoLogToolInjected.Value.LOG_GROUPS.name -> {
- val initializerBlockStmt = BlockStmt()
- for (group in groups) {
- initializerBlockStmt.addStatement(
- MethodCallExpr()
- .setName("put")
- .setArguments(
- NodeList(StringLiteralExpr(group.key),
- FieldAccessExpr()
- .setScope(
- NameExpr(
- protoLogGroupsClassName
- ))
- .setName(group.value.name)))
- )
- group.key
- }
-
- val treeMapCreation = ObjectCreationExpr()
- .setType("TreeMap<String, IProtoLogGroup>")
- .setAnonymousClassBody(NodeList(
- InitializerDeclaration().setBody(
- initializerBlockStmt
- )
- ))
-
+ needsCreateLogGroupsMap = true
field.setFinal(true)
- field.variables.first().setInitializer(treeMapCreation)
+ field.variables.first().setInitializer(
+ MethodCallExpr().setName("createLogGroupsMap"))
}
else -> error("Unhandled ProtoLogToolInjected value: $valueName.")
}
}
}
}
+
+ if (needsCreateLogGroupsMap) {
+ val body = BlockStmt()
+ body.addStatement(AssignExpr(
+ VariableDeclarationExpr(
+ ClassOrInterfaceType("TreeMap<String, IProtoLogGroup>"),
+ "result"
+ ),
+ ObjectCreationExpr().setType("TreeMap<String, IProtoLogGroup>"),
+ AssignExpr.Operator.ASSIGN
+ ))
+ for (group in groups) {
+ body.addStatement(
+ MethodCallExpr(
+ NameExpr("result"),
+ "put",
+ NodeList(
+ StringLiteralExpr(group.key),
+ FieldAccessExpr()
+ .setScope(
+ NameExpr(
+ protoLogGroupsClassName
+ ))
+ .setName(group.value.name)
+ )
+ )
+ )
+ }
+ body.addStatement(ReturnStmt(NameExpr("result")))
+
+ val method = classDeclaration.addMethod(
+ "createLogGroupsMap",
+ Modifier.Keyword.PRIVATE,
+ Modifier.Keyword.STATIC,
+ Modifier.Keyword.FINAL
+ )
+ method.setType("TreeMap<String, IProtoLogGroup>")
+ method.setBody(body)
+ }
}
private fun tryParse(code: String, fileName: String): CompilationUnit {
diff --git a/tools/systemfeatures/Android.bp b/tools/systemfeatures/Android.bp
index 2cebfe9..aca25eb 100644
--- a/tools/systemfeatures/Android.bp
+++ b/tools/systemfeatures/Android.bp
@@ -30,9 +30,9 @@
genrule {
name: "systemfeatures-gen-tests-srcs",
cmd: "$(location systemfeatures-gen-tool) com.android.systemfeatures.RwNoFeatures --readonly=false > $(location RwNoFeatures.java) && " +
- "$(location systemfeatures-gen-tool) com.android.systemfeatures.RoNoFeatures --readonly=true > $(location RoNoFeatures.java) && " +
+ "$(location systemfeatures-gen-tool) com.android.systemfeatures.RoNoFeatures --readonly=true --feature-apis=WATCH > $(location RoNoFeatures.java) && " +
"$(location systemfeatures-gen-tool) com.android.systemfeatures.RwFeatures --readonly=false --feature=WATCH:1 --feature=WIFI:0 --feature=VULKAN:-1 --feature=AUTO: > $(location RwFeatures.java) && " +
- "$(location systemfeatures-gen-tool) com.android.systemfeatures.RoFeatures --readonly=true --feature=WATCH:1 --feature=WIFI:0 --feature=VULKAN:-1 --feature=AUTO: > $(location RoFeatures.java)",
+ "$(location systemfeatures-gen-tool) com.android.systemfeatures.RoFeatures --readonly=true --feature=WATCH:1 --feature=WIFI:0 --feature=VULKAN:-1 --feature=AUTO: --feature-apis=WATCH,PC > $(location RoFeatures.java)",
out: [
"RwNoFeatures.java",
"RoNoFeatures.java",
diff --git a/tools/systemfeatures/src/com/android/systemfeatures/SystemFeaturesGenerator.kt b/tools/systemfeatures/src/com/android/systemfeatures/SystemFeaturesGenerator.kt
index 9bfda45..e537ffc 100644
--- a/tools/systemfeatures/src/com/android/systemfeatures/SystemFeaturesGenerator.kt
+++ b/tools/systemfeatures/src/com/android/systemfeatures/SystemFeaturesGenerator.kt
@@ -32,6 +32,7 @@
* <pre>
* <cmd> com.foo.RoSystemFeatures --readonly=true \
* --feature=WATCH:0 --feature=AUTOMOTIVE: --feature=VULKAN:9348
+ * --feature-apis=WATCH,PC,LEANBACK
* </pre>
*
* This generates a class that has the following signature:
@@ -45,12 +46,15 @@
* public static boolean hasFeatureAutomotive(Context context);
* @AssumeTrueForR8
* public static boolean hasFeatureVulkan(Context context);
+ * public static boolean hasFeaturePc(Context context);
+ * public static boolean hasFeatureLeanback(Context context);
* public static Boolean maybeHasFeature(String feature, int version);
* }
* </pre>
*/
object SystemFeaturesGenerator {
private const val FEATURE_ARG = "--feature="
+ private const val FEATURE_APIS_ARG = "--feature-apis="
private const val READONLY_ARG = "--readonly="
private val PACKAGEMANAGER_CLASS = ClassName.get("android.content.pm", "PackageManager")
private val CONTEXT_CLASS = ClassName.get("android.content", "Context")
@@ -64,6 +68,15 @@
println(" Options:")
println(" --readonly=true|false Whether to encode features as build-time constants")
println(" --feature=\$NAME:\$VER A feature+version pair (blank version == disabled)")
+ println(" This will always generate associated query APIs,")
+ println(" adding to or replacing those from `--feature-apis=`.")
+ println(" --feature-apis=\$NAME_1,\$NAME_2")
+ println(" A comma-separated set of features for which to always")
+ println(" generate named query APIs. If a feature in this set is")
+ println(" not explicitly defined via `--feature=`, then a simple")
+ println(" runtime passthrough API will be generated, regardless")
+ println(" of the `--readonly` flag. This allows decoupling the")
+ println(" API surface from variations in device feature sets.")
}
/** Main entrypoint for build-time system feature codegen. */
@@ -76,18 +89,42 @@
var readonly = false
var outputClassName: ClassName? = null
- val features = mutableListOf<FeatureInfo>()
+ val featureArgs = mutableListOf<FeatureArg>()
+ // We could just as easily hardcode this list, as the static API surface should change
+ // somewhat infrequently, but this decouples the codegen from the framework completely.
+ val featureApiArgs = mutableSetOf<String>()
for (arg in args) {
when {
arg.startsWith(READONLY_ARG) ->
readonly = arg.substring(READONLY_ARG.length).toBoolean()
arg.startsWith(FEATURE_ARG) -> {
- features.add(parseFeatureArg(arg))
+ featureArgs.add(parseFeatureArg(arg))
+ }
+ arg.startsWith(FEATURE_APIS_ARG) -> {
+ featureApiArgs.addAll(
+ arg.substring(FEATURE_APIS_ARG.length).split(",").map {
+ parseFeatureName(it)
+ }
+ )
}
else -> outputClassName = ClassName.bestGuess(arg)
}
}
+ // First load in all of the feature APIs we want to generate. Explicit feature definitions
+ // will then override this set with the appropriate readonly and version value.
+ val features = mutableMapOf<String, FeatureInfo>()
+ featureApiArgs.associateByTo(
+ features,
+ { it },
+ { FeatureInfo(it, version = null, readonly = false) },
+ )
+ featureArgs.associateByTo(
+ features,
+ { it.name },
+ { FeatureInfo(it.name, it.version, readonly) },
+ )
+
outputClassName
?: run {
println("Output class name must be provided.")
@@ -100,8 +137,8 @@
.addModifiers(Modifier.PUBLIC, Modifier.FINAL)
.addJavadoc("@hide")
- addFeatureMethodsToClass(classBuilder, readonly, features)
- addMaybeFeatureMethodToClass(classBuilder, readonly, features)
+ addFeatureMethodsToClass(classBuilder, features.values)
+ addMaybeFeatureMethodToClass(classBuilder, features.values)
// TODO(b/203143243): Add validation of build vs runtime values to ensure consistency.
JavaFile.builder(outputClassName.packageName(), classBuilder.build())
@@ -115,13 +152,16 @@
* * "--feature=WATCH:7" -> Feature enabled w/ version 7
* * "--feature=WATCH:" -> Feature disabled
*/
- private fun parseFeatureArg(arg: String): FeatureInfo {
+ private fun parseFeatureArg(arg: String): FeatureArg {
val featureArgs = arg.substring(FEATURE_ARG.length).split(":")
- val name = featureArgs[0].let { if (!it.startsWith("FEATURE_")) "FEATURE_$it" else it }
+ val name = parseFeatureName(featureArgs[0])
val version = featureArgs.getOrNull(1)?.toIntOrNull()
- return FeatureInfo(name, version)
+ return FeatureArg(name, version)
}
+ private fun parseFeatureName(name: String): String =
+ if (name.startsWith("FEATURE_")) name else "FEATURE_$name"
+
/*
* Adds per-feature query methods to the class with the form:
* {@code public static boolean hasFeatureX(Context context)},
@@ -129,8 +169,7 @@
*/
private fun addFeatureMethodsToClass(
builder: TypeSpec.Builder,
- readonly: Boolean,
- features: List<FeatureInfo>
+ features: Collection<FeatureInfo>,
) {
for (feature in features) {
// Turn "FEATURE_FOO" into "hasFeatureFoo".
@@ -142,7 +181,7 @@
.returns(Boolean::class.java)
.addParameter(CONTEXT_CLASS, "context")
- if (readonly) {
+ if (feature.readonly) {
val featureEnabled = compareValues(feature.version, 0) >= 0
methodBuilder.addAnnotation(
if (featureEnabled) ASSUME_TRUE_CLASS else ASSUME_FALSE_CLASS
@@ -158,19 +197,17 @@
builder.addMethod(methodBuilder.build())
}
- if (!readonly) {
- builder.addMethod(
- MethodSpec.methodBuilder("hasFeatureFallback")
- .addModifiers(Modifier.PRIVATE, Modifier.STATIC)
- .returns(Boolean::class.java)
- .addParameter(CONTEXT_CLASS, "context")
- .addParameter(String::class.java, "featureName")
- .addStatement(
- "return context.getPackageManager().hasSystemFeature(featureName, 0)"
- )
- .build()
- )
- }
+ // This is a trivial method, even if unused based on readonly-codegen, it does little harm
+ // to always include it.
+ builder.addMethod(
+ MethodSpec.methodBuilder("hasFeatureFallback")
+ .addModifiers(Modifier.PRIVATE, Modifier.STATIC)
+ .returns(Boolean::class.java)
+ .addParameter(CONTEXT_CLASS, "context")
+ .addParameter(String::class.java, "featureName")
+ .addStatement("return context.getPackageManager().hasSystemFeature(featureName, 0)")
+ .build()
+ )
}
/*
@@ -185,8 +222,7 @@
*/
private fun addMaybeFeatureMethodToClass(
builder: TypeSpec.Builder,
- readonly: Boolean,
- features: List<FeatureInfo>
+ features: Collection<FeatureInfo>,
) {
val methodBuilder =
MethodSpec.methodBuilder("maybeHasFeature")
@@ -196,16 +232,27 @@
.addParameter(String::class.java, "featureName")
.addParameter(Int::class.java, "version")
- if (readonly) {
- methodBuilder.beginControlFlow("switch (featureName)")
- for (feature in features) {
- methodBuilder.addCode("case \$T.\$N: ", PACKAGEMANAGER_CLASS, feature.name)
- if (feature.version != null) {
- methodBuilder.addStatement("return \$L >= version", feature.version)
- } else {
- methodBuilder.addStatement("return false")
- }
+ var hasSwitchBlock = false
+ for (feature in features) {
+ // We only return non-null results for queries against readonly-defined features.
+ if (!feature.readonly) {
+ continue
}
+ if (!hasSwitchBlock) {
+ // As an optimization, only create the switch block if needed. Even an empty
+ // switch-on-string block can induce a hash, which we can avoid if readonly
+ // support is completely disabled.
+ hasSwitchBlock = true
+ methodBuilder.beginControlFlow("switch (featureName)")
+ }
+ methodBuilder.addCode("case \$T.\$N: ", PACKAGEMANAGER_CLASS, feature.name)
+ if (feature.version != null) {
+ methodBuilder.addStatement("return \$L >= version", feature.version)
+ } else {
+ methodBuilder.addStatement("return false")
+ }
+ }
+ if (hasSwitchBlock) {
methodBuilder.addCode("default: ")
methodBuilder.addStatement("break")
methodBuilder.endControlFlow()
@@ -214,5 +261,7 @@
builder.addMethod(methodBuilder.build())
}
- private data class FeatureInfo(val name: String, val version: Int?)
+ private data class FeatureArg(val name: String, val version: Int?)
+
+ private data class FeatureInfo(val name: String, val version: Int?, val readonly: Boolean)
}
diff --git a/tools/systemfeatures/tests/PackageManager.java b/tools/systemfeatures/tests/PackageManager.java
index 645d500..db67048 100644
--- a/tools/systemfeatures/tests/PackageManager.java
+++ b/tools/systemfeatures/tests/PackageManager.java
@@ -19,6 +19,7 @@
/** Stub for testing */
public class PackageManager {
public static final String FEATURE_AUTO = "automotive";
+ public static final String FEATURE_PC = "pc";
public static final String FEATURE_VULKAN = "vulkan";
public static final String FEATURE_WATCH = "watch";
public static final String FEATURE_WIFI = "wifi";
diff --git a/tools/systemfeatures/tests/SystemFeaturesGeneratorTest.java b/tools/systemfeatures/tests/SystemFeaturesGeneratorTest.java
index 547d2cb..6dfd244 100644
--- a/tools/systemfeatures/tests/SystemFeaturesGeneratorTest.java
+++ b/tools/systemfeatures/tests/SystemFeaturesGeneratorTest.java
@@ -68,6 +68,13 @@
assertThat(RoNoFeatures.maybeHasFeature(PackageManager.FEATURE_VULKAN, 0)).isNull();
assertThat(RoNoFeatures.maybeHasFeature(PackageManager.FEATURE_AUTO, 0)).isNull();
assertThat(RoNoFeatures.maybeHasFeature("com.arbitrary.feature", 0)).isNull();
+
+ // Also ensure we fall back to the PackageManager for feature APIs without an accompanying
+ // versioned feature definition.
+ when(mPackageManager.hasSystemFeature(PackageManager.FEATURE_WATCH, 0)).thenReturn(true);
+ assertThat(RwFeatures.hasFeatureWatch(mContext)).isTrue();
+ when(mPackageManager.hasSystemFeature(PackageManager.FEATURE_WATCH, 0)).thenReturn(false);
+ assertThat(RwFeatures.hasFeatureWatch(mContext)).isFalse();
}
@Test
@@ -127,6 +134,16 @@
assertThat(RoFeatures.maybeHasFeature(PackageManager.FEATURE_AUTO, 0)).isFalse();
assertThat(RoFeatures.maybeHasFeature(PackageManager.FEATURE_AUTO, 100)).isFalse();
+ // For feature APIs without an associated feature definition, conditional queries should
+ // report null, and explicit queries should report runtime-defined versions.
+ when(mPackageManager.hasSystemFeature(PackageManager.FEATURE_PC, 0)).thenReturn(true);
+ assertThat(RoFeatures.hasFeaturePc(mContext)).isTrue();
+ when(mPackageManager.hasSystemFeature(PackageManager.FEATURE_PC, 0)).thenReturn(false);
+ assertThat(RoFeatures.hasFeaturePc(mContext)).isFalse();
+ assertThat(RoFeatures.maybeHasFeature(PackageManager.FEATURE_PC, -1)).isNull();
+ assertThat(RoFeatures.maybeHasFeature(PackageManager.FEATURE_PC, 0)).isNull();
+ assertThat(RoFeatures.maybeHasFeature(PackageManager.FEATURE_PC, 100)).isNull();
+
// For undefined types, conditional queries should report null (unknown).
assertThat(RoFeatures.maybeHasFeature("com.arbitrary.feature", -1)).isNull();
assertThat(RoFeatures.maybeHasFeature("com.arbitrary.feature", 0)).isNull();