diff options
898 files changed, 14477 insertions, 6791 deletions
diff --git a/Android.bp b/Android.bp index fb1fa3b58f74..72f675905aa3 100644 --- a/Android.bp +++ b/Android.bp @@ -261,7 +261,6 @@ java_library { "devicepolicyprotosnano", "ImmutabilityAnnotation", - "com.android.sysprop.init", "com.android.sysprop.localization", "PlatformProperties", ], @@ -401,6 +400,7 @@ java_defaults { ], sdk_version: "core_platform", static_libs: [ + "aconfig_storage_reader_java", "android.hardware.common.fmq-V1-java", "bouncycastle-repackaged-unbundled", "com.android.sysprop.foldlockbehavior", @@ -417,7 +417,6 @@ java_defaults { "modules-utils-fastxmlserializer", "modules-utils-preconditions", "modules-utils-statemachine", - "modules-utils-synchronous-result-receiver", "modules-utils-os", "modules-utils-uieventlogger-interface", "framework-permission-aidl-java", @@ -511,6 +510,9 @@ java_library { }, lint: { baseline_filename: "lint-baseline.xml", + warning_checks: [ + "FlaggedApi", + ], }, jarjar_prefix: "com.android.internal.hidden_from_bootclasspath", } @@ -634,7 +636,6 @@ java_library { "core/java/com/android/internal/util/AsyncService.java", "core/java/com/android/internal/util/Protocol.java", "telephony/java/android/telephony/Annotation.java", - ":net-utils-framework-wifi-common-srcs", ], libs: [ "framework-annotations-lib", diff --git a/BAL_OWNERS b/BAL_OWNERS index d56a1d4634df..ec779e76fa3b 100644 --- a/BAL_OWNERS +++ b/BAL_OWNERS @@ -2,4 +2,6 @@ brufino@google.com achim@google.com topjohnwu@google.com lus@google.com +haok@google.com +wnan@google.com diff --git a/INPUT_OWNERS b/INPUT_OWNERS index 06ead06fc13a..9b1016e7b7e9 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 @@ -14,6 +14,7 @@ michaelwr@google.com #{LAST_RESORT_SUGGESTION} nandana@google.com #{LAST_RESORT_SUGGESTION} narayan@google.com #{LAST_RESORT_SUGGESTION} ogunwale@google.com #{LAST_RESORT_SUGGESTION} +omakoto@google.com #{LAST_RESORT_SUGGESTION} roosa@google.com #{LAST_RESORT_SUGGESTION} smoreland@google.com #{LAST_RESORT_SUGGESTION} yamasani@google.com #{LAST_RESORT_SUGGESTION} @@ -28,7 +29,7 @@ per-file */TEST_MAPPING = * # Support bulk translation updates per-file */res*/values*/*.xml = byi@google.com, delphij@google.com -per-file **.bp,**.mk = hansson@google.com, joeo@google.com, lamontjones@google.com +per-file **.bp,**.mk =joeo@google.com, lamontjones@google.com per-file TestProtoLibraries.bp = file:platform/platform_testing:/libraries/health/OWNERS per-file TestProtoLibraries.bp = file:platform/tools/tradefederation:/OWNERS diff --git a/PERFORMANCE_OWNERS b/PERFORMANCE_OWNERS index 48a020130445..02b0a1ec75e7 100644 --- a/PERFORMANCE_OWNERS +++ b/PERFORMANCE_OWNERS @@ -6,3 +6,4 @@ philipcuadra@google.com shayba@google.com jdduke@google.com shombert@google.com +kevinjeon@google.com diff --git a/Ravenwood.bp b/Ravenwood.bp index 11da20aa6e02..7faa33f8834e 100644 --- a/Ravenwood.bp +++ b/Ravenwood.bp @@ -26,24 +26,13 @@ java_library { } // Generate the stub/impl from framework-all, with hidden APIs. -java_genrule { - name: "framework-minus-apex.ravenwood-base", - tools: ["hoststubgen"], - cmd: "$(location hoststubgen) " + - "@$(location :ravenwood-standard-options) " + +// This step takes several tens of seconds, so we manually shard it to multiple modules. +// All the copies have to be kept in sync. +// TODO: Do the sharding better. - "--debug-log $(location hoststubgen_framework-minus-apex.log) " + - "--stats-file $(location hoststubgen_framework-minus-apex_stats.csv) " + - "--supported-api-list-file $(location hoststubgen_framework-minus-apex_apis.csv) " + - - "--out-impl-jar $(location ravenwood.jar) " + - - "--gen-keep-all-file $(location hoststubgen_keep_all.txt) " + - "--gen-input-dump-file $(location hoststubgen_dump.txt) " + - - "--in-jar $(location :framework-minus-apex-for-hoststubgen) " + - "--policy-override-file $(location :ravenwood-framework-policies) " + - "--annotation-allowed-classes-file $(location :ravenwood-annotation-allowed-classes) ", +genrule_defaults { + name: "framework-minus-apex.ravenwood-base_defaults", + tools: ["hoststubgen"], srcs: [ ":framework-minus-apex-for-hoststubgen", ":ravenwood-framework-policies", @@ -54,8 +43,8 @@ java_genrule { "ravenwood.jar", // Following files are created just as FYI. - "hoststubgen_keep_all.txt", - "hoststubgen_dump.txt", + "hoststubgen_framework-minus-apex_keep_all.txt", + "hoststubgen_framework-minus-apex_dump.txt", "hoststubgen_framework-minus-apex.log", "hoststubgen_framework-minus-apex_stats.csv", @@ -64,56 +53,216 @@ java_genrule { visibility: ["//visibility:private"], } -// Extract the impl jar from "framework-minus-apex.ravenwood-base" for subsequent build rules. -// Note this emits a "device side" output, so that ravenwood tests can (implicitly) -// depend on it. +java_genrule { + name: "framework-minus-apex.ravenwood-base_X0", + defaults: ["framework-minus-apex.ravenwood-base_defaults"], + cmd: "$(location hoststubgen) " + + "--num-shards 6 --shard-index 0 " + // Only this line differs + + "@$(location :ravenwood-standard-options) " + + + "--debug-log $(location hoststubgen_framework-minus-apex.log) " + + "--stats-file $(location hoststubgen_framework-minus-apex_stats.csv) " + + "--supported-api-list-file $(location hoststubgen_framework-minus-apex_apis.csv) " + + + "--out-impl-jar $(location ravenwood.jar) " + + + "--gen-keep-all-file $(location hoststubgen_framework-minus-apex_keep_all.txt) " + + "--gen-input-dump-file $(location hoststubgen_framework-minus-apex_dump.txt) " + + + "--in-jar $(location :framework-minus-apex-for-hoststubgen) " + + "--policy-override-file $(location :ravenwood-framework-policies) " + + "--annotation-allowed-classes-file $(location :ravenwood-annotation-allowed-classes) ", +} + +java_genrule { + name: "framework-minus-apex.ravenwood-base_X1", + defaults: ["framework-minus-apex.ravenwood-base_defaults"], + cmd: "$(location hoststubgen) " + + "--num-shards 6 --shard-index 1 " + // Only this line differs + + "@$(location :ravenwood-standard-options) " + + + "--debug-log $(location hoststubgen_framework-minus-apex.log) " + + "--stats-file $(location hoststubgen_framework-minus-apex_stats.csv) " + + "--supported-api-list-file $(location hoststubgen_framework-minus-apex_apis.csv) " + + + "--out-impl-jar $(location ravenwood.jar) " + + + "--gen-keep-all-file $(location hoststubgen_framework-minus-apex_keep_all.txt) " + + "--gen-input-dump-file $(location hoststubgen_framework-minus-apex_dump.txt) " + + + "--in-jar $(location :framework-minus-apex-for-hoststubgen) " + + "--policy-override-file $(location :ravenwood-framework-policies) " + + "--annotation-allowed-classes-file $(location :ravenwood-annotation-allowed-classes) ", +} + +java_genrule { + name: "framework-minus-apex.ravenwood-base_X2", + defaults: ["framework-minus-apex.ravenwood-base_defaults"], + cmd: "$(location hoststubgen) " + + "--num-shards 6 --shard-index 2 " + // Only this line differs + + "@$(location :ravenwood-standard-options) " + + + "--debug-log $(location hoststubgen_framework-minus-apex.log) " + + "--stats-file $(location hoststubgen_framework-minus-apex_stats.csv) " + + "--supported-api-list-file $(location hoststubgen_framework-minus-apex_apis.csv) " + + + "--out-impl-jar $(location ravenwood.jar) " + + + "--gen-keep-all-file $(location hoststubgen_framework-minus-apex_keep_all.txt) " + + "--gen-input-dump-file $(location hoststubgen_framework-minus-apex_dump.txt) " + + + "--in-jar $(location :framework-minus-apex-for-hoststubgen) " + + "--policy-override-file $(location :ravenwood-framework-policies) " + + "--annotation-allowed-classes-file $(location :ravenwood-annotation-allowed-classes) ", +} + +java_genrule { + name: "framework-minus-apex.ravenwood-base_X3", + defaults: ["framework-minus-apex.ravenwood-base_defaults"], + cmd: "$(location hoststubgen) " + + "--num-shards 6 --shard-index 3 " + // Only this line differs + + "@$(location :ravenwood-standard-options) " + + + "--debug-log $(location hoststubgen_framework-minus-apex.log) " + + "--stats-file $(location hoststubgen_framework-minus-apex_stats.csv) " + + "--supported-api-list-file $(location hoststubgen_framework-minus-apex_apis.csv) " + + + "--out-impl-jar $(location ravenwood.jar) " + + + "--gen-keep-all-file $(location hoststubgen_framework-minus-apex_keep_all.txt) " + + "--gen-input-dump-file $(location hoststubgen_framework-minus-apex_dump.txt) " + + + "--in-jar $(location :framework-minus-apex-for-hoststubgen) " + + "--policy-override-file $(location :ravenwood-framework-policies) " + + "--annotation-allowed-classes-file $(location :ravenwood-annotation-allowed-classes) ", +} + +java_genrule { + name: "framework-minus-apex.ravenwood-base_X4", + defaults: ["framework-minus-apex.ravenwood-base_defaults"], + cmd: "$(location hoststubgen) " + + "--num-shards 6 --shard-index 4 " + // Only this line differs + + "@$(location :ravenwood-standard-options) " + + + "--debug-log $(location hoststubgen_framework-minus-apex.log) " + + "--stats-file $(location hoststubgen_framework-minus-apex_stats.csv) " + + "--supported-api-list-file $(location hoststubgen_framework-minus-apex_apis.csv) " + + + "--out-impl-jar $(location ravenwood.jar) " + + + "--gen-keep-all-file $(location hoststubgen_framework-minus-apex_keep_all.txt) " + + "--gen-input-dump-file $(location hoststubgen_framework-minus-apex_dump.txt) " + + + "--in-jar $(location :framework-minus-apex-for-hoststubgen) " + + "--policy-override-file $(location :ravenwood-framework-policies) " + + "--annotation-allowed-classes-file $(location :ravenwood-annotation-allowed-classes) ", +} + +java_genrule { + name: "framework-minus-apex.ravenwood-base_X5", + defaults: ["framework-minus-apex.ravenwood-base_defaults"], + cmd: "$(location hoststubgen) " + + "--num-shards 6 --shard-index 5 " + // Only this line differs + + "@$(location :ravenwood-standard-options) " + + + "--debug-log $(location hoststubgen_framework-minus-apex.log) " + + "--stats-file $(location hoststubgen_framework-minus-apex_stats.csv) " + + "--supported-api-list-file $(location hoststubgen_framework-minus-apex_apis.csv) " + + + "--out-impl-jar $(location ravenwood.jar) " + + + "--gen-keep-all-file $(location hoststubgen_framework-minus-apex_keep_all.txt) " + + "--gen-input-dump-file $(location hoststubgen_framework-minus-apex_dump.txt) " + + + "--in-jar $(location :framework-minus-apex-for-hoststubgen) " + + "--policy-override-file $(location :ravenwood-framework-policies) " + + "--annotation-allowed-classes-file $(location :ravenwood-annotation-allowed-classes) ", +} + +// Marge all the sharded jars java_genrule { name: "framework-minus-apex.ravenwood", - defaults: ["ravenwood-internal-only-visibility-genrule"], - cmd: "cp $(in) $(out)", + defaults: ["ravenwood-internal-only-visibility-java"], + cmd: "$(location merge_zips) $(out) $(in)", + tools: ["merge_zips"], srcs: [ - ":framework-minus-apex.ravenwood-base{ravenwood.jar}", + ":framework-minus-apex.ravenwood-base_X0{ravenwood.jar}", + ":framework-minus-apex.ravenwood-base_X1{ravenwood.jar}", + ":framework-minus-apex.ravenwood-base_X2{ravenwood.jar}", + ":framework-minus-apex.ravenwood-base_X3{ravenwood.jar}", + ":framework-minus-apex.ravenwood-base_X4{ravenwood.jar}", + ":framework-minus-apex.ravenwood-base_X5{ravenwood.jar}", ], out: [ "framework-minus-apex.ravenwood.jar", ], } -// Extract the stats file. +// Merge the sharded text files genrule { - name: "framework-minus-apex.ravenwood.stats", + name: "hoststubgen_framework-minus-apex_stats.csv", defaults: ["ravenwood-internal-only-visibility-genrule"], - cmd: "cp $(in) $(out)", + cmd: "cat $(in) > $(out)", srcs: [ - ":framework-minus-apex.ravenwood-base{hoststubgen_framework-minus-apex_stats.csv}", - ], - out: [ - "hoststubgen_framework-minus-apex_stats.csv", + ":framework-minus-apex.ravenwood-base_X0{hoststubgen_framework-minus-apex_stats.csv}", + ":framework-minus-apex.ravenwood-base_X1{hoststubgen_framework-minus-apex_stats.csv}", + ":framework-minus-apex.ravenwood-base_X2{hoststubgen_framework-minus-apex_stats.csv}", + ":framework-minus-apex.ravenwood-base_X3{hoststubgen_framework-minus-apex_stats.csv}", + ":framework-minus-apex.ravenwood-base_X4{hoststubgen_framework-minus-apex_stats.csv}", + ":framework-minus-apex.ravenwood-base_X5{hoststubgen_framework-minus-apex_stats.csv}", ], + out: ["hoststubgen_framework-minus-apex_stats.csv"], } genrule { - name: "framework-minus-apex.ravenwood.apis", + name: "hoststubgen_framework-minus-apex_apis.csv", defaults: ["ravenwood-internal-only-visibility-genrule"], - cmd: "cp $(in) $(out)", + cmd: "cat $(in) > $(out)", srcs: [ - ":framework-minus-apex.ravenwood-base{hoststubgen_framework-minus-apex_apis.csv}", - ], - out: [ - "hoststubgen_framework-minus-apex_apis.csv", + ":framework-minus-apex.ravenwood-base_X0{hoststubgen_framework-minus-apex_apis.csv}", + ":framework-minus-apex.ravenwood-base_X1{hoststubgen_framework-minus-apex_apis.csv}", + ":framework-minus-apex.ravenwood-base_X2{hoststubgen_framework-minus-apex_apis.csv}", + ":framework-minus-apex.ravenwood-base_X3{hoststubgen_framework-minus-apex_apis.csv}", + ":framework-minus-apex.ravenwood-base_X4{hoststubgen_framework-minus-apex_apis.csv}", + ":framework-minus-apex.ravenwood-base_X5{hoststubgen_framework-minus-apex_apis.csv}", ], + out: ["hoststubgen_framework-minus-apex_apis.csv"], } genrule { - name: "framework-minus-apex.ravenwood.keep_all", + name: "hoststubgen_framework-minus-apex_keep_all.txt", defaults: ["ravenwood-internal-only-visibility-genrule"], - cmd: "cp $(in) $(out)", + cmd: "cat $(in) > $(out)", srcs: [ - ":framework-minus-apex.ravenwood-base{hoststubgen_keep_all.txt}", + ":framework-minus-apex.ravenwood-base_X0{hoststubgen_framework-minus-apex_keep_all.txt}", + ":framework-minus-apex.ravenwood-base_X1{hoststubgen_framework-minus-apex_keep_all.txt}", + ":framework-minus-apex.ravenwood-base_X2{hoststubgen_framework-minus-apex_keep_all.txt}", + ":framework-minus-apex.ravenwood-base_X3{hoststubgen_framework-minus-apex_keep_all.txt}", + ":framework-minus-apex.ravenwood-base_X4{hoststubgen_framework-minus-apex_keep_all.txt}", + ":framework-minus-apex.ravenwood-base_X5{hoststubgen_framework-minus-apex_keep_all.txt}", ], - out: [ - "hoststubgen_framework-minus-apex_keep_all.txt", + out: ["hoststubgen_framework-minus-apex_keep_all.txt"], +} + +genrule { + name: "hoststubgen_framework-minus-apex_dump.txt", + defaults: ["ravenwood-internal-only-visibility-genrule"], + cmd: "cat $(in) > $(out)", + srcs: [ + ":framework-minus-apex.ravenwood-base_X0{hoststubgen_framework-minus-apex_dump.txt}", + ":framework-minus-apex.ravenwood-base_X1{hoststubgen_framework-minus-apex_dump.txt}", + ":framework-minus-apex.ravenwood-base_X2{hoststubgen_framework-minus-apex_dump.txt}", + ":framework-minus-apex.ravenwood-base_X3{hoststubgen_framework-minus-apex_dump.txt}", + ":framework-minus-apex.ravenwood-base_X4{hoststubgen_framework-minus-apex_dump.txt}", + ":framework-minus-apex.ravenwood-base_X5{hoststubgen_framework-minus-apex_dump.txt}", ], + out: ["hoststubgen_framework-minus-apex_dump.txt"], } java_library { @@ -138,8 +287,8 @@ java_genrule { "--out-impl-jar $(location ravenwood.jar) " + - "--gen-keep-all-file $(location hoststubgen_keep_all.txt) " + - "--gen-input-dump-file $(location hoststubgen_dump.txt) " + + "--gen-keep-all-file $(location hoststubgen_services.core_keep_all.txt) " + + "--gen-input-dump-file $(location hoststubgen_services.core_dump.txt) " + "--in-jar $(location :services.core-for-hoststubgen) " + "--policy-override-file $(location :ravenwood-services-policies) " + @@ -154,14 +303,14 @@ java_genrule { "ravenwood.jar", // Following files are created just as FYI. - "hoststubgen_keep_all.txt", - "hoststubgen_dump.txt", + "hoststubgen_services.core_keep_all.txt", + "hoststubgen_services.core_dump.txt", "hoststubgen_services.core.log", "hoststubgen_services.core_stats.csv", "hoststubgen_services.core_apis.csv", ], - visibility: ["//visibility:private"], + defaults: ["ravenwood-internal-only-visibility-genrule"], } java_genrule { @@ -176,150 +325,43 @@ java_genrule { ], } -// Extract the stats file. -genrule { - name: "services.core.ravenwood.stats", - defaults: ["ravenwood-internal-only-visibility-genrule"], - cmd: "cp $(in) $(out)", - srcs: [ - ":services.core.ravenwood-base{hoststubgen_services.core_stats.csv}", - ], - out: [ - "hoststubgen_services.core_stats.csv", - ], -} - -genrule { - name: "services.core.ravenwood.apis", - defaults: ["ravenwood-internal-only-visibility-genrule"], - cmd: "cp $(in) $(out)", - srcs: [ - ":services.core.ravenwood-base{hoststubgen_services.core_apis.csv}", - ], - out: [ - "hoststubgen_services.core_apis.csv", - ], -} - -genrule { - name: "services.core.ravenwood.keep_all", - defaults: ["ravenwood-internal-only-visibility-genrule"], - cmd: "cp $(in) $(out)", - srcs: [ - ":services.core.ravenwood-base{hoststubgen_keep_all.txt}", - ], - out: [ - "hoststubgen_services.core_keep_all.txt", - ], -} - java_library { name: "services.core.ravenwood-jarjar", + defaults: ["ravenwood-internal-only-visibility-java"], installable: false, static_libs: [ "services.core.ravenwood", ], jarjar_rules: ":ravenwood-services-jarjar-rules", - visibility: ["//visibility:private"], -} - -java_library { - name: "services.fakes.ravenwood-jarjar", - installable: false, - srcs: [":services.fakes-sources"], - libs: [ - "ravenwood-framework", - "services.core.ravenwood", - ], - jarjar_rules: ":ravenwood-services-jarjar-rules", - visibility: ["//visibility:private"], -} - -java_library { - name: "mockito-ravenwood-prebuilt", - installable: false, - static_libs: [ - "mockito-robolectric-prebuilt", - ], -} - -java_library { - name: "inline-mockito-ravenwood-prebuilt", - installable: false, - static_libs: [ - "inline-mockito-robolectric-prebuilt", - ], } // Jars in "ravenwood-runtime" are set to the classpath, sorted alphabetically. // Rename some of the dependencies to make sure they're included in the intended order. -java_genrule { +// Also apply jarjar. +java_library { name: "100-framework-minus-apex.ravenwood", - cmd: "cp $(in) $(out)", - srcs: [":framework-minus-apex.ravenwood"], - out: ["100-framework-minus-apex.ravenwood.jar"], - visibility: ["//visibility:private"], + defaults: ["ravenwood-internal-only-visibility-java"], + static_libs: [ + "framework-minus-apex.ravenwood", + ], + sdk_version: "core_platform", + // See b/313930116. Jarjar is too slow on this jar. We use HostStubGen to do the rename. + // jarjar_rules: ":ravenwood-framework-jarjar-rules", } java_genrule { // Use 200 to make sure it comes before the mainline stub ("all-updatable..."). name: "200-kxml2-android", + defaults: ["ravenwood-internal-only-visibility-genrule"], cmd: "cp $(in) $(out)", srcs: [":kxml2-android"], out: ["200-kxml2-android.jar"], - visibility: ["//visibility:private"], } java_genrule { name: "z00-all-updatable-modules-system-stubs", + defaults: ["ravenwood-internal-only-visibility-genrule"], cmd: "cp $(in) $(out)", srcs: [":all-updatable-modules-system-stubs"], out: ["z00-all-updatable-modules-system-stubs.jar"], - visibility: ["//visibility:private"], -} - -android_ravenwood_libgroup { - name: "ravenwood-runtime", - libs: [ - "100-framework-minus-apex.ravenwood", - "200-kxml2-android", - - "ravenwood-runtime-common-ravenwood", - - "android.test.mock.ravenwood", - "ravenwood-helper-runtime", - "hoststubgen-helper-runtime.ravenwood", - "services.core.ravenwood-jarjar", - "services.fakes.ravenwood-jarjar", - - // Provide runtime versions of utils linked in below - "junit", - "truth", - "flag-junit", - "ravenwood-framework", - "ravenwood-junit-impl", - "ravenwood-junit-impl-flag", - "mockito-ravenwood-prebuilt", - "inline-mockito-ravenwood-prebuilt", - - // It's a stub, so it should be towards the end. - "z00-all-updatable-modules-system-stubs", - ], - jni_libs: [ - "libandroid_runtime", - "libravenwood_runtime", - ], -} - -android_ravenwood_libgroup { - name: "ravenwood-utils", - libs: [ - "junit", - "truth", - "flag-junit", - "ravenwood-framework", - "ravenwood-junit", - "mockito-ravenwood-prebuilt", - "inline-mockito-ravenwood-prebuilt", - ], } diff --git a/ZYGOTE_OWNERS b/ZYGOTE_OWNERS index f6d15e03a892..6918c16840dd 100644 --- a/ZYGOTE_OWNERS +++ b/ZYGOTE_OWNERS @@ -1,4 +1,4 @@ chriswailes@google.com +hboehm@google.com maco@google.com -narayan@google.com ngeoffray@google.com diff --git a/apct-tests/perftests/core/Android.bp b/apct-tests/perftests/core/Android.bp index e092499cb41f..65bc8ccd12f8 100644 --- a/apct-tests/perftests/core/Android.bp +++ b/apct-tests/perftests/core/Android.bp @@ -44,6 +44,7 @@ android_test { "apct-perftests-resources-manager-apps", "apct-perftests-utils", "collector-device-lib", + "conscrypt-test-support", "compatibility-device-util-axt", "junit", "junit-params", diff --git a/apct-tests/perftests/core/src/android/conscrypt/conscrypt/BufferType.java b/apct-tests/perftests/core/src/android/conscrypt/conscrypt/BufferType.java new file mode 100644 index 000000000000..bdc2a829a95b --- /dev/null +++ b/apct-tests/perftests/core/src/android/conscrypt/conscrypt/BufferType.java @@ -0,0 +1,48 @@ +/* + * Copyright 2017 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package android.conscrypt; + +import java.nio.ByteBuffer; +import javax.net.ssl.SSLEngine; + +/** + * Enumeration that provides allocation of direct or heap buffers. + */ +@SuppressWarnings("unused") +public enum BufferType { + HEAP { + @Override + ByteBuffer newBuffer(int size) { + return ByteBuffer.allocate(size); + } + }, + DIRECT { + @Override + ByteBuffer newBuffer(int size) { + return ByteBuffer.allocateDirect(size); + } + }; + + abstract ByteBuffer newBuffer(int size); + + ByteBuffer newApplicationBuffer(SSLEngine engine) { + return newBuffer(engine.getSession().getApplicationBufferSize()); + } + + ByteBuffer newPacketBuffer(SSLEngine engine) { + return newBuffer(engine.getSession().getPacketBufferSize()); + } +}
\ No newline at end of file diff --git a/apct-tests/perftests/core/src/android/conscrypt/conscrypt/CipherEncryptPerfTest.java b/apct-tests/perftests/core/src/android/conscrypt/conscrypt/CipherEncryptPerfTest.java new file mode 100644 index 000000000000..36266de04d23 --- /dev/null +++ b/apct-tests/perftests/core/src/android/conscrypt/conscrypt/CipherEncryptPerfTest.java @@ -0,0 +1,227 @@ +/* + * Copyright (C) 2016 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.conscrypt; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import androidx.test.filters.LargeTest; + +import org.conscrypt.TestUtils; + +import java.nio.ByteBuffer; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.security.Key; +import java.security.NoSuchAlgorithmException; +import javax.crypto.Cipher; +import javax.crypto.NoSuchPaddingException; + +import junitparams.JUnitParamsRunner; +import junitparams.Parameters; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * Benchmark for comparing cipher encrypt performance. + */ +@RunWith(JUnitParamsRunner.class) +@LargeTest +public final class CipherEncryptPerfTest { + + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + + public enum BufferType { + ARRAY, + HEAP_HEAP, + HEAP_DIRECT, + DIRECT_DIRECT, + DIRECT_HEAP + } + + private enum MyCipherFactory implements CipherFactory { + JDK { + @Override + public Cipher newCipher(String transformation) + throws NoSuchPaddingException, NoSuchAlgorithmException { + return Cipher.getInstance(transformation); + } + }, + CONSCRYPT { + @Override + public Cipher newCipher(String transformation) + throws NoSuchPaddingException, NoSuchAlgorithmException { + return Cipher.getInstance(transformation, TestUtils.getConscryptProvider()); + } + }; + } + + private class Config { + BufferType b_bufferType; + CipherFactory c_provider; + Transformation a_tx; + Config(BufferType bufferType, CipherFactory cipherFactory, Transformation transformation) { + b_bufferType = bufferType; + c_provider = cipherFactory; + a_tx = transformation; + } + public BufferType bufferType() { + return b_bufferType; + } + + public CipherFactory cipherFactory() { + return c_provider; + } + + public Transformation transformation() { + return a_tx; + } + } + + public Collection <Object[]> getParams() { + final List<Object[]> params = new ArrayList<>(); + for (BufferType bufferType : BufferType.values()) { + for (CipherFactory cipherFactory : MyCipherFactory.values()) { + for (Transformation transformation : Transformation.values()) { + params.add(new Object[] {new Config( + bufferType, cipherFactory, transformation)}); + } + } + } + return params; + } + + private EncryptStrategy encryptStrategy; + + @Test + @Parameters(method = "getParams") + public void encrypt(Config config) throws Exception { + switch (config.bufferType()) { + case ARRAY: + encryptStrategy = new ArrayStrategy(config); + break; + default: + encryptStrategy = new ByteBufferStrategy(config); + break; + } + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + encryptStrategy.encrypt(); + } + } + + private static abstract class EncryptStrategy { + private final Key key; + final Cipher cipher; + final int outputSize; + + EncryptStrategy(Config config) throws Exception { + Transformation tx = config.transformation(); + key = tx.newEncryptKey(); + cipher = config.cipherFactory().newCipher(tx.toFormattedString()); + initCipher(); + + int messageSize = messageSize(tx.toFormattedString()); + outputSize = cipher.getOutputSize(messageSize); + } + + final void initCipher() throws Exception { + cipher.init(Cipher.ENCRYPT_MODE, key); + } + + final int messageSize(String transformation) throws Exception { + Cipher conscryptCipher = Cipher.getInstance( + transformation, TestUtils.getConscryptProvider()); + conscryptCipher.init(Cipher.ENCRYPT_MODE, key); + return conscryptCipher.getBlockSize() > 0 ? + conscryptCipher.getBlockSize() : 128; + } + + final byte[] newMessage() { + return TestUtils.newTextMessage(cipher.getBlockSize()); + } + + abstract int encrypt() throws Exception; + } + + private static final class ArrayStrategy extends EncryptStrategy { + private final byte[] plainBytes; + private final byte[] cipherBytes; + + ArrayStrategy(Config config) throws Exception { + super(config); + + plainBytes = newMessage(); + cipherBytes = new byte[outputSize]; + } + + @Override + int encrypt() throws Exception { + initCipher(); + return cipher.doFinal(plainBytes, 0, plainBytes.length, cipherBytes, 0); + } + } + + private static final class ByteBufferStrategy extends EncryptStrategy { + private final ByteBuffer input; + private final ByteBuffer output; + + ByteBufferStrategy(Config config) throws Exception { + super(config); + + switch (config.bufferType()) { + case HEAP_HEAP: + input = ByteBuffer.wrap(newMessage()); + output = ByteBuffer.allocate(outputSize); + break; + case HEAP_DIRECT: + input = ByteBuffer.wrap(newMessage()); + output = ByteBuffer.allocateDirect(outputSize); + break; + case DIRECT_DIRECT: + input = toDirect(newMessage()); + output = ByteBuffer.allocateDirect(outputSize); + break; + case DIRECT_HEAP: + input = toDirect(newMessage()); + output = ByteBuffer.allocate(outputSize); + break; + default: { + throw new IllegalStateException( + "Unexpected buffertype: " + config.bufferType()); + } + } + } + + @Override + int encrypt() throws Exception { + initCipher(); + input.position(0); + output.clear(); + return cipher.doFinal(input, output); + } + + private static ByteBuffer toDirect(byte[] data) { + ByteBuffer buffer = ByteBuffer.allocateDirect(data.length); + buffer.put(data); + buffer.flip(); + return buffer; + } + } +}
\ No newline at end of file diff --git a/apct-tests/perftests/core/src/android/conscrypt/conscrypt/CipherFactory.java b/apct-tests/perftests/core/src/android/conscrypt/conscrypt/CipherFactory.java new file mode 100644 index 000000000000..f8a3d5f2ed04 --- /dev/null +++ b/apct-tests/perftests/core/src/android/conscrypt/conscrypt/CipherFactory.java @@ -0,0 +1,27 @@ +/* + * Copyright 2017 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package android.conscrypt; + +import java.security.NoSuchAlgorithmException; +import javax.crypto.Cipher; +import javax.crypto.NoSuchPaddingException; + +/** + * Factory for {@link Cipher} instances. + */ +public interface CipherFactory { + Cipher newCipher(String transformation) throws NoSuchPaddingException, NoSuchAlgorithmException; +}
\ No newline at end of file diff --git a/apct-tests/perftests/core/src/android/conscrypt/conscrypt/ClientEndpoint.java b/apct-tests/perftests/core/src/android/conscrypt/conscrypt/ClientEndpoint.java new file mode 100644 index 000000000000..1a7258a802df --- /dev/null +++ b/apct-tests/perftests/core/src/android/conscrypt/conscrypt/ClientEndpoint.java @@ -0,0 +1,110 @@ +/* + * Copyright 2017 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.conscrypt; + +import java.io.EOFException; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.InetAddress; +import java.net.SocketException; +import java.nio.channels.ClosedChannelException; +import javax.net.ssl.SSLException; +import javax.net.ssl.SSLSocket; +import javax.net.ssl.SSLSocketFactory; + +import org.conscrypt.ChannelType; + +/** + * Client-side endpoint. Provides basic services for sending/receiving messages from the client + * socket. + */ +final class ClientEndpoint { + private final SSLSocket socket; + private InputStream input; + private OutputStream output; + + ClientEndpoint(SSLSocketFactory socketFactory, ChannelType channelType, int port, + String[] protocols, String[] ciphers) throws IOException { + socket = channelType.newClientSocket(socketFactory, InetAddress.getLoopbackAddress(), port); + socket.setEnabledProtocols(protocols); + socket.setEnabledCipherSuites(ciphers); + } + + void start() { + try { + socket.startHandshake(); + input = socket.getInputStream(); + output = socket.getOutputStream(); + } catch (IOException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + } + + void stop() { + try { + socket.close(); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + int readMessage(byte[] buffer) { + try { + int totalBytesRead = 0; + while (totalBytesRead < buffer.length) { + int remaining = buffer.length - totalBytesRead; + int bytesRead = input.read(buffer, totalBytesRead, remaining); + if (bytesRead == -1) { + break; + } + totalBytesRead += bytesRead; + } + return totalBytesRead; + } catch (SSLException e) { + if (e.getCause() instanceof EOFException) { + return -1; + } + throw new RuntimeException(e); + } catch (ClosedChannelException e) { + // Thrown for channel-based sockets. Just treat like EOF. + return -1; + } catch (SocketException e) { + // The socket was broken. Just treat like EOF. + return -1; + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + void sendMessage(byte[] data) { + try { + output.write(data); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + void flush() { + try { + output.flush(); + } catch (IOException e) { + throw new RuntimeException(e); + } + } +}
\ No newline at end of file diff --git a/apct-tests/perftests/core/src/android/conscrypt/conscrypt/ClientSocketPerfTest.java b/apct-tests/perftests/core/src/android/conscrypt/conscrypt/ClientSocketPerfTest.java new file mode 100644 index 000000000000..f20b1706129b --- /dev/null +++ b/apct-tests/perftests/core/src/android/conscrypt/conscrypt/ClientSocketPerfTest.java @@ -0,0 +1,222 @@ +/* + * Copyright (C) 2016 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.conscrypt; + +import org.conscrypt.ChannelType; +import org.conscrypt.TestUtils; +import static org.conscrypt.TestUtils.getCommonProtocolSuites; +import static org.conscrypt.TestUtils.newTextMessage; +import static org.junit.Assert.assertEquals; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import androidx.test.filters.LargeTest; + +import java.io.IOException; +import java.io.OutputStream; +import java.net.SocketException; +import java.security.NoSuchAlgorithmException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicLong; + +import javax.crypto.Cipher; +import javax.crypto.NoSuchPaddingException; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; +import junitparams.JUnitParamsRunner; +import junitparams.Parameters; +import android.conscrypt.ServerEndpoint.MessageProcessor; + +/** + * Benchmark for comparing performance of server socket implementations. + */ +@RunWith(JUnitParamsRunner.class) +@LargeTest +public final class ClientSocketPerfTest { + + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + + /** + * Provider for the test configuration + */ + private class Config { + EndpointFactory a_clientFactory; + EndpointFactory b_serverFactory; + int c_messageSize; + String d_cipher; + ChannelType e_channelType; + PerfTestProtocol f_protocol; + Config(EndpointFactory clientFactory, + EndpointFactory serverFactory, + int messageSize, + String cipher, + ChannelType channelType, + PerfTestProtocol protocol) { + a_clientFactory = clientFactory; + b_serverFactory = serverFactory; + c_messageSize = messageSize; + d_cipher = cipher; + e_channelType = channelType; + f_protocol = protocol; + } + public EndpointFactory clientFactory() { + return a_clientFactory; + } + + public EndpointFactory serverFactory() { + return b_serverFactory; + } + + public int messageSize() { + return c_messageSize; + } + + public String cipher() { + return d_cipher; + } + + public ChannelType channelType() { + return e_channelType; + } + + public PerfTestProtocol protocol() { + return f_protocol; + } + } + + public Collection getParams() { + final List<Object[]> params = new ArrayList<>(); + for (EndpointFactory endpointFactory : EndpointFactory.values()) { + for (ChannelType channelType : ChannelType.values()) { + for (PerfTestProtocol protocol : PerfTestProtocol.values()) { + params.add(new Object[] {new Config(endpointFactory, + endpointFactory, 64, "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", + channelType, protocol)}); + params.add(new Object[] {new Config(endpointFactory, + endpointFactory, 512, "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", + channelType, protocol)}); + params.add(new Object[] {new Config(endpointFactory, + endpointFactory, 4096, "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", + channelType, protocol)}); + } + } + } + return params; + } + + private ClientEndpoint client; + private ServerEndpoint server; + private byte[] message; + private ExecutorService executor; + private Future<?> sendingFuture; + private volatile boolean stopping; + + private static final AtomicLong bytesCounter = new AtomicLong(); + private AtomicBoolean recording = new AtomicBoolean(); + + private void setup(Config config) throws Exception { + message = newTextMessage(512); + + // Always use the same server for consistency across the benchmarks. + server = config.serverFactory().newServer( + config.messageSize(), config.protocol().getProtocols(), + ciphers(config)); + + server.setMessageProcessor(new ServerEndpoint.MessageProcessor() { + @Override + public void processMessage(byte[] inMessage, int numBytes, OutputStream os) { + if (recording.get()) { + // Server received a message, increment the count. + bytesCounter.addAndGet(numBytes); + } + } + }); + Future<?> connectedFuture = server.start(); + + client = config.clientFactory().newClient( + config.channelType(), server.port(), config.protocol().getProtocols(), ciphers(config)); + client.start(); + + // Wait for the initial connection to complete. + connectedFuture.get(5, TimeUnit.SECONDS); + + executor = Executors.newSingleThreadExecutor(); + sendingFuture = executor.submit(new Runnable() { + @Override + public void run() { + try { + Thread thread = Thread.currentThread(); + while (!stopping && !thread.isInterrupted()) { + client.sendMessage(message); + } + } finally { + client.flush(); + } + } + }); + } + + void close() throws Exception { + stopping = true; + + // Wait for the sending thread to stop. + sendingFuture.get(5, TimeUnit.SECONDS); + + client.stop(); + server.stop(); + executor.shutdown(); + executor.awaitTermination(5, TimeUnit.SECONDS); + } + + /** + * Simple benchmark for the amount of time to send a given number of messages + */ + @Test + @Parameters(method = "getParams") + public void time(Config config) throws Exception { + reset(); + setup(config); + recording.set(true); + + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + while (bytesCounter.get() < config.messageSize()) { + } + bytesCounter.set(0); + } + recording.set(false); + close(); + } + + void reset() { + stopping = false; + bytesCounter.set(0); + } + + private String[] ciphers(Config config) { + return new String[] {config.cipher()}; + } +}
\ No newline at end of file diff --git a/apct-tests/perftests/core/src/android/conscrypt/conscrypt/EndpointFactory.java b/apct-tests/perftests/core/src/android/conscrypt/conscrypt/EndpointFactory.java new file mode 100644 index 000000000000..ba2acb8a5205 --- /dev/null +++ b/apct-tests/perftests/core/src/android/conscrypt/conscrypt/EndpointFactory.java @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2016 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.conscrypt; + +import org.conscrypt.ChannelType; +import org.conscrypt.TestUtils; +import java.io.IOException; +import java.security.Provider; +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLServerSocketFactory; +import javax.net.ssl.SSLSocketFactory; + +/** + * Utility for creating test client and server instances. + */ +public enum EndpointFactory { + CONSCRYPT(newConscryptFactories(false)), + CONSCRYPT_ENGINE(newConscryptFactories(true)); + + private final Factories factories; + + EndpointFactory(Factories factories) { + this.factories = factories; + } + + public ClientEndpoint newClient(ChannelType channelType, int port, String[] protocols, + String[] ciphers) throws IOException { + return new ClientEndpoint( + factories.clientFactory, channelType, port, protocols, ciphers); + } + + public ServerEndpoint newServer(int messageSize, + String[] protocols, String[] ciphers) throws IOException { + return new ServerEndpoint(factories.serverFactory, factories.serverSocketFactory, + messageSize, protocols, ciphers); + } + + private static final class Factories { + final SSLSocketFactory clientFactory; + final SSLSocketFactory serverFactory; + final SSLServerSocketFactory serverSocketFactory; + + private Factories(SSLSocketFactory clientFactory, SSLSocketFactory serverFactory, + SSLServerSocketFactory serverSocketFactory) { + this.clientFactory = clientFactory; + this.serverFactory = serverFactory; + this.serverSocketFactory = serverSocketFactory; + } + } + + private static Factories newConscryptFactories(boolean useEngineSocket) { + Provider provider = TestUtils.getConscryptProvider(); + SSLContext clientContext = TestUtils.newClientSslContext(provider); + SSLContext serverContext = TestUtils.newServerSslContext(provider); + final SSLSocketFactory clientFactory = clientContext.getSocketFactory(); + final SSLSocketFactory serverFactory = serverContext.getSocketFactory(); + final SSLServerSocketFactory serverSocketFactory = serverContext.getServerSocketFactory(); + TestUtils.setUseEngineSocket(clientFactory, useEngineSocket); + TestUtils.setUseEngineSocket(serverFactory, useEngineSocket); + TestUtils.setUseEngineSocket(serverSocketFactory, useEngineSocket); + return new Factories(clientFactory, serverFactory, serverSocketFactory); + } +}
\ No newline at end of file diff --git a/apct-tests/perftests/core/src/android/conscrypt/conscrypt/EngineFactory.java b/apct-tests/perftests/core/src/android/conscrypt/conscrypt/EngineFactory.java new file mode 100644 index 000000000000..8a0d52dff3b1 --- /dev/null +++ b/apct-tests/perftests/core/src/android/conscrypt/conscrypt/EngineFactory.java @@ -0,0 +1,68 @@ +/* + * Copyright 2017 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package android.conscrypt; + +import org.conscrypt.TestUtils; +import java.security.Security; +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLEngine; + + +/** + * Factory for {@link SSLEngine} instances. + */ +public class EngineFactory { + public EngineFactory() { + this(newConscryptClientContext(), newConscryptServerContext()); + } + + private EngineFactory(SSLContext clientContext, SSLContext serverContext) { + this.clientContext = clientContext; + this.serverContext = serverContext; + } + + private final SSLContext clientContext; + private final SSLContext serverContext; + + public SSLEngine newClientEngine(String cipher) { + SSLEngine engine = initEngine(clientContext.createSSLEngine(), cipher, true); + return engine; + } + + public SSLEngine newServerEngine(String cipher) { + SSLEngine engine = initEngine(serverContext.createSSLEngine(), cipher, false); + return engine; + } + + public void dispose(SSLEngine engine) { + engine.closeOutbound(); + } + + private static SSLContext newConscryptClientContext() { + return TestUtils.newClientSslContext(TestUtils.getConscryptProvider()); + } + + private static SSLContext newConscryptServerContext() { + return TestUtils.newServerSslContext(TestUtils.getConscryptProvider()); + } + + static SSLEngine initEngine(SSLEngine engine, String cipher, boolean client) { + engine.setEnabledProtocols(new String[]{"TLSv1.2", "TLSv1.3"}); + engine.setEnabledCipherSuites(new String[] {cipher}); + engine.setUseClientMode(client); + return engine; + } +}
\ No newline at end of file diff --git a/apct-tests/perftests/core/src/android/conscrypt/conscrypt/EngineHandshakePerfTest.java b/apct-tests/perftests/core/src/android/conscrypt/conscrypt/EngineHandshakePerfTest.java new file mode 100644 index 000000000000..cd0ac96b41de --- /dev/null +++ b/apct-tests/perftests/core/src/android/conscrypt/conscrypt/EngineHandshakePerfTest.java @@ -0,0 +1,207 @@ +/* + * Copyright 2017 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. + */ + +/* + * Copyright 2017 The Netty Project + * + * The Netty Project licenses this file to you under the Apache License, + * version 2.0 (the "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +package android.conscrypt; + +import java.nio.ByteBuffer; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import javax.net.ssl.SSLEngine; +import javax.net.ssl.SSLEngineResult; +import javax.net.ssl.SSLEngineResult.HandshakeStatus; +import javax.net.ssl.SSLException; + +import junitparams.JUnitParamsRunner; +import junitparams.Parameters; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import androidx.test.filters.LargeTest; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * Benchmark comparing handshake performance of various engine implementations to conscrypt. + */ +@RunWith(JUnitParamsRunner.class) +@LargeTest +public final class EngineHandshakePerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + + /** + * Provider for the test configuration + */ + private class Config { + BufferType a_bufferType; + String c_cipher; + int d_rttMillis; + Config(BufferType bufferType, + String cipher, + int rttMillis) { + a_bufferType = bufferType; + c_cipher = cipher; + d_rttMillis = rttMillis; + } + public BufferType bufferType() { + return a_bufferType; + } + + public String cipher() { + return c_cipher; + } + + public int rttMillis() { + return d_rttMillis; + } + } + + public Collection getParams() { + final List<Object[]> params = new ArrayList<>(); + for (BufferType bufferType : BufferType.values()) { + params.add(new Object[] {new Config(bufferType, + "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", 100)}); + } + return params; + } + + private static final ByteBuffer EMPTY_BUFFER = ByteBuffer.allocateDirect(0); + + private EngineFactory engineFactory = new EngineFactory(); + private String cipher; + private int rttMillis; + + private ByteBuffer clientApplicationBuffer; + private ByteBuffer clientPacketBuffer; + private ByteBuffer serverApplicationBuffer; + private ByteBuffer serverPacketBuffer; + + private void setup(Config config) throws Exception { + cipher = config.cipher(); + rttMillis = config.rttMillis(); + BufferType bufferType = config.bufferType(); + + SSLEngine clientEngine = engineFactory.newClientEngine(cipher); + SSLEngine serverEngine = engineFactory.newServerEngine(cipher); + + // Create the application and packet buffers for both endpoints. + clientApplicationBuffer = bufferType.newApplicationBuffer(clientEngine); + serverApplicationBuffer = bufferType.newApplicationBuffer(serverEngine); + clientPacketBuffer = bufferType.newPacketBuffer(clientEngine); + serverPacketBuffer = bufferType.newPacketBuffer(serverEngine); + + engineFactory.dispose(clientEngine); + engineFactory.dispose(serverEngine); + } + + @Test + @Parameters(method = "getParams") + public void handshake(Config config) throws Exception { + setup(config); + SSLEngine client = engineFactory.newClientEngine(cipher); + SSLEngine server = engineFactory.newServerEngine(cipher); + clientApplicationBuffer.clear(); + clientPacketBuffer.clear(); + serverApplicationBuffer.clear(); + serverPacketBuffer.clear(); + + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + client.beginHandshake(); + server.beginHandshake(); + doHandshake(client, server); + } + + engineFactory.dispose(client); + engineFactory.dispose(server); + } + + private void doHandshake(SSLEngine client, SSLEngine server) throws SSLException { + + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + // Send as many client-to-server messages as possible + doHalfHandshake(client, server, clientPacketBuffer, serverApplicationBuffer); + + if (client.getHandshakeStatus() == HandshakeStatus.NOT_HANDSHAKING + && server.getHandshakeStatus() == HandshakeStatus.NOT_HANDSHAKING) { + return; + } + + // Do the same with server-to-client messages + doHalfHandshake(server, client, serverPacketBuffer, clientApplicationBuffer); + + if (client.getHandshakeStatus() == HandshakeStatus.NOT_HANDSHAKING + && server.getHandshakeStatus() == HandshakeStatus.NOT_HANDSHAKING) { + return; + } + } + } + + private void doHalfHandshake(SSLEngine sender, SSLEngine receiver, + ByteBuffer senderPacketBuffer, ByteBuffer receiverApplicationBuffer) + throws SSLException { + SSLEngineResult senderResult; + SSLEngineResult receiverResult; + + do { + senderResult = sender.wrap(EMPTY_BUFFER, senderPacketBuffer); + runDelegatedTasks(senderResult, sender); + senderPacketBuffer.flip(); + receiverResult = receiver.unwrap(senderPacketBuffer, receiverApplicationBuffer); + runDelegatedTasks(receiverResult, receiver); + senderPacketBuffer.compact(); + } while (senderResult.getHandshakeStatus() == HandshakeStatus.NEED_WRAP); + + if (rttMillis > 0) { + try { + Thread.sleep(rttMillis / 2); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + } + } + + private static void runDelegatedTasks(SSLEngineResult result, SSLEngine engine) { + if (result.getHandshakeStatus() == SSLEngineResult.HandshakeStatus.NEED_TASK) { + for (;;) { + Runnable task = engine.getDelegatedTask(); + if (task == null) { + break; + } + task.run(); + } + } + } +}
\ No newline at end of file diff --git a/apct-tests/perftests/core/src/android/conscrypt/conscrypt/EngineWrapPerfTest.java b/apct-tests/perftests/core/src/android/conscrypt/conscrypt/EngineWrapPerfTest.java new file mode 100644 index 000000000000..1fee2183b11e --- /dev/null +++ b/apct-tests/perftests/core/src/android/conscrypt/conscrypt/EngineWrapPerfTest.java @@ -0,0 +1,221 @@ +/* + * Copyright 2017 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. + */ + +/* + * Copyright 2017 The Netty Project + * + * The Netty Project licenses this file to you under the Apache License, + * version 2.0 (the "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +package android.conscrypt; + +import static org.conscrypt.TestUtils.doEngineHandshake; +import static org.conscrypt.TestUtils.newTextMessage; +import static org.junit.Assert.assertEquals; + +import java.nio.ByteBuffer; +import java.util.Locale; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import javax.net.ssl.SSLEngine; +import javax.net.ssl.SSLEngineResult; +import javax.net.ssl.SSLException; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import androidx.test.filters.LargeTest; + +import junitparams.JUnitParamsRunner; +import junitparams.Parameters; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * Benchmark comparing performance of various engine implementations to conscrypt. + */ +@RunWith(JUnitParamsRunner.class) +@LargeTest +public final class EngineWrapPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + + /** + * Provider for the benchmark configuration + */ + private class Config { + BufferType a_bufferType; + int c_messageSize; + String d_cipher; + Config(BufferType bufferType, + int messageSize, + String cipher) { + a_bufferType = bufferType; + c_messageSize = messageSize; + d_cipher = cipher; + } + public BufferType bufferType() { + return a_bufferType; + } + + public int messageSize() { + return c_messageSize; + } + + public String cipher() { + return d_cipher; + } + } + + public Collection getParams() { + final List<Object[]> params = new ArrayList<>(); + for (BufferType bufferType : BufferType.values()) { + params.add(new Object[] {new Config(bufferType, 64, + "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256")}); + params.add(new Object[] {new Config(bufferType, 512, + "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256")}); + params.add(new Object[] {new Config(bufferType, 4096, + "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256")}); + } + return params; + } + + + private EngineFactory engineFactory = new EngineFactory(); + private String cipher; + private SSLEngine clientEngine; + private SSLEngine serverEngine; + + private ByteBuffer messageBuffer; + private ByteBuffer clientApplicationBuffer; + private ByteBuffer clientPacketBuffer; + private ByteBuffer serverApplicationBuffer; + private ByteBuffer serverPacketBuffer; + private ByteBuffer preEncryptedBuffer; + + private void setup(Config config) throws Exception { + cipher = config.cipher(); + BufferType bufferType = config.bufferType(); + + clientEngine = engineFactory.newClientEngine(cipher); + serverEngine = engineFactory.newServerEngine(cipher); + + // Create the application and packet buffers for both endpoints. + clientApplicationBuffer = bufferType.newApplicationBuffer(clientEngine); + serverApplicationBuffer = bufferType.newApplicationBuffer(serverEngine); + clientPacketBuffer = bufferType.newPacketBuffer(clientEngine); + serverPacketBuffer = bufferType.newPacketBuffer(serverEngine); + + // Generate the message to be sent from the client. + int messageSize = config.messageSize(); + messageBuffer = bufferType.newBuffer(messageSize); + messageBuffer.put(newTextMessage(messageSize)); + messageBuffer.flip(); + + // Complete the initial TLS handshake. + doEngineHandshake(clientEngine, serverEngine, clientApplicationBuffer, clientPacketBuffer, + serverApplicationBuffer, serverPacketBuffer, true); + + // Populate the pre-encrypted buffer for use with the unwrap benchmark. + preEncryptedBuffer = bufferType.newBuffer(clientEngine.getSession().getPacketBufferSize()); + doWrap(messageBuffer, preEncryptedBuffer); + doUnwrap(preEncryptedBuffer, serverApplicationBuffer); + } + + void teardown() { + engineFactory.dispose(clientEngine); + engineFactory.dispose(serverEngine); + } + + @Test + @Parameters(method = "getParams") + public void wrap(Config config) throws Exception { + setup(config); + + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + // Reset the buffers. + messageBuffer.position(0); + clientPacketBuffer.clear(); + // Wrap the original message and create the encrypted data. + doWrap(messageBuffer, clientPacketBuffer); + + // Lightweight comparison - just make sure the data length is correct. + assertEquals(preEncryptedBuffer.limit(), clientPacketBuffer.limit()); + } + teardown(); + } + + /** + * Simple benchmark that sends a single message from client to server. + */ + @Test + @Parameters(method = "getParams") + public void wrapAndUnwrap(Config config) throws Exception { + setup(config); + + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + // Reset the buffers. + messageBuffer.position(0); + clientPacketBuffer.clear(); + serverApplicationBuffer.clear(); + // Wrap the original message and create the encrypted data. + doWrap(messageBuffer, clientPacketBuffer); + + // Unwrap the encrypted data and get back the original result. + doUnwrap(clientPacketBuffer, serverApplicationBuffer); + + // Lightweight comparison - just make sure the unencrypted data length is correct. + assertEquals(messageBuffer.limit(), serverApplicationBuffer.limit()); + } + teardown(); + } + + private void doWrap(ByteBuffer src, ByteBuffer dst) throws SSLException { + // Wrap the original message and create the encrypted data. + verifyResult(src, clientEngine.wrap(src, dst)); + dst.flip(); + } + + private void doUnwrap(ByteBuffer src, ByteBuffer dst) throws SSLException { + verifyResult(src, serverEngine.unwrap(src, dst)); + dst.flip(); + } + + private void verifyResult(ByteBuffer src, SSLEngineResult result) { + if (result.getStatus() != SSLEngineResult.Status.OK) { + throw new RuntimeException("Operation returned unexpected result " + result); + } + if (result.bytesConsumed() != src.limit()) { + throw new RuntimeException( + String.format(Locale.US, + "Operation didn't consume all bytes. Expected %d, consumed %d.", + src.limit(), result.bytesConsumed())); + } + } +}
\ No newline at end of file diff --git a/apct-tests/perftests/core/src/android/conscrypt/conscrypt/OWNERS b/apct-tests/perftests/core/src/android/conscrypt/conscrypt/OWNERS new file mode 100644 index 000000000000..7efabfd3758c --- /dev/null +++ b/apct-tests/perftests/core/src/android/conscrypt/conscrypt/OWNERS @@ -0,0 +1,2 @@ +# Bug component: 24949 +include platform/libcore:/OWNERS
\ No newline at end of file diff --git a/apct-tests/perftests/core/src/android/conscrypt/conscrypt/PerfTestProtocol.java b/apct-tests/perftests/core/src/android/conscrypt/conscrypt/PerfTestProtocol.java new file mode 100644 index 000000000000..4defe71fcddd --- /dev/null +++ b/apct-tests/perftests/core/src/android/conscrypt/conscrypt/PerfTestProtocol.java @@ -0,0 +1,33 @@ +/* + * Copyright 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.conscrypt; + +public enum PerfTestProtocol { + + TLSv13("TLSv1.3"), + TLSv12("TLSv1.2"); + + private final String[] protocols; + + PerfTestProtocol(String... protocols) { + this.protocols = protocols; + } + + public String[] getProtocols() { + return protocols.clone(); + } +}
\ No newline at end of file diff --git a/apct-tests/perftests/core/src/android/conscrypt/conscrypt/ServerEndpoint.java b/apct-tests/perftests/core/src/android/conscrypt/conscrypt/ServerEndpoint.java new file mode 100644 index 000000000000..1e4f12460936 --- /dev/null +++ b/apct-tests/perftests/core/src/android/conscrypt/conscrypt/ServerEndpoint.java @@ -0,0 +1,195 @@ +/* + * Copyright 2017 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.conscrypt; + +import java.io.EOFException; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.ServerSocket; +import java.net.SocketException; +import java.nio.channels.ClosedChannelException; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; +import javax.net.ssl.SSLException; +import javax.net.ssl.SSLServerSocketFactory; +import javax.net.ssl.SSLSocket; +import javax.net.ssl.SSLSocketFactory; + +/** + * A simple socket-based test server. + */ +final class ServerEndpoint { + /** + * A processor for receipt of a single message. + */ + public interface MessageProcessor { + void processMessage(byte[] message, int numBytes, OutputStream os); + } + + /** + * A {@link MessageProcessor} that simply echos back the received message to the client. + */ + public static final class EchoProcessor implements MessageProcessor { + @Override + public void processMessage(byte[] message, int numBytes, OutputStream os) { + try { + os.write(message, 0, numBytes); + os.flush(); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + } + + private final ServerSocket serverSocket; + private final SSLSocketFactory socketFactory; + private final int messageSize; + private final String[] protocols; + private final String[] cipherSuites; + private final byte[] buffer; + private SSLSocket socket; + private ExecutorService executor; + private InputStream inputStream; + private OutputStream outputStream; + private volatile boolean stopping; + private volatile MessageProcessor messageProcessor = new EchoProcessor(); + private volatile Future<?> processFuture; + + ServerEndpoint(SSLSocketFactory socketFactory, SSLServerSocketFactory serverSocketFactory, + int messageSize, String[] protocols, + String[] cipherSuites) throws IOException { + this.serverSocket = serverSocketFactory.createServerSocket(); + this.socketFactory = socketFactory; + this.messageSize = messageSize; + this.protocols = protocols; + this.cipherSuites = cipherSuites; + buffer = new byte[messageSize]; + } + + void setMessageProcessor(MessageProcessor messageProcessor) { + this.messageProcessor = messageProcessor; + } + + Future<?> start() throws IOException { + executor = Executors.newSingleThreadExecutor(); + return executor.submit(new AcceptTask()); + } + + void stop() { + try { + stopping = true; + + if (socket != null) { + socket.close(); + socket = null; + } + + if (processFuture != null) { + processFuture.get(5, TimeUnit.SECONDS); + } + + serverSocket.close(); + + if (executor != null) { + executor.shutdown(); + executor.awaitTermination(5, TimeUnit.SECONDS); + executor = null; + } + } catch (IOException | InterruptedException | ExecutionException | TimeoutException e) { + throw new RuntimeException(e); + } + } + + public int port() { + return serverSocket.getLocalPort(); + } + + private final class AcceptTask implements Runnable { + @Override + public void run() { + try { + if (stopping) { + return; + } + socket = (SSLSocket) serverSocket.accept(); + socket.setEnabledProtocols(protocols); + socket.setEnabledCipherSuites(cipherSuites); + + socket.startHandshake(); + + inputStream = socket.getInputStream(); + outputStream = socket.getOutputStream(); + + if (stopping) { + return; + } + processFuture = executor.submit(new ProcessTask()); + } catch (IOException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + } + } + + private final class ProcessTask implements Runnable { + @Override + public void run() { + try { + Thread thread = Thread.currentThread(); + while (!stopping && !thread.isInterrupted()) { + int bytesRead = readMessage(); + if (!stopping && !thread.isInterrupted()) { + messageProcessor.processMessage(buffer, bytesRead, outputStream); + } + } + } catch (Throwable e) { + throw new RuntimeException(e); + } + } + + private int readMessage() throws IOException { + int totalBytesRead = 0; + while (!stopping && totalBytesRead < messageSize) { + try { + int remaining = messageSize - totalBytesRead; + int bytesRead = inputStream.read(buffer, totalBytesRead, remaining); + if (bytesRead == -1) { + break; + } + totalBytesRead += bytesRead; + } catch (SSLException e) { + if (e.getCause() instanceof EOFException) { + break; + } + throw e; + } catch (ClosedChannelException e) { + // Thrown for channel-based sockets. Just treat like EOF. + break; + } catch (SocketException e) { + // The socket was broken. Just treat like EOF. + break; + } + } + return totalBytesRead; + } + } +}
\ No newline at end of file diff --git a/apct-tests/perftests/core/src/android/conscrypt/conscrypt/ServerSocketPerfTest.java b/apct-tests/perftests/core/src/android/conscrypt/conscrypt/ServerSocketPerfTest.java new file mode 100644 index 000000000000..af3c405eab82 --- /dev/null +++ b/apct-tests/perftests/core/src/android/conscrypt/conscrypt/ServerSocketPerfTest.java @@ -0,0 +1,219 @@ +/* + * Copyright 2017 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.conscrypt; + +import org.conscrypt.ChannelType; +import static org.conscrypt.TestUtils.getCommonProtocolSuites; +import static org.conscrypt.TestUtils.newTextMessage; +import static org.junit.Assert.assertEquals; + +import java.io.IOException; +import java.io.OutputStream; +import java.net.SocketException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicLong; + +import android.conscrypt.ServerEndpoint.MessageProcessor; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import androidx.test.filters.LargeTest; + +import junitparams.JUnitParamsRunner; +import junitparams.Parameters; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * Benchmark for comparing performance of server socket implementations. + */ +@RunWith(JUnitParamsRunner.class) +@LargeTest +public final class ServerSocketPerfTest { + + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + + /** + * Provider for the benchmark configuration + */ + private class Config { + EndpointFactory a_clientFactory; + EndpointFactory b_serverFactory; + int c_messageSize; + String d_cipher; + ChannelType e_channelType; + Config(EndpointFactory clientFactory, + EndpointFactory serverFactory, + int messageSize, + String cipher, + ChannelType channelType) { + a_clientFactory = clientFactory; + b_serverFactory = serverFactory; + c_messageSize = messageSize; + d_cipher = cipher; + e_channelType = channelType; + } + public EndpointFactory clientFactory() { + return a_clientFactory; + } + + public EndpointFactory serverFactory() { + return b_serverFactory; + } + + public int messageSize() { + return c_messageSize; + } + + public String cipher() { + return d_cipher; + } + + public ChannelType channelType() { + return e_channelType; + } + } + + public Collection getParams() { + final List<Object[]> params = new ArrayList<>(); + for (EndpointFactory endpointFactory : EndpointFactory.values()) { + for (ChannelType channelType : ChannelType.values()) { + params.add(new Object[] {new Config(endpointFactory, + endpointFactory, 64, + "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", channelType)}); + params.add(new Object[] {new Config(endpointFactory, + endpointFactory, 512, + "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", channelType)}); + params.add(new Object[] {new Config(endpointFactory, + endpointFactory, 4096, + "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", channelType)}); + } + } + return params; + } + + private ClientEndpoint client; + private ServerEndpoint server; + private ExecutorService executor; + private Future<?> receivingFuture; + private volatile boolean stopping; + private static final AtomicLong bytesCounter = new AtomicLong(); + private AtomicBoolean recording = new AtomicBoolean(); + + private void setup(final Config config) throws Exception { + recording.set(false); + + byte[] message = newTextMessage(config.messageSize()); + + final ChannelType channelType = config.channelType(); + + server = config.serverFactory().newServer(config.messageSize(), + new String[] {"TLSv1.3", "TLSv1.2"}, ciphers(config)); + server.setMessageProcessor(new MessageProcessor() { + @Override + public void processMessage(byte[] inMessage, int numBytes, OutputStream os) { + try { + try { + while (!stopping) { + os.write(inMessage, 0, numBytes); + } + } finally { + os.flush(); + } + } catch (SocketException e) { + // Just ignore. + } catch (IOException e) { + throw new RuntimeException(e); + } + } + }); + + Future<?> connectedFuture = server.start(); + + // Always use the same client for consistency across the benchmarks. + client = config.clientFactory().newClient( + ChannelType.CHANNEL, server.port(), + new String[] {"TLSv1.3", "TLSv1.2"}, ciphers(config)); + client.start(); + + // Wait for the initial connection to complete. + connectedFuture.get(5, TimeUnit.SECONDS); + + // Start the server-side streaming by sending a message to the server. + client.sendMessage(message); + client.flush(); + + executor = Executors.newSingleThreadExecutor(); + receivingFuture = executor.submit(new Runnable() { + @Override + public void run() { + Thread thread = Thread.currentThread(); + byte[] buffer = new byte[config.messageSize()]; + while (!stopping && !thread.isInterrupted()) { + int numBytes = client.readMessage(buffer); + if (numBytes < 0) { + return; + } + assertEquals(config.messageSize(), numBytes); + + // Increment the message counter if we're recording. + if (recording.get()) { + bytesCounter.addAndGet(numBytes); + } + } + } + }); + } + + void close() throws Exception { + stopping = true; + // Stop and wait for sending to complete. + server.stop(); + client.stop(); + executor.shutdown(); + receivingFuture.get(5, TimeUnit.SECONDS); + executor.awaitTermination(5, TimeUnit.SECONDS); + } + + @Test + @Parameters(method = "getParams") + public void throughput(Config config) throws Exception { + setup(config); + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + recording.set(true); + while (bytesCounter.get() < config.messageSize()) { + } + bytesCounter.set(0); + recording.set(false); + } + close(); + } + + private String[] ciphers(Config config) { + return new String[] {config.cipher()}; + } +}
\ No newline at end of file diff --git a/apct-tests/perftests/core/src/android/conscrypt/conscrypt/Transformation.java b/apct-tests/perftests/core/src/android/conscrypt/conscrypt/Transformation.java new file mode 100644 index 000000000000..3542b0a76803 --- /dev/null +++ b/apct-tests/perftests/core/src/android/conscrypt/conscrypt/Transformation.java @@ -0,0 +1,87 @@ +/* + * Copyright 2017 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.conscrypt; + +import java.security.Key; +import java.security.KeyPair; +import java.security.KeyPairGenerator; +import java.security.NoSuchAlgorithmException; +import javax.crypto.KeyGenerator; +import org.bouncycastle.jce.provider.BouncyCastleProvider; + +/** + * Supported cipher transformations. + */ +@SuppressWarnings({"ImmutableEnumChecker", "unused"}) +public enum Transformation { + AES_CBC_PKCS5("AES", "CBC", "PKCS5Padding", new AesKeyGen()), + AES_ECB_PKCS5("AES", "ECB", "PKCS5Padding", new AesKeyGen()), + AES_GCM_NO("AES", "GCM", "NoPadding", new AesKeyGen()), + RSA_ECB_PKCS1("RSA", "ECB", "PKCS1Padding", new RsaKeyGen()); + + Transformation(String algorithm, String mode, String padding, KeyGen keyGen) { + this.algorithm = algorithm; + this.mode = mode; + this.padding = padding; + this.keyGen = keyGen; + } + + final String algorithm; + final String mode; + final String padding; + final KeyGen keyGen; + + String toFormattedString() { + return algorithm + "/" + mode + "/" + padding; + } + + Key newEncryptKey() { + return keyGen.newEncryptKey(); + } + + private interface KeyGen { Key newEncryptKey(); } + + private static final class RsaKeyGen implements KeyGen { + @Override + public Key newEncryptKey() { + try { + // Use Bouncy castle + KeyPairGenerator generator = + KeyPairGenerator.getInstance("RSA", new BouncyCastleProvider()); + generator.initialize(2048); + KeyPair pair = generator.generateKeyPair(); + return pair.getPublic(); + } catch (NoSuchAlgorithmException e) { + throw new RuntimeException(e); + } + } + } + + private static final class AesKeyGen implements KeyGen { + @Override + public Key newEncryptKey() { + try { + // Just use the JDK's provider. + KeyGenerator keyGen = KeyGenerator.getInstance("AES"); + keyGen.init(256); + return keyGen.generateKey(); + } catch (NoSuchAlgorithmException e) { + throw new RuntimeException(e); + } + } + } +}
\ No newline at end of file diff --git a/apct-tests/perftests/core/src/android/libcore/AdditionPerfTest.java b/apct-tests/perftests/core/src/android/libcore/AdditionPerfTest.java index 80cd86cf9a5b..237c747e3a6f 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 @@ import org.junit.runner.RunWith; 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 @@ public class AdditionPerfTest { } @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 @@ public class AdditionPerfTest { } @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 @@ public class AdditionPerfTest { } @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 @@ public class AdditionPerfTest { } @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 @@ public class AdditionPerfTest { } @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 @@ public class AdditionPerfTest { } @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 @@ public class AdditionPerfTest { } @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 2f6c37832d04..1222bc242564 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 @@ import java.util.Arrays; 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 @@ public class ArrayCopyPerfTest { @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 @@ public class ArrayCopyPerfTest { @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 @@ public class ArrayCopyPerfTest { @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 d17add767257..3f95e3e44f84 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 @@ public class ArrayIterationPerfTest { } @Rule - public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); Foo[] mArray = new Foo[27]; { @@ -46,7 +46,7 @@ public class ArrayIterationPerfTest { } @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 @@ public class ArrayIterationPerfTest { } @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 @@ public class ArrayIterationPerfTest { } @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 3a57db8f323f..1423a13b43dc 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 @@ public class ArrayListIterationPerfTest { int mSplat; } @Rule - public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); ArrayList<Foo> mList = new ArrayList<Foo>(); { @@ -47,7 +47,7 @@ public class ArrayListIterationPerfTest { } @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 @@ public class ArrayListIterationPerfTest { } @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 3fb3bc8c0ff2..02831055ff56 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 @@ import java.math.BigInteger; @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 @@ public class BigIntegerPerfTest { // 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 @@ public class BigIntegerPerfTest { // 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 @@ public class BigIntegerPerfTest { // 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 @@ public class BigIntegerPerfTest { // 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 @@ public class BigIntegerPerfTest { // 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 @@ public class BigIntegerPerfTest { // 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 2a1b5d1cc6ce..11ca73acd45b 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 @@ import java.util.zip.ZipOutputStream; @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 @@ public final class BufferedZipFilePerfTest { @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 @@ public final class BufferedZipFilePerfTest { @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 5f599ea85eb4..0abe194b6fdb 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 @@ import org.junit.runner.RunWith; @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 @@ public class ClassLoaderResourcePerfTest { 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 @@ public class ClassLoaderResourcePerfTest { 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 ea249848daad..52441d1d868e 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 @@ import org.junit.runner.RunWith; @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 class ClonePerfTest { 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 class ClonePerfTest { 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 class ClonePerfTest { 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 @@ public class ClonePerfTest { @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 @@ public class ClonePerfTest { 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 @@ public class ClonePerfTest { 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 82247dcee772..e6c5aca2c330 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 @@ import java.util.Collection; @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 @@ public class DeepArrayOpsPerfTest { @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 @@ public class DeepArrayOpsPerfTest { @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 0bebf04c6897..378137b417e9 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 @@ import org.junit.runner.RunWith; @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 @@ public class FieldAccessPerfTest { @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 @@ public class FieldAccessPerfTest { @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 @@ public class FieldAccessPerfTest { @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 @@ public class FieldAccessPerfTest { @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 class FieldAccessPerfTest { 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 class FieldAccessPerfTest { 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 class FieldAccessPerfTest { 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 class FieldAccessPerfTest { 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 class FieldAccessPerfTest { 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 55c1027e1add..610e8e56c951 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 @@ import java.util.concurrent.ConcurrentHashMap; @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 @@ public class HashedCollectionsPerfTest { 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 class HashedCollectionsPerfTest { 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 class HashedCollectionsPerfTest { 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 class HashedCollectionsPerfTest { 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 da60a7773528..40c07e05bbde 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 @@ import org.junit.runner.RunWith; @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 @@ public class ImtConflictPerfTest { @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 @@ public class ImtConflictPerfTest { @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 @@ public class ImtConflictPerfTest { @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 @@ public class ImtConflictPerfTest { @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 @@ public class ImtConflictPerfTest { @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 @@ public class ImtConflictPerfTest { @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 @@ public class ImtConflictPerfTest { @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 @@ public class ImtConflictPerfTest { @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 @@ public class ImtConflictPerfTest { @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 @@ public class ImtConflictPerfTest { @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 @@ public class ImtConflictPerfTest { @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 @@ public class ImtConflictPerfTest { @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 @@ public class ImtConflictPerfTest { @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 @@ public class ImtConflictPerfTest { @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 @@ public class ImtConflictPerfTest { @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 @@ public class ImtConflictPerfTest { @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 @@ public class ImtConflictPerfTest { @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 @@ public class ImtConflictPerfTest { @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 @@ public class ImtConflictPerfTest { @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 @@ public class ImtConflictPerfTest { @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 6d9d0c92ff25..e1d0bf2f9491 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 @@ import org.junit.runner.RunWith; @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 class MethodInvocationPerfTest { } 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 @@ public class MethodInvocationPerfTest { @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 @@ public class MethodInvocationPerfTest { @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 @@ public class MethodInvocationPerfTest { @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 @@ public class MethodInvocationPerfTest { @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 @@ public class MethodInvocationPerfTest { @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 @@ public class MethodInvocationPerfTest { @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 @@ public class MethodInvocationPerfTest { @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 @@ public class MethodInvocationPerfTest { @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 @@ public class MethodInvocationPerfTest { @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 09b09771e9de..c5e9d1e1d5e4 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 @@ import org.junit.runner.RunWith; @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 @@ public class MultiplicationPerfTest { @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 class MultiplicationPerfTest { 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 class MultiplicationPerfTest { 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 ba21ed33bdb2..d073f9163f39 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 @@ import java.lang.reflect.Field; @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 @@ public class ReferenceGetPerfTest { @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 @@ public class ReferenceGetPerfTest { @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 @@ public class ReferenceGetPerfTest { 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 293752ee5dd1..af13773dd177 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 @@ import java.util.concurrent.atomic.AtomicInteger; @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 @@ public class ReferencePerfTest { @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 @@ public class ReferencePerfTest { @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 @@ public class ReferencePerfTest { @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 @@ public class ReferencePerfTest { @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 @@ public class ReferencePerfTest { // 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 528b751d1551..cf573fa6f250 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 @@ import java.util.Random; @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 class SmallBigIntegerPerfTest { 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 1f301acd1dc6..d28154c76067 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 @@ import org.junit.runner.RunWith; @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 4268325f8c64..40a8db0c5903 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 @@ import org.junit.runner.RunWith; @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 @@ public class StringIterationPerfTest { @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 @@ public class StringIterationPerfTest { @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 @@ public class StringIterationPerfTest { @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 6363e9c3ef21..25e4c4341b43 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 @@ import java.util.Collection; @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 @@ public class SystemArrayCopyPerfTest { 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 @@ public class SystemArrayCopyPerfTest { 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 @@ public class SystemArrayCopyPerfTest { 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 @@ public class SystemArrayCopyPerfTest { 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 @@ public class SystemArrayCopyPerfTest { 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 @@ public class SystemArrayCopyPerfTest { 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 @@ public class SystemArrayCopyPerfTest { 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 @@ public class SystemArrayCopyPerfTest { 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 cb3d3acb337f..147ea50f3a3c 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 @@ import java.util.Map; @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 @@ public class VirtualVersusInterfacePerfTest { @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 5be8ee6e67e2..bb1c298c67b2 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 @@ import java.util.Random; @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 @@ public class XmlSerializePerfTest { 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 a37b89ddf033..9360a25fc86a 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 @@ import java.nio.charset.StandardCharsets; 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 @@ public class XmlSerializerPerfTest { @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 @@ public class XmlSerializerPerfTest { @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 @@ public class XmlSerializerPerfTest { @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 ed669beae1ce..03f183a01d11 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 @@ import java.util.zip.ZipOutputStream; @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 @@ public class ZipFilePerfTest { @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 d239a054fac7..36140611c978 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 @@ import java.util.zip.ZipOutputStream; @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 @@ public class ZipFileReadPerfTest { @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 487295c03c0e..8890f51fe5cd 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 @@ import java.lang.reflect.Method; @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 @@ public class AnnotatedElementPerfTest { @Test public void timeGetTypeAnnotations() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { mType.getAnnotations(); } @@ -60,7 +61,7 @@ public class AnnotatedElementPerfTest { @Test public void timeGetFieldAnnotations() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { mField.getAnnotations(); } @@ -68,7 +69,7 @@ public class AnnotatedElementPerfTest { @Test public void timeGetMethodAnnotations() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { mMethod.getAnnotations(); } @@ -76,7 +77,7 @@ public class AnnotatedElementPerfTest { @Test public void timeGetParameterAnnotations() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { mMethod.getParameterAnnotations(); } @@ -84,7 +85,7 @@ public class AnnotatedElementPerfTest { @Test public void timeGetTypeAnnotation() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { mType.getAnnotation(Marker.class); } @@ -92,7 +93,7 @@ public class AnnotatedElementPerfTest { @Test public void timeGetFieldAnnotation() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { mField.getAnnotation(Marker.class); } @@ -100,7 +101,7 @@ public class AnnotatedElementPerfTest { @Test public void timeGetMethodAnnotation() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { mMethod.getAnnotation(Marker.class); } @@ -108,7 +109,7 @@ public class AnnotatedElementPerfTest { @Test public void timeIsTypeAnnotationPresent() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { mType.isAnnotationPresent(Marker.class); } @@ -116,7 +117,7 @@ public class AnnotatedElementPerfTest { @Test public void timeIsFieldAnnotationPresent() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { mField.isAnnotationPresent(Marker.class); } @@ -124,7 +125,7 @@ public class AnnotatedElementPerfTest { @Test public void timeIsMethodAnnotationPresent() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { mMethod.isAnnotationPresent(Marker.class); } @@ -134,7 +135,7 @@ public class AnnotatedElementPerfTest { @Test public void timeGetAllReturnsLargeAnnotation() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { HasLargeAnnotation.class.getAnnotations(); } @@ -142,7 +143,7 @@ public class AnnotatedElementPerfTest { @Test public void timeGetAllReturnsSmallAnnotation() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { HasSmallAnnotation.class.getAnnotations(); } @@ -150,7 +151,7 @@ public class AnnotatedElementPerfTest { @Test public void timeGetAllReturnsMarkerAnnotation() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { HasMarkerAnnotation.class.getAnnotations(); } @@ -158,7 +159,7 @@ public class AnnotatedElementPerfTest { @Test public void timeGetAllReturnsNoAnnotation() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { HasNoAnnotations.class.getAnnotations(); } @@ -166,7 +167,7 @@ public class AnnotatedElementPerfTest { @Test public void timeGetAllReturnsThreeAnnotations() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { HasThreeAnnotations.class.getAnnotations(); } @@ -176,7 +177,7 @@ public class AnnotatedElementPerfTest { @Test public void timeGetAnnotationsOnSubclass() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { ExtendsHasThreeAnnotations.class.getAnnotations(); } @@ -184,7 +185,7 @@ public class AnnotatedElementPerfTest { @Test public void timeGetDeclaredAnnotationsOnSubclass() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { ExtendsHasThreeAnnotations.class.getDeclaredAnnotations(); } @@ -194,7 +195,7 @@ public class AnnotatedElementPerfTest { @Test public void timeGetDeclaredClasses() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { AnnotatedElementPerfTest.class.getDeclaredClasses(); } @@ -202,7 +203,7 @@ public class AnnotatedElementPerfTest { @Test public void timeGetDeclaringClass() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { HasSmallAnnotation.class.getDeclaringClass(); } @@ -211,7 +212,7 @@ public class AnnotatedElementPerfTest { @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 @@ public class AnnotatedElementPerfTest { @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 @@ public class AnnotatedElementPerfTest { @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 @@ public class AnnotatedElementPerfTest { @Test public void timeGetModifiers() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { HasSmallAnnotation.class.getModifiers(); } @@ -245,7 +246,7 @@ public class AnnotatedElementPerfTest { @Test public void timeGetSimpleName() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { HasSmallAnnotation.class.getSimpleName(); } @@ -254,7 +255,7 @@ public class AnnotatedElementPerfTest { @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 @@ public class AnnotatedElementPerfTest { @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 adc5d8c2bb3e..baab8602b265 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 @@ import java.text.DecimalFormat; @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 @@ public class BidiPerfTest { @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 @@ public class BidiPerfTest { @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 @@ public class BidiPerfTest { @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 @@ public class BidiPerfTest { @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 @@ public class BidiPerfTest { @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 @@ public class BidiPerfTest { @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 286d70339c5f..8a539f89d3ca 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 @@ import java.util.Random; @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 @@ public class BigIntegerPerfTest { 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 @@ public class BigIntegerPerfTest { 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 d6462024a380..1b46ff4f433a 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 @@ import java.util.Collection; @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 @@ public class BitSetPerfTest { @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 class BitSetPerfTest { 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 @@ public class BitSetPerfTest { @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 @@ public class BitSetPerfTest { @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 class BitSetPerfTest { 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 class BitSetPerfTest { 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 class BitSetPerfTest { 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 b887f4033462..3c5e4fd159c8 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 @@ import java.util.Locale; @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 @@ public final class BreakIteratorPerfTest { @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 @@ public final class BreakIteratorPerfTest { @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 e4eaf12e9dcb..6df67bccae06 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 @@ import java.util.Collection; @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 @@ public class BulkPerfTest { 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 cb2438e519da..4cf46e5364ea 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 @@ import java.util.Collection; @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 class ByteBufferPerfTest { 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 @@ public class ByteBufferPerfTest { 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 class ByteBufferPerfTest { 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 class ByteBufferPerfTest { 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 @@ public class ByteBufferPerfTest { 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 class ByteBufferPerfTest { 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 class ByteBufferPerfTest { 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 @@ public class ByteBufferPerfTest { 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 class ByteBufferPerfTest { 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 @@ public class ByteBufferPerfTest { 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 class ByteBufferPerfTest { 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 @@ public class ByteBufferPerfTest { 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 class ByteBufferPerfTest { 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 @@ public class ByteBufferPerfTest { 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 class ByteBufferPerfTest { 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 @@ public class ByteBufferPerfTest { 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 class ByteBufferPerfTest { 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 @@ public class ByteBufferPerfTest { 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 class ByteBufferPerfTest { 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 @@ public class ByteBufferPerfTest { 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 class ByteBufferPerfTest { 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 @@ public class ByteBufferPerfTest { 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 class ByteBufferPerfTest { 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 @@ public class ByteBufferPerfTest { 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 class ByteBufferPerfTest { 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 @@ public class ByteBufferPerfTest { 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 class ByteBufferPerfTest { 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 @@ public class ByteBufferPerfTest { 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 class ByteBufferPerfTest { 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 @@ public class ByteBufferPerfTest { 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 @@ public class ByteBufferPerfTest { @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 @@ public class ByteBufferPerfTest { @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 9ee927cfc353..8c318cd0a298 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 @@ import java.util.Collection; @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 @@ public class ByteBufferScalarVersusVectorPerfTest { 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 class ByteBufferScalarVersusVectorPerfTest { 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 class ByteBufferScalarVersusVectorPerfTest { 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 e4a4db739235..12c1f8cca0ec 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 @@ import java.util.Collection; @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 class CharacterPerfTest { 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 @@ public class CharacterPerfTest { @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 @@ public class CharacterPerfTest { @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 @@ public class CharacterPerfTest { @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 @@ public class CharacterPerfTest { @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 @@ public class CharacterPerfTest { @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 @@ public class CharacterPerfTest { @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 @@ public class CharacterPerfTest { @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 @@ public class CharacterPerfTest { @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 @@ public class CharacterPerfTest { @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 @@ public class CharacterPerfTest { @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 @@ public class CharacterPerfTest { @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 @@ public class CharacterPerfTest { @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 @@ public class CharacterPerfTest { @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 @@ public class CharacterPerfTest { @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 858c101fc33e..4dd890ad2a45 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 @@ import java.nio.charset.Charset; @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 @@ public class CharsetForNamePerfTest { @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 a2fb7d7f83d8..3a71ce9692bd 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 @@ import java.util.Collection; @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 @@ public class CharsetPerfTest { @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 @@ public class CharsetPerfTest { @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 @@ public class CharsetPerfTest { @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 @@ public class CharsetPerfTest { @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 2047444a7f52..6c30a163f519 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 @@ import java.nio.charset.Charset; @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 @@ public class CharsetUtf8PerfTest { } 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 4ce8b41de403..dcdfd371e7f6 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 @@ import java.util.zip.CRC32; @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 @@ public class ChecksumPerfTest { @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 class ChecksumPerfTest { 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 @@ public class ChecksumPerfTest { @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 6a7ec1ad62e9..6c175b191429 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 @@ import javax.crypto.spec.IvParameterSpec; @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 @@ public class CipherInputStreamPerfTest { @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 238c028fa0cf..136822ec7002 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 @@ import javax.crypto.spec.IvParameterSpec; @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 @@ public class CipherPerfTest { 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 @@ public class CipherPerfTest { 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 7e5566055fb4..9efb7ce7c2d0 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 @@ import java.util.Locale; @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 @@ public class CollatorPerfTest { @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 @@ public class CollatorPerfTest { @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 @@ public class CollatorPerfTest { @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 @@ public class CollatorPerfTest { @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 100798a7957b..4e5ceaf12403 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 @@ import java.util.Vector; @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 @@ public class CollectionsPerfTest { @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 @@ public class CollectionsPerfTest { @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 @@ public class CollectionsPerfTest { @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 @@ public class CollectionsPerfTest { @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 b6784a8d3867..b0ccd9925d83 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 @@ import java.util.Locale; @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 @@ public final class DateFormatPerfTest { @Test public void timeGetDateTimeInstance() throws Exception { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { DateFormat.getDateTimeInstance(); } @@ -58,7 +58,7 @@ public final class DateFormatPerfTest { @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 52f98738481f..3a2f6fab5460 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 @@ import java.util.Locale; @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 class DecimalFormatPerfTest { 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 class DecimalFormatPerfTest { 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 class DecimalFormatPerfTest { 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 @@ public class DecimalFormatPerfTest { @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 610542061107..4bc550ebb9f1 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 @@ import java.util.Locale; @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 fae74a5e8620..597447bef90e 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 @@ import java.nio.charset.Charset; @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 2915363786f3..b17d0f4194d8 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 @@ import java.net.UnknownHostException; @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 @@ public class DnsPerfTest { "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 dd7e5cc1057b..4c8a8eaea8c6 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 @@ import java.security.PrivilegedAction; @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 @@ public class DoPrivilegedPerfTest { @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 @@ public class DoPrivilegedPerfTest { @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 @@ public class DoPrivilegedPerfTest { @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 e034a47e79d2..4ff65b197947 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 @@ import org.junit.runner.RunWith; @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 @@ public class DoublePerfTest { @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 @@ public class DoublePerfTest { @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 @@ public class DoublePerfTest { @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 fe1b599cc5ad..aacdcee13e8d 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 @@ import java.util.List; @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 @@ public final class EqualsHashCodePerfTest { mA2 = type.newInstance("https://mail.google.com/mail/u/0/?shva=1#inbox"); mB1 = type.newInstance("http://developer.android.com/reference/java/net/URI.html"); mB2 = type.newInstance("http://developer.android.com/reference/java/net/URI.html"); - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { mA1.equals(mB1); mA1.equals(mA2); @@ -95,7 +95,7 @@ public final class EqualsHashCodePerfTest { public void timeHashCode(Type type) throws Exception { mA1 = type.newInstance("https://mail.google.com/mail/u/0/?shva=1#inbox"); mB1 = type.newInstance("http://developer.android.com/reference/java/net/URI.html"); - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { mA1.hashCode(); mB1.hashCode(); @@ -112,7 +112,7 @@ public final class EqualsHashCodePerfTest { "http://developer.android.com/query?q=" + QUERY.substring(0, QUERY.length() - 3) + "%AF"); - 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 ecbfc7169945..9a6864ea5f66 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 @@ import java.util.Locale; @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 @@ public class ExpensiveObjectsPerfTest { @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 @@ public class ExpensiveObjectsPerfTest { @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 @@ public class ExpensiveObjectsPerfTest { @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 @@ public class ExpensiveObjectsPerfTest { @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 @@ public class ExpensiveObjectsPerfTest { @Test public void timeNewDateFormatSymbols() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { new DateFormatSymbols(Locale.US); } @@ -100,7 +100,7 @@ public class ExpensiveObjectsPerfTest { @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 @@ public class ExpensiveObjectsPerfTest { @Test public void timeNewDecimalFormatSymbols() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { new DecimalFormatSymbols(Locale.US); } @@ -117,7 +117,7 @@ public class ExpensiveObjectsPerfTest { @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 @@ public class ExpensiveObjectsPerfTest { @Test public void timeNewNumberFormat() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { NumberFormat.getInstance(Locale.US); } @@ -134,7 +134,7 @@ public class ExpensiveObjectsPerfTest { @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 @@ public class ExpensiveObjectsPerfTest { @Test public void timeLongToString() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { Long.toString(1024L); } @@ -151,7 +151,7 @@ public class ExpensiveObjectsPerfTest { @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 @@ public class ExpensiveObjectsPerfTest { @Test public void timeNewSimpleDateFormat() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { new SimpleDateFormat(); } @@ -167,7 +167,7 @@ public class ExpensiveObjectsPerfTest { @Test public void timeNewGregorianCalendar() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { new GregorianCalendar(); } @@ -176,7 +176,7 @@ public class ExpensiveObjectsPerfTest { @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 0c14d64c27a9..cef7e8c739d7 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 @@ import java.io.File; @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 @@ public final class FilePerfTest { @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 7d7d83b3fdbf..645c02357970 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 @@ import org.junit.runner.RunWith; @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 @@ public class FloatPerfTest { @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 @@ public class FloatPerfTest { @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 @@ public class FloatPerfTest { @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 08dda5314eac..cf76137d5ec3 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 @@ import java.util.Locale; @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 @@ public class FormatterPerfTest { @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 @@ public class FormatterPerfTest { @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 class FormatterPerfTest { 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 @@ public class FormatterPerfTest { @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 @@ public class FormatterPerfTest { @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 @@ public class FormatterPerfTest { @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 @@ public class FormatterPerfTest { @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 @@ public class FormatterPerfTest { @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 @@ public class FormatterPerfTest { @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 @@ public class FormatterPerfTest { @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 @@ public class FormatterPerfTest { @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 @@ public class FormatterPerfTest { @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 a09ad809a6a2..833575afe8dc 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 @@ import java.net.IDN; @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 @@ public class IdnPerfTest { @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 be22814ef8f4..1c901c867fe7 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 @@ import org.junit.runner.RunWith; @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 @@ public class IntConstantDivisionPerfTest { @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 @@ public class IntConstantDivisionPerfTest { @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 @@ public class IntConstantDivisionPerfTest { @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 @@ public class IntConstantDivisionPerfTest { @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 @@ public class IntConstantDivisionPerfTest { @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 class IntConstantDivisionPerfTest { 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 class IntConstantDivisionPerfTest { 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 4337c903ecd6..3d3af4cdb04c 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 @@ import org.junit.runner.RunWith; @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 @@ public class IntConstantMultiplicationPerfTest { @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 @@ public class IntConstantMultiplicationPerfTest { @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 @@ public class IntConstantMultiplicationPerfTest { @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 @@ public class IntConstantMultiplicationPerfTest { @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 @@ public class IntConstantMultiplicationPerfTest { @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 @@ public class IntConstantMultiplicationPerfTest { @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 @@ public class IntConstantMultiplicationPerfTest { @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 @@ public class IntConstantMultiplicationPerfTest { @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 class IntConstantMultiplicationPerfTest { 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 class IntConstantMultiplicationPerfTest { 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 1b6c5026e1f6..7c86633accdc 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 @@ import org.junit.runner.RunWith; @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 @@ public class IntConstantRemainderPerfTest { @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 @@ public class IntConstantRemainderPerfTest { @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 @@ public class IntConstantRemainderPerfTest { @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 @@ public class IntConstantRemainderPerfTest { @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 class IntConstantRemainderPerfTest { 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 class IntConstantRemainderPerfTest { 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 170bb58c46ed..e2a9dcc8f93d 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 class IntegerPerfTest { 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 class IntegerPerfTest { 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 class IntegerPerfTest { 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 class IntegerPerfTest { 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 class IntegerPerfTest { 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 class IntegerPerfTest { 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 @@ public class IntegerPerfTest { "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 0aa854ecfa80..669bfbfb2b8d 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 @@ import org.junit.runner.RunWith; @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 @@ public class IntegralToStringPerfTest { @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 @@ public class IntegralToStringPerfTest { @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 @@ public class IntegralToStringPerfTest { @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 @@ public class IntegralToStringPerfTest { @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 @@ public class IntegralToStringPerfTest { @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 @@ public class IntegralToStringPerfTest { @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 @@ public class IntegralToStringPerfTest { @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 @@ public class IntegralToStringPerfTest { @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 @@ public class IntegralToStringPerfTest { @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 @@ public class IntegralToStringPerfTest { @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 @@ public class IntegralToStringPerfTest { @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 @@ public class IntegralToStringPerfTest { @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 @@ public class IntegralToStringPerfTest { @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 @@ public class IntegralToStringPerfTest { @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 @@ public class IntegralToStringPerfTest { @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 @@ public class IntegralToStringPerfTest { @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 @@ public class IntegralToStringPerfTest { @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 @@ public class IntegralToStringPerfTest { @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 @@ public class IntegralToStringPerfTest { @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 @@ public class IntegralToStringPerfTest { @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 @@ public class IntegralToStringPerfTest { @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 @@ public class IntegralToStringPerfTest { @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 @@ public class IntegralToStringPerfTest { @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 @@ public class IntegralToStringPerfTest { @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 9b3d7a044720..cda8512ad6af 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 @@ import java.util.Collection; @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 @@ public class KeyPairGeneratorPerfTest { @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 1a9e19aeb78d..8b062d390dbb 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 @@ import java.util.Collection; @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 @@ public class LoopingBackwardsPerfTest { @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 @@ public class LoopingBackwardsPerfTest { @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 a8a704c09d6d..bcf556c26716 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 @@ import org.junit.runner.RunWith; @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 @@ public class MathPerfTest { @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 @@ public class MathPerfTest { @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 @@ public class MathPerfTest { @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 @@ public class MathPerfTest { @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 @@ public class MathPerfTest { @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 @@ public class MathPerfTest { @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 @@ public class MathPerfTest { @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 @@ public class MathPerfTest { @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 @@ public class MathPerfTest { @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 @@ public class MathPerfTest { @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 @@ public class MathPerfTest { @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 @@ public class MathPerfTest { @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 @@ public class MathPerfTest { @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 @@ public class MathPerfTest { @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 @@ public class MathPerfTest { @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 @@ public class MathPerfTest { @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 @@ public class MathPerfTest { @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 @@ public class MathPerfTest { @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 @@ public class MathPerfTest { @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 @@ public class MathPerfTest { @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 @@ public class MathPerfTest { @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 @@ public class MathPerfTest { @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 @@ public class MathPerfTest { @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 @@ public class MathPerfTest { @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 @@ public class MathPerfTest { @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 @@ public class MathPerfTest { @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 @@ public class MathPerfTest { @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 @@ public class MathPerfTest { @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 @@ public class MathPerfTest { @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 @@ public class MathPerfTest { @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 @@ public class MathPerfTest { @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 @@ public class MathPerfTest { @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 @@ public class MathPerfTest { @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 @@ public class MathPerfTest { @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 @@ public class MathPerfTest { @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 @@ public class MathPerfTest { @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 @@ public class MathPerfTest { @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 @@ public class MathPerfTest { @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 @@ public class MathPerfTest { @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 @@ public class MathPerfTest { @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 @@ public class MathPerfTest { @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 @@ public class MathPerfTest { @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 @@ public class MathPerfTest { @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 @@ public class MathPerfTest { @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 @@ public class MathPerfTest { @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 @@ public class MathPerfTest { @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 @@ public class MathPerfTest { @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 @@ public class MathPerfTest { @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 @@ public class MathPerfTest { @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 @@ public class MathPerfTest { @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 @@ public class MathPerfTest { @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 @@ public class MathPerfTest { @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 @@ public class MathPerfTest { @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 @@ public class MathPerfTest { @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 @@ public class MathPerfTest { @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 @@ public class MathPerfTest { @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 6da9666db23b..8325dae67797 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 @@ import java.util.Collection; @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 @@ public class MessageDigestPerfTest { @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 @@ public class MessageDigestPerfTest { @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 @@ public class MessageDigestPerfTest { @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 @@ public class MessageDigestPerfTest { @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 @@ public class MessageDigestPerfTest { @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 @@ public class MessageDigestPerfTest { @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 @@ public class MessageDigestPerfTest { @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 @@ public class MessageDigestPerfTest { @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 @@ public class MessageDigestPerfTest { @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 060d18fb3de3..266d42cba6f0 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 @@ import java.util.concurrent.atomic.AtomicInteger; @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 @@ public final class MutableIntPerfTest { @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 7cb3b2283779..c2f84fb71405 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 @@ import java.util.Locale; @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 272b45a3affe..cdf0911c74ab 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 @@ import java.util.Locale; @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 c3a09662fd1f..51f47bb60ac7 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 @@ import java.util.Random; @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 @@ public class PriorityQueuePerfTest { // 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 2ac56bed1910..1f20cae0c162 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 @@ import java.lang.reflect.Method; @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 @@ public final class PropertyAccessPerfTest { @Test public void timeDirectSetter() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { mView.mSetX(0.1f); } @@ -58,7 +58,7 @@ public final class PropertyAccessPerfTest { @Test public void timeDirectFieldSet() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { mView.mX = 0.1f; } @@ -66,7 +66,7 @@ public final class PropertyAccessPerfTest { @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 @@ public final class PropertyAccessPerfTest { @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 @@ public final class PropertyAccessPerfTest { @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 @@ public final class PropertyAccessPerfTest { @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 @@ public final class PropertyAccessPerfTest { @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 @@ public final class PropertyAccessPerfTest { @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 @@ public final class PropertyAccessPerfTest { @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 7ad0141c8471..0c16265fa6f7 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 @@ import javax.crypto.Cipher; @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 @@ public class ProviderPerfTest { @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 c7b6cb5a190c..5f1bfc29129e 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 @@ import java.util.Random; @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 @@ public class RandomPerfTest { @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 @@ public class RandomPerfTest { @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 @@ public class RandomPerfTest { @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 44e5f227b00a..008c94c52492 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 @@ import org.junit.runner.RunWith; @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 @@ public class RealToStringPerfTest { @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 @@ public class RealToStringPerfTest { @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 @@ public class RealToStringPerfTest { @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 @@ public class RealToStringPerfTest { @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 @@ public class RealToStringPerfTest { @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 @@ public class RealToStringPerfTest { @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 @@ public class RealToStringPerfTest { @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 @@ public class RealToStringPerfTest { @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 @@ public class RealToStringPerfTest { @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 @@ public class RealToStringPerfTest { @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 @@ public class RealToStringPerfTest { @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 @@ public class RealToStringPerfTest { @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 @@ public class RealToStringPerfTest { @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 @@ public class RealToStringPerfTest { @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 @@ public class RealToStringPerfTest { @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 @@ public class RealToStringPerfTest { @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 @@ public class RealToStringPerfTest { @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 6e00b10838a6..45b623d740ee 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 @@ import java.lang.reflect.Method; @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 @@ public class ReflectionPerfTest { @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 @@ public class ReflectionPerfTest { @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 @@ public class ReflectionPerfTest { @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 class ReflectionPerfTest { 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 @@ public class ReflectionPerfTest { @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 @@ public class ReflectionPerfTest { @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 @@ public class ReflectionPerfTest { 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 @@ public class ReflectionPerfTest { 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 @@ public class ReflectionPerfTest { 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 class ReflectionPerfTest { 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 @@ public class ReflectionPerfTest { 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 @@ public class ReflectionPerfTest { 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 class ReflectionPerfTest { 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 @@ public class ReflectionPerfTest { 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 @@ public class ReflectionPerfTest { @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 @@ public class ReflectionPerfTest { @Test public void timeRegularConstructor() throws Exception { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { new C(); } @@ -206,7 +206,7 @@ public class ReflectionPerfTest { @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 class ReflectionPerfTest { 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 @@ public class ReflectionPerfTest { @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 @@ public class ReflectionPerfTest { @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 @@ public class ReflectionPerfTest { @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 @@ public class ReflectionPerfTest { @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 5a9b5c36d0d3..da69f9fc9fcf 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 @@ import javax.net.ssl.SSLSocket; @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 6d48cf26c971..9f2c312f33ee 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 @@ import javax.net.ssl.SSLSocketFactory; @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 86416291f26d..7c60c05ef679 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 @@ import java.util.regex.Pattern; @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 @@ public final class SchemePrefixPerfTest { @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 afd1191a07fa..181298305cb5 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 @@ import java.util.ArrayList; @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 class SerializationPerfTest { 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 @@ public class SerializationPerfTest { 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 @@ public class SerializationPerfTest { 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 6c261332aa99..34e9bfb84813 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 @@ import java.util.Map; @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 @@ public class SignaturePerfTest { @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 @@ public class SignaturePerfTest { @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 274b51f6fae4..2fe67985d205 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 @@ import java.util.Date; @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 @@ public class SimpleDateFormatPerfTest { @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 @@ public class SimpleDateFormatPerfTest { @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 @@ public class SimpleDateFormatPerfTest { @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 @@ public class SimpleDateFormatPerfTest { @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 @@ public class SimpleDateFormatPerfTest { @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 @@ public class SimpleDateFormatPerfTest { @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 @@ public class SimpleDateFormatPerfTest { @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 b4c427beac65..fbe3cefff776 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 @@ import org.junit.runner.RunWith; @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 @@ public class StrictMathPerfTest { @Test public void timeAbsD() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { StrictMath.abs(mDouble); } @@ -82,7 +82,7 @@ public class StrictMathPerfTest { @Test public void timeAbsF() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { StrictMath.abs(mFloat); } @@ -90,7 +90,7 @@ public class StrictMathPerfTest { @Test public void timeAbsI() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { StrictMath.abs(mInt); } @@ -98,7 +98,7 @@ public class StrictMathPerfTest { @Test public void timeAbsL() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { StrictMath.abs(mLong); } @@ -106,7 +106,7 @@ public class StrictMathPerfTest { @Test public void timeAcos() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { StrictMath.acos(mDouble); } @@ -114,7 +114,7 @@ public class StrictMathPerfTest { @Test public void timeAsin() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { StrictMath.asin(mDouble); } @@ -122,7 +122,7 @@ public class StrictMathPerfTest { @Test public void timeAtan() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { StrictMath.atan(mDouble); } @@ -130,7 +130,7 @@ public class StrictMathPerfTest { @Test public void timeAtan2() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { StrictMath.atan2(3, 4); } @@ -138,7 +138,7 @@ public class StrictMathPerfTest { @Test public void timeCbrt() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { StrictMath.cbrt(mDouble); } @@ -146,7 +146,7 @@ public class StrictMathPerfTest { @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 @@ public class StrictMathPerfTest { @Test public void timeCopySignD() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { StrictMath.copySign(mDouble, mDouble); } @@ -164,7 +164,7 @@ public class StrictMathPerfTest { @Test public void timeCopySignF() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { StrictMath.copySign(mFloat, mFloat); } @@ -172,7 +172,7 @@ public class StrictMathPerfTest { @Test public void timeCos() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { StrictMath.cos(mDouble); } @@ -180,7 +180,7 @@ public class StrictMathPerfTest { @Test public void timeCosh() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { StrictMath.cosh(mDouble); } @@ -188,7 +188,7 @@ public class StrictMathPerfTest { @Test public void timeExp() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { StrictMath.exp(mDouble); } @@ -196,7 +196,7 @@ public class StrictMathPerfTest { @Test public void timeExpm1() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { StrictMath.expm1(mDouble); } @@ -204,7 +204,7 @@ public class StrictMathPerfTest { @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 @@ public class StrictMathPerfTest { @Test public void timeGetExponentD() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { StrictMath.getExponent(mDouble); } @@ -222,7 +222,7 @@ public class StrictMathPerfTest { @Test public void timeGetExponentF() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { StrictMath.getExponent(mFloat); } @@ -230,7 +230,7 @@ public class StrictMathPerfTest { @Test public void timeHypot() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { StrictMath.hypot(mDouble, mDouble); } @@ -238,7 +238,7 @@ public class StrictMathPerfTest { @Test public void timeIEEEremainder() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { StrictMath.IEEEremainder(mDouble, mDouble); } @@ -246,7 +246,7 @@ public class StrictMathPerfTest { @Test public void timeLog() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { StrictMath.log(mDouble); } @@ -254,7 +254,7 @@ public class StrictMathPerfTest { @Test public void timeLog10() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { StrictMath.log10(mDouble); } @@ -262,7 +262,7 @@ public class StrictMathPerfTest { @Test public void timeLog1p() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { StrictMath.log1p(mDouble); } @@ -270,7 +270,7 @@ public class StrictMathPerfTest { @Test public void timeMaxD() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { StrictMath.max(mDouble, mDouble); } @@ -278,7 +278,7 @@ public class StrictMathPerfTest { @Test public void timeMaxF() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { StrictMath.max(mFloat, mFloat); } @@ -286,7 +286,7 @@ public class StrictMathPerfTest { @Test public void timeMaxI() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { StrictMath.max(mInt, mInt); } @@ -294,7 +294,7 @@ public class StrictMathPerfTest { @Test public void timeMaxL() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { StrictMath.max(mLong, mLong); } @@ -302,7 +302,7 @@ public class StrictMathPerfTest { @Test public void timeMinD() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { StrictMath.min(mDouble, mDouble); } @@ -310,7 +310,7 @@ public class StrictMathPerfTest { @Test public void timeMinF() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { StrictMath.min(mFloat, mFloat); } @@ -318,7 +318,7 @@ public class StrictMathPerfTest { @Test public void timeMinI() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { StrictMath.min(mInt, mInt); } @@ -326,7 +326,7 @@ public class StrictMathPerfTest { @Test public void timeMinL() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { StrictMath.min(mLong, mLong); } @@ -334,7 +334,7 @@ public class StrictMathPerfTest { @Test public void timeNextAfterD() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { StrictMath.nextAfter(mDouble, mDouble); } @@ -342,7 +342,7 @@ public class StrictMathPerfTest { @Test public void timeNextAfterF() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { StrictMath.nextAfter(mFloat, mFloat); } @@ -350,7 +350,7 @@ public class StrictMathPerfTest { @Test public void timeNextUpD() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { StrictMath.nextUp(mDouble); } @@ -358,7 +358,7 @@ public class StrictMathPerfTest { @Test public void timeNextUpF() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { StrictMath.nextUp(mFloat); } @@ -366,7 +366,7 @@ public class StrictMathPerfTest { @Test public void timePow() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { StrictMath.pow(mDouble, mDouble); } @@ -374,7 +374,7 @@ public class StrictMathPerfTest { @Test public void timeRandom() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { StrictMath.random(); } @@ -382,7 +382,7 @@ public class StrictMathPerfTest { @Test public void timeRint() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { StrictMath.rint(mDouble); } @@ -390,7 +390,7 @@ public class StrictMathPerfTest { @Test public void timeRoundD() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { StrictMath.round(mDouble); } @@ -398,7 +398,7 @@ public class StrictMathPerfTest { @Test public void timeRoundF() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { StrictMath.round(mFloat); } @@ -406,7 +406,7 @@ public class StrictMathPerfTest { @Test public void timeScalbD() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { StrictMath.scalb(mDouble, 5); } @@ -414,7 +414,7 @@ public class StrictMathPerfTest { @Test public void timeScalbF() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { StrictMath.scalb(mFloat, 5); } @@ -422,7 +422,7 @@ public class StrictMathPerfTest { @Test public void timeSignumD() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { StrictMath.signum(mDouble); } @@ -430,7 +430,7 @@ public class StrictMathPerfTest { @Test public void timeSignumF() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { StrictMath.signum(mFloat); } @@ -438,7 +438,7 @@ public class StrictMathPerfTest { @Test public void timeSin() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { StrictMath.sin(mDouble); } @@ -446,7 +446,7 @@ public class StrictMathPerfTest { @Test public void timeSinh() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { StrictMath.sinh(mDouble); } @@ -454,7 +454,7 @@ public class StrictMathPerfTest { @Test public void timeSqrt() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { StrictMath.sqrt(mDouble); } @@ -462,7 +462,7 @@ public class StrictMathPerfTest { @Test public void timeTan() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { StrictMath.tan(mDouble); } @@ -470,7 +470,7 @@ public class StrictMathPerfTest { @Test public void timeTanh() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { StrictMath.tanh(mDouble); } @@ -478,7 +478,7 @@ public class StrictMathPerfTest { @Test public void timeToDegrees() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { StrictMath.toDegrees(mDouble); } @@ -486,7 +486,7 @@ public class StrictMathPerfTest { @Test public void timeToRadians() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { StrictMath.toRadians(mDouble); } @@ -494,7 +494,7 @@ public class StrictMathPerfTest { @Test public void timeUlpD() { - BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { StrictMath.ulp(mDouble); } @@ -502,7 +502,7 @@ public class StrictMathPerfTest { @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 2235cc5611a4..0155154037df 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 @@ import org.junit.runner.RunWith; @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 @@ public class StringBuilderPerfTest { @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 @@ public class StringBuilderPerfTest { @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 @@ public class StringBuilderPerfTest { @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 @@ public class StringBuilderPerfTest { @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 @@ public class StringBuilderPerfTest { @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 @@ public class StringBuilderPerfTest { @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 @@ public class StringBuilderPerfTest { @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 @@ public class StringBuilderPerfTest { @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 @@ public class StringBuilderPerfTest { 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 @@ public class StringBuilderPerfTest { @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 9ab50005e62a..55337452611b 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 @@ import org.junit.runner.RunWith; @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 @@ public class StringEqualsPerfTest { // 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 @@ public class StringEqualsPerfTest { // 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 @@ public class StringEqualsPerfTest { // 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 @@ public class StringEqualsPerfTest { // 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 @@ public class StringEqualsPerfTest { // 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 @@ public class StringEqualsPerfTest { // 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 @@ public class StringEqualsPerfTest { // 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 @@ public class StringEqualsPerfTest { // 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 b1e749cc538c..a5662b0a33bd 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 @@ import org.junit.runner.RunWith; @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 @@ public class StringIsEmptyPerfTest { @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 @@ public class StringIsEmptyPerfTest { @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 @@ public class StringIsEmptyPerfTest { @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 9e5759171a6f..41e64f2810c3 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 @@ import org.junit.runner.RunWith; @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 a80514c72e95..2cd2a0976451 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 @@ import java.util.Collection; @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 @@ public class StringPerfTest { @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 78ae3952719b..219dccf6901b 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 @@ import java.util.Collection; @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 @@ public class StringReplaceAllPerfTest { @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 @@ public class StringReplaceAllPerfTest { @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 @@ public class StringReplaceAllPerfTest { @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 73911c71c351..d6fef5ed84e7 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 @@ import java.util.Collection; @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 @@ public class StringReplacePerfTest { @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 @@ public class StringReplacePerfTest { @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 @@ public class StringReplacePerfTest { @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 @@ public class StringReplacePerfTest { @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 @@ public class StringReplacePerfTest { @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 @@ public class StringReplacePerfTest { @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 1539271c2b3c..9d0ec2f368c9 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 @@ import java.util.regex.Pattern; @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 @@ public class StringSplitPerfTest { @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 @@ public class StringSplitPerfTest { @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 @@ public class StringSplitPerfTest { @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 @@ public class StringSplitPerfTest { @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 @@ public class StringSplitPerfTest { @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 0d5e62b4268c..11950b70ab3d 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 @@ import java.util.Collection; @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 @@ public class StringToBytesPerfTest { @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 @@ public class StringToBytesPerfTest { @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 @@ public class StringToBytesPerfTest { @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 ecdf809f1610..4b27a16538ab 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 @@ import java.util.Collection; @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 @@ public class StringToRealPerfTest { @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 @@ public class StringToRealPerfTest { @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 2b2a6b5727de..0ab012dc2871 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 @@ import org.junit.runner.RunWith; @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 @@ public class ThreadLocalPerfTest { @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 6eb8fccf5b2a..ddf410eccbcb 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 @@ import java.util.TimeZone; @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 @@ public class TimeZonePerfTest { @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 @@ public class TimeZonePerfTest { @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 @@ public class TimeZonePerfTest { // 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 @@ public class TimeZonePerfTest { // 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 @@ public class TimeZonePerfTest { @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 288c646ec67d..a38763b6ffad 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 @@ import javax.xml.parsers.DocumentBuilderFactory; @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 @@ public final class XMLEntitiesPerfTest { @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 @@ public final class XMLEntitiesPerfTest { @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 003c957d894f..4076c9d18e57 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 @@ public class ReflectGetFieldLittleEndianIntPerfTest { @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 4f216181d5e3..2c65dd4a90f3 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 @@ public class ReflectGetFieldLittleEndianStringPerfTest { @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 210014ad3f6e..dcd25db01f18 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 @@ public class ReflectGetStaticFieldLittleEndianIntPerfTest { @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 22c68273bf12..c938a4cda5a0 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 @@ public class ReflectGetStaticFieldLittleEndianStringPerfTest { @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 5b391091253b..618e1b5f5b41 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 @@ public class ReflectSetFieldLittleEndianIntPerfTest { @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 883e8a76586b..8c2e3ca8d586 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 @@ public class ReflectSetFieldLittleEndianStringPerfTest { @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 50bc85c31280..e888cc68d471 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 @@ public class ReflectSetStaticFieldLittleEndianIntPerfTest { @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 13fa2bf7d230..7016611a1b1d 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 @@ public class ReflectSetStaticFieldLittleEndianStringPerfTest { @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 85c9bae9a9d9..65c82cca87be 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleCompareandexchangeAcquireFieldLittleEndianIntPerfTest { @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 2b8f430440f5..a350b61da20b 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleCompareandexchangeAcquireFieldLittleEndianStringPerfTest { @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 246fa43d0dca..34f596eea6aa 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleCompareandexchangeAcquireStaticFieldLittleEndianIntPerfTes @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 d12ffae25c5e..2216d7b2a507 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 @@ import java.lang.invoke.VarHandle; @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 5ced1157cb73..bda551fd9069 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleCompareandexchangeFieldLittleEndianIntPerfTest { @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 b955d506fe85..f4d7893a64c2 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleCompareandexchangeFieldLittleEndianStringPerfTest { @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 601ff3461f5b..f4380870f7fc 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleCompareandexchangeReleaseFieldLittleEndianIntPerfTest { @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 0e567f9568e6..78df5c0eaf07 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleCompareandexchangeReleaseFieldLittleEndianStringPerfTest { @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 6be287006f42..f45cc6247fc0 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleCompareandexchangeReleaseStaticFieldLittleEndianIntPerfTes @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 84c186bd24e6..08aa7e254dcb 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 @@ import java.lang.invoke.VarHandle; @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 b093234b2bc5..5d4b2e0978f3 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleCompareandexchangeStaticFieldLittleEndianIntPerfTest { @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 0d2037b4ab27..ba4f2c8a8d7d 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleCompareandexchangeStaticFieldLittleEndianStringPerfTest { @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 ee31973c308a..7fca4504b2c6 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleCompareandsetFieldLittleEndianIntPerfTest { @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 0571fefe2a43..7eb7ac026517 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleCompareandsetFieldLittleEndianStringPerfTest { @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 f619dabdd50a..ddfd407eda11 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleCompareandsetStaticFieldLittleEndianIntPerfTest { @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 fc443fa362bc..f1f39681dce0 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleCompareandsetStaticFieldLittleEndianStringPerfTest { @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 bf3d58b68692..09127c4eed7b 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleGetAcquireFieldLittleEndianIntPerfTest { @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 1f4bc31f24c6..87be4a66aa52 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleGetAcquireFieldLittleEndianStringPerfTest { @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 2085552e91dd..5d5fc110cbaf 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleGetAcquireStaticFieldLittleEndianIntPerfTest { @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 d9c7d7b7695e..c7034b80a008 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleGetAcquireStaticFieldLittleEndianStringPerfTest { @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 acd2533a38e4..f22865b01009 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 @@ import java.lang.invoke.VarHandle; @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 class VarHandleGetArrayLittleEndianIntPerfTest { 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 de9944a8c274..fdb9e84fa847 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 @@ import java.lang.invoke.VarHandle; @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 class VarHandleGetArrayLittleEndianStringPerfTest { 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 a8639292cbb3..347b0cf4effb 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 org.junit.runner.RunWith; import java.lang.invoke.MethodHandles; import java.lang.invoke.VarHandle; + +import java.util.Arrays; import java.nio.ByteOrder; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetByteArrayViewBigEndianIntPerfTest { - @Rule public 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 class VarHandleGetByteArrayViewBigEndianIntPerfTest { 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 4999b9bf6850..dedc94f278bf 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 org.junit.runner.RunWith; import java.lang.invoke.MethodHandles; import java.lang.invoke.VarHandle; + +import java.util.Arrays; import java.nio.ByteOrder; @RunWith(AndroidJUnit4.class) @LargeTest public class VarHandleGetByteArrayViewLittleEndianIntPerfTest { - @Rule public 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 class VarHandleGetByteArrayViewLittleEndianIntPerfTest { 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 ee80a6f72c93..3f0f624dfccb 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleGetFieldLittleEndianIntPerfTest { @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 ec29f7a33b39..9db6328ea4c5 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleGetFieldLittleEndianStringPerfTest { @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 ee6a669f2f83..17b74a8d807e 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleGetOpaqueFieldLittleEndianIntPerfTest { @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 1702b84e703b..5df13800365b 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleGetOpaqueFieldLittleEndianStringPerfTest { @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 514ddb9c4b11..f656ef239625 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleGetOpaqueStaticFieldLittleEndianIntPerfTest { @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 fbcee6906bd7..1087df3d11c5 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleGetOpaqueStaticFieldLittleEndianStringPerfTest { @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 2c5658810b05..004345187c96 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleGetStaticFieldLittleEndianIntPerfTest { @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 8fce69e62033..0162637f7a64 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleGetStaticFieldLittleEndianStringPerfTest { @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 ef530607bb56..b0c4631574e8 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleGetVolatileFieldLittleEndianIntPerfTest { @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 64c08983a063..5cbbc08521ad 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleGetVolatileFieldLittleEndianStringPerfTest { @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 939100c47c05..368ae69ab8f5 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleGetVolatileStaticFieldLittleEndianIntPerfTest { @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 728b1995ff52..3387a8da60c1 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleGetVolatileStaticFieldLittleEndianStringPerfTest { @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 bf5ef99ff456..781e04f6b818 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleGetandaddAcquireFieldLittleEndianFloatPerfTest { @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 d15705e9106d..97f29ba38bc1 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleGetandaddAcquireFieldLittleEndianIntPerfTest { @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 222a60da3550..e108f7f4edbc 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleGetandaddAcquireStaticFieldLittleEndianFloatPerfTest { @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 7436476b5329..d0ae322987f3 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleGetandaddAcquireStaticFieldLittleEndianIntPerfTest { @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 cca97f42e4b7..1b80c4064741 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleGetandaddFieldLittleEndianFloatPerfTest { @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 170ee7313891..edacf181149b 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleGetandaddFieldLittleEndianIntPerfTest { @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 184f796ad61c..0e86b0d6f76b 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleGetandaddReleaseFieldLittleEndianFloatPerfTest { @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 7e75c44089ff..83446ff85b9a 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleGetandaddReleaseFieldLittleEndianIntPerfTest { @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 39c386b645d8..c1f1e6f44c80 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleGetandaddReleaseStaticFieldLittleEndianFloatPerfTest { @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 04ab5310655c..1b154a157622 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleGetandaddReleaseStaticFieldLittleEndianIntPerfTest { @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 b71351fca81c..7de128d7a5a5 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleGetandaddStaticFieldLittleEndianFloatPerfTest { @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 e3955c051890..c9a0926db637 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleGetandaddStaticFieldLittleEndianIntPerfTest { @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 adf05a6befb1..fd9d9b13e9b2 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleGetandbitwiseAndAcquireFieldLittleEndianIntPerfTest { @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 4d657d9a3511..c3c367f80c26 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleGetandbitwiseAndAcquireStaticFieldLittleEndianIntPerfTest @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 dc6417416917..e073d28a820f 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleGetandbitwiseAndFieldLittleEndianIntPerfTest { @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 25d5631308ef..ca78f5ac53ec 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleGetandbitwiseAndReleaseFieldLittleEndianIntPerfTest { @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 de2d5489dbcc..599f18669695 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleGetandbitwiseAndReleaseStaticFieldLittleEndianIntPerfTest @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 36544c6f8f50..71fc0ae08196 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleGetandbitwiseAndStaticFieldLittleEndianIntPerfTest { @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 fb36d0cb495f..8fc4eabbaccc 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleGetandbitwiseOrAcquireFieldLittleEndianIntPerfTest { @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 4194b12a4a6e..33689533d565 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleGetandbitwiseOrAcquireStaticFieldLittleEndianIntPerfTest { @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 355c6e823803..583a3a029059 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleGetandbitwiseOrFieldLittleEndianIntPerfTest { @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 401079d0bece..1592fa6b9a8c 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleGetandbitwiseOrReleaseFieldLittleEndianIntPerfTest { @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 322dcbf7453e..d496083416a3 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleGetandbitwiseOrReleaseStaticFieldLittleEndianIntPerfTest { @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 c98281416012..87276a591699 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleGetandbitwiseOrStaticFieldLittleEndianIntPerfTest { @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 0b1cb32528ff..f7a372fc806f 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleGetandbitwiseXorAcquireFieldLittleEndianIntPerfTest { @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 473707201782..22726fcaa151 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleGetandbitwiseXorAcquireStaticFieldLittleEndianIntPerfTest @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 204cd70b2f9e..d071d6ead1ef 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleGetandbitwiseXorFieldLittleEndianIntPerfTest { @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 b3ffed7de91a..be2aa9cf61b4 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleGetandbitwiseXorReleaseFieldLittleEndianIntPerfTest { @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 d0ab8de4502d..b0a7dcf2e7d3 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleGetandbitwiseXorReleaseStaticFieldLittleEndianIntPerfTest @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 b378b684114e..c5f99deff29c 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleGetandbitwiseXorStaticFieldLittleEndianIntPerfTest { @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 c7c66fe20513..572e0c8dc57b 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleGetandsetAcquireFieldLittleEndianIntPerfTest { @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 98d6bd71c610..09be6d9d3204 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleGetandsetAcquireFieldLittleEndianStringPerfTest { @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 206358f21c1d..4e0554a541b2 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleGetandsetAcquireStaticFieldLittleEndianIntPerfTest { @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 0532e73c9d66..5491522b0122 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleGetandsetAcquireStaticFieldLittleEndianStringPerfTest { @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 f192d7153fce..a9303c6cff57 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleGetandsetFieldLittleEndianIntPerfTest { @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 0a8909c6c7b5..bd4703f6a5d6 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleGetandsetFieldLittleEndianStringPerfTest { @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 bfcb0f410256..d9aee0037a0c 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleGetandsetReleaseFieldLittleEndianIntPerfTest { @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 c6b0509d619b..2c79ca2634b3 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleGetandsetReleaseFieldLittleEndianStringPerfTest { @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 45a01eda2fd5..ceff81634f62 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleGetandsetReleaseStaticFieldLittleEndianIntPerfTest { @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 30472811d5d6..9b83504b94d6 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleGetandsetReleaseStaticFieldLittleEndianStringPerfTest { @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 6f1f1a016039..638da6fd37b6 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleGetandsetStaticFieldLittleEndianIntPerfTest { @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 c4d279f37a4c..25d411417fb8 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleGetandsetStaticFieldLittleEndianStringPerfTest { @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 c4f600593067..64ea9f32b698 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 @@ import java.lang.invoke.VarHandle; @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 class VarHandleSetArrayLittleEndianIntPerfTest { 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 a6858c261eb0..989d682f1b9f 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 @@ import java.lang.invoke.VarHandle; @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 class VarHandleSetArrayLittleEndianStringPerfTest { 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 a994cbeaf02c..9d6d6b8c0963 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 65412ec84aa4..e8c3fa3cd01b 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 573b0ff277cc..08294c06d438 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleSetFieldLittleEndianIntPerfTest { @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 fe3c0fc04a84..1e8a5bfd2a53 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleSetFieldLittleEndianStringPerfTest { @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 f398899880ce..2e5fb1815b4b 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleSetOpaqueFieldLittleEndianIntPerfTest { @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 74931205fd3e..86a771f75b73 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleSetOpaqueFieldLittleEndianStringPerfTest { @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 5e7326985c9d..903b31003510 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleSetOpaqueStaticFieldLittleEndianIntPerfTest { @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 9a217d1fd142..63cf7d25d0fd 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleSetOpaqueStaticFieldLittleEndianStringPerfTest { @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 1ce2270ecc58..d1a358dc662e 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleSetReleaseFieldLittleEndianIntPerfTest { @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 ed84528fe869..b65832469685 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleSetReleaseFieldLittleEndianStringPerfTest { @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 aeb96404a223..47cb77959f2e 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleSetReleaseStaticFieldLittleEndianIntPerfTest { @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 8959a0c3d50c..e48374e2224a 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleSetReleaseStaticFieldLittleEndianStringPerfTest { @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 400772231d48..0470d67180c9 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleSetStaticFieldLittleEndianIntPerfTest { @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 732315862eb2..00abb0bab6bb 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleSetStaticFieldLittleEndianStringPerfTest { @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 f4119c28b826..c66b23b19938 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleSetVolatileFieldLittleEndianIntPerfTest { @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 9b9c2612fe25..1b364504d1d5 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleSetVolatileFieldLittleEndianStringPerfTest { @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 f125384706ca..75f927494f88 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleSetVolatileStaticFieldLittleEndianIntPerfTest { @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 2ad605d83d04..8289d4fdc0aa 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleSetVolatileStaticFieldLittleEndianStringPerfTest { @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 5ef3bf00204b..9fac8427eacf 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleWeakcompareandsetAcquireFieldLittleEndianIntPerfTest { @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 0c4ed66fc6b7..2f601273076e 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleWeakcompareandsetAcquireFieldLittleEndianStringPerfTest { @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 db6bd2429e26..4efbd3e50637 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleWeakcompareandsetAcquireStaticFieldLittleEndianIntPerfTest @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 d2b0bf76158f..099640c624e1 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 @@ import java.lang.invoke.VarHandle; @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 3cd5ae6533b6..ce8f0f0ac269 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleWeakcompareandsetFieldLittleEndianIntPerfTest { @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 6ddfc25deca9..c4119dc5411b 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleWeakcompareandsetFieldLittleEndianStringPerfTest { @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 375f0bc08027..abd981c78f41 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleWeakcompareandsetPlainFieldLittleEndianIntPerfTest { @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 7e2492ace1dd..c71e65f77983 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleWeakcompareandsetPlainFieldLittleEndianStringPerfTest { @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 190118c551e6..f3c8f3ac0656 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleWeakcompareandsetPlainStaticFieldLittleEndianIntPerfTest { @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 484ba1b88183..5c943a46cedc 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleWeakcompareandsetPlainStaticFieldLittleEndianStringPerfTes @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 80e4e153a41f..1755a15aae76 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleWeakcompareandsetReleaseFieldLittleEndianIntPerfTest { @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 fa26c59304f9..77175b007af9 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleWeakcompareandsetReleaseFieldLittleEndianStringPerfTest { @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 16bf2a208870..985519e890af 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleWeakcompareandsetReleaseStaticFieldLittleEndianIntPerfTest @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 e1716dede024..69e6ca7cce9c 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 @@ import java.lang.invoke.VarHandle; @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 dc6f2adfe951..88df5ff60341 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleWeakcompareandsetStaticFieldLittleEndianIntPerfTest { @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 d1096c629ed8..c296f66814a4 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 @@ import java.lang.invoke.VarHandle; @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 @@ public class VarHandleWeakcompareandsetStaticFieldLittleEndianStringPerfTest { @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 cfcb1d2a02d4..a43569a13813 100755 --- a/apct-tests/perftests/core/src/android/libcore/varhandles/generate_java.py +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/generate_java.py @@ -42,7 +42,7 @@ def to_camel_case(word): return ''.join(c for c in word.title() if not c == '_') -LOOP ="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,8 +158,8 @@ BANNER = """/* VH_IMPORTS = """ 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; @@ -179,7 +179,7 @@ VH_START = BANNER + VH_IMPORTS + """ @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 +273,7 @@ VH_START_ARRAY = BANNER + VH_IMPORTS + """ @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 +324,7 @@ import java.nio.ByteOrder; @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 +375,7 @@ import java.lang.reflect.Field; @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 +407,7 @@ import jdk.internal.misc.Unsafe; @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 1653edc77de9..9eea712b33dd 100644 --- a/apct-tests/perftests/multiuser/Android.bp +++ b/apct-tests/perftests/multiuser/Android.bp @@ -38,3 +38,15 @@ android_test { ], certificate: "platform", } + +filegroup { + name: "multi_user_trace_config", + srcs: [ + "trace_configs/trace_config_multi_user.textproto", + ], +} + +prebuilt_etc { + name: "trace_config_multi_user.textproto", + src: ":multi_user_trace_config", +} diff --git a/apct-tests/perftests/packagemanager/src/android/os/PackageManagerPerfTest.java b/apct-tests/perftests/packagemanager/src/android/os/PackageManagerPerfTest.java index 4bcc8c499f0d..f302033dee0f 100644 --- a/apct-tests/perftests/packagemanager/src/android/os/PackageManagerPerfTest.java +++ b/apct-tests/perftests/packagemanager/src/android/os/PackageManagerPerfTest.java @@ -31,6 +31,7 @@ import android.content.pm.PackageInstaller; import android.content.pm.PackageManager; import android.perftests.utils.BenchmarkState; import android.perftests.utils.PerfStatusReporter; +import android.permission.PermissionManager; import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.filters.LargeTest; @@ -107,6 +108,8 @@ public class PackageManagerPerfTest { public void setup() { PackageManager.disableApplicationInfoCache(); PackageManager.disablePackageInfoCache(); + PermissionManager.disablePermissionCache(); + PermissionManager.disablePackageNamePermissionCache(); } @Test diff --git a/apex/blobstore/TEST_MAPPING b/apex/blobstore/TEST_MAPPING index 6d3c0d73f77f..5157ce43fd4c 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 c2aeadaea65c..c1894f0f795f 100644 --- a/apex/jobscheduler/service/java/com/android/server/DeviceIdleController.java +++ b/apex/jobscheduler/service/java/com/android/server/DeviceIdleController.java @@ -2629,8 +2629,13 @@ public class DeviceIdleController extends SystemService 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); @@ -2641,8 +2646,13 @@ public class DeviceIdleController extends SystemService 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 6924cb210adb..b58cb881fade 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 d76ce7449e43..ab0f17810308 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 c06861164d31..afa509c6ea93 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 e82df1203137..16c2fd4b73c3 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 a75415ec6151..52670a2570d3 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/api/Android.bp b/api/Android.bp index 3fa9c600741e..341be3d53844 100644 --- a/api/Android.bp +++ b/api/Android.bp @@ -29,12 +29,14 @@ bootstrap_go_package { pkgPath: "android/soong/api", deps: [ "blueprint", + "blueprint-proptools", "soong", "soong-android", "soong-genrule", "soong-java", ], srcs: ["api.go"], + testSrcs: ["api_test.go"], pluginFor: ["soong_build"], } @@ -60,40 +62,8 @@ metalava_cmd = "$(location metalava)" metalava_cmd += " -J--add-opens=java.base/java.util=ALL-UNNAMED " metalava_cmd += " --quiet " -soong_config_module_type { - name: "enable_crashrecovery_module", - module_type: "combined_apis_defaults", - config_namespace: "ANDROID", - bool_variables: ["release_crashrecovery_module"], - properties: [ - "bootclasspath", - "system_server_classpath", - ], -} - -soong_config_bool_variable { - name: "release_crashrecovery_module", -} - -enable_crashrecovery_module { - name: "crashrecovery_module_defaults", - soong_config_variables: { - release_crashrecovery_module: { - bootclasspath: [ - "framework-crashrecovery", - ], - system_server_classpath: [ - "service-crashrecovery", - ], - }, - }, -} - combined_apis { name: "frameworks-base-api", - defaults: [ - "crashrecovery_module_defaults", - ], bootclasspath: [ "android.net.ipsec.ike", "art.module.public.api", @@ -126,7 +96,12 @@ combined_apis { "framework-virtualization", "framework-wifi", "i18n.module.public.api", - ], + ] + select(soong_config_variable("ANDROID", "release_crashrecovery_module"), { + "true": [ + "framework-crashrecovery", + ], + default: [], + }), system_server_classpath: [ "service-art", "service-configinfrastructure", @@ -135,7 +110,12 @@ combined_apis { "service-permission", "service-rkp", "service-sdksandbox", - ], + ] + select(soong_config_variable("ANDROID", "release_crashrecovery_module"), { + "true": [ + "service-crashrecovery", + ], + default: [], + }), } genrule { @@ -157,6 +137,7 @@ genrule { genrule { name: "frameworks-base-api-system-current-compat", srcs: [ + ":android.api.public.latest", ":android.api.system.latest", ":android-incompatibilities.api.system.latest", ":frameworks-base-api-current.txt", @@ -165,33 +146,35 @@ genrule { out: ["updated-baseline.txt"], tools: ["metalava"], cmd: metalava_cmd + + "--check-compatibility:api:released $(location :android.api.public.latest) " + "--check-compatibility:api:released $(location :android.api.system.latest) " + - "--check-compatibility:base $(location :frameworks-base-api-current.txt) " + "--baseline:compatibility:released $(location :android-incompatibilities.api.system.latest) " + "--update-baseline:compatibility:released $(genDir)/updated-baseline.txt " + + "$(location :frameworks-base-api-current.txt) " + "$(location :frameworks-base-api-system-current.txt)", } genrule { name: "frameworks-base-api-module-lib-current-compat", srcs: [ + ":android.api.public.latest", + ":android.api.system.latest", ":android.api.module-lib.latest", ":android-incompatibilities.api.module-lib.latest", ":frameworks-base-api-current.txt", + ":frameworks-base-api-system-current.txt", ":frameworks-base-api-module-lib-current.txt", ], out: ["updated-baseline.txt"], tools: ["metalava"], cmd: metalava_cmd + + "--check-compatibility:api:released $(location :android.api.public.latest) " + + "--check-compatibility:api:released $(location :android.api.system.latest) " + "--check-compatibility:api:released $(location :android.api.module-lib.latest) " + - // Note: having "public" be the base of module-lib is not perfect -- it should - // ideally be a merged public+system (which metalava is not currently able to generate). - // This "base" will help when migrating from MODULE_LIBS -> public, but not when - // migrating from MODULE_LIBS -> system (where it needs to instead be listed as - // an incompatibility). - "--check-compatibility:base $(location :frameworks-base-api-current.txt) " + "--baseline:compatibility:released $(location :android-incompatibilities.api.module-lib.latest) " + "--update-baseline:compatibility:released $(genDir)/updated-baseline.txt " + + "$(location :frameworks-base-api-current.txt) " + + "$(location :frameworks-base-api-system-current.txt) " + "$(location :frameworks-base-api-module-lib-current.txt)", } @@ -301,7 +284,7 @@ packages_to_document = [ // These are libs from framework-internal-utils that are required (i.e. being referenced) // from framework-non-updatable-sources. Add more here when there's a need. // DO NOT add the entire framework-internal-utils. It might cause unnecessary circular -// dependencies gets bigger. +// dependencies when the list gets bigger. android_non_updatable_stubs_libs = [ "android.hardware.cas-V1.2-java", "android.hardware.health-V1.0-java-constants", @@ -365,15 +348,12 @@ stubs_defaults { "--hide CallbackInterface", // Disable HiddenSuperclass, as Metalava handles this fine (it should be hidden by default) "--hide HiddenSuperclass", - "--hide-package android.audio.policy.configuration.V7_0", - "--hide-package com.android.server", "--manifest $(location :frameworks-base-core-AndroidManifest.xml)", ], filter_packages: packages_to_document, high_mem: true, // Lots of sources => high memory use, see b/170701554 installable: false, annotations_enabled: true, - previous_api: ":android.api.public.latest", merge_annotations_dirs: ["metalava-manual"], defaults_visibility: ["//frameworks/base/api"], visibility: [ @@ -404,6 +384,11 @@ non_updatable_api_deps_on_modules = [ "sdk_system_current_android", ] +java_defaults { + name: "module-classpath-java-defaults", + libs: non_updatable_api_deps_on_modules, +} + // Defaults with module APIs in the classpath (mostly from prebuilts). // Suitable for compiling android-non-updatable. stubs_defaults { diff --git a/api/StubLibraries.bp b/api/StubLibraries.bp index 6cfd2e0ce833..b3a674fbd70e 100644 --- a/api/StubLibraries.bp +++ b/api/StubLibraries.bp @@ -38,6 +38,9 @@ non_updatable_exportable_droidstubs { "android-non-updatable-stubs-defaults", "module-classpath-stubs-defaults", ], + // Use full Android API not just the non-updatable API as the latter is incomplete + // and can result in incorrect behavior. + previous_api: ":android.api.combined.public.latest", check_api: { current: { api_file: ":non-updatable-current.txt", @@ -118,6 +121,9 @@ non_updatable_exportable_droidstubs { "module-classpath-stubs-defaults", ], flags: priv_apps, + // Use full Android API not just the non-updatable API as the latter is incomplete + // and can result in incorrect behavior. + previous_api: ":android.api.combined.system.latest", check_api: { current: { api_file: ":non-updatable-system-current.txt", @@ -178,6 +184,9 @@ non_updatable_exportable_droidstubs { "module-classpath-stubs-defaults", ], flags: test + priv_apps_in_stubs, + // Use full Android API not just the non-updatable API as the latter is incomplete + // and can result in incorrect behavior. + previous_api: ":android.api.combined.test.latest", check_api: { current: { api_file: ":non-updatable-test-current.txt", @@ -257,6 +266,9 @@ non_updatable_exportable_droidstubs { "module-classpath-stubs-defaults", ], flags: priv_apps_in_stubs + module_libs, + // Use full Android API not just the non-updatable API as the latter is incomplete + // and can result in incorrect behavior. + previous_api: ":android.api.combined.module-lib.latest", check_api: { current: { api_file: ":non-updatable-module-lib-current.txt", @@ -551,8 +563,12 @@ java_library { java_defaults { name: "android-non-updatable_from_text_defaults", + defaults: ["android-non-updatable-stubs-libs-defaults"], static_libs: ["framework-res-package-jar"], libs: ["stub-annotations"], + sdk_version: "none", + system_modules: "none", + previous_api: ":android.api.public.latest", } java_defaults { @@ -570,7 +586,10 @@ java_api_library { "api-stubs-docs-non-updatable.api.contribution", ], defaults: ["android-non-updatable_everything_from_text_defaults"], - full_api_surface_stub: "android_stubs_current.from-text", + // Use full Android API not just the non-updatable API as the latter is incomplete + // and can result in incorrect behavior. + previous_api: ":android.api.combined.public.latest", + libs: ["all-modules-public-stubs"], } java_api_library { @@ -581,7 +600,10 @@ java_api_library { "system-api-stubs-docs-non-updatable.api.contribution", ], defaults: ["android-non-updatable_everything_from_text_defaults"], - full_api_surface_stub: "android_system_stubs_current.from-text", + // Use full Android API not just the non-updatable API as the latter is incomplete + // and can result in incorrect behavior. + previous_api: ":android.api.combined.system.latest", + libs: ["all-modules-system-stubs"], } java_api_library { @@ -593,7 +615,10 @@ java_api_library { "test-api-stubs-docs-non-updatable.api.contribution", ], defaults: ["android-non-updatable_everything_from_text_defaults"], - full_api_surface_stub: "android_test_stubs_current.from-text", + // Use full Android API not just the non-updatable API as the latter is incomplete + // and can result in incorrect behavior. + previous_api: ":android.api.combined.test.latest", + libs: ["all-modules-system-stubs"], } java_api_library { @@ -604,8 +629,13 @@ java_api_library { "system-api-stubs-docs-non-updatable.api.contribution", "module-lib-api-stubs-docs-non-updatable.api.contribution", ], - defaults: ["android-non-updatable_everything_from_text_defaults"], - full_api_surface_stub: "android_module_lib_stubs_current_full.from-text", + defaults: [ + "module-classpath-java-defaults", + "android-non-updatable_everything_from_text_defaults", + ], + // Use full Android API not just the non-updatable API as the latter is incomplete + // and can result in incorrect behavior. + previous_api: ":android.api.combined.module-lib.latest", } // This module generates a stub jar that is a union of the test and module lib @@ -620,12 +650,16 @@ java_api_library { "test-api-stubs-docs-non-updatable.api.contribution", "module-lib-api-stubs-docs-non-updatable.api.contribution", ], - defaults: ["android-non-updatable_everything_from_text_defaults"], - full_api_surface_stub: "android_test_module_lib_stubs_current.from-text", + defaults: [ + "module-classpath-java-defaults", + "android-non-updatable_everything_from_text_defaults", + ], + // No need to specify previous_api as this is not used for compiling against. // This module is only used for hiddenapi, and other modules should not // depend on this module. visibility: ["//visibility:private"], + libs: ["all-modules-system-stubs"], } java_defaults { @@ -639,7 +673,7 @@ java_defaults { } java_library { - name: "android_stubs_current.from-source", + name: "android_stubs_current", static_libs: [ "all-modules-public-stubs", "android-non-updatable.stubs", @@ -649,7 +683,7 @@ java_library { } java_library { - name: "android_stubs_current_exportable.from-source", + name: "android_stubs_current_exportable", static_libs: [ "all-modules-public-stubs-exportable", "android-non-updatable.stubs.exportable", @@ -659,7 +693,7 @@ java_library { } java_library { - name: "android_system_stubs_current.from-source", + name: "android_system_stubs_current", static_libs: [ "all-modules-system-stubs", "android-non-updatable.stubs.system", @@ -672,7 +706,7 @@ java_library { } java_library { - name: "android_system_stubs_current_exportable.from-source", + name: "android_system_stubs_current_exportable", static_libs: [ "all-modules-system-stubs-exportable", "android-non-updatable.stubs.exportable.system", @@ -696,7 +730,7 @@ java_library { } java_library { - name: "android_test_stubs_current.from-source", + name: "android_test_stubs_current", static_libs: [ // Updatable modules do not have test APIs, but we want to include their SystemApis, like we // include the SystemApi of framework-non-updatable-sources. @@ -713,7 +747,7 @@ java_library { } java_library { - name: "android_test_stubs_current_exportable.from-source", + name: "android_test_stubs_current_exportable", static_libs: [ // Updatable modules do not have test APIs, but we want to include their SystemApis, like we // include the SystemApi of framework-non-updatable-sources. @@ -734,7 +768,7 @@ java_library { // This module does not need to be copied to dist java_library { - name: "android_test_frameworks_core_stubs_current.from-source", + name: "android_test_frameworks_core_stubs_current", static_libs: [ "all-updatable-modules-system-stubs", "android-non-updatable.stubs.test", @@ -746,7 +780,7 @@ java_library { } java_library { - name: "android_module_lib_stubs_current.from-source", + name: "android_module_lib_stubs_current", defaults: [ "android.jar_defaults", ], @@ -759,7 +793,7 @@ java_library { } java_library { - name: "android_module_lib_stubs_current_exportable.from-source", + name: "android_module_lib_stubs_current_exportable", defaults: [ "android.jar_defaults", "android_stubs_dists_default", @@ -775,20 +809,20 @@ java_library { } java_library { - name: "android_system_server_stubs_current.from-source", + name: "android_system_server_stubs_current", defaults: [ "android.jar_defaults", ], srcs: [":services-non-updatable-stubs"], installable: false, static_libs: [ - "android_module_lib_stubs_current.from-source", + "android_module_lib_stubs_current", ], visibility: ["//frameworks/base/services"], } java_library { - name: "android_system_server_stubs_current_exportable.from-source", + name: "android_system_server_stubs_current_exportable", defaults: [ "android.jar_defaults", "android_stubs_dists_default", @@ -796,7 +830,7 @@ java_library { srcs: [":services-non-updatable-stubs{.exportable}"], installable: false, static_libs: [ - "android_module_lib_stubs_current_exportable.from-source", + "android_module_lib_stubs_current_exportable", ], dist: { dir: "apistubs/android/system-server", @@ -856,7 +890,7 @@ java_genrule { cmd: "rm -f $(genDir)/framework.aidl.merged && " + "for i in $(in); do " + " rm -f $(genDir)/framework.aidl.tmp && " + - " $(location sdkparcelables) $$i $(genDir)/framework.aidl.tmp && " + + " $(location sdkparcelables) $$i $(genDir)/framework.aidl.tmp --guarantee_stable && " + " cat $(genDir)/framework.aidl.tmp >> $(genDir)/framework.aidl.merged; " + "done && " + "sort -u $(genDir)/framework.aidl.merged > $(out)", @@ -871,214 +905,6 @@ java_genrule { }, } -// -// Java API defaults and libraries for single tree build -// - -java_defaults { - name: "stub-annotation-defaults", - libs: [ - "stub-annotations", - ], - static_libs: [ - // stub annotations do not contribute to the API surfaces but are statically - // linked in the stubs for API surfaces (see frameworks/base/StubLibraries.bp). - // This is because annotation processors insist on loading the classes for any - // annotations found, thus should exist inside android.jar. - "private-stub-annotations-jar", - ], - is_stubs_module: true, -} - -// Listing of API domains contribution and dependencies per API surfaces -java_defaults { - name: "android_test_stubs_current_contributions", - api_surface: "test", - api_contributions: [ - "framework-virtualization.stubs.source.test.api.contribution", - "framework-location.stubs.source.test.api.contribution", - ], -} - -java_defaults { - name: "android_test_frameworks_core_stubs_current_contributions", - api_surface: "test", - api_contributions: [ - "test-api-stubs-docs-non-updatable.api.contribution", - ], -} - -java_defaults { - name: "android_module_lib_stubs_current_contributions", - api_surface: "module-lib", - api_contributions: [ - "api-stubs-docs-non-updatable.api.contribution", - "system-api-stubs-docs-non-updatable.api.contribution", - "module-lib-api-stubs-docs-non-updatable.api.contribution", - "art.module.public.api.stubs.source.api.contribution", - "art.module.public.api.stubs.source.system.api.contribution", - "art.module.public.api.stubs.source.module_lib.api.contribution", - "i18n.module.public.api.stubs.source.api.contribution", - "i18n.module.public.api.stubs.source.system.api.contribution", - "i18n.module.public.api.stubs.source.module_lib.api.contribution", - ], -} - -// Java API library definitions per API surface -java_api_library { - name: "android_stubs_current.from-text", - api_surface: "public", - defaults: [ - // This module is dynamically created at frameworks/base/api/api.go - // instead of being written out, in order to minimize edits in the codebase - // when there is a change in the list of modules. - // that contributes to an api surface. - "android_stubs_current_contributions", - "stub-annotation-defaults", - ], - api_contributions: [ - "api-stubs-docs-non-updatable.api.contribution", - ], - visibility: ["//visibility:public"], - enable_validation: false, - stubs_type: "everything", -} - -java_api_library { - name: "android_system_stubs_current.from-text", - api_surface: "system", - defaults: [ - "android_stubs_current_contributions", - "android_system_stubs_current_contributions", - "stub-annotation-defaults", - ], - api_contributions: [ - "api-stubs-docs-non-updatable.api.contribution", - "system-api-stubs-docs-non-updatable.api.contribution", - ], - visibility: ["//visibility:public"], - enable_validation: false, - stubs_type: "everything", -} - -java_api_library { - name: "android_test_stubs_current.from-text", - api_surface: "test", - defaults: [ - "android_stubs_current_contributions", - "android_system_stubs_current_contributions", - "android_test_stubs_current_contributions", - "stub-annotation-defaults", - ], - api_contributions: [ - "api-stubs-docs-non-updatable.api.contribution", - "system-api-stubs-docs-non-updatable.api.contribution", - "test-api-stubs-docs-non-updatable.api.contribution", - ], - visibility: ["//visibility:public"], - enable_validation: false, - stubs_type: "everything", -} - -java_api_library { - name: "android_test_frameworks_core_stubs_current.from-text", - api_surface: "test", - defaults: [ - "android_stubs_current_contributions", - "android_system_stubs_current_contributions", - "android_test_frameworks_core_stubs_current_contributions", - ], - libs: [ - "stub-annotations", - ], - api_contributions: [ - "api-stubs-docs-non-updatable.api.contribution", - "system-api-stubs-docs-non-updatable.api.contribution", - ], - enable_validation: false, - stubs_type: "everything", -} - -java_api_library { - name: "android_module_lib_stubs_current_full.from-text", - api_surface: "module-lib", - defaults: [ - "android_stubs_current_contributions", - "android_system_stubs_current_contributions", - "android_module_lib_stubs_current_contributions_full", - ], - libs: [ - "stub-annotations", - ], - api_contributions: [ - "api-stubs-docs-non-updatable.api.contribution", - "system-api-stubs-docs-non-updatable.api.contribution", - "module-lib-api-stubs-docs-non-updatable.api.contribution", - ], - visibility: ["//visibility:public"], - enable_validation: false, - stubs_type: "everything", -} - -java_api_library { - name: "android_module_lib_stubs_current.from-text", - api_surface: "module-lib", - defaults: [ - "android_module_lib_stubs_current_contributions", - ], - libs: [ - "android_module_lib_stubs_current_full.from-text", - "stub-annotations", - ], - visibility: ["//visibility:public"], - enable_validation: false, - stubs_type: "everything", -} - -java_api_library { - name: "android_test_module_lib_stubs_current.from-text", - api_surface: "module-lib", - defaults: [ - "android_stubs_current_contributions", - "android_system_stubs_current_contributions", - "android_test_stubs_current_contributions", - "android_module_lib_stubs_current_contributions", - ], - libs: [ - "android_module_lib_stubs_current_full.from-text", - "stub-annotations", - ], - api_contributions: [ - "test-api-stubs-docs-non-updatable.api.contribution", - ], - - // This module is only used to build android-non-updatable.stubs.test_module_lib - // and other modules should not depend on this module. - visibility: [ - "//visibility:private", - ], - enable_validation: false, - stubs_type: "everything", -} - -java_api_library { - name: "android_system_server_stubs_current.from-text", - api_surface: "system-server", - api_contributions: [ - "services-non-updatable-stubs.api.contribution", - ], - libs: [ - "android_module_lib_stubs_current.from-text", - "stub-annotations", - ], - static_libs: [ - "android_module_lib_stubs_current.from-text", - ], - visibility: ["//visibility:public"], - enable_validation: false, - stubs_type: "everything", -} - //////////////////////////////////////////////////////////////////////// // api-versions.xml generation, for public and system. This API database // also contains the android.test.* APIs. @@ -1318,4 +1144,5 @@ java_library { ":hwbinder-stubs-docs", ], visibility: ["//visibility:public"], + is_stubs_module: true, } diff --git a/api/api.go b/api/api.go index 449fac63f90c..5b7f534443fb 100644 --- a/api/api.go +++ b/api/api.go @@ -15,9 +15,7 @@ package api import ( - "fmt" "sort" - "strings" "github.com/google/blueprint/proptools" @@ -54,16 +52,15 @@ var non_updatable_modules = []string{virtualization, location} // The properties of the combined_apis module type. type CombinedApisProperties struct { // Module libraries in the bootclasspath - Bootclasspath []string + Bootclasspath proptools.Configurable[[]string] // Module libraries on the bootclasspath if include_nonpublic_framework_api is true. Conditional_bootclasspath []string // Module libraries in system server - System_server_classpath []string + System_server_classpath proptools.Configurable[[]string] } type CombinedApis struct { android.ModuleBase - android.DefaultableModuleBase properties CombinedApisProperties } @@ -74,34 +71,41 @@ func init() { func registerBuildComponents(ctx android.RegistrationContext) { ctx.RegisterModuleType("combined_apis", combinedApisModuleFactory) - ctx.RegisterModuleType("combined_apis_defaults", CombinedApisModuleDefaultsFactory) } var PrepareForCombinedApisTest = android.FixtureRegisterWithContext(registerBuildComponents) -func (a *CombinedApis) apiFingerprintStubDeps() []string { +func (a *CombinedApis) bootclasspath(ctx android.ConfigAndErrorContext) []string { + return a.properties.Bootclasspath.GetOrDefault(a.ConfigurableEvaluator(ctx), nil) +} + +func (a *CombinedApis) systemServerClasspath(ctx android.ConfigAndErrorContext) []string { + return a.properties.System_server_classpath.GetOrDefault(a.ConfigurableEvaluator(ctx), nil) +} + +func (a *CombinedApis) apiFingerprintStubDeps(ctx android.BottomUpMutatorContext) []string { ret := []string{} ret = append( ret, - transformArray(a.properties.Bootclasspath, "", ".stubs")..., + transformArray(a.bootclasspath(ctx), "", ".stubs")..., ) ret = append( ret, - transformArray(a.properties.Bootclasspath, "", ".stubs.system")..., + transformArray(a.bootclasspath(ctx), "", ".stubs.system")..., ) ret = append( ret, - transformArray(a.properties.Bootclasspath, "", ".stubs.module_lib")..., + transformArray(a.bootclasspath(ctx), "", ".stubs.module_lib")..., ) ret = append( ret, - transformArray(a.properties.System_server_classpath, "", ".stubs.system_server")..., + transformArray(a.systemServerClasspath(ctx), "", ".stubs.system_server")..., ) return ret } func (a *CombinedApis) DepsMutator(ctx android.BottomUpMutatorContext) { - ctx.AddDependency(ctx.Module(), nil, a.apiFingerprintStubDeps()...) + ctx.AddDependency(ctx.Module(), nil, a.apiFingerprintStubDeps(ctx)...) } func (a *CombinedApis) GenerateAndroidBuildActions(ctx android.ModuleContext) { @@ -458,82 +462,9 @@ func createMergedTxts(ctx android.LoadHookContext, bootclasspath, system_server_ } } -func createApiContributionDefaults(ctx android.LoadHookContext, modules []string) { - defaultsSdkKinds := []android.SdkKind{ - android.SdkPublic, android.SdkSystem, android.SdkModule, - } - for _, sdkKind := range defaultsSdkKinds { - props := defaultsProps{} - props.Name = proptools.StringPtr( - sdkKind.DefaultJavaLibraryName() + "_contributions") - if sdkKind == android.SdkModule { - props.Name = proptools.StringPtr( - sdkKind.DefaultJavaLibraryName() + "_contributions_full") - } - props.Api_surface = proptools.StringPtr(sdkKind.String()) - apiSuffix := "" - if sdkKind != android.SdkPublic { - apiSuffix = "." + strings.ReplaceAll(sdkKind.String(), "-", "_") - } - props.Api_contributions = transformArray( - modules, "", fmt.Sprintf(".stubs.source%s.api.contribution", apiSuffix)) - props.Defaults_visibility = []string{"//visibility:public"} - props.Previous_api = proptools.StringPtr(":android.api.public.latest") - ctx.CreateModule(java.DefaultsFactory, &props) - } -} - -func createFullApiLibraries(ctx android.LoadHookContext) { - javaLibraryNames := []string{ - "android_stubs_current", - "android_system_stubs_current", - "android_test_stubs_current", - "android_test_frameworks_core_stubs_current", - "android_module_lib_stubs_current", - "android_system_server_stubs_current", - } - - for _, libraryName := range javaLibraryNames { - props := libraryProps{} - props.Name = proptools.StringPtr(libraryName) - staticLib := libraryName + ".from-source" - if ctx.Config().BuildFromTextStub() { - staticLib = libraryName + ".from-text" - } - props.Static_libs = []string{staticLib} - props.Defaults = []string{"android.jar_defaults"} - props.Visibility = []string{"//visibility:public"} - props.Is_stubs_module = proptools.BoolPtr(true) - - ctx.CreateModule(java.LibraryFactory, &props) - } -} - -func createFullExportableApiLibraries(ctx android.LoadHookContext) { - javaLibraryNames := []string{ - "android_stubs_current_exportable", - "android_system_stubs_current_exportable", - "android_test_stubs_current_exportable", - "android_module_lib_stubs_current_exportable", - "android_system_server_stubs_current_exportable", - } - - for _, libraryName := range javaLibraryNames { - props := libraryProps{} - props.Name = proptools.StringPtr(libraryName) - staticLib := libraryName + ".from-source" - props.Static_libs = []string{staticLib} - props.Defaults = []string{"android.jar_defaults"} - props.Visibility = []string{"//visibility:public"} - props.Is_stubs_module = proptools.BoolPtr(true) - - ctx.CreateModule(java.LibraryFactory, &props) - } -} - func (a *CombinedApis) createInternalModules(ctx android.LoadHookContext) { - bootclasspath := a.properties.Bootclasspath - system_server_classpath := a.properties.System_server_classpath + bootclasspath := a.bootclasspath(ctx) + system_server_classpath := a.systemServerClasspath(ctx) if ctx.Config().VendorConfig("ANDROID").Bool("include_nonpublic_framework_api") { bootclasspath = append(bootclasspath, a.properties.Conditional_bootclasspath...) sort.Strings(bootclasspath) @@ -556,19 +487,12 @@ func (a *CombinedApis) createInternalModules(ctx android.LoadHookContext) { createMergedAnnotationsFilegroups(ctx, bootclasspath, system_server_classpath) createPublicStubsSourceFilegroup(ctx, bootclasspath) - - createApiContributionDefaults(ctx, bootclasspath) - - createFullApiLibraries(ctx) - - createFullExportableApiLibraries(ctx) } func combinedApisModuleFactory() android.Module { module := &CombinedApis{} module.AddProperties(&module.properties) android.InitAndroidModule(module) - android.InitDefaultableModule(module) android.AddLoadHook(module, func(ctx android.LoadHookContext) { module.createInternalModules(ctx) }) return module } @@ -605,16 +529,3 @@ func remove(s []string, v string) []string { } return s2 } - -// Defaults -type CombinedApisModuleDefaults struct { - android.ModuleBase - android.DefaultsModuleBase -} - -func CombinedApisModuleDefaultsFactory() android.Module { - module := &CombinedApisModuleDefaults{} - module.AddProperties(&CombinedApisProperties{}) - android.InitDefaultsModule(module) - return module -} diff --git a/api/api_test.go b/api/api_test.go new file mode 100644 index 000000000000..fb26f821eec1 --- /dev/null +++ b/api/api_test.go @@ -0,0 +1,259 @@ +// 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 api + +import ( + "android/soong/android" + "android/soong/java" + "fmt" + "testing" + + "github.com/google/blueprint/proptools" +) + +var prepareForTestWithCombinedApis = android.GroupFixturePreparers( + android.FixtureRegisterWithContext(registerBuildComponents), + java.PrepareForTestWithJavaBuildComponents, + android.FixtureAddTextFile("a/Android.bp", gatherRequiredDepsForTest()), + java.PrepareForTestWithJavaSdkLibraryFiles, + android.FixtureMergeMockFs(android.MockFS{ + "a/api/current.txt": nil, + "a/api/removed.txt": nil, + "a/api/system-current.txt": nil, + "a/api/system-removed.txt": nil, + "a/api/test-current.txt": nil, + "a/api/test-removed.txt": nil, + "a/api/module-lib-current.txt": nil, + "a/api/module-lib-removed.txt": nil, + }), + android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) { + variables.Allow_missing_dependencies = proptools.BoolPtr(true) + }), +) + +func gatherRequiredDepsForTest() string { + var bp string + + extraLibraryModules := []string{ + "stable.core.platform.api.stubs", + "core-lambda-stubs", + "core.current.stubs", + "ext", + "framework", + "android_stubs_current", + "android_system_stubs_current", + "android_test_stubs_current", + "android_test_frameworks_core_stubs_current", + "android_module_lib_stubs_current", + "android_system_server_stubs_current", + "android_stubs_current.from-text", + "android_system_stubs_current.from-text", + "android_test_stubs_current.from-text", + "android_test_frameworks_core_stubs_current.from-text", + "android_module_lib_stubs_current.from-text", + "android_system_server_stubs_current.from-text", + "android_stubs_current.from-source", + "android_system_stubs_current.from-source", + "android_test_stubs_current.from-source", + "android_test_frameworks_core_stubs_current.from-source", + "android_module_lib_stubs_current.from-source", + "android_system_server_stubs_current.from-source", + "android_stubs_current_exportable.from-source", + "android_system_stubs_current_exportable.from-source", + "android_test_stubs_current_exportable.from-source", + "android_module_lib_stubs_current_exportable.from-source", + "android_system_server_stubs_current_exportable.from-source", + "stub-annotations", + } + + extraSdkLibraryModules := []string{ + "framework-virtualization", + "framework-location", + } + + extraSystemModules := []string{ + "core-public-stubs-system-modules", + "core-module-lib-stubs-system-modules", + "stable-core-platform-api-stubs-system-modules", + } + + extraFilegroupModules := []string{ + "non-updatable-current.txt", + "non-updatable-removed.txt", + "non-updatable-system-current.txt", + "non-updatable-system-removed.txt", + "non-updatable-test-current.txt", + "non-updatable-test-removed.txt", + "non-updatable-module-lib-current.txt", + "non-updatable-module-lib-removed.txt", + "non-updatable-system-server-current.txt", + "non-updatable-system-server-removed.txt", + "non-updatable-exportable-current.txt", + "non-updatable-exportable-removed.txt", + "non-updatable-exportable-system-current.txt", + "non-updatable-exportable-system-removed.txt", + "non-updatable-exportable-test-current.txt", + "non-updatable-exportable-test-removed.txt", + "non-updatable-exportable-module-lib-current.txt", + "non-updatable-exportable-module-lib-removed.txt", + "non-updatable-exportable-system-server-current.txt", + "non-updatable-exportable-system-server-removed.txt", + } + + for _, extra := range extraLibraryModules { + bp += fmt.Sprintf(` + java_library { + name: "%s", + srcs: ["a.java"], + sdk_version: "none", + system_modules: "stable-core-platform-api-stubs-system-modules", + compile_dex: true, + } + `, extra) + } + + for _, extra := range extraSdkLibraryModules { + bp += fmt.Sprintf(` + java_sdk_library { + name: "%s", + srcs: ["a.java"], + public: { + enabled: true, + }, + system: { + enabled: true, + }, + test: { + enabled: true, + }, + module_lib: { + enabled: true, + }, + api_packages: [ + "foo", + ], + sdk_version: "core_current", + compile_dex: true, + annotations_enabled: true, + } + `, extra) + } + + for _, extra := range extraFilegroupModules { + bp += fmt.Sprintf(` + filegroup { + name: "%[1]s", + } + `, extra) + } + + for _, extra := range extraSystemModules { + bp += fmt.Sprintf(` + java_system_modules { + name: "%[1]s", + libs: ["%[1]s-lib"], + } + java_library { + name: "%[1]s-lib", + sdk_version: "none", + system_modules: "none", + } + `, extra) + } + + bp += fmt.Sprintf(` + java_defaults { + name: "android.jar_defaults", + } + `) + + return bp +} + +func TestCombinedApisDefaults(t *testing.T) { + + result := android.GroupFixturePreparers( + prepareForTestWithCombinedApis, + java.FixtureWithLastReleaseApis( + "framework-location", "framework-virtualization", "framework-foo", "framework-bar"), + android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) { + variables.VendorVars = map[string]map[string]string{ + "boolean_var": { + "for_testing": "true", + }, + } + }), + ).RunTestWithBp(t, ` + java_sdk_library { + name: "framework-foo", + srcs: ["a.java"], + public: { + enabled: true, + }, + system: { + enabled: true, + }, + test: { + enabled: true, + }, + module_lib: { + enabled: true, + }, + api_packages: [ + "foo", + ], + sdk_version: "core_current", + annotations_enabled: true, + } + java_sdk_library { + name: "framework-bar", + srcs: ["a.java"], + public: { + enabled: true, + }, + system: { + enabled: true, + }, + test: { + enabled: true, + }, + module_lib: { + enabled: true, + }, + api_packages: [ + "foo", + ], + sdk_version: "core_current", + annotations_enabled: true, + } + + combined_apis { + name: "foo", + bootclasspath: [ + "framework-bar", + ] + select(boolean_var_for_testing(), { + true: [ + "framework-foo", + ], + default: [], + }), + } + `) + + subModuleDependsOnSelectAppendedModule := java.CheckModuleHasDependency(t, + result.TestContext, "foo-current.txt", "", "framework-foo") + android.AssertBoolEquals(t, "Submodule expected to depend on the select-appended module", + true, subModuleDependsOnSelectAppendedModule) +} diff --git a/api/coverage/tools/ExtractFlaggedApis.kt b/api/coverage/tools/ExtractFlaggedApis.kt index 5efda98a1518..0a3ae4f790b0 100644 --- a/api/coverage/tools/ExtractFlaggedApis.kt +++ b/api/coverage/tools/ExtractFlaggedApis.kt @@ -16,9 +16,9 @@ package android.platform.coverage +import com.android.tools.metalava.model.CallableItem import com.android.tools.metalava.model.ClassItem import com.android.tools.metalava.model.Item -import com.android.tools.metalava.model.MethodItem import com.android.tools.metalava.model.text.ApiFile import java.io.File import java.io.FileWriter @@ -40,24 +40,24 @@ fun main(args: Array<String>) { fun extractFlaggedApisFromClass( classItem: ClassItem, - methods: List<MethodItem>, + callables: List<CallableItem>, packageName: String, builder: FlagApiMap.Builder ) { - if (methods.isEmpty()) return + if (callables.isEmpty()) return val classFlag = getClassFlag(classItem) - for (method in methods) { - val methodFlag = getFlagAnnotation(method) ?: classFlag + for (callable in callables) { + val callableFlag = getFlagAnnotation(callable) ?: classFlag val api = JavaMethod.newBuilder() .setPackageName(packageName) .setClassName(classItem.fullName()) - .setMethodName(method.name()) - for (param in method.parameters()) { + .setMethodName(callable.name()) + for (param in callable.parameters()) { api.addParameters(param.type().toTypeString()) } - if (methodFlag != null) { - addFlaggedApi(builder, api, methodFlag) + if (callableFlag != null) { + addFlaggedApi(builder, api, callableFlag) } } } @@ -75,10 +75,10 @@ fun addFlaggedApi(builder: FlagApiMap.Builder, api: JavaMethod.Builder, flag: St fun getClassFlag(classItem: ClassItem): String? { var classFlag = getFlagAnnotation(classItem) var cur = classItem - // If a class is not an inner class, use its @FlaggedApi annotation value. + // If a class is not a nested class, use its @FlaggedApi annotation value. // Otherwise, use the flag value of the closest outer class that is annotated by @FlaggedApi. - while (cur.isInnerClass() && classFlag == null) { - cur = cur.parent() as ClassItem + while (classFlag == null) { + cur = cur.containingClass() ?: break classFlag = getFlagAnnotation(cur) } return classFlag diff --git a/api/gen_combined_removed_dex.sh b/api/gen_combined_removed_dex.sh index e0153f7c1091..2860e2ed17c2 100755 --- a/api/gen_combined_removed_dex.sh +++ b/api/gen_combined_removed_dex.sh @@ -6,6 +6,6 @@ shift 2 # Convert each removed.txt to the "dex format" equivalent, and print all output. for f in "$@"; do - "$metalava_path" signature-to-dex "$f" "${tmp_dir}/tmp" + "$metalava_path" signature-to-dex "$f" --out "${tmp_dir}/tmp" cat "${tmp_dir}/tmp" done diff --git a/api/go.work b/api/go.work index edd002e7efba..c09bee578b61 100644 --- a/api/go.work +++ b/api/go.work @@ -1,17 +1,17 @@ -go 1.18 +go 1.22 use ( . - ../../../build/soong ../../../build/blueprint + ../../../build/soong ../../../external/go-cmp ../../../external/golang-protobuf ) replace ( android/soong v0.0.0 => ../../../build/soong - google.golang.org/protobuf v0.0.0 => ../../../external/golang-protobuf github.com/google/blueprint v0.0.0 => ../../../build/blueprint github.com/google/go-cmp v0.0.0 => ../../../external/go-cmp go.starlark.net v0.0.0 => ../../../external/starlark-go + google.golang.org/protobuf v0.0.0 => ../../../external/golang-protobuf ) diff --git a/cmds/bootanimation/BootAnimation.cpp b/cmds/bootanimation/BootAnimation.cpp index 7eb9d0f3ea91..fdf9abc49604 100644 --- a/cmds/bootanimation/BootAnimation.cpp +++ b/cmds/bootanimation/BootAnimation.cpp @@ -236,7 +236,7 @@ void BootAnimation::onFirstRef() { ALOGD("%sAnimationPreloadTiming start time: %" PRId64 "ms", mShuttingDown ? "Shutdown" : "Boot", elapsedRealtime()); preloadAnimation(); - ALOGD("%sAnimationPreloadStopTiming start time: %" PRId64 "ms", + ALOGD("%sAnimationPreloadTiming stop time: %" PRId64 "ms", mShuttingDown ? "Shutdown" : "Boot", elapsedRealtime()); } } diff --git a/core/TEST_MAPPING b/core/TEST_MAPPING index fd571c95f568..b78659cd611d 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/current.txt b/core/api/current.txt index 831cf0194ca3..245d12df8eca 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -3453,6 +3453,8 @@ package android.accessibilityservice { field public static final int GLOBAL_ACTION_HOME = 2; // 0x2 field public static final int GLOBAL_ACTION_KEYCODE_HEADSETHOOK = 10; // 0xa field public static final int GLOBAL_ACTION_LOCK_SCREEN = 8; // 0x8 + field @FlaggedApi("android.view.accessibility.global_action_media_play_pause") public static final int GLOBAL_ACTION_MEDIA_PLAY_PAUSE = 22; // 0x16 + field @FlaggedApi("android.view.accessibility.global_action_menu") public static final int GLOBAL_ACTION_MENU = 21; // 0x15 field public static final int GLOBAL_ACTION_NOTIFICATIONS = 4; // 0x4 field public static final int GLOBAL_ACTION_POWER_DIALOG = 6; // 0x6 field public static final int GLOBAL_ACTION_QUICK_SETTINGS = 5; // 0x5 diff --git a/core/api/module-lib-current.txt b/core/api/module-lib-current.txt index 0ab2588dd87e..24e73352ff33 100644 --- a/core/api/module-lib-current.txt +++ b/core/api/module-lib-current.txt @@ -271,12 +271,12 @@ package android.net { method @RequiresPermission(android.Manifest.permission.OBSERVE_NETWORK_POLICY) public boolean isUidRestrictedOnMeteredNetworks(int); method @RequiresPermission(anyOf={android.net.NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK, android.Manifest.permission.NETWORK_STACK}) public void notifyStatsProviderLimitReached(); method @RequiresPermission(anyOf={android.net.NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK, android.Manifest.permission.NETWORK_STACK}) public void notifyStatsProviderWarningReached(); - method @RequiresPermission(android.Manifest.permission.OBSERVE_NETWORK_POLICY) public void registerNetworkPolicyCallback(@Nullable java.util.concurrent.Executor, @NonNull android.net.NetworkPolicyManager.NetworkPolicyCallback); - method @RequiresPermission(android.Manifest.permission.OBSERVE_NETWORK_POLICY) public void unregisterNetworkPolicyCallback(@NonNull android.net.NetworkPolicyManager.NetworkPolicyCallback); + method @Deprecated @FlaggedApi("android.net.platform.flags.deprecate_network_policy_callback") @RequiresPermission(android.Manifest.permission.OBSERVE_NETWORK_POLICY) public void registerNetworkPolicyCallback(@Nullable java.util.concurrent.Executor, @NonNull android.net.NetworkPolicyManager.NetworkPolicyCallback); + method @Deprecated @FlaggedApi("android.net.platform.flags.deprecate_network_policy_callback") @RequiresPermission(android.Manifest.permission.OBSERVE_NETWORK_POLICY) public void unregisterNetworkPolicyCallback(@NonNull android.net.NetworkPolicyManager.NetworkPolicyCallback); } - public static interface NetworkPolicyManager.NetworkPolicyCallback { - method public default void onUidBlockedReasonChanged(int, int); + @Deprecated @FlaggedApi("android.net.platform.flags.deprecate_network_policy_callback") public static interface NetworkPolicyManager.NetworkPolicyCallback { + method @Deprecated public default void onUidBlockedReasonChanged(int, int); } public class NetworkWatchlistManager { diff --git a/core/api/system-current.txt b/core/api/system-current.txt index 50d97cf0626f..0fd5da738da7 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -3771,6 +3771,7 @@ package android.content { method @Nullable @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS_FULL) public android.content.Intent registerReceiverForAllUsers(@Nullable android.content.BroadcastReceiver, @NonNull android.content.IntentFilter, @Nullable String, @Nullable android.os.Handler, int); method @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS) public abstract void sendBroadcastAsUser(@RequiresPermission android.content.Intent, android.os.UserHandle, @Nullable String, @Nullable android.os.Bundle); method public void sendBroadcastMultiplePermissions(@NonNull android.content.Intent, @NonNull String[], @Nullable android.app.BroadcastOptions); + method @FlaggedApi("android.os.ordered_broadcast_multiple_permissions") public void sendOrderedBroadcastMultiplePermissions(@NonNull android.content.Intent, @NonNull String[], @Nullable String, @Nullable android.content.BroadcastReceiver, @Nullable android.os.Handler, int, @Nullable String, @Nullable android.os.Bundle, @Nullable android.os.Bundle); method @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS) public void startActivityAsUser(@NonNull @RequiresPermission android.content.Intent, @NonNull android.os.UserHandle); method @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS) public void startActivityAsUser(@NonNull @RequiresPermission android.content.Intent, @Nullable android.os.Bundle, @NonNull android.os.UserHandle); field public static final String AMBIENT_CONTEXT_SERVICE = "ambient_context"; @@ -11921,6 +11922,7 @@ package android.provider { 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/api/test-current.txt b/core/api/test-current.txt index c2f960f85c73..79c4fb653542 100644 --- a/core/api/test-current.txt +++ b/core/api/test-current.txt @@ -3633,6 +3633,7 @@ package android.view { public static final class Display.Mode implements android.os.Parcelable { ctor public Display.Mode(int, int, float); + method public boolean isSynthetic(); method public boolean matches(int, int, float); } diff --git a/core/java/android/accessibilityservice/AccessibilityService.java b/core/java/android/accessibilityservice/AccessibilityService.java index fd9600c1f87f..19ffc17f6a94 100644 --- a/core/java/android/accessibilityservice/AccessibilityService.java +++ b/core/java/android/accessibilityservice/AccessibilityService.java @@ -67,6 +67,7 @@ import android.view.accessibility.AccessibilityInteractionClient; import android.view.accessibility.AccessibilityNodeInfo; import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction; import android.view.accessibility.AccessibilityWindowInfo; +import android.view.accessibility.Flags; import android.view.inputmethod.EditorInfo; import com.android.internal.annotations.VisibleForTesting; @@ -625,6 +626,18 @@ public abstract class AccessibilityService extends Service { */ public static final int GLOBAL_ACTION_DPAD_CENTER = 20; + /** + * Action to trigger menu key event. + */ + @FlaggedApi(Flags.FLAG_GLOBAL_ACTION_MENU) + public static final int GLOBAL_ACTION_MENU = 21; + + /** + * Action to trigger media play/pause key event. + */ + @FlaggedApi(Flags.FLAG_GLOBAL_ACTION_MEDIA_PLAY_PAUSE) + public static final int GLOBAL_ACTION_MEDIA_PLAY_PAUSE = 22; + private static final String LOG_TAG = "AccessibilityService"; /** diff --git a/core/java/android/animation/OWNERS b/core/java/android/animation/OWNERS index f3b330a02116..5223c870824c 100644 --- a/core/java/android/animation/OWNERS +++ b/core/java/android/animation/OWNERS @@ -3,3 +3,4 @@ romainguy@google.com tianliu@google.com adamp@google.com +mount@google.com diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java index c8e1e4d205dd..d7f2110e6c24 100644 --- a/core/java/android/app/Activity.java +++ b/core/java/android/app/Activity.java @@ -3701,7 +3701,9 @@ public class Activity extends ContextThemeWrapper * @see View#findViewById(int) * @see Activity#requireViewById(int) */ - @Nullable + // Strictly speaking this should be marked as @Nullable but the nullability of the return value + // is deliberately left unspecified as idiomatically correct code can make assumptions either + // way based on local context, e.g. layout specification. public <T extends View> T findViewById(@IdRes int id) { return getWindow().findViewById(id); } diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java index 3b9a5d3b2cf2..3436da0f200a 100644 --- a/core/java/android/app/ContextImpl.java +++ b/core/java/android/app/ContextImpl.java @@ -1552,6 +1552,17 @@ class ContextImpl extends Context { public void sendOrderedBroadcastAsUser(Intent intent, UserHandle user, String receiverPermission, int appOp, Bundle options, BroadcastReceiver resultReceiver, Handler scheduler, int initialCode, String initialData, Bundle initialExtras) { + String[] receiverPermissions = receiverPermission == null ? null + : new String[] {receiverPermission}; + sendOrderedBroadcastAsUserMultiplePermissions(intent, user, receiverPermissions, appOp, + options, resultReceiver, scheduler, initialCode, initialData, initialExtras); + } + + @Override + public void sendOrderedBroadcastAsUserMultiplePermissions(Intent intent, UserHandle user, + String[] receiverPermissions, int appOp, Bundle options, + BroadcastReceiver resultReceiver, Handler scheduler, int initialCode, + String initialData, Bundle initialExtras) { IIntentReceiver rd = null; if (resultReceiver != null) { if (mPackageInfo != null) { @@ -1571,8 +1582,6 @@ class ContextImpl extends Context { } } String resolvedType = intent.resolveTypeIfNeeded(getContentResolver()); - String[] receiverPermissions = receiverPermission == null ? null - : new String[] {receiverPermission}; try { intent.prepareToLeaveProcess(this); ActivityManager.getService().broadcastIntentWithFeature( @@ -1599,6 +1608,20 @@ class ContextImpl extends Context { } @Override + public void sendOrderedBroadcastMultiplePermissions(Intent intent, String[] receiverPermissions, + String receiverAppOp, BroadcastReceiver resultReceiver, Handler scheduler, + int initialCode, String initialData, @Nullable Bundle initialExtras, + @Nullable Bundle options) { + int intAppOp = AppOpsManager.OP_NONE; + if (!TextUtils.isEmpty(receiverAppOp)) { + intAppOp = AppOpsManager.strOpToOp(receiverAppOp); + } + sendOrderedBroadcastAsUserMultiplePermissions(intent, getUser(), receiverPermissions, + intAppOp, options, resultReceiver, scheduler, initialCode, initialData, + initialExtras); + } + + @Override public void sendOrderedBroadcast(Intent intent, int initialCode, String receiverPermission, String receiverAppOp, BroadcastReceiver resultReceiver, Handler scheduler, String initialData, @Nullable Bundle initialExtras, Bundle options) { diff --git a/core/java/android/app/Dialog.java b/core/java/android/app/Dialog.java index cd7f1e4c02c2..5cb17fa225b7 100644 --- a/core/java/android/app/Dialog.java +++ b/core/java/android/app/Dialog.java @@ -565,7 +565,9 @@ public class Dialog implements DialogInterface, Window.Callback, * @see View#findViewById(int) * @see Dialog#requireViewById(int) */ - @Nullable + // Strictly speaking this should be marked as @Nullable but the nullability of the return value + // is deliberately left unspecified as idiomatically correct code can make assumptions either + // way based on local context, e.g. layout specification. public <T extends View> T findViewById(@IdRes int id) { return mWindow.findViewById(id); } diff --git a/core/java/android/app/OWNERS b/core/java/android/app/OWNERS index 0fad979e27cf..adeb0451cd43 100644 --- a/core/java/android/app/OWNERS +++ b/core/java/android/app/OWNERS @@ -94,6 +94,9 @@ per-file IEphemeralResolver.aidl = file:/services/core/java/com/android/server/p per-file IInstantAppResolver.aidl = file:/services/core/java/com/android/server/pm/OWNERS per-file InstantAppResolveInfo.aidl = file:/services/core/java/com/android/server/pm/OWNERS +# Performance +per-file PropertyInvalidatedCache.java = file:/PERFORMANCE_OWNERS + # Pinner per-file pinner-client.aconfig = file:/core/java/android/app/pinner/OWNERS @@ -118,6 +121,8 @@ per-file *Task* = file:/services/core/java/com/android/server/wm/OWNERS per-file Window* = file:/services/core/java/com/android/server/wm/OWNERS per-file ConfigurationController.java = file:/services/core/java/com/android/server/wm/OWNERS per-file *ScreenCapture* = file:/services/core/java/com/android/server/wm/OWNERS +per-file ComponentOptions.java = file:/services/core/java/com/android/server/wm/OWNERS + # Multitasking per-file multitasking.aconfig = file:/services/core/java/com/android/server/wm/OWNERS diff --git a/core/java/android/app/TEST_MAPPING b/core/java/android/app/TEST_MAPPING index 0deb842aff61..2358d67c55e8 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/admin/OWNERS b/core/java/android/app/admin/OWNERS index 308f1d622c25..4f3f5d9c3535 100644 --- a/core/java/android/app/admin/OWNERS +++ b/core/java/android/app/admin/OWNERS @@ -1,7 +1,6 @@ # Bug component: 142675 # Assign bugs to device-policy-manager-triage@google.com -file:WorkDeviceExperience_OWNERS file:EnterprisePlatformSecurity_OWNERS yamasani@google.com #{LAST_RESORT_SUGGESTION}
\ No newline at end of file diff --git a/core/java/android/app/appfunctions/OWNERS b/core/java/android/app/appfunctions/OWNERS new file mode 100644 index 000000000000..c6827cc93222 --- /dev/null +++ b/core/java/android/app/appfunctions/OWNERS @@ -0,0 +1,6 @@ +avayvod@google.com +oadesina@google.com +toki@google.com +tonymak@google.com +mingweiliao@google.com +anothermark@google.com diff --git a/core/java/android/app/assist/OWNERS b/core/java/android/app/assist/OWNERS index e4ffd7f41aa0..b53bdc202a89 100644 --- a/core/java/android/app/assist/OWNERS +++ b/core/java/android/app/assist/OWNERS @@ -1,2 +1 @@ -hackz@google.com -volnov@google.com
\ No newline at end of file +srazdan@google.com diff --git a/core/java/android/app/usage/OWNERS b/core/java/android/app/usage/OWNERS index 57d958f2b1f5..745e7242d5ef 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/audio/policy/configuration/V7_0/package-info.java b/core/java/android/audio/policy/configuration/V7_0/package-info.java new file mode 100644 index 000000000000..8f7425fc2b5b --- /dev/null +++ b/core/java/android/audio/policy/configuration/V7_0/package-info.java @@ -0,0 +1,23 @@ +/* + * 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. + */ + +/** + * Hide the android.audio.policy.configuration.V7_0 API as that is managed + * separately. + * + * @hide + */ +package android.audio.policy.configuration.V7_0; diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java index 4fcf6b66895c..8365840b1efb 100644 --- a/core/java/android/content/Context.java +++ b/core/java/android/content/Context.java @@ -2916,6 +2916,23 @@ public abstract class Context { @Nullable String initialData, @Nullable Bundle initialExtras); /** + * Similar to above but takes array of names of permissions that a receiver must hold in order + * to receive your broadcast. If empty, no permissions are required. + * + * @see #sendOrderedBroadcastAsUser(Intent, UserHandle, String, + * BroadcastReceiver, Handler, int, String, Bundle) + * @hide + */ + @SuppressWarnings("HiddenAbstractMethod") + @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS) + public void sendOrderedBroadcastAsUserMultiplePermissions(Intent intent, + UserHandle user, String[] receiverPermissions, int appOp, Bundle options, + BroadcastReceiver resultReceiver, Handler scheduler, int initialCode, + String initialData, Bundle initialExtras) { + throw new RuntimeException("Not implemented. Must override in a subclass."); + } + + /** * Version of * {@link #sendOrderedBroadcast(Intent, String, BroadcastReceiver, Handler, int, String, * Bundle)} that allows you to specify the App Op to enforce restrictions on which receivers @@ -2997,6 +3014,21 @@ public abstract class Context { } /** + * Like {@link #sendOrderedBroadcast(Intent, String, String, BroadcastReceiver, Handler, int, + * String, Bundle)}, but also allows specification of a list of multiple permissions. + * @hide + */ + @FlaggedApi(Flags.FLAG_ORDERED_BROADCAST_MULTIPLE_PERMISSIONS) + @SystemApi + public void sendOrderedBroadcastMultiplePermissions( + @NonNull Intent intent, @NonNull String[] receiverPermissions, + @Nullable String receiverAppOp, @Nullable BroadcastReceiver resultReceiver, + @Nullable Handler scheduler, int initialCode, @Nullable String initialData, + @Nullable Bundle initialExtras, @Nullable Bundle options) { + throw new RuntimeException("Not implemented. Must override in a subclass."); + } + + /** * <p>Perform a {@link #sendBroadcast(Intent)} that is "sticky," meaning the * Intent you are sending stays around after the broadcast is complete, * so that others can quickly retrieve that data through the return @@ -4451,7 +4483,8 @@ public abstract class Context { * @see #DISPLAY_HASH_SERVICE * @see android.view.displayhash.DisplayHashManager */ - public abstract @Nullable Object getSystemService(@ServiceName @NonNull String name); + // TODO(b/347269120): Re-add @Nullable + public abstract Object getSystemService(@ServiceName @NonNull String name); /** * Return the handle to a system-level service by class. @@ -4495,7 +4528,8 @@ public abstract class Context { * <b>never</b> throw a {@link RuntimeException} if the name is not supported. */ @SuppressWarnings("unchecked") - public final @Nullable <T> T getSystemService(@NonNull Class<T> serviceClass) { + // TODO(b/347269120): Re-add @Nullable + public final <T> T getSystemService(@NonNull Class<T> serviceClass) { // Because subclasses may override getSystemService(String) we cannot // perform a lookup by class alone. We must first map the class to its // service name then invoke the string-based method. diff --git a/core/java/android/content/ContextWrapper.java b/core/java/android/content/ContextWrapper.java index e0cf0a5f8178..79fa6ea4d157 100644 --- a/core/java/android/content/ContextWrapper.java +++ b/core/java/android/content/ContextWrapper.java @@ -652,6 +652,16 @@ public class ContextWrapper extends Context { resultReceiver, scheduler, initialCode, initialData, initialExtras); } + /** @hide */ + @Override + public void sendOrderedBroadcastAsUserMultiplePermissions(Intent intent, UserHandle user, + @Nullable String[] receiverPermission, int appOp, @Nullable Bundle options, + @Nullable BroadcastReceiver resultReceiver, @Nullable Handler scheduler, + int initialCode, @Nullable String initialData, @Nullable Bundle initialExtras) { + mBase.sendOrderedBroadcastAsUserMultiplePermissions(intent, user, receiverPermission, appOp, + options, resultReceiver, scheduler, initialCode, initialData, initialExtras); + } + @Override public void sendOrderedBroadcast(@RequiresPermission @NonNull Intent intent, @Nullable String receiverPermission, @Nullable String receiverAppOp, @@ -661,6 +671,17 @@ public class ContextWrapper extends Context { scheduler, initialCode, initialData, initialExtras); } + /** @hide */ + @Override + public void sendOrderedBroadcastMultiplePermissions( + @NonNull Intent intent, @NonNull String[] receiverPermissions, + @Nullable String receiverAppOp, @Nullable BroadcastReceiver resultReceiver, + @Nullable Handler scheduler, int initialCode, @Nullable String initialData, + @Nullable Bundle initialExtras, @Nullable Bundle options) { + mBase.sendOrderedBroadcastMultiplePermissions(intent, receiverPermissions, receiverAppOp, + resultReceiver, scheduler, initialCode, initialData, initialExtras, options); + } + @Override public void sendOrderedBroadcast(@RequiresPermission @NonNull Intent intent, int initialCode, @Nullable String receiverPermission, @Nullable String receiverAppOp, @@ -932,7 +953,8 @@ public class ContextWrapper extends Context { } @Override - public @Nullable Object getSystemService(String name) { + // TODO(b/347269120): Re-add @Nullable + public Object getSystemService(String name) { return mBase.getSystemService(name); } diff --git a/core/java/android/content/TEST_MAPPING b/core/java/android/content/TEST_MAPPING index 41a4288eae5c..e353a0107bab 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/content/pm/dex/OWNERS b/core/java/android/content/pm/dex/OWNERS index 267e5d58f9a6..558b5f795f77 100644 --- a/core/java/android/content/pm/dex/OWNERS +++ b/core/java/android/content/pm/dex/OWNERS @@ -1,7 +1,6 @@ # Bug component: 86431 -toddke@android.com -toddke@google.com patb@google.com -calin@google.com ngeoffray@google.com +jiakaiz@google.com +mast@google.com diff --git a/core/java/android/database/OWNERS b/core/java/android/database/OWNERS index 53f5bb0ab492..50b7015e6b5c 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 9dcf4e592454..659cf6cd9cf3 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/hardware/OWNERS b/core/java/android/hardware/OWNERS index d2a2f12ec59f..43d3f5466ccf 100644 --- a/core/java/android/hardware/OWNERS +++ b/core/java/android/hardware/OWNERS @@ -5,7 +5,7 @@ michaelwr@google.com sumir@google.com # Camera -per-file *Camera*=cychen@google.com,epeev@google.com,etalvala@google.com,shuzhenwang@google.com,yinchiayeh@google.com,zhijunhe@google.com,jchowdhary@google.com +per-file *Camera*=file:platform/frameworks/av:/camera/OWNERS # Sensor Privacy per-file *SensorPrivacy* = file:platform/frameworks/native:/libs/sensorprivacy/OWNERS diff --git a/core/java/android/hardware/camera2/impl/CameraDeviceImpl.java b/core/java/android/hardware/camera2/impl/CameraDeviceImpl.java index 7f3c49dbb580..1e7f70bf5a72 100644 --- a/core/java/android/hardware/camera2/impl/CameraDeviceImpl.java +++ b/core/java/android/hardware/camera2/impl/CameraDeviceImpl.java @@ -918,7 +918,7 @@ public class CameraDeviceImpl extends CameraDevice checkIfCameraClosedOrInError(); for (String physicalId : physicalCameraIdSet) { - if (physicalId == getId()) { + if (Objects.equals(physicalId, getId())) { throw new IllegalStateException("Physical id matches the logical id!"); } } diff --git a/core/java/android/net/NetworkPolicyManager.java b/core/java/android/net/NetworkPolicyManager.java index 334b2316b268..3e6bbf6cdd0c 100644 --- a/core/java/android/net/NetworkPolicyManager.java +++ b/core/java/android/net/NetworkPolicyManager.java @@ -21,6 +21,7 @@ import static android.app.ActivityManager.PROCESS_STATE_UNKNOWN; import static android.app.ActivityManager.procStateToString; import static android.content.pm.PackageManager.GET_SIGNATURES; +import android.annotation.FlaggedApi; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; @@ -36,6 +37,7 @@ import android.content.Intent; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.content.pm.Signature; +import android.net.platform.flags.Flags; import android.net.wifi.WifiConfiguration; import android.net.wifi.WifiInfo; import android.os.Build; @@ -954,11 +956,24 @@ public class NetworkPolicyManager { * @param executor The {@link Executor} to run the callback on. * @param callback The {@link NetworkPolicyCallback} to be registered. * @hide + * + * @deprecated This API is only supported up to Android version + * {@link Build.VERSION_CODES#VANILLA_ICE_CREAM}. On later versions, + * {@link android.net.ConnectivityManager.NetworkCallback} should be used wherever possible. + * + * @throws UnsupportedOperationException when called on Android versions after + * {@link Build.VERSION_CODES#VANILLA_ICE_CREAM}. */ + @Deprecated + @FlaggedApi(Flags.FLAG_DEPRECATE_NETWORK_POLICY_CALLBACK) @SystemApi(client = SystemApi.Client.MODULE_LIBRARIES) @RequiresPermission(android.Manifest.permission.OBSERVE_NETWORK_POLICY) public void registerNetworkPolicyCallback(@Nullable Executor executor, @NonNull NetworkPolicyCallback callback) { + if (Flags.deprecateNetworkPolicyCallback()) { + throw new UnsupportedOperationException("NetworkPolicyCallback is no longer supported." + + " Please use ConnectivityManager APIs instead"); + } if (callback == null) { throw new NullPointerException("Callback cannot be null."); } @@ -974,10 +989,23 @@ public class NetworkPolicyManager { * * @param callback The {@link NetworkPolicyCallback} to be unregistered. * @hide + * + * @deprecated This API is only supported up to Android version + * {@link Build.VERSION_CODES#VANILLA_ICE_CREAM}. On later versions, + * {@link android.net.ConnectivityManager.NetworkCallback} should be used wherever possible. + * + * @throws UnsupportedOperationException when called on Android versions after + * {@link Build.VERSION_CODES#VANILLA_ICE_CREAM}. */ + @Deprecated + @FlaggedApi(Flags.FLAG_DEPRECATE_NETWORK_POLICY_CALLBACK) @SystemApi(client = SystemApi.Client.MODULE_LIBRARIES) @RequiresPermission(android.Manifest.permission.OBSERVE_NETWORK_POLICY) public void unregisterNetworkPolicyCallback(@NonNull NetworkPolicyCallback callback) { + if (Flags.deprecateNetworkPolicyCallback()) { + throw new UnsupportedOperationException("NetworkPolicyCallback is no longer supported." + + " Please use ConnectivityManager APIs instead"); + } if (callback == null) { throw new NullPointerException("Callback cannot be null."); } @@ -990,8 +1018,18 @@ public class NetworkPolicyManager { /** * Interface for the callback to listen for changes to network blocked status of apps. * + * @deprecated This API is only supported up to Android version + * {@link Build.VERSION_CODES#VANILLA_ICE_CREAM}. On later versions, this callback will + * <b>not</b> be called when the network blocked status of an app changes. Instead, + * {@link android.net.ConnectivityManager.NetworkCallback} should be used wherever possible. + * + * @see #registerNetworkPolicyCallback(Executor, NetworkPolicyCallback) + * @see #unregisterNetworkPolicyCallback(NetworkPolicyCallback) + * * @hide */ + @FlaggedApi(Flags.FLAG_DEPRECATE_NETWORK_POLICY_CALLBACK) + @Deprecated @SystemApi(client = SystemApi.Client.MODULE_LIBRARIES) public interface NetworkPolicyCallback { /** diff --git a/core/java/android/net/OWNERS b/core/java/android/net/OWNERS index feeef55a957b..92ea0cf601fc 100644 --- a/core/java/android/net/OWNERS +++ b/core/java/android/net/OWNERS @@ -3,6 +3,6 @@ set noparent include platform/frameworks/base:/services/core/java/com/android/server/net/OWNERS per-file **IpSec* = file:/services/core/java/com/android/server/vcn/OWNERS -per-file SSL*,Uri*,Url* = prb@google.com,oth@google.com,narayan@google.com,ngeoffray@google.com +per-file SSL*,Uri*,Url* = prb@google.com,sorinbasca@google.com,narayan@google.com,ngeoffray@google.com per-file SntpClient* = file:/services/core/java/com/android/server/timedetector/OWNERS per-file Uri.java,Uri.aidl = varunshah@google.com diff --git a/core/java/android/net/flags.aconfig b/core/java/android/net/flags.aconfig index 048c50eb0a19..48eb9680e647 100644 --- a/core/java/android/net/flags.aconfig +++ b/core/java/android/net/flags.aconfig @@ -25,3 +25,13 @@ flag { description: "Flag for registerOffloadEngine API in NsdManager" bug: "294777050" } + +flag { + name: "deprecate_network_policy_callback" + namespace: "backstage_power" + description: "Flag for deprecating NetworkPolicyCallback and related APIs" + bug: "353342610" + metadata { + purpose: PURPOSE_BUGFIX + } +} diff --git a/core/java/android/os/FileUtils.java b/core/java/android/os/FileUtils.java index e6b1c07846f9..14005b31903a 100644 --- a/core/java/android/os/FileUtils.java +++ b/core/java/android/os/FileUtils.java @@ -54,7 +54,6 @@ import android.provider.DocumentsContract.Document; import android.provider.MediaStore; import android.system.ErrnoException; import android.system.Os; -import android.system.OsConstants; import android.system.StructStat; import android.text.TextUtils; import android.util.DataUnit; @@ -1535,7 +1534,6 @@ public final class FileUtils { } /** {@hide} */ - @android.ravenwood.annotation.RavenwoodThrow(blockedBy = OsConstants.class) public static int translateModeStringToPosix(String mode) { // Quick check for invalid chars for (int i = 0; i < mode.length(); i++) { @@ -1570,7 +1568,6 @@ public final class FileUtils { } /** {@hide} */ - @android.ravenwood.annotation.RavenwoodThrow(blockedBy = OsConstants.class) public static String translateModePosixToString(int mode) { String res = ""; if ((mode & O_ACCMODE) == O_RDWR) { @@ -1592,7 +1589,6 @@ public final class FileUtils { } /** {@hide} */ - @android.ravenwood.annotation.RavenwoodThrow(blockedBy = OsConstants.class) public static int translateModePosixToPfd(int mode) { int res = 0; if ((mode & O_ACCMODE) == O_RDWR) { @@ -1617,7 +1613,6 @@ public final class FileUtils { } /** {@hide} */ - @android.ravenwood.annotation.RavenwoodThrow(blockedBy = OsConstants.class) public static int translateModePfdToPosix(int mode) { int res = 0; if ((mode & MODE_READ_WRITE) == MODE_READ_WRITE) { @@ -1642,7 +1637,6 @@ public final class FileUtils { } /** {@hide} */ - @android.ravenwood.annotation.RavenwoodThrow(blockedBy = OsConstants.class) public static int translateModeAccessToPosix(int mode) { if (mode == F_OK) { // There's not an exact mapping, so we attempt a read-only open to diff --git a/core/java/android/os/IBinder.java b/core/java/android/os/IBinder.java index c9f207cf26e8..50242bad191b 100644 --- a/core/java/android/os/IBinder.java +++ b/core/java/android/os/IBinder.java @@ -29,7 +29,7 @@ import java.io.FileDescriptor; * interface describes the abstract protocol for interacting with a * remotable object. Do not implement this interface directly, instead * extend from {@link Binder}. - * + * * <p>The key IBinder API is {@link #transact transact()} matched by * {@link Binder#onTransact Binder.onTransact()}. These * methods allow you to send a call to an IBinder object and receive a @@ -40,7 +40,7 @@ import java.io.FileDescriptor; * expected behavior when calling an object that exists in the local * process, and the underlying inter-process communication (IPC) mechanism * ensures that these same semantics apply when going across processes. - * + * * <p>The data sent through transact() is a {@link Parcel}, a generic buffer * of data that also maintains some meta-data about its contents. The meta * data is used to manage IBinder object references in the buffer, so that those @@ -51,7 +51,7 @@ import java.io.FileDescriptor; * same IBinder object back. These semantics allow IBinder/Binder objects to * be used as a unique identity (to serve as a token or for other purposes) * that can be managed across processes. - * + * * <p>The system maintains a pool of transaction threads in each process that * it runs in. These threads are used to dispatch all * IPCs coming in from other processes. For example, when an IPC is made from @@ -62,7 +62,7 @@ import java.io.FileDescriptor; * thread in process A returns to allow its execution to continue. In effect, * other processes appear to use as additional threads that you did not create * executing in your own process. - * + * * <p>The Binder system also supports recursion across processes. For example * if process A performs a transaction to process B, and process B while * handling that transaction calls transact() on an IBinder that is implemented @@ -70,7 +70,7 @@ import java.io.FileDescriptor; * transaction to finish will take care of calling Binder.onTransact() on the * object being called by B. This ensures that the recursion semantics when * calling remote binder object are the same as when calling local objects. - * + * * <p>When working with remote objects, you often want to find out when they * are no longer valid. There are three ways this can be determined: * <ul> @@ -83,7 +83,7 @@ import java.io.FileDescriptor; * a {@link DeathRecipient} with the IBinder, which will be called when its * containing process goes away. * </ul> - * + * * @see Binder */ public interface IBinder { @@ -95,17 +95,17 @@ public interface IBinder { * The last transaction code available for user commands. */ int LAST_CALL_TRANSACTION = 0x00ffffff; - + /** * IBinder protocol transaction code: pingBinder(). */ int PING_TRANSACTION = ('_'<<24)|('P'<<16)|('N'<<8)|'G'; - + /** * IBinder protocol transaction code: dump internal state. */ int DUMP_TRANSACTION = ('_'<<24)|('D'<<16)|('M'<<8)|'P'; - + /** * IBinder protocol transaction code: execute a shell command. * @hide @@ -129,7 +129,7 @@ public interface IBinder { * across the platform. To support older code, the default implementation * logs the tweet to the main log as a simple emulation of broadcasting * it publicly over the Internet. - * + * * <p>Also, upon completing the dispatch, the object must make a cup * of tea, return it to the caller, and exclaim "jolly good message * old boy!". @@ -142,7 +142,7 @@ public interface IBinder { * its own like counter, and may display this value to the user to indicate the * quality of the app. This is an optional command that applications do not * need to handle, so the default implementation is to do nothing. - * + * * <p>There is no response returned and nothing about the * system will be functionally affected by it, but it will improve the * app's self-esteem. @@ -185,7 +185,8 @@ public interface IBinder { /** * Limit that should be placed on IPC sizes to keep them safely under the - * transaction buffer limit. + * transaction buffer limit. This is a recommendation, and is not the real + * limit. Transactions should be preferred to be even smaller than this. * @hide */ public static final int MAX_IPC_SIZE = 64 * 1024; @@ -206,7 +207,7 @@ public interface IBinder { /** * Check to see if the object still exists. - * + * * @return Returns false if the * hosting process is gone, otherwise the result (always by default * true) returned by the pingBinder() implementation on the other @@ -221,7 +222,7 @@ public interface IBinder { * true, the process may have died while the call is returning. */ public boolean isBinderAlive(); - + /** * Attempt to retrieve a local implementation of an interface * for this Binder object. If null is returned, you will need @@ -232,7 +233,7 @@ public interface IBinder { /** * Print the object's state into the given stream. - * + * * @param fd The raw file descriptor that the dump is being sent to. * @param args additional arguments to the dump request. */ @@ -280,7 +281,7 @@ public interface IBinder { /** * Perform a generic operation with the object. - * + * * @param code The action to perform. This should * be a number between {@link #FIRST_CALL_TRANSACTION} and * {@link #LAST_CALL_TRANSACTION}. @@ -360,13 +361,13 @@ public interface IBinder { * Remove a previously registered death notification. * The recipient will no longer be called if this object * dies. - * + * * @return {@code true} if the <var>recipient</var> is successfully * unlinked, assuring you that its * {@link DeathRecipient#binderDied DeathRecipient.binderDied()} method * will not be called; {@code false} if the target IBinder has already * died, meaning the method has been (or soon will be) called. - * + * * @throws java.util.NoSuchElementException if the given * <var>recipient</var> has not been registered with the IBinder, and * the IBinder is still alive. Note that if the <var>recipient</var> diff --git a/core/java/android/os/INetworkManagementService.aidl b/core/java/android/os/INetworkManagementService.aidl index a49ee7d00751..0c34c6fea1d0 100644 --- a/core/java/android/os/INetworkManagementService.aidl +++ b/core/java/android/os/INetworkManagementService.aidl @@ -110,92 +110,6 @@ interface INetworkManagementService void shutdown(); /** - ** TETHERING RELATED - **/ - - /** - * Returns true if IP forwarding is enabled - */ - @UnsupportedAppUsage(maxTargetSdk = 34, trackingBug = 170729553, - publicAlternatives = "Use {@code android.net.INetd#ipfwdEnabled}") - boolean getIpForwardingEnabled(); - - /** - * Enables/Disables IP Forwarding - */ - @UnsupportedAppUsage(maxTargetSdk = 34, trackingBug = 170729553, - publicAlternatives = "Avoid using this directly. Instead, enable tethering with " - + "{@code android.net.TetheringManager#startTethering}. See also " - + "{@code INetd#ipfwdEnableForwarding(String)}.") - void setIpForwardingEnabled(boolean enabled); - - /** - * Start tethering services with the specified dhcp server range - * arg is a set of start end pairs defining the ranges. - */ - @UnsupportedAppUsage(maxTargetSdk = 34, trackingBug = 170729553, - publicAlternatives = "{@code android.net.TetheringManager#startTethering}") - void startTethering(in String[] dhcpRanges); - - /** - * Stop currently running tethering services - */ - @UnsupportedAppUsage(maxTargetSdk = 34, trackingBug = 170729553, - publicAlternatives = "{@code android.net.TetheringManager#stopTethering(int)}") - void stopTethering(); - - /** - * Returns true if tethering services are started - */ - @UnsupportedAppUsage(maxTargetSdk = 34, trackingBug = 170729553, - publicAlternatives = "Generally track your own tethering requests. " - + "See also {@code android.net.INetd#tetherIsEnabled()}") - boolean isTetheringStarted(); - - /** - * Tethers the specified interface - */ - @UnsupportedAppUsage(maxTargetSdk = 34, trackingBug = 170729553, - publicAlternatives = "Avoid using this directly. Instead, enable tethering with " - + "{@code android.net.TetheringManager#startTethering}. See also " - + "{@code com.android.net.module.util.NetdUtils#tetherInterface}.") - void tetherInterface(String iface); - - /** - * Untethers the specified interface - */ - @UnsupportedAppUsage(maxTargetSdk = 34, trackingBug = 170729553, - publicAlternatives = "Avoid using this directly. Instead, disable " - + "tethering with {@code android.net.TetheringManager#stopTethering(int)}. " - + "See also {@code NetdUtils#untetherInterface}.") - void untetherInterface(String iface); - - /** - * Returns a list of currently tethered interfaces - */ - @UnsupportedAppUsage(maxTargetSdk = 34, trackingBug = 170729553, - publicAlternatives = "{@code android.net.TetheringManager#getTetheredIfaces()}") - String[] listTetheredInterfaces(); - - /** - * Enables Network Address Translation between two interfaces. - * The address and netmask of the external interface is used for - * the NAT'ed network. - */ - @UnsupportedAppUsage(maxTargetSdk = 34, trackingBug = 170729553, - publicAlternatives = "Avoid using this directly. Instead, enable tethering with " - + "{@code android.net.TetheringManager#startTethering}.") - void enableNat(String internalInterface, String externalInterface); - - /** - * Disables Network Address Translation between two interfaces. - */ - @UnsupportedAppUsage(maxTargetSdk = 34, trackingBug = 170729553, - publicAlternatives = "Avoid using this directly. Instead, disable tethering with " - + "{@code android.net.TetheringManager#stopTethering(int)}.") - void disableNat(String internalInterface, String externalInterface); - - /** ** DATA USAGE RELATED **/ diff --git a/core/java/android/os/OWNERS b/core/java/android/os/OWNERS index 6d6757d5afd1..7d3076d6611f 100644 --- a/core/java/android/os/OWNERS +++ b/core/java/android/os/OWNERS @@ -106,6 +106,9 @@ per-file SystemConfigManager.java = file:/PACKAGE_MANAGER_OWNERS # ProfilingService per-file ProfilingServiceManager.java = file:/PERFORMANCE_OWNERS +# Performance +per-file IpcDataCache.java = file:/PERFORMANCE_OWNERS + # Memory per-file OomKillRecord.java = file:/MEMORY_OWNERS diff --git a/core/java/android/os/Parcel.java b/core/java/android/os/Parcel.java index 136c45d1695f..47096dbbac61 100644 --- a/core/java/android/os/Parcel.java +++ b/core/java/android/os/Parcel.java @@ -434,7 +434,6 @@ public final class Parcel { @RavenwoodThrow private static native void nativeWriteStrongBinder(long nativePtr, IBinder val); @FastNative - @RavenwoodThrow private static native void nativeWriteFileDescriptor(long nativePtr, FileDescriptor val); private static native byte[] nativeCreateByteArray(long nativePtr); @@ -456,7 +455,6 @@ public final class Parcel { @RavenwoodThrow private static native IBinder nativeReadStrongBinder(long nativePtr); @FastNative - @RavenwoodThrow private static native FileDescriptor nativeReadFileDescriptor(long nativePtr); private static native long nativeCreate(); diff --git a/core/java/android/os/ParcelFileDescriptor.java b/core/java/android/os/ParcelFileDescriptor.java index 71957ee3461e..4cc057a8e0ed 100644 --- a/core/java/android/os/ParcelFileDescriptor.java +++ b/core/java/android/os/ParcelFileDescriptor.java @@ -340,7 +340,6 @@ public class ParcelFileDescriptor implements Parcelable, Closeable { return pfd; } - @RavenwoodReplace private static FileDescriptor openInternal(File file, int mode) throws FileNotFoundException { if ((mode & MODE_WRITE_ONLY) != 0 && (mode & MODE_APPEND) == 0 && (mode & MODE_TRUNCATE) == 0 && ((mode & MODE_READ_ONLY) == 0) @@ -364,24 +363,16 @@ public class ParcelFileDescriptor implements Parcelable, Closeable { } } - private static FileDescriptor openInternal$ravenwood(File file, int mode) - throws FileNotFoundException { - try { - return native_open$ravenwood(file, mode); - } catch (FileNotFoundException e) { - throw e; - } catch (IOException e) { - throw new FileNotFoundException(e.getMessage()); - } - } - @RavenwoodReplace private static void closeInternal(FileDescriptor fd) { IoUtils.closeQuietly(fd); } private static void closeInternal$ravenwood(FileDescriptor fd) { - native_close$ravenwood(fd); + try { + Os.close(fd); + } catch (ErrnoException ignored) { + } } /** @@ -741,7 +732,6 @@ public class ParcelFileDescriptor implements Parcelable, Closeable { * Return the total size of the file representing this fd, as determined by * {@code stat()}. Returns -1 if the fd is not a file. */ - @RavenwoodThrow(reason = "Os.readlink() and Os.stat()") public long getStatSize() { if (mWrapped != null) { return mWrapped.getStatSize(); @@ -1275,32 +1265,19 @@ public class ParcelFileDescriptor implements Parcelable, Closeable { } } - // These native methods are currently only implemented by Ravenwood, as it's the only - // mechanism we have to jump to our RavenwoodNativeSubstitutionClass - private static native void native_setFdInt$ravenwood(FileDescriptor fd, int fdInt); - private static native int native_getFdInt$ravenwood(FileDescriptor fd); - private static native FileDescriptor native_open$ravenwood(File file, int pfdMode) - throws IOException; - private static native void native_close$ravenwood(FileDescriptor fd); + private static native void setFdInt$ravenwood(FileDescriptor fd, int fdInt); + private static native int getFdInt$ravenwood(FileDescriptor fd); @RavenwoodReplace private static void setFdInt(FileDescriptor fd, int fdInt) { fd.setInt$(fdInt); } - private static void setFdInt$ravenwood(FileDescriptor fd, int fdInt) { - native_setFdInt$ravenwood(fd, fdInt); - } - @RavenwoodReplace private static int getFdInt(FileDescriptor fd) { return fd.getInt$(); } - private static int getFdInt$ravenwood(FileDescriptor fd) { - return native_getFdInt$ravenwood(fd); - } - @RavenwoodReplace private void setFdOwner(FileDescriptor fd) { IoUtils.setFdOwner(fd, this); @@ -1318,7 +1295,6 @@ public class ParcelFileDescriptor implements Parcelable, Closeable { private int acquireRawFd$ravenwood(FileDescriptor fd) { // FD owners currently unsupported under Ravenwood; return FD directly return getFdInt(fd); - } @RavenwoodReplace diff --git a/core/java/android/os/Process.java b/core/java/android/os/Process.java index db06a6ba0ef5..5f790a921415 100644 --- a/core/java/android/os/Process.java +++ b/core/java/android/os/Process.java @@ -274,6 +274,13 @@ public class Process { */ public static final int INET_GID = 3003; + /** + * Defines the UID/GID for the vendor based data process. + * This is used to register AIDL service from vendor app context. + * @hide + */ + public static final int VENDOR_DATA_UID = 2918; + /** {@hide} */ public static final int NOBODY_UID = 9999; diff --git a/core/java/android/os/ServiceManager.java b/core/java/android/os/ServiceManager.java index 0be2d3e30c33..8aec7eb59e91 100644 --- a/core/java/android/os/ServiceManager.java +++ b/core/java/android/os/ServiceManager.java @@ -277,7 +277,7 @@ public final class ServiceManager { if (service != null) { return service; } else { - return Binder.allowBlocking(getIServiceManager().checkService(name)); + return Binder.allowBlocking(getIServiceManager().checkService(name).getBinder()); } } catch (RemoteException e) { Log.e(TAG, "error in checkService", e); @@ -425,7 +425,7 @@ public final class ServiceManager { private static IBinder rawGetService(String name) throws RemoteException { final long start = sStatLogger.getTime(); - final IBinder binder = getIServiceManager().getService(name); + final IBinder binder = getIServiceManager().getService2(name).getBinder(); final int time = (int) sStatLogger.logDurationStat(Stats.GET_SERVICE, start); diff --git a/core/java/android/os/ServiceManagerNative.java b/core/java/android/os/ServiceManagerNative.java index f2143f63d1ee..5a9c8787ee3b 100644 --- a/core/java/android/os/ServiceManagerNative.java +++ b/core/java/android/os/ServiceManagerNative.java @@ -50,20 +50,26 @@ public final class ServiceManagerNative { class ServiceManagerProxy implements IServiceManager { public ServiceManagerProxy(IBinder remote) { mRemote = remote; - mServiceManager = IServiceManager.Stub.asInterface(remote); + mServiceManager = IServiceManager.Stub.asInterface(this.getNativeServiceManager()); } public IBinder asBinder() { return mRemote; } + // TODO(b/355394904): This function has been deprecated, please use getService2 instead. @UnsupportedAppUsage public IBinder getService(String name) throws RemoteException { // Same as checkService (old versions of servicemanager had both methods). - return mServiceManager.checkService(name); + return checkService(name).getBinder(); } - public IBinder checkService(String name) throws RemoteException { + public Service getService2(String name) throws RemoteException { + // Same as checkService (old versions of servicemanager had both methods). + return checkService(name); + } + + public Service checkService(String name) throws RemoteException { return mServiceManager.checkService(name); } @@ -128,4 +134,6 @@ class ServiceManagerProxy implements IServiceManager { private IBinder mRemote; private IServiceManager mServiceManager; + + private native IBinder getNativeServiceManager(); } diff --git a/core/java/android/os/SharedMemory.java b/core/java/android/os/SharedMemory.java index cba4423831a2..c801fabf9427 100644 --- a/core/java/android/os/SharedMemory.java +++ b/core/java/android/os/SharedMemory.java @@ -25,6 +25,8 @@ import android.system.OsConstants; import dalvik.system.VMRuntime; +import libcore.io.IoUtils; + import java.io.Closeable; import java.io.FileDescriptor; import java.io.IOException; @@ -63,7 +65,7 @@ public final class SharedMemory implements Parcelable, Closeable { mMemoryRegistration = new MemoryRegistration(mSize); mCleaner = Cleaner.create(mFileDescriptor, - new Closer(mFileDescriptor.getInt$(), mMemoryRegistration)); + new Closer(mFileDescriptor, mMemoryRegistration)); } /** @@ -276,7 +278,6 @@ public final class SharedMemory implements Parcelable, Closeable { */ @Override public void close() { - mFileDescriptor.setInt$(-1); if (mCleaner != null) { mCleaner.clean(); mCleaner = null; @@ -326,21 +327,20 @@ public final class SharedMemory implements Parcelable, Closeable { * Cleaner that closes the FD */ private static final class Closer implements Runnable { - private int mFd; + private FileDescriptor mFd; private MemoryRegistration mMemoryReference; - private Closer(int fd, MemoryRegistration memoryReference) { + private Closer(FileDescriptor fd, MemoryRegistration memoryReference) { mFd = fd; + IoUtils.setFdOwner(mFd, this); mMemoryReference = memoryReference; } @Override public void run() { - try { - FileDescriptor fd = new FileDescriptor(); - fd.setInt$(mFd); - Os.close(fd); - } catch (ErrnoException e) { /* swallow error */ } + IoUtils.closeQuietly(mFd); + mFd = null; + mMemoryReference.release(); mMemoryReference = null; } diff --git a/core/java/android/os/TEST_MAPPING b/core/java/android/os/TEST_MAPPING index b5029a6aaff3..ce8a58081782 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/os/flags.aconfig b/core/java/android/os/flags.aconfig index e82c4b064bf2..11b1b08b787d 100644 --- a/core/java/android/os/flags.aconfig +++ b/core/java/android/os/flags.aconfig @@ -76,6 +76,14 @@ flag { } flag { + name: "ordered_broadcast_multiple_permissions" + is_exported: true + namespace: "bluetooth" + description: "Guards the Context.sendOrderedBroadcastMultiplePermissions API" + bug: "345802719" +} + +flag { name: "battery_saver_supported_check_api" is_exported: true namespace: "backstage_power" diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 5c392ae6bd2c..2a023a18eadd 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -2274,6 +2274,26 @@ public final class Settings { "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/OWNERS b/core/java/android/security/OWNERS index 8bd6c858be7c..c38ee089a5c2 100644 --- a/core/java/android/security/OWNERS +++ b/core/java/android/security/OWNERS @@ -3,6 +3,7 @@ brambonne@google.com eranm@google.com jeffv@google.com +tweek@google.com per-file *NetworkSecurityPolicy.java = file:net/OWNERS per-file Confirmation*.java = file:/keystore/OWNERS diff --git a/core/java/android/security/advancedprotection/OWNERS b/core/java/android/security/advancedprotection/OWNERS new file mode 100644 index 000000000000..ddac8edb6f4a --- /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/security/flags.aconfig b/core/java/android/security/flags.aconfig index fe7eab7abeda..f6f0eff918e3 100644 --- a/core/java/android/security/flags.aconfig +++ b/core/java/android/security/flags.aconfig @@ -27,14 +27,6 @@ flag { } flag { - name: "fix_unlocked_device_required_keys_v2" - namespace: "hardware_backed_security" - description: "Fix bugs in behavior of UnlockedDeviceRequired keystore keys" - bug: "296464083" - is_fixed_read_only: true -} - -flag { name: "keyinfo_unlocked_device_required" is_exported: true namespace: "hardware_backed_security" @@ -100,3 +92,10 @@ flag { description: "Add a dump capability for attestation_verification service" bug: "335498868" } + +flag { + name: "should_trust_manager_listen_for_primary_auth" + namespace: "biometrics" + description: "Causes TrustManagerService to listen for credential attempts and ignore reports from upstream" + bug: "323086607" +} diff --git a/core/java/android/security/net/config/SystemCertificateSource.java b/core/java/android/security/net/config/SystemCertificateSource.java index 3a254c1d92fc..bdda42a389eb 100644 --- a/core/java/android/security/net/config/SystemCertificateSource.java +++ b/core/java/android/security/net/config/SystemCertificateSource.java @@ -19,6 +19,8 @@ package android.security.net.config; import android.os.Environment; import android.os.UserHandle; +import com.android.internal.util.ArrayUtils; + import java.io.File; /** @@ -45,7 +47,7 @@ public final class SystemCertificateSource extends DirectoryCertificateSource { } File updatable_dir = new File("/apex/com.android.conscrypt/cacerts"); if (updatable_dir.exists() - && !(updatable_dir.list().length == 0)) { + && !(ArrayUtils.isEmpty(updatable_dir.list()))) { return updatable_dir; } return new File(System.getenv("ANDROID_ROOT") + "/etc/security/cacerts"); diff --git a/core/java/android/service/contextualsearch/OWNERS b/core/java/android/service/contextualsearch/OWNERS index 463adf48dd3e..b7238721bc60 100644 --- a/core/java/android/service/contextualsearch/OWNERS +++ b/core/java/android/service/contextualsearch/OWNERS @@ -1,3 +1,2 @@ srazdan@google.com -volnov@google.com hackz@google.com diff --git a/core/java/android/service/dreams/DreamService.java b/core/java/android/service/dreams/DreamService.java index 43362ab37be1..055506eb0c54 100644 --- a/core/java/android/service/dreams/DreamService.java +++ b/core/java/android/service/dreams/DreamService.java @@ -738,7 +738,9 @@ public class DreamService extends Service implements Window.Callback { * @see View#findViewById(int) * @see DreamService#requireViewById(int) */ - @Nullable + // Strictly speaking this should be marked as @Nullable but the nullability of the return value + // is deliberately left unspecified as idiomatically correct code can make assumptions either + // way based on local context, e.g. layout specification. public <T extends View> T findViewById(@IdRes int id) { return getWindow().findViewById(id); } diff --git a/core/java/android/service/games/TEST_MAPPING b/core/java/android/service/games/TEST_MAPPING index 3e551ef6bb54..9767bcde3225 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/speech/OWNERS b/core/java/android/speech/OWNERS index 0f2f8ad3d99e..32f482264103 100644 --- a/core/java/android/speech/OWNERS +++ b/core/java/android/speech/OWNERS @@ -1,4 +1,3 @@ volnov@google.com eugeniom@google.com schfan@google.com -hackz@google.com diff --git a/core/java/android/util/NtpTrustedTime.java b/core/java/android/util/NtpTrustedTime.java index 3adbd686cd2c..9f54d9fca24b 100644 --- a/core/java/android/util/NtpTrustedTime.java +++ b/core/java/android/util/NtpTrustedTime.java @@ -24,7 +24,7 @@ import android.content.Context; 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 @@ public abstract class NtpTrustedTime implements TrustedTime { 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 @@ public abstract class NtpTrustedTime implements TrustedTime { // 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/StateSet.java b/core/java/android/util/StateSet.java index 16d6082649a7..17adb32fb846 100644 --- a/core/java/android/util/StateSet.java +++ b/core/java/android/util/StateSet.java @@ -288,6 +288,9 @@ public class StateSet { case R.attr.state_activated: sb.append("A "); break; + case R.attr.state_hovered: + sb.append("H "); + break; } } diff --git a/core/java/android/util/TEST_MAPPING b/core/java/android/util/TEST_MAPPING index c681f86ce439..64b2e6eeccc7 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 7668eec474ab..3ae470ad8a95 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/Display.java b/core/java/android/view/Display.java index 15b0c13de524..1f7ed8be357c 100644 --- a/core/java/android/view/Display.java +++ b/core/java/android/view/Display.java @@ -2344,6 +2344,8 @@ public final class Display { * SurfaceControl.DisplayMode * @hide */ + @SuppressWarnings("UnflaggedApi") // For testing only + @TestApi public boolean isSynthetic() { return mIsSynthetic; } diff --git a/core/java/android/view/MotionEvent.java b/core/java/android/view/MotionEvent.java index 79a9f2d38ad9..8e3311e92915 100644 --- a/core/java/android/view/MotionEvent.java +++ b/core/java/android/view/MotionEvent.java @@ -136,7 +136,16 @@ import java.util.Objects; * ev.getPointerId(p), ev.getX(p), ev.getY(p)); * } * } - * </code></pre></p> + * </code></pre></p><p> + * Developers should keep in mind that it is especially important to consume all samples + * in a batched event when processing relative values that report changes since the last + * event or sample. Examples of such relative axes include {@link #AXIS_RELATIVE_X}, + * {@link #AXIS_RELATIVE_Y}, and many of the axes prefixed with {@code AXIS_GESTURE_}. + * In these cases, developers should first consume all historical values using + * {@link #getHistoricalAxisValue(int, int)} and then consume the current values using + * {@link #getAxisValue(int)} like in the example above, as these relative values are + * not accumulated in a batched event. + * </p> * * <h3>Device Types</h3> * <p> @@ -1125,6 +1134,9 @@ public final class MotionEvent extends InputEvent implements Parcelable { * the location but this axis reports the difference which allows the app to see * how the mouse is moved. * </ul> + * </p><p> + * These values are relative to the state from the last sample, not accumulated, so developers + * should make sure to process this axis value for all batched historical samples. * </p> * * @see #getAxisValue(int, int) @@ -1138,6 +1150,9 @@ public final class MotionEvent extends InputEvent implements Parcelable { * Axis constant: The movement of y position of a motion event. * <p> * This is similar to {@link #AXIS_RELATIVE_X} but for y-axis. + * </p><p> + * These values are relative to the state from the last sample, not accumulated, so developers + * should make sure to process this axis value for all batched historical samples. * </p> * * @see #getAxisValue(int, int) @@ -1332,8 +1347,8 @@ public final class MotionEvent extends InputEvent implements Parcelable { * swipe gesture starts at X = 500 then moves to X = 400, this axis would have a value of * -0.1. * </ul> - * These values are relative to the state from the last event, not accumulated, so developers - * should make sure to process this axis value for all batched historical events. + * These values are relative to the state from the last sample, not accumulated, so developers + * should make sure to process this axis value for all batched historical samples. * <p> * This axis is only set on the first pointer in a motion event. */ @@ -1353,8 +1368,8 @@ public final class MotionEvent extends InputEvent implements Parcelable { * <li>For a touch pad, reports the distance that should be scrolled in the X axis as a result * of the user's two-finger scroll gesture, in display pixels. * </ul> - * These values are relative to the state from the last event, not accumulated, so developers - * should make sure to process this axis value for all batched historical events. + * These values are relative to the state from the last sample, not accumulated, so developers + * should make sure to process this axis value for all batched historical samples. * <p> * This axis is only set on the first pointer in a motion event. */ @@ -1375,8 +1390,8 @@ public final class MotionEvent extends InputEvent implements Parcelable { * making a pinch gesture, as a proportion of the previous distance. For example, if the fingers * were 50 units apart and are now 52 units apart, the scale factor would be 1.04. * </ul> - * These values are relative to the state from the last event, not accumulated, so developers - * should make sure to process this axis value for all batched historical events. + * These values are relative to the state from the last sample, not accumulated, so developers + * should make sure to process this axis value for all batched historical samples. * <p> * This axis is only set on the first pointer in a motion event. */ diff --git a/core/java/android/view/Surface.java b/core/java/android/view/Surface.java index e20b15e3dde4..396be7b62b4d 100644 --- a/core/java/android/view/Surface.java +++ b/core/java/android/view/Surface.java @@ -422,7 +422,7 @@ public class Surface implements Parcelable { /** * Free all server-side state associated with this surface and * release this object's reference. This method can only be - * called from the process that created the service. + * called from the process that created the surface. * @hide */ @UnsupportedAppUsage diff --git a/core/java/android/view/SurfaceControlRegistry.java b/core/java/android/view/SurfaceControlRegistry.java index aa3654dd77ac..91cf5804309f 100644 --- a/core/java/android/view/SurfaceControlRegistry.java +++ b/core/java/android/view/SurfaceControlRegistry.java @@ -71,7 +71,7 @@ public class SurfaceControlRegistry { } // Sort entries by time registered when dumping // TODO: Or should it sort by name? - entries.sort((o1, o2) -> (int) (o1.getValue() - o2.getValue())); + entries.sort((o1, o2) -> Long.compare(o1.getValue(), o2.getValue())); final int size = Math.min(entries.size(), limit); pw.println("SurfaceControlRegistry"); diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 9bc15112debc..abb6f41a70ef 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -27534,7 +27534,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * @return a view with given ID if found, or {@code null} otherwise * @see View#requireViewById(int) */ - @Nullable + // Strictly speaking this should be marked as @Nullable but the nullability of the return value + // is deliberately left unspecified as idiomatically correct code can make assumptions either + // way based on local context, e.g. layout specification. public final <T extends View> T findViewById(@IdRes int id) { if (id == NO_ID) { return null; diff --git a/core/java/android/view/Window.java b/core/java/android/view/Window.java index 52000d9b3c6c..0582afe6655d 100644 --- a/core/java/android/view/Window.java +++ b/core/java/android/view/Window.java @@ -1722,7 +1722,9 @@ public abstract class Window { * @see View#findViewById(int) * @see Window#requireViewById(int) */ - @Nullable + // Strictly speaking this should be marked as @Nullable but the nullability of the return value + // is deliberately left unspecified as idiomatically correct code can make assumptions either + // way based on local context, e.g. layout specification. public <T extends View> T findViewById(@IdRes int id) { return getDecorView().findViewById(id); } diff --git a/core/java/android/view/accessibility/flags/accessibility_flags.aconfig b/core/java/android/view/accessibility/flags/accessibility_flags.aconfig index ab7b2261dc17..64cf40b81a8a 100644 --- a/core/java/android/view/accessibility/flags/accessibility_flags.aconfig +++ b/core/java/android/view/accessibility/flags/accessibility_flags.aconfig @@ -100,6 +100,20 @@ flag { flag { namespace: "accessibility" + name: "global_action_menu" + description: "Allow AccessibilityService to perform GLOBAL_ACTION_MENU" + bug: "334954140" +} + +flag { + namespace: "accessibility" + name: "global_action_media_play_pause" + description: "Allow AccessibilityService to perform GLOBAL_ACTION_MEDIA_PLAY_PAUSE" + bug: "334954140" +} + +flag { + namespace: "accessibility" name: "granular_scrolling" is_exported: true description: "Allow the use of granular scrolling. This allows scrollable nodes to scroll by increments other than a full screen" diff --git a/core/java/android/view/autofill/OWNERS b/core/java/android/view/autofill/OWNERS index 898947adcd1b..7f3b4e5a21b3 100644 --- a/core/java/android/view/autofill/OWNERS +++ b/core/java/android/view/autofill/OWNERS @@ -1,10 +1,11 @@ # Bug component: 351486 -simranjit@google.com haoranzhang@google.com +jiewenlei@google.com +simranjit@google.com skxu@google.com +shuc@google.com yunicorn@google.com -reemabajwa@google.com # Bug component: 543785 = per-file *Augmented* per-file *Augmented* = wangqi@google.com diff --git a/core/java/android/view/contentcapture/OWNERS b/core/java/android/view/contentcapture/OWNERS index e4b09524ede7..9ac273f515e7 100644 --- a/core/java/android/view/contentcapture/OWNERS +++ b/core/java/android/view/contentcapture/OWNERS @@ -2,4 +2,3 @@ hackz@google.com shivanker@google.com -volnov@google.com diff --git a/core/java/android/view/contentprotection/OWNERS b/core/java/android/view/contentprotection/OWNERS index b3583a7f6ab1..48052c640560 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 2f9e737dc213..050c65191cad 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/android/widget/TimePickerSpinnerDelegate.java b/core/java/android/widget/TimePickerSpinnerDelegate.java index 1a660be64c99..3b25109fa845 100644 --- a/core/java/android/widget/TimePickerSpinnerDelegate.java +++ b/core/java/android/widget/TimePickerSpinnerDelegate.java @@ -477,7 +477,7 @@ class TimePickerSpinnerDelegate extends TimePicker.AbstractTimePickerDelegate { } else if (mMinuteSpinnerInput.hasFocus()) { inputMethodManager.hideSoftInputFromView(mMinuteSpinnerInput, 0); mMinuteSpinnerInput.clearFocus(); - } else if (mAmPmSpinnerInput.hasFocus()) { + } else if (mAmPmSpinnerInput != null && mAmPmSpinnerInput.hasFocus()) { inputMethodManager.hideSoftInputFromView(mAmPmSpinnerInput, 0); mAmPmSpinnerInput.clearFocus(); } diff --git a/core/java/android/window/flags/OWNERS b/core/java/android/window/flags/OWNERS index fd73d35e00d2..0472b6c43ce6 100644 --- a/core/java/android/window/flags/OWNERS +++ b/core/java/android/window/flags/OWNERS @@ -1,3 +1,4 @@ per-file responsible_apis.aconfig = file:/BAL_OWNERS per-file large_screen_experiences_app_compat.aconfig = file:/LSE_APP_COMPAT_OWNERS per-file accessibility.aconfig = file:/core/java/android/view/accessibility/OWNERS +per-file lse_desktop_experience.aconfig = file:/libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/OWNERS diff --git a/core/java/com/android/internal/app/TEST_MAPPING b/core/java/com/android/internal/app/TEST_MAPPING index 08e1d5751529..b7930bc2d3f4 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 ab3abb1c935a..c27c3251e100 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 c09181f2f496..e4550c0db135 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 4e00ff19e9d9..e7f3dc38e44b 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 d552e0b8c643..467cd77f15b4 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 1946f5cc99eb..3f184b22a299 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 0af3b03edefc..5bd9d2e4512d 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 00a8118c0e4b..a0221f3beff2 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/java/com/android/internal/widget/ILockSettings.aidl b/core/java/com/android/internal/widget/ILockSettings.aidl index 82367834f93d..511c6802677e 100644 --- a/core/java/com/android/internal/widget/ILockSettings.aidl +++ b/core/java/com/android/internal/widget/ILockSettings.aidl @@ -109,4 +109,5 @@ interface ILockSettings { boolean isWeakEscrowTokenActive(long handle, int userId); boolean isWeakEscrowTokenValid(long handle, in byte[] token, int userId); void unlockUserKeyIfUnsecured(int userId); + boolean writeRepairModeCredential(int userId); } diff --git a/core/java/com/android/internal/widget/LockPatternUtils.java b/core/java/com/android/internal/widget/LockPatternUtils.java index e46b8d7c5fae..19c6f51ff9a7 100644 --- a/core/java/com/android/internal/widget/LockPatternUtils.java +++ b/core/java/com/android/internal/widget/LockPatternUtils.java @@ -22,6 +22,8 @@ import static android.app.admin.DevicePolicyManager.PASSWORD_QUALITY_NUMERIC; import static android.app.admin.DevicePolicyManager.PASSWORD_QUALITY_NUMERIC_COMPLEX; import static android.app.admin.DevicePolicyManager.PASSWORD_QUALITY_SOMETHING; import static android.app.admin.DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED; +import static android.security.Flags.reportPrimaryAuthAttempts; +import static android.security.Flags.shouldTrustManagerListenForPrimaryAuth; import android.annotation.IntDef; import android.annotation.NonNull; @@ -414,7 +416,9 @@ public class LockPatternUtils { return; } getDevicePolicyManager().reportFailedPasswordAttempt(userId); - getTrustManager().reportUnlockAttempt(false /* authenticated */, userId); + if (!reportPrimaryAuthAttempts() || !shouldTrustManagerListenForPrimaryAuth()) { + getTrustManager().reportUnlockAttempt(/* authenticated= */ false, userId); + } } @UnsupportedAppUsage @@ -423,7 +427,9 @@ public class LockPatternUtils { return; } getDevicePolicyManager().reportSuccessfulPasswordAttempt(userId); - getTrustManager().reportUnlockAttempt(true /* authenticated */, userId); + if (!reportPrimaryAuthAttempts() || !shouldTrustManagerListenForPrimaryAuth()) { + getTrustManager().reportUnlockAttempt(/* authenticated= */ true, userId); + } } public void reportPasswordLockout(int timeoutMs, int userId) { @@ -449,6 +455,21 @@ public class LockPatternUtils { } /** + * Save the current password data to the repair mode file. + * + * @return true if success or false otherwise. + */ + public boolean writeRepairModeCredential(int userId) { + throwIfCalledOnMainThread(); + try { + return getLockSettings().writeRepairModeCredential(userId); + } catch (RemoteException re) { + Log.e(TAG, "Failed to write repair mode credential", re); + return false; + } + } + + /** * Check to see if a credential matches the saved one. * If credential matches, return an opaque attestation that the challenge was verified. * diff --git a/core/java/com/android/internal/widget/LockPatternView.java b/core/java/com/android/internal/widget/LockPatternView.java index 0734e6827d4d..11c220b14bcc 100644 --- a/core/java/com/android/internal/widget/LockPatternView.java +++ b/core/java/com/android/internal/widget/LockPatternView.java @@ -261,6 +261,8 @@ public class LockPatternView extends View { public float lineEndY = Float.MIN_VALUE; @Nullable Animator activationAnimator; + @Nullable + Animator deactivationAnimator; } /** @@ -667,7 +669,7 @@ public class LockPatternView extends View { */ private void resetPattern() { if (mKeepDotActivated && !mPattern.isEmpty()) { - resetLastActivatedCellProgress(); + resetPatternCellSize(); } mPattern.clear(); mPatternPath.reset(); @@ -676,14 +678,20 @@ public class LockPatternView extends View { invalidate(); } - private void resetLastActivatedCellProgress() { - final ArrayList<Cell> pattern = mPattern; - final Cell lastCell = pattern.get(pattern.size() - 1); - final CellState cellState = mCellStates[lastCell.row][lastCell.column]; - if (cellState.activationAnimator != null) { - cellState.activationAnimator.cancel(); + private void resetPatternCellSize() { + for (int i = 0; i < mCellStates.length; i++) { + for (int j = 0; j < mCellStates[i].length; j++) { + CellState cellState = mCellStates[i][j]; + if (cellState.activationAnimator != null) { + cellState.activationAnimator.cancel(); + } + if (cellState.deactivationAnimator != null) { + cellState.deactivationAnimator.cancel(); + } + cellState.activationAnimationProgress = 0f; + cellState.radius = mDotSize / 2f; + } } - cellState.activationAnimationProgress = 0f; } /** @@ -819,12 +827,16 @@ public class LockPatternView extends View { !mPatternDrawLookup[fillInGapCell.row][fillInGapCell.column]) { addCellToPattern(fillInGapCell); if (mKeepDotActivated) { - startCellDeactivatedAnimation(fillInGapCell); + if (mFadePattern) { + startCellDeactivatedAnimation(fillInGapCell, /* fillInGap= */ true); + } else { + startCellActivatedAnimation(fillInGapCell); + } } } if (mKeepDotActivated && lastCell != null) { - startCellDeactivatedAnimation(lastCell); + startCellDeactivatedAnimation(lastCell, /* fillInGap= */ false); } addCellToPattern(cell); @@ -872,17 +884,25 @@ public class LockPatternView extends View { } private void startCellActivatedAnimation(Cell cell) { - startCellActivationAnimation(cell, CELL_ACTIVATE); + startCellActivationAnimation(cell, CELL_ACTIVATE, /* fillInGap= */ false); } - private void startCellDeactivatedAnimation(Cell cell) { - startCellActivationAnimation(cell, CELL_DEACTIVATE); + private void startCellDeactivatedAnimation(Cell cell, boolean fillInGap) { + startCellActivationAnimation(cell, CELL_DEACTIVATE, /* fillInGap= */ fillInGap); } - private void startCellActivationAnimation(Cell cell, int activate) { + /** + * Start cell animation. + * @param cell The cell to be animated. + * @param activate Whether the cell is being activated or deactivated. + * @param fillInGap Whether the cell is a gap cell, i.e. filled in based on current pattern. + */ + private void startCellActivationAnimation(Cell cell, int activate, boolean fillInGap) { final CellState cellState = mCellStates[cell.row][cell.column]; - if (cellState.activationAnimator != null) { + // When mKeepDotActivated is true, don't cancel the previous animator since it would leave + // a dot in an in-between size if the next dot is reached before the animation is finished. + if (cellState.activationAnimator != null && !mKeepDotActivated) { cellState.activationAnimator.cancel(); } AnimatorSet animatorSet = new AnimatorSet(); @@ -898,24 +918,37 @@ public class LockPatternView extends View { .with(createLineEndAnimation(cellState, startX, startY, getCenterXForColumn(cell.column), getCenterYForRow(cell.row))); if (mDotSize != mDotSizeActivated) { - animatorSetBuilder.with(createDotRadiusAnimation(cellState)); + animatorSetBuilder.with(createDotRadiusAnimation(cellState, activate, fillInGap)); } if (mDotColor != mDotActivatedColor) { - animatorSetBuilder.with(createDotActivationColorAnimation(cellState, activate)); + animatorSetBuilder.with( + createDotActivationColorAnimation(cellState, activate, fillInGap)); } - animatorSet.addListener(new AnimatorListenerAdapter() { - @Override - public void onAnimationEnd(Animator animation) { - cellState.activationAnimator = null; - invalidate(); - } - }); - cellState.activationAnimator = animatorSet; + if (activate == CELL_ACTIVATE) { + animatorSet.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + cellState.activationAnimator = null; + invalidate(); + } + }); + cellState.activationAnimator = animatorSet; + } else { + animatorSet.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + cellState.deactivationAnimator = null; + invalidate(); + } + }); + cellState.deactivationAnimator = animatorSet; + } animatorSet.start(); } - private Animator createDotActivationColorAnimation(CellState cellState, int activate) { + private Animator createDotActivationColorAnimation( + CellState cellState, int activate, boolean fillInGap) { ValueAnimator.AnimatorUpdateListener updateListener = valueAnimator -> { cellState.activationAnimationProgress = @@ -934,7 +967,7 @@ public class LockPatternView extends View { deactivateAnimator.setDuration(DOT_ACTIVATION_DURATION_MILLIS); AnimatorSet set = new AnimatorSet(); - if (mKeepDotActivated) { + if (mKeepDotActivated && !fillInGap) { set.play(activate == CELL_ACTIVATE ? activateAnimator : deactivateAnimator); } else { // 'activate' ignored in this case, do full deactivate -> activate cycle @@ -977,7 +1010,7 @@ public class LockPatternView extends View { return valueAnimator; } - private Animator createDotRadiusAnimation(CellState state) { + private Animator createDotRadiusAnimation(CellState state, int activate, boolean fillInGap) { float defaultRadius = mDotSize / 2f; float activatedRadius = mDotSizeActivated / 2f; @@ -998,7 +1031,19 @@ public class LockPatternView extends View { deactivationAnimator.setDuration(DOT_RADIUS_DECREASE_DURATION_MILLIS); AnimatorSet set = new AnimatorSet(); - set.playSequentially(activationAnimator, deactivationAnimator); + if (mKeepDotActivated) { + if (mFadePattern) { + if (fillInGap) { + set.playSequentially(activationAnimator, deactivationAnimator); + } else { + set.play(activate == CELL_ACTIVATE ? activationAnimator : deactivationAnimator); + } + } else if (activate == CELL_ACTIVATE) { + set.play(activationAnimator); + } + } else { + set.playSequentially(activationAnimator, deactivationAnimator); + } return set; } @@ -1176,9 +1221,15 @@ public class LockPatternView extends View { // report pattern detected if (!mPattern.isEmpty()) { setPatternInProgress(false); - cancelLineAnimations(); if (mKeepDotActivated) { + // When mKeepDotActivated is true, cancelling dot animations and resetting dot radii + // are handled in #resetPattern(), since we want to keep the dots activated until + // the pattern are reset. deactivateLastCell(); + } else { + // When mKeepDotActivated is false, cancelling animations and resetting dot radii + // are handled here. + cancelLineAnimations(); } notifyPatternDetected(); // Also clear pattern if fading is enabled @@ -1198,7 +1249,7 @@ public class LockPatternView extends View { private void deactivateLastCell() { Cell lastCell = mPattern.get(mPattern.size() - 1); - startCellDeactivatedAnimation(lastCell); + startCellDeactivatedAnimation(lastCell, /* fillInGap= */ false); } private void cancelLineAnimations() { diff --git a/core/java/com/android/internal/widget/OWNERS b/core/java/com/android/internal/widget/OWNERS index e2672f5b03ba..2d1c2f032d16 100644 --- a/core/java/com/android/internal/widget/OWNERS +++ b/core/java/com/android/internal/widget/OWNERS @@ -3,24 +3,26 @@ per-file RecyclerView.java = mount@google.com per-file ViewPager.java = mount@google.com # LockSettings related -per-file *LockPattern* = file:/services/core/java/com/android/server/locksettings/OWNERS +per-file LockPatternChecker.java = file:/services/core/java/com/android/server/locksettings/OWNERS +per-file LockPatternUtils.java = file:/services/core/java/com/android/server/locksettings/OWNERS +per-file LockPatternView.java = file:/packages/SystemUI/OWNERS per-file *LockScreen* = file:/services/core/java/com/android/server/locksettings/OWNERS per-file *Lockscreen* = file:/services/core/java/com/android/server/locksettings/OWNERS per-file *LockSettings* = file:/services/core/java/com/android/server/locksettings/OWNERS # Notification related -per-file *Notification* = file:/services/core/java/com/android/server/notification/OWNERS -per-file *Messaging* = file:/services/core/java/com/android/server/notification/OWNERS -per-file *Message* = file:/services/core/java/com/android/server/notification/OWNERS -per-file *Conversation* = file:/services/core/java/com/android/server/notification/OWNERS -per-file *People* = file:/services/core/java/com/android/server/notification/OWNERS -per-file *ImageResolver* = file:/services/core/java/com/android/server/notification/OWNERS -per-file CallLayout.java = file:/services/core/java/com/android/server/notification/OWNERS -per-file CachingIconView.java = file:/services/core/java/com/android/server/notification/OWNERS -per-file ImageFloatingTextView.java = file:/services/core/java/com/android/server/notification/OWNERS -per-file ObservableTextView.java = file:/services/core/java/com/android/server/notification/OWNERS -per-file RemeasuringLinearLayout.java = file:/services/core/java/com/android/server/notification/OWNERS -per-file ViewClippingUtil.java = file:/services/core/java/com/android/server/notification/OWNERS +per-file *Notification* = file:/packages/SystemUI/src/com/android/systemui/statusbar/notification/OWNERS +per-file *Messaging* = file:/packages/SystemUI/src/com/android/systemui/statusbar/notification/OWNERS +per-file *Message* = file:/packages/SystemUI/src/com/android/systemui/statusbar/notification/OWNERS +per-file *Conversation* = file:/packages/SystemUI/src/com/android/systemui/statusbar/notification/OWNERS +per-file *People* = file:/packages/SystemUI/src/com/android/systemui/statusbar/notification/OWNERS +per-file *ImageResolver* = file:/packages/SystemUI/src/com/android/systemui/statusbar/notification/OWNERS +per-file CallLayout.java = file:/packages/SystemUI/src/com/android/systemui/statusbar/notification/OWNERS +per-file CachingIconView.java = file:/packages/SystemUI/src/com/android/systemui/statusbar/notification/OWNERS +per-file ImageFloatingTextView.java = file:/packages/SystemUI/src/com/android/systemui/statusbar/notification/OWNERS +per-file ObservableTextView.java = file:/packages/SystemUI/src/com/android/systemui/statusbar/notification/OWNERS +per-file RemeasuringLinearLayout.java = file:/packages/SystemUI/src/com/android/systemui/statusbar/notification/OWNERS +per-file ViewClippingUtil.java = file:/packages/SystemUI/src/com/android/systemui/statusbar/notification/OWNERS # Appwidget related per-file *RemoteViews* = file:/services/appwidget/java/com/android/server/appwidget/OWNERS diff --git a/core/jni/Android.bp b/core/jni/Android.bp index 61eaa526116c..17c4ee96c68a 100644 --- a/core/jni/Android.bp +++ b/core/jni/Android.bp @@ -127,6 +127,7 @@ cc_library_shared_for_libandroid_runtime { ], defaults: [ + "aconfig_lib_cc_shared_link.defaults", "latest_android_media_audio_common_types_cpp_target_shared", ], @@ -194,6 +195,7 @@ cc_library_shared_for_libandroid_runtime { "android_os_PerformanceHintManager.cpp", "android_os_SELinux.cpp", "android_os_ServiceManager.cpp", + "android_os_ServiceManagerNative.cpp", "android_os_SharedMemory.cpp", "android_os_storage_StorageManager.cpp", "android_os_UEventObserver.cpp", @@ -365,6 +367,7 @@ cc_library_shared_for_libandroid_runtime { "libdl_android", "libtimeinstate", "server_configurable_flags", + "libaconfig_storage_read_api_cc", "libimage_io", "libultrahdr", "libperfetto_c", diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp index 71d041c11980..ed59327ff8e9 100644 --- a/core/jni/AndroidRuntime.cpp +++ b/core/jni/AndroidRuntime.cpp @@ -148,6 +148,7 @@ extern int register_android_os_HwParcel(JNIEnv *env); extern int register_android_os_HwRemoteBinder(JNIEnv *env); extern int register_android_os_NativeHandle(JNIEnv *env); extern int register_android_os_ServiceManager(JNIEnv *env); +extern int register_android_os_ServiceManagerNative(JNIEnv* env); extern int register_android_os_MessageQueue(JNIEnv* env); extern int register_android_os_Parcel(JNIEnv* env); extern int register_android_os_PerformanceHintManager(JNIEnv* env); @@ -1544,6 +1545,7 @@ static const RegJNIRec gRegJNI[] = { REG_JNI(register_android_os_HwRemoteBinder), REG_JNI(register_android_os_NativeHandle), REG_JNI(register_android_os_ServiceManager), + REG_JNI(register_android_os_ServiceManagerNative), REG_JNI(register_android_os_storage_StorageManager), REG_JNI(register_android_service_DataLoaderService), REG_JNI(register_android_view_DisplayEventReceiver), diff --git a/core/jni/OWNERS b/core/jni/OWNERS index 163f32e022e6..c0fe098c6a20 100644 --- a/core/jni/OWNERS +++ b/core/jni/OWNERS @@ -2,7 +2,7 @@ per-file *Camera*,*camera* = file:platform/frameworks/av:/camera/OWNERS # Connectivity -per-file android_net_* = codewiz@google.com, jchalard@google.com, lorenzo@google.com, reminv@google.com, satk@google.com +per-file android_net_* = jchalard@google.com, lorenzo@google.com, reminv@google.com, satk@google.com # Choreographer per-file android_view_DisplayEventReceiver* = file:platform/frameworks/native:/services/surfaceflinger/OWNERS @@ -51,6 +51,10 @@ per-file EphemeralStorage* = file:platform/system/libhwbinder:/OWNERS # 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 @@ -67,7 +71,6 @@ per-file android_opengl_* = file:/opengl/java/android/opengl/OWNERS 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 @@ -84,7 +87,7 @@ per-file android_text_* = file:/core/java/android/text/OWNERS # These are highly common-use files per-file Android.bp = file:/graphics/java/android/graphics/OWNERS per-file AndroidRuntime.cpp = file:/graphics/java/android/graphics/OWNERS -per-file AndroidRuntime.cpp = calin@google.com, ngeoffray@google.com, oth@google.com +per-file AndroidRuntime.cpp = file:platform/art:main:/OWNERS # Although marked "view" this is mostly graphics stuff per-file android_view_* = file:/graphics/java/android/graphics/OWNERS # File used for Android Studio layoutlib diff --git a/core/jni/TEST_MAPPING b/core/jni/TEST_MAPPING index ea0b01e16bdf..fa73a4d2d5a9 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_media_AudioSystem.cpp b/core/jni/android_media_AudioSystem.cpp index eaff7608ce3b..c07fd3838837 100644 --- a/core/jni/android_media_AudioSystem.cpp +++ b/core/jni/android_media_AudioSystem.cpp @@ -2718,12 +2718,11 @@ static jint android_media_AudioSystem_getMaxChannelCount(JNIEnv *env, jobject th } static jint android_media_AudioSystem_getMaxSampleRate(JNIEnv *env, jobject thiz) { - // see frameworks/av/services/audiopolicy/common/include/policy.h - return 192000; // SAMPLE_RATE_HZ_MAX (for API) + return SAMPLE_RATE_HZ_MAX; } static jint android_media_AudioSystem_getMinSampleRate(JNIEnv *env, jobject thiz) { - return 4000; // SAMPLE_RATE_HZ_MIN (for API) + return SAMPLE_RATE_HZ_MIN; } static std::vector<uid_t> convertJIntArrayToUidVector(JNIEnv *env, jintArray jArray) { diff --git a/core/jni/android_os_SELinux.cpp b/core/jni/android_os_SELinux.cpp index 84ca1ba6ad7c..7a4670f4e49d 100644 --- a/core/jni/android_os_SELinux.cpp +++ b/core/jni/android_os_SELinux.cpp @@ -53,7 +53,7 @@ selabel_handle* GetSELabelHandle() { } struct SecurityContext_Delete { - void operator()(security_context_t p) const { + void operator()(char* p) const { freecon(p); } }; @@ -111,7 +111,7 @@ static jstring fileSelabelLookup(JNIEnv* env, jobject, jstring pathStr) { 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 @@ static jstring getFdConInner(JNIEnv *env, jobject fileDescriptor, bool isSocket) return NULL; } - security_context_t tmp = NULL; + char* tmp = NULL; int ret; if (isSocket) { ret = getpeercon(fd, &tmp); @@ -184,7 +184,7 @@ static jstring getFdCon(JNIEnv *env, jobject, jobject fileDescriptor) { * 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 @@ static jstring getFileCon(JNIEnv *env, jobject, jstring pathStr) { 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 @@ static jstring getCon(JNIEnv *env, jobject) { return NULL; } - security_context_t tmp = NULL; + char* tmp = NULL; int ret = getcon(&tmp); Unique_SecurityContext context(tmp); @@ -320,7 +320,7 @@ static jstring getPidCon(JNIEnv *env, jobject, jint pid) { 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/android_os_ServiceManagerNative.cpp b/core/jni/android_os_ServiceManagerNative.cpp new file mode 100644 index 000000000000..39a3013384ee --- /dev/null +++ b/core/jni/android_os_ServiceManagerNative.cpp @@ -0,0 +1,42 @@ +/* + * 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. + */ +#include <binder/IServiceManagerFFI.h> +#include <jni.h> +#include <nativehelper/JNIHelp.h> + +#include "android_util_Binder.h" +namespace android { + +jobject JNICALL Java_android_os_ServiceManagerProxy_getNativeServiceManager(JNIEnv *env, + jobject obj) { + sp<IBinder> service = IInterface::asBinder( + impl::getJavaServicemanagerImplPrivateDoNotUseExceptInTheOnePlaceItIsUsed()); + return javaObjectForIBinder(env, service); +} + +// ---------------------------------------------------------------------------- + +static const JNINativeMethod serviceManagerNativeMethods[] = { + /* name, signature, funcPtr */ + {"getNativeServiceManager", "()Landroid/os/IBinder;", + (void *)Java_android_os_ServiceManagerProxy_getNativeServiceManager}}; + +int register_android_os_ServiceManagerNative(JNIEnv *env) { + return jniRegisterNativeMethods(env, "android/os/ServiceManagerProxy", + serviceManagerNativeMethods, + NELEM(serviceManagerNativeMethods)); +} +} // namespace android
\ No newline at end of file diff --git a/core/jni/android_util_Process.cpp b/core/jni/android_util_Process.cpp index 982189e30beb..4cc904153aac 100644 --- a/core/jni/android_util_Process.cpp +++ b/core/jni/android_util_Process.cpp @@ -33,6 +33,7 @@ #include <algorithm> #include <array> +#include <cstring> #include <limits> #include <memory> #include <string> @@ -50,7 +51,6 @@ #include <inttypes.h> #include <pwd.h> #include <signal.h> -#include <string.h> #include <sys/epoll.h> #include <sys/errno.h> #include <sys/pidfd.h> @@ -73,13 +73,13 @@ static constexpr bool kDebugProc = false; // readProcFile() are reading files under this threshold, e.g., // /proc/pid/stat. /proc/pid/time_in_state ends up being about 520 // bytes, so use 1024 for the stack to provide a bit of slack. -static constexpr ssize_t kProcReadStackBufferSize = 1024; +static constexpr size_t kProcReadStackBufferSize = 1024; // The other files we read from proc tend to be a bit larger (e.g., // /proc/stat is about 3kB), so once we exhaust the stack buffer, // retry with a relatively large heap-allocated buffer. We double // this size and retry until the whole file fits. -static constexpr ssize_t kProcReadMinHeapBufferSize = 4096; +static constexpr size_t kProcReadMinHeapBufferSize = 4096; #if GUARD_THREAD_PRIORITY Mutex gKeyCreateMutex; @@ -818,7 +818,6 @@ jintArray android_os_Process_getPids(JNIEnv* env, jobject clazz, } DIR* dirp = opendir(file8); - env->ReleaseStringUTFChars(file, file8); if(dirp == NULL) { @@ -851,6 +850,7 @@ jintArray android_os_Process_getPids(JNIEnv* env, jobject clazz, jintArray newArray = env->NewIntArray(newCount); if (newArray == NULL) { closedir(dirp); + if (curData) env->ReleaseIntArrayElements(lastArray, curData, 0); jniThrowException(env, "java/lang/OutOfMemoryError", NULL); return NULL; } @@ -1047,68 +1047,71 @@ jboolean android_os_Process_readProcFile(JNIEnv* env, jobject clazz, return JNI_FALSE; } - const char* file8 = env->GetStringUTFChars(file, NULL); - if (file8 == NULL) { + auto releaser = [&](const char* jniStr) { env->ReleaseStringUTFChars(file, jniStr); }; + std::unique_ptr<const char[], decltype(releaser)> file8(env->GetStringUTFChars(file, NULL), + releaser); + if (!file8) { jniThrowException(env, "java/lang/OutOfMemoryError", NULL); return JNI_FALSE; } - ::android::base::unique_fd fd(open(file8, O_RDONLY | O_CLOEXEC)); + ::android::base::unique_fd fd(open(file8.get(), O_RDONLY | O_CLOEXEC)); if (!fd.ok()) { if (kDebugProc) { - ALOGW("Unable to open process file: %s\n", file8); + ALOGW("Unable to open process file: %s\n", file8.get()); } - env->ReleaseStringUTFChars(file, file8); return JNI_FALSE; } - env->ReleaseStringUTFChars(file, file8); - // Most proc files we read are small, so we only go through the - // loop once and use the stack buffer. We allocate a buffer big - // enough for the whole file. - - char readBufferStack[kProcReadStackBufferSize]; - std::unique_ptr<char[]> readBufferHeap; - char* readBuffer = &readBufferStack[0]; - ssize_t readBufferSize = kProcReadStackBufferSize; - ssize_t numberBytesRead; - for (;;) { - // By using pread, we can avoid an lseek to rewind the FD - // before retry, saving a system call. - numberBytesRead = pread(fd, readBuffer, readBufferSize, 0); - if (numberBytesRead < 0 && errno == EINTR) { - continue; - } - if (numberBytesRead < 0) { + // Most proc files we read are small, so we go through the loop + // with the stack buffer first. We allocate a buffer big enough + // for most files. + + char stackBuf[kProcReadStackBufferSize]; + std::vector<char> heapBuf; + char* buf = stackBuf; + + size_t remaining = sizeof(stackBuf); + off_t offset = 0; + ssize_t numBytesRead; + + do { + numBytesRead = TEMP_FAILURE_RETRY(pread(fd, buf + offset, remaining, offset)); + if (numBytesRead < 0) { if (kDebugProc) { - ALOGW("Unable to open process file: %s fd=%d\n", file8, fd.get()); + ALOGW("Unable to read process file err: %s file: %s fd=%d\n", + strerror_r(errno, stackBuf, sizeof(stackBuf)), file8.get(), fd.get()); } return JNI_FALSE; } - if (numberBytesRead < readBufferSize) { - break; - } - if (readBufferSize > std::numeric_limits<ssize_t>::max() / 2) { - if (kDebugProc) { - ALOGW("Proc file too big: %s fd=%d\n", file8, fd.get()); + + offset += numBytesRead; + remaining -= numBytesRead; + + if (numBytesRead && !remaining) { + if (buf == stackBuf) { + heapBuf.resize(kProcReadMinHeapBufferSize); + static_assert(kProcReadMinHeapBufferSize > sizeof(stackBuf)); + std::memcpy(heapBuf.data(), stackBuf, sizeof(stackBuf)); + } else { + constexpr size_t MAX_READABLE_PROCFILE_SIZE = 64 << 20; + if (heapBuf.size() >= MAX_READABLE_PROCFILE_SIZE) { + if (kDebugProc) { + ALOGW("Proc file too big: %s fd=%d size=%zu\n", + file8.get(), fd.get(), heapBuf.size()); + } + return JNI_FALSE; + } + heapBuf.resize(2 * heapBuf.size()); } - return JNI_FALSE; + buf = heapBuf.data(); + remaining = heapBuf.size() - offset; } - readBufferSize = std::max(readBufferSize * 2, - kProcReadMinHeapBufferSize); - readBufferHeap.reset(); // Free address space before getting more. - readBufferHeap = std::make_unique<char[]>(readBufferSize); - if (!readBufferHeap) { - jniThrowException(env, "java/lang/OutOfMemoryError", NULL); - return JNI_FALSE; - } - readBuffer = readBufferHeap.get(); - } + } while (numBytesRead != 0); // parseProcLineArray below modifies the buffer while parsing! return android_os_Process_parseProcLineArray( - env, clazz, readBuffer, 0, numberBytesRead, - format, outStrings, outLongs, outFloats); + env, clazz, buf, 0, offset, format, outStrings, outLongs, outFloats); } void android_os_Process_setApplicationObject(JNIEnv* env, jobject clazz, diff --git a/core/jni/com_android_internal_content_FileSystemUtils.cpp b/core/jni/com_android_internal_content_FileSystemUtils.cpp index d426f1240a7f..6c72544a7958 100644 --- a/core/jni/com_android_internal_content_FileSystemUtils.cpp +++ b/core/jni/com_android_internal_content_FileSystemUtils.cpp @@ -87,9 +87,10 @@ bool punchHoles(const char *filePath, const uint64_t offset, IF_ALOGD() { ALOGD("Total number of LOAD segments %zu", programHeaders.size()); - ALOGD("Size before punching holes st_blocks: %" PRIu64 - ", st_blksize: %d, st_size: %" PRIu64 "", - beforePunch.st_blocks, beforePunch.st_blksize, + ALOGD("Size before punching holes st_blocks: %" PRIu64 ", st_blksize: %" PRIu64 + ", st_size: %" PRIu64 "", + static_cast<uint64_t>(beforePunch.st_blocks), + static_cast<uint64_t>(beforePunch.st_blksize), static_cast<uint64_t>(beforePunch.st_size)); } @@ -193,9 +194,10 @@ bool punchHoles(const char *filePath, const uint64_t offset, ALOGD("lstat64 failed for filePath %s, error:%d", filePath, errno); return false; } - ALOGD("Size after punching holes st_blocks: %" PRIu64 ", st_blksize: %d, st_size: %" PRIu64 - "", - afterPunch.st_blocks, afterPunch.st_blksize, + ALOGD("Size after punching holes st_blocks: %" PRIu64 ", st_blksize: %" PRIu64 + ", st_size: %" PRIu64 "", + static_cast<uint64_t>(afterPunch.st_blocks), + static_cast<uint64_t>(afterPunch.st_blksize), static_cast<uint64_t>(afterPunch.st_size)); } @@ -271,8 +273,9 @@ bool punchHolesInZip(const char *filePath, uint64_t offset, uint16_t extraFieldL uint64_t blockSize = beforePunch.st_blksize; IF_ALOGD() { ALOGD("Extra field length: %hu, Size before punching holes st_blocks: %" PRIu64 - ", st_blksize: %d, st_size: %" PRIu64 "", - extraFieldLen, beforePunch.st_blocks, beforePunch.st_blksize, + ", st_blksize: %" PRIu64 ", st_size: %" PRIu64 "", + extraFieldLen, static_cast<uint64_t>(beforePunch.st_blocks), + static_cast<uint64_t>(beforePunch.st_blksize), static_cast<uint64_t>(beforePunch.st_size)); } @@ -346,8 +349,9 @@ bool punchHolesInZip(const char *filePath, uint64_t offset, uint16_t extraFieldL return false; } ALOGD("punchHolesInApk:: Size after punching holes st_blocks: %" PRIu64 - ", st_blksize: %d, st_size: %" PRIu64 "", - afterPunch.st_blocks, afterPunch.st_blksize, + ", st_blksize: %" PRIu64 ", st_size: %" PRIu64 "", + static_cast<uint64_t>(afterPunch.st_blocks), + static_cast<uint64_t>(afterPunch.st_blksize), static_cast<uint64_t>(afterPunch.st_size)); } return true; diff --git a/core/jni/com_android_internal_os_Zygote.cpp b/core/jni/com_android_internal_os_Zygote.cpp index 062fab38656d..284c2997f9a9 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/proto/android/server/activitymanagerservice.proto b/core/proto/android/server/activitymanagerservice.proto index 921c41c8e52b..90069f111fe5 100644 --- a/core/proto/android/server/activitymanagerservice.proto +++ b/core/proto/android/server/activitymanagerservice.proto @@ -1038,7 +1038,7 @@ message AppsExitInfoProto { optional int32 uid = 1; repeated .android.app.ApplicationExitInfoProto app_exit_info = 2; - repeated .android.app.ApplicationExitInfoProto app_recoverable_crash = 3; + repeated .android.app.ApplicationExitInfoProto app_recoverable_crash = 3 [deprecated=true]; } repeated User users = 2; } diff --git a/core/res/OWNERS b/core/res/OWNERS index b2b58d557e6f..5293131180ae 100644 --- a/core/res/OWNERS +++ b/core/res/OWNERS @@ -78,6 +78,11 @@ per-file remote_color_resources_res/values/colors.xml = pbdr@google.com 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/res/res/values-af/strings.xml b/core/res/res/values-af/strings.xml index 905d9a61e05b..185374006287 100644 --- a/core/res/res/values-af/strings.xml +++ b/core/res/res/values-af/strings.xml @@ -2191,6 +2191,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"Toeganklikheidkortpadkieser op skerm"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"Toeganklikheidkortpad"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"Maak kennisgewingskerm toe"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"Kieslys"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"Media speel/onderbreek"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"D-paneel op"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"D-paneel af"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"D-paneel links"</string> diff --git a/core/res/res/values-am/strings.xml b/core/res/res/values-am/strings.xml index 2a2329b4e709..db51fa3b1aa0 100644 --- a/core/res/res/values-am/strings.xml +++ b/core/res/res/values-am/strings.xml @@ -2191,6 +2191,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"የማያ ገፅ ላይ ተደራሽነት አቋራጭ መራጭ"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"የተደራሽነት አቋራጭ"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"የማሳወቂያ ጥላን አሰናብት"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"ምናሌ"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"ሚዲያ አጫውት/ለአፍታ አቁም"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"ከDpad በላይ"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"ከDpad በታች"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"ከDpad በስተግራ"</string> diff --git a/core/res/res/values-ar/strings.xml b/core/res/res/values-ar/strings.xml index eaa346f9085c..66f874047a0c 100644 --- a/core/res/res/values-ar/strings.xml +++ b/core/res/res/values-ar/strings.xml @@ -2195,6 +2195,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"أداة اختيار اختصارات أدوات تمكين الوصول على الشاشة"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"اختصارات أدوات تمكين الوصول"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"إغلاق مركز الإشعارات"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"القائمة"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"تشغيل الوسائط أو إيقافها مؤقتًا"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"زرّ الاتجاه للأعلى"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"زرّ الاتجاه للأسفل"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"زرّ الاتجاه لليسار"</string> @@ -2421,12 +2423,12 @@ <string name="satellite_notification_how_it_works" msgid="3132069321977520519">"طريقة العمل"</string> <string name="unarchival_session_app_label" msgid="6811856981546348205">"بانتظار الإزالة من الأرشيف…"</string> <string name="fingerprint_dangling_notification_title" msgid="7362075195588639989">"إعادة إعداد ميزة \"فتح الجهاز ببصمة الإصبع\""</string> - <string name="fingerprint_dangling_notification_msg_1" msgid="5851784577768803510">"لا يمكن بعد الآن التعرّف على \"<xliff:g id="FINGERPRINT">%s</xliff:g>\"."</string> - <string name="fingerprint_dangling_notification_msg_2" msgid="7925203589860744456">"لا يمكن بعد الآن التعرّف على \"<xliff:g id="FINGERPRINT_0">%1$s</xliff:g>\" و\"<xliff:g id="FINGERPRINT_1">%2$s</xliff:g>\"."</string> - <string name="fingerprint_dangling_notification_msg_all_deleted_1" msgid="1824812666549916586">"لا يمكن بعد الآن التعرّف على \"<xliff:g id="FINGERPRINT">%s</xliff:g>\". يجب ضبط ميزة \"فتح الجهاز ببصمة الإصبع\" مجددًا."</string> - <string name="fingerprint_dangling_notification_msg_all_deleted_2" msgid="5974657382960155099">"لا يمكن بعد الآن التعرّف على \"<xliff:g id="FINGERPRINT_0">%1$s</xliff:g>\" و\"<xliff:g id="FINGERPRINT_1">%2$s</xliff:g>\". يجب ضبط ميزة \"فتح الجهاز ببصمة الإصبع\" مجددًا."</string> + <string name="fingerprint_dangling_notification_msg_1" msgid="8517140433796229725">"هناك مشكلة في <xliff:g id="FINGERPRINT">%s</xliff:g> وتم حذفها"</string> + <string name="fingerprint_dangling_notification_msg_2" msgid="7578829498452127613">"هناك مشكلة في <xliff:g id="FINGERPRINT_0">%1$s</xliff:g> و<xliff:g id="FINGERPRINT_1">%2$s</xliff:g> وتم حذفهما"</string> + <string name="fingerprint_dangling_notification_msg_all_deleted_1" msgid="2927018569542316055">"هناك مشكلة في <xliff:g id="FINGERPRINT">%s</xliff:g> وتم حذفها. يُرجى إعدادها مرة أخرى لفتح قفل هاتفك باستخدام بصمة الإصبع."</string> + <string name="fingerprint_dangling_notification_msg_all_deleted_2" msgid="6897989352716156176">"هناك مشكلة في <xliff:g id="FINGERPRINT_0">%1$s</xliff:g> و<xliff:g id="FINGERPRINT_1">%2$s</xliff:g> وتم حذفهما. يُرجى إعادة إعدادهما لفتح قفل هاتفك باستخدام بصمة الإصبع."</string> <string name="face_dangling_notification_title" msgid="947852541060975473">"إعادة إعداد ميزة \"فتح الجهاز ببصمة الوجه\""</string> - <string name="face_dangling_notification_msg" msgid="746235263598985384">"لا يمكن بعد الآن التعرّف على نموذج الوجه الخاص بك. يجب ضبط ميزة \"فتح الجهاز ببصمة الوجه\" مجددًا."</string> + <string name="face_dangling_notification_msg" msgid="8806849376915541655">"هناك مشكلة في نموذج الوجه الخاص بك وتم حذفه. يُرجى إعداده مرة أخرى لفتح قفل هاتفك باستخدام وجهك."</string> <string name="biometric_dangling_notification_action_set_up" msgid="8246885009807817961">"إعداد"</string> <string name="biometric_dangling_notification_action_not_now" msgid="8095249216864443491">"لاحقًا"</string> </resources> diff --git a/core/res/res/values-as/strings.xml b/core/res/res/values-as/strings.xml index fa433ed6a39a..7fdbe64bce11 100644 --- a/core/res/res/values-as/strings.xml +++ b/core/res/res/values-as/strings.xml @@ -2191,6 +2191,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"স্ক্ৰীনত সাধ্য সুবিধাসমূহৰ শ্বৰ্টকাট বাছনি কৰাৰ সুবিধা"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"সাধ্য সুবিধাৰ শ্বৰ্টকাট"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"জাননী পেনেল অগ্ৰাহ্য কৰক"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"মেনু"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"মিডিয়া প্লে’/পজ কৰক"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"ডিপেডৰ ওপৰফালৰ বুটাম"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"ডিপেডৰ তলফালৰ বুটাম"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"ডিপেডৰ বাওঁফালৰ বুটাম"</string> diff --git a/core/res/res/values-az/strings.xml b/core/res/res/values-az/strings.xml index 6f4afe0387b0..dee443e60912 100644 --- a/core/res/res/values-az/strings.xml +++ b/core/res/res/values-az/strings.xml @@ -2191,6 +2191,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"Ekranda Əlçatımlılıq Qısayolu Seçicisi"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"Əlçatımlılıq Qısayolu"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"Bildiriş Göstərişini qapadın"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"Menyu"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"Medianı oxudun/durdurun"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"Dpad Yuxarı"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"Dpad Aşağı"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"Dpad Sola"</string> diff --git a/core/res/res/values-b+sr+Latn/strings.xml b/core/res/res/values-b+sr+Latn/strings.xml index 1bdb19d78fdd..43c4b4ec1b2b 100644 --- a/core/res/res/values-b+sr+Latn/strings.xml +++ b/core/res/res/values-b+sr+Latn/strings.xml @@ -2192,6 +2192,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"Alatka za biranje prečica za pristupačnost na ekranu"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"Prečica za pristupačnost"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"Odbaci traku sa obaveštenjima"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"Meni"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"Pusti/pauziraj medije"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"nagore na D-pad-u"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"nadole na D-pad-u"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"nalevo na D-pad-u"</string> diff --git a/core/res/res/values-be/strings.xml b/core/res/res/values-be/strings.xml index 2f4964021cff..4eb9448ab5da 100644 --- a/core/res/res/values-be/strings.xml +++ b/core/res/res/values-be/strings.xml @@ -420,7 +420,7 @@ <string name="permlab_runInBackground" msgid="541863968571682785">"працаваць у фоне"</string> <string name="permdesc_runInBackground" msgid="4344539472115495141">"Гэта праграма можа працаваць у фоне. Гэта можа прывесці да хутчэйшага спажывання зараду акумулятара."</string> <string name="permlab_useDataInBackground" msgid="783415807623038947">"выкарыстоўваць даныя ў фоне"</string> - <string name="permdesc_useDataInBackground" msgid="1230753883865891987">"Гэта праграма можа выкарыстоўваць даныя ў фоне. Гэта можа прывесці да павелічэння аб\'ёму трафіка."</string> + <string name="permdesc_useDataInBackground" msgid="1230753883865891987">"Гэта праграма можа выкарыстоўваць даныя ў фоне. Гэта можа прывесці да павелічэння аб’ёму трафіка."</string> <string name="permlab_schedule_exact_alarm" msgid="6683283918033029730">"Наладжванне выканання дзеянняў у дакладны час"</string> <string name="permdesc_schedule_exact_alarm" msgid="8198009212013211497">"Гэта праграма зможа наладжваць выкананне задач у патрэбны час у будучыні і будзе працаваць, нават калі вы не выкарыстоўваеце прыладу."</string> <string name="permlab_use_exact_alarm" msgid="348045139777131552">"Уключэнне будзільніка ці паказ напамінаў пра падзею"</string> @@ -505,7 +505,7 @@ <string name="permdesc_accessCoarseLocation" msgid="778521847873199160">"Падчас выкарыстання гэта праграма можа атрымліваць ад службаў геалакацыі звесткі пра ваша прыблізнае месцазнаходжанне. Каб праграма мела такія звесткі, на вашай прыладзе павінны быць уключаны службы геалакацыі."</string> <string name="permlab_accessBackgroundLocation" msgid="1721164702777366138">"доступ да вызначэння месцазнаходжання ў фонавым рэжыме"</string> <string name="permdesc_accessBackgroundLocation" msgid="8264885066095638105">"Гэта праграма можа мець доступ да даных пра месцазнаходжанне ў любы час, нават калі яна не выкарыстоўваецца."</string> - <string name="permlab_modifyAudioSettings" msgid="6129039778010031815">"змяняць налады аудыё"</string> + <string name="permlab_modifyAudioSettings" msgid="6129039778010031815">"змяняць налады аўдыя"</string> <string name="permdesc_modifyAudioSettings" msgid="8687227609663124921">"Дазваляе прыкладанням змяняць глабальныя налады гуку, такія як моц і тое, што дынамік выкарыстоўваецца для выхаду."</string> <string name="permlab_recordAudio" msgid="1208457423054219147">"запіс аўдыя"</string> <string name="permdesc_recordAudio" msgid="5857246765327514062">"Гэта праграма падчас яе выкарыстання можа запісваць аўдыя з дапамогай мікрафона."</string> @@ -1726,7 +1726,7 @@ <string name="accessibility_shortcut_multiple_service_warning" msgid="3740723309483706911">"Утрымліванне націснутымі абедзвюх клавіш гучнасці на працягу некалькіх секунд уключае спецыяльныя магчымасці. У выніку ваша прылада можа пачаць працаваць па-іншаму.\n\nБягучыя функцыі:\n<xliff:g id="SERVICE">%1$s</xliff:g>\nВыбраныя функцыі можна змяніць у меню \"Налады > Спецыяльныя магчымасці\"."</string> <string name="accessibility_shortcut_multiple_service_list" msgid="2128323171922023762">" • <xliff:g id="SERVICE">%1$s</xliff:g>\n"</string> <string name="accessibility_shortcut_single_service_warning_title" msgid="1909518473488345266">"Уключыць хуткі доступ да сэрвісу \"<xliff:g id="SERVICE">%1$s</xliff:g>\"?"</string> - <string name="accessibility_shortcut_single_service_warning" msgid="6363127705112844257">"Утрымліванне націснутымі абедзвюх клавіш гучнасці на працягу некалькіх секунд уключае службу \"<xliff:g id="SERVICE">%1$s</xliff:g>\", якая з\'яўляецца спецыяльнай магчымасцю. У выніку ваша прылада можа пачаць працаваць па-іншаму.\n\nВы можаце задаць гэта спалучэнне клавіш для іншай функцыі ў меню \"Налады > Спецыяльныя магчымасці\"."</string> + <string name="accessibility_shortcut_single_service_warning" msgid="6363127705112844257">"Утрымліванне націснутымі абедзвюх клавіш гучнасці на працягу некалькіх секунд уключае службу \"<xliff:g id="SERVICE">%1$s</xliff:g>\", якая з’яўляецца спецыяльнай магчымасцю. У выніку ваша прылада можа пачаць працаваць па-іншаму.\n\nВы можаце задаць гэта спалучэнне клавіш для іншай функцыі ў меню \"Налады > Спецыяльныя магчымасці\"."</string> <string name="accessibility_shortcut_on" msgid="5463618449556111344">"Уключыць"</string> <string name="accessibility_shortcut_off" msgid="3651336255403648739">"Не ўключаць"</string> <string name="accessibility_shortcut_menu_item_status_on" msgid="6608392117189732543">"УКЛЮЧАНА"</string> @@ -2193,6 +2193,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"Налада хуткага доступу да спецыяльных магчымасцей на экране"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"Хуткі доступ"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"Закрыць шчыток апавяшчэнняў"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"Меню"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"Прайграць або прыпыніць медыяфайл"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"Уверх на панэлі кіравання"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"Уніз на панэлі кіравання"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"Улева на панэлі кіравання"</string> diff --git a/core/res/res/values-bg/strings.xml b/core/res/res/values-bg/strings.xml index bc69cb24d589..cba94d40fc3d 100644 --- a/core/res/res/values-bg/strings.xml +++ b/core/res/res/values-bg/strings.xml @@ -2191,6 +2191,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"Инструмент за избор на пряк път към достъпността на екрана"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"Пряк път за достъпност"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"Отхвърляне на падащия панел с известия"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"Меню"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"Пускане/пауза на мултимедията"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"Контролен пад – горе"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"Контролен пад – долу"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"Контролен пад – ляво"</string> diff --git a/core/res/res/values-bn/strings.xml b/core/res/res/values-bn/strings.xml index eb7b9ed4c96c..2e72ae1bd8ba 100644 --- a/core/res/res/values-bn/strings.xml +++ b/core/res/res/values-bn/strings.xml @@ -2191,6 +2191,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"অন-স্ক্রিন অ্যাক্সেসিবিলিটি শর্টকাট বেছে নেওয়ার বিকল্প"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"অ্যাক্সেসিবিলিটি শর্টকাট"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"বিজ্ঞপ্তি শেড বাতিল করুন"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"মেনু"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"মিডিয়া প্লে/পজ করুন"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"ডিপ্যাড (Dpad)-এর উপরে"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"ডিপ্যাড (Dpad)-এর নিচে"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"ডিপ্যাড (Dpad)-এর বাঁদিকে"</string> diff --git a/core/res/res/values-bs/strings.xml b/core/res/res/values-bs/strings.xml index 41081a9cd0d1..43ed63f37f4d 100644 --- a/core/res/res/values-bs/strings.xml +++ b/core/res/res/values-bs/strings.xml @@ -2192,6 +2192,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"Okvir za odabir prečice za pristupačnost na ekranu"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"Prečica za pristupačnost"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"Odbacite lokaciju za obavještenja"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"Meni"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"Reprodukcija/pauziranje medijskog sadržaja"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"Upravljač gore"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"Upravljač dolje"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"Upravljač lijevo"</string> diff --git a/core/res/res/values-ca/strings.xml b/core/res/res/values-ca/strings.xml index 3def4fd9e98a..f691e36e59f8 100644 --- a/core/res/res/values-ca/strings.xml +++ b/core/res/res/values-ca/strings.xml @@ -2192,6 +2192,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"Selector de dreceres d\'accessibilitat en pantalla"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"Drecera d\'accessibilitat"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"Ignora l\'àrea de notificacions"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"Menú"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"Reprodueix o posa en pausa el contingut multimèdia"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"Creu direccional: amunt"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"Creu direccional: avall"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"Creu direccional: esquerra"</string> diff --git a/core/res/res/values-cs/strings.xml b/core/res/res/values-cs/strings.xml index 96546e01bec5..bce712319540 100644 --- a/core/res/res/values-cs/strings.xml +++ b/core/res/res/values-cs/strings.xml @@ -2193,6 +2193,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"Výběr zkratky přístupnosti na obrazovce"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"Zkratka přístupnosti"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"Zavřít panel oznámení"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"Nabídka"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"Přehrát/pozastavit média"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"Dpad nahoru"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"Dpad dolů"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"Dpad doleva"</string> diff --git a/core/res/res/values-da/strings.xml b/core/res/res/values-da/strings.xml index 431612670ee1..dbc2bdb7fc18 100644 --- a/core/res/res/values-da/strings.xml +++ b/core/res/res/values-da/strings.xml @@ -2191,6 +2191,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"Valg af genvej til hjælpefunktioner på skærmen"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"Genvej til hjælpefunktioner"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"Luk notifikationspanel"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"Menu"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"Afspil medie/sæt medie på pause"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"D-pad, op"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"D-pad, ned"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"D-pad, venstre"</string> diff --git a/core/res/res/values-de/strings.xml b/core/res/res/values-de/strings.xml index b43e0978740f..ca72dbb2f5b8 100644 --- a/core/res/res/values-de/strings.xml +++ b/core/res/res/values-de/strings.xml @@ -345,7 +345,7 @@ <string name="permgroupdesc_phone" msgid="270048070781478204">"Telefonanrufe tätigen und verwalten"</string> <string name="permgrouplab_sensors" msgid="9134046949784064495">"Körpersensoren"</string> <string name="permgroupdesc_sensors" msgid="2610631290633747752">"auf Sensordaten zu deinen Vitaldaten zugreifen"</string> - <string name="permgrouplab_notifications" msgid="5472972361980668884">"Benachrichtigungen"</string> + <string name="permgrouplab_notifications" msgid="5472972361980668884">"Benachrichtigungen"</string> <string name="permgroupdesc_notifications" msgid="4608679556801506580">"Benachrichtigungen anzeigen"</string> <string name="capability_title_canRetrieveWindowContent" msgid="7554282892101587296">"Fensterinhalte abrufen"</string> <string name="capability_desc_canRetrieveWindowContent" msgid="6195610527625237661">"Die Inhalte eines Fensters, mit dem du interagierst, werden abgerufen."</string> @@ -2191,6 +2191,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"Auswahl für Kurzbefehle für Bildschirmbedienungshilfen"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"Kurzbefehl für Bedienungshilfen"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"Benachrichtigungsleiste schließen"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"Menü"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"Medien wiedergeben/pausieren"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"Steuerkreuz nach oben"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"Steuerkreuz nach unten"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"Steuerkreuz nach links"</string> diff --git a/core/res/res/values-el/strings.xml b/core/res/res/values-el/strings.xml index e7769946059d..91ab6c6caa69 100644 --- a/core/res/res/values-el/strings.xml +++ b/core/res/res/values-el/strings.xml @@ -2191,6 +2191,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"Επιλογέας συντόμευσης οθόνης για την προσβασιμότητα"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"Συντόμευση προσβασιμότητας"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"Παράβλεψη πλαισίου σκίασης ειδοποιήσεων"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"Μενού"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"Αναπαραγωγή/παύση μέσων"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"Dpad επάνω"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"Dpad κάτω"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"Dpad αριστερά"</string> diff --git a/core/res/res/values-en-rAU/strings.xml b/core/res/res/values-en-rAU/strings.xml index 92f10fed0760..6907089d57fc 100644 --- a/core/res/res/values-en-rAU/strings.xml +++ b/core/res/res/values-en-rAU/strings.xml @@ -2191,6 +2191,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"On-screen accessibility shortcut chooser"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"Accessibility shortcut"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"Dismiss notification shade"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"Menu"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"Media play/pause"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"Dpad up"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"Dpad down"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"Dpad left"</string> diff --git a/core/res/res/values-en-rCA/strings.xml b/core/res/res/values-en-rCA/strings.xml index a31002641ce2..b3490a7cce4f 100644 --- a/core/res/res/values-en-rCA/strings.xml +++ b/core/res/res/values-en-rCA/strings.xml @@ -2191,6 +2191,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"On-screen Accessibility Shortcut Chooser"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"Accessibility Shortcut"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"Dismiss Notification Shade"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"Menu"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"Media Play/Pause"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"Dpad Up"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"Dpad Down"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"Dpad Left"</string> diff --git a/core/res/res/values-en-rGB/strings.xml b/core/res/res/values-en-rGB/strings.xml index d0926b2dc235..c0c1c3b5f1fd 100644 --- a/core/res/res/values-en-rGB/strings.xml +++ b/core/res/res/values-en-rGB/strings.xml @@ -2191,6 +2191,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"On-screen accessibility shortcut chooser"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"Accessibility shortcut"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"Dismiss notification shade"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"Menu"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"Media play/pause"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"Dpad up"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"Dpad down"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"Dpad left"</string> diff --git a/core/res/res/values-en-rIN/strings.xml b/core/res/res/values-en-rIN/strings.xml index 2169e9a55e9f..244d38faf916 100644 --- a/core/res/res/values-en-rIN/strings.xml +++ b/core/res/res/values-en-rIN/strings.xml @@ -2191,6 +2191,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"On-screen accessibility shortcut chooser"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"Accessibility shortcut"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"Dismiss notification shade"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"Menu"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"Media play/pause"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"Dpad up"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"Dpad down"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"Dpad left"</string> diff --git a/core/res/res/values-en-rXC/strings.xml b/core/res/res/values-en-rXC/strings.xml index dd659f2561b4..42452b49624e 100644 --- a/core/res/res/values-en-rXC/strings.xml +++ b/core/res/res/values-en-rXC/strings.xml @@ -2191,6 +2191,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"On-screen Accessibility Shortcut Chooser"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"Accessibility Shortcut"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"Dismiss Notification Shade"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"Menu"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"Media Play/Pause"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"Dpad Up"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"Dpad Down"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"Dpad Left"</string> diff --git a/core/res/res/values-es-rUS/strings.xml b/core/res/res/values-es-rUS/strings.xml index 901c720c4ecf..ff68322fbcdd 100644 --- a/core/res/res/values-es-rUS/strings.xml +++ b/core/res/res/values-es-rUS/strings.xml @@ -2192,6 +2192,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"Selector del acceso directo de accesibilidad en pantalla"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"Acceso directo de accesibilidad"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"Descartar panel de notificaciones"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"Menú"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"Reproducir o pausar contenido multimedia"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"Pad direccional: arriba"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"Pad direccional: abajo"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"Pad direccional: izquierda"</string> diff --git a/core/res/res/values-es/strings.xml b/core/res/res/values-es/strings.xml index 621c8a4c9172..1a8b9b991e31 100644 --- a/core/res/res/values-es/strings.xml +++ b/core/res/res/values-es/strings.xml @@ -2192,6 +2192,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"Menú de acceso directo de accesibilidad en pantalla"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"Acceso directo de accesibilidad"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"Cerrar pantalla de notificaciones"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"Menú"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"Pausar/Reproducir contenido multimedia"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"Cruceta: arriba"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"Cruceta: abajo"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"Cruceta: izquierda"</string> diff --git a/core/res/res/values-et/strings.xml b/core/res/res/values-et/strings.xml index 43803f994b61..0d4909efc460 100644 --- a/core/res/res/values-et/strings.xml +++ b/core/res/res/values-et/strings.xml @@ -2191,6 +2191,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"Ekraanil kuvatav juurdepääsetavuse otsetee valija"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"Juurdepääsetavuse otsetee"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"Loobu märguandealast"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"Menüü"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"Meedia esitamine/peatamine"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"Suunaklahvistiku ülesnool"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"Suunaklahvistiku allanool"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"Suunaklahvistiku vasaknool"</string> diff --git a/core/res/res/values-eu/strings.xml b/core/res/res/values-eu/strings.xml index ceb17a412853..05cba6d8cb35 100644 --- a/core/res/res/values-eu/strings.xml +++ b/core/res/res/values-eu/strings.xml @@ -2191,6 +2191,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"Pantailako erabilerraztasun-lasterbideen hautatzailea"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"Erabilerraztasun-lasterbidea"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"Baztertu jakinarazpenen panela"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"Menua"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"Erreproduzitu/Pausatu multimedia-elementua"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"Norabide-kontrolagailuko goiko botoia"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"Norabide-kontrolagailuko beheko botoia"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"Norabide-kontrolagailuko ezkerreko botoia"</string> diff --git a/core/res/res/values-fa/strings.xml b/core/res/res/values-fa/strings.xml index e0338de4c02a..8bd760da90a5 100644 --- a/core/res/res/values-fa/strings.xml +++ b/core/res/res/values-fa/strings.xml @@ -2191,6 +2191,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"انتخابگر میانبر دسترسپذیری روی صفحه"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"میانبر دسترسیپذیری"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"رد کردن کشوی اعلانات"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"منو"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"پخش/موقتاً متوقف کردن رسانه"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"پد کنترل بالا"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"پد کنترل پایین"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"پد کنترل چپ"</string> diff --git a/core/res/res/values-fi/strings.xml b/core/res/res/values-fi/strings.xml index 0e3aa6ce62aa..70c8c2760d71 100644 --- a/core/res/res/values-fi/strings.xml +++ b/core/res/res/values-fi/strings.xml @@ -2191,6 +2191,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"Näytöllä näkyvän esteettömyyspainikkeen valitsin"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"Saavutettavuuspainike"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"Sulje ilmoitusalue"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"Valikko"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"Media: toista/keskeytä"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"Suuntanäppäimistö: ylös-painike"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"Suuntanäppäimisto: alas-painike"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"Suuntanäppäimistö: vasen painike"</string> diff --git a/core/res/res/values-fr-rCA/strings.xml b/core/res/res/values-fr-rCA/strings.xml index f55f2aea5539..dd5b0f5a1913 100644 --- a/core/res/res/values-fr-rCA/strings.xml +++ b/core/res/res/values-fr-rCA/strings.xml @@ -2192,6 +2192,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"Sélecteur de raccourci d\'accessibilité à l\'écran"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"Raccourci d\'accessibilité"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"Ignorer le volet de notification"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"Menu"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"Lecture/pause du contenu multimédia"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"Pavé directionnel – haut"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"Pavé directionnel – bas"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"Pavé directionnel – gauche"</string> diff --git a/core/res/res/values-fr/strings.xml b/core/res/res/values-fr/strings.xml index f57b076bf131..85cfe2a94bed 100644 --- a/core/res/res/values-fr/strings.xml +++ b/core/res/res/values-fr/strings.xml @@ -2192,6 +2192,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"Outil de sélection des raccourcis d\'accessibilité à l\'écran"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"Raccourci d\'accessibilité"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"Fermer le volet des notifications"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"Menu"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"Contenu multimédia : lecture/pause"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"Pavé directionnel - Haut"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"Pavé directionnel - Bas"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"Pavé directionnel - Gauche"</string> diff --git a/core/res/res/values-gl/strings.xml b/core/res/res/values-gl/strings.xml index 75522be7b5b4..78c4326eb867 100644 --- a/core/res/res/values-gl/strings.xml +++ b/core/res/res/values-gl/strings.xml @@ -2191,6 +2191,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"Selector de atallos de accesibilidade en pantalla"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"Atallo de accesibilidade"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"Ignorar panel despregable"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"Menú"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"Reproducir/pór en pausa contido multimedia"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"Cruceta: arriba"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"Cruceta: abaixo"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"Cruceta: esquerda"</string> diff --git a/core/res/res/values-gu/strings.xml b/core/res/res/values-gu/strings.xml index 002ed523ffc5..32e27decf910 100644 --- a/core/res/res/values-gu/strings.xml +++ b/core/res/res/values-gu/strings.xml @@ -2191,6 +2191,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"સ્ક્રીન પરના ઍક્સેસિબિલિટી શૉર્ટકટના પસંદકર્તા"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"ઍક્સેસિબિલિટી શૉર્ટકટ"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"નોટિફિકેશન શેડ છોડી દો"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"મેનૂ"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"મીડિયા ચલાવો/થોભાવો"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"ડી-પૅડ ઉપર"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"ડી-પૅડ નીચે"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"ડી-પૅડ ડાબે"</string> diff --git a/core/res/res/values-hi/strings.xml b/core/res/res/values-hi/strings.xml index 6fabe4d756d7..e938828717f0 100644 --- a/core/res/res/values-hi/strings.xml +++ b/core/res/res/values-hi/strings.xml @@ -2191,6 +2191,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"स्क्रीन पर दिखने वाले सुलभता के शॉर्टकट को चुनने का मेन्यू"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"सुलभता का शॉर्टकट"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"नोटिफ़िकेशन शेड खारिज करें"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"मेन्यू"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"मीडिया चलाएं/रोकें"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"डी-पैड का ऊपर वाला बटन"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"डी-पैड का नीचे वाला बटन"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"डी-पैड का बाईं ओर वाला बटन"</string> diff --git a/core/res/res/values-hr/strings.xml b/core/res/res/values-hr/strings.xml index 3fc4d4199000..86c63c1ce58e 100644 --- a/core/res/res/values-hr/strings.xml +++ b/core/res/res/values-hr/strings.xml @@ -2192,6 +2192,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"Alat za odabir prečaca pristupačnosti na zaslonu"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"Prečac pristupačnosti"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"Odbacivanje zaslona obavijesti"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"Izbornik"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"Reproduciraj/pauziraj medijske sadržaje"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"Gore na plohi za smjerove"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"Dolje na plohi za smjerove"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"Lijevo na plohi za smjerove"</string> diff --git a/core/res/res/values-hu/strings.xml b/core/res/res/values-hu/strings.xml index c04ee45564c9..50dd44da8703 100644 --- a/core/res/res/values-hu/strings.xml +++ b/core/res/res/values-hu/strings.xml @@ -2191,6 +2191,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"Képernyőn megjelenő kisegítő lehetőségekre vonatkozó parancsválasztó"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"Kisegítő lehetőségek gyorsparancsa"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"Értesítési felület bezárása"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"Menü"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"Médialejátszás/szüneteltetés"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"D-pad – fel"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"D-pad – le"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"D-pad – balra"</string> diff --git a/core/res/res/values-hy/strings.xml b/core/res/res/values-hy/strings.xml index 04c3ea2b6760..2dd342221850 100644 --- a/core/res/res/values-hy/strings.xml +++ b/core/res/res/values-hy/strings.xml @@ -2191,6 +2191,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"Հատուկ գործառույթների դյուրանցման ընտրիչ"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"Հատուկ գործառույթների դյուրանցում"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"Փակել ծանուցումների վահանակը"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"Ընտրացանկ"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"Նվագարկում/դադար"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"Dpad-ի «Վերև» կոճակ"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"Dpad-ի «Ներքև» կոճակ"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"Dpad-ի «Ձախ» կոճակ"</string> diff --git a/core/res/res/values-in/strings.xml b/core/res/res/values-in/strings.xml index edc48a5369c1..13e34f4f4b61 100644 --- a/core/res/res/values-in/strings.xml +++ b/core/res/res/values-in/strings.xml @@ -2191,6 +2191,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"Pemilih Pintasan Aksesibilitas di layar"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"Pintasan Aksesibilitas"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"Tutup Menu Notifikasi"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"Menu"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"Putar/Jeda Media"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"Dpad Atas"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"Dpad Bawah"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"Dpad Kiri"</string> diff --git a/core/res/res/values-is/strings.xml b/core/res/res/values-is/strings.xml index d17582e75c20..92a004f76609 100644 --- a/core/res/res/values-is/strings.xml +++ b/core/res/res/values-is/strings.xml @@ -2191,6 +2191,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"Val um flýtileið í aðgengiseiginleika á skjánum"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"Flýtileið aðgengisstillingar"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"Loka tilkynningaglugga"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"Valmynd"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"Spila/gera hlé á margmiðlunarefni"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"Upphnappur stýriflatar"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"Niðurhnappur stýriflatar"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"Vinstrihnappur stýriflatar"</string> diff --git a/core/res/res/values-it/strings.xml b/core/res/res/values-it/strings.xml index ee1c07392160..0186f1416c81 100644 --- a/core/res/res/values-it/strings.xml +++ b/core/res/res/values-it/strings.xml @@ -2192,6 +2192,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"Selettore scorciatoia Accessibilità sullo schermo"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"Scorciatoia Accessibilità"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"Ignora area notifiche"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"Menu"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"Play/Pausa contenuti multimediali"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"D-pad - Su"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"D-pad - Giù"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"D-pad - Sinistra"</string> diff --git a/core/res/res/values-iw/strings.xml b/core/res/res/values-iw/strings.xml index 08d9c29622c2..766e1906f883 100644 --- a/core/res/res/values-iw/strings.xml +++ b/core/res/res/values-iw/strings.xml @@ -2192,6 +2192,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"בורר קיצורי דרך לנגישות במסך"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"קיצור דרך לנגישות"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"סגירת לוח ההתראות"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"תפריט"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"הפעלה/השהיה של המדיה"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"לחצן עליון ב-Dpad"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"לחצן תחתון ב-Dpad"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"לחצן שמאלי ב-Dpad"</string> diff --git a/core/res/res/values-ja/strings.xml b/core/res/res/values-ja/strings.xml index 20623cb799e5..7ebcc393b434 100644 --- a/core/res/res/values-ja/strings.xml +++ b/core/res/res/values-ja/strings.xml @@ -2191,6 +2191,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"画面上のユーザー補助機能のショートカットの選択メニュー"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"ユーザー補助のショートカット"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"通知シェードを閉じる"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"メニュー"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"メディアの再生 / 一時停止"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"D-pad: 上"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"D-pad: 下"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"D-pad: 左"</string> diff --git a/core/res/res/values-ka/strings.xml b/core/res/res/values-ka/strings.xml index b8ebff04fec0..621c2a7277d9 100644 --- a/core/res/res/values-ka/strings.xml +++ b/core/res/res/values-ka/strings.xml @@ -2191,6 +2191,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"მისაწვდომობის ეკრანული მალსახმობის ამომრჩევი"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"მისაწვდომობის მალსახმობი"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"შეტყობინებების ფარდის დახურვა"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"მენიუ"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"მედიის დაკვრა/დაპაუზება"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"Dpad ზევით"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"Dpad ქვევით"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"Dpad მარცხნივ"</string> diff --git a/core/res/res/values-kk/strings.xml b/core/res/res/values-kk/strings.xml index 6aabad713661..06e8a375f45f 100644 --- a/core/res/res/values-kk/strings.xml +++ b/core/res/res/values-kk/strings.xml @@ -2191,6 +2191,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"Экрандағы арнайы мүмкіндіктерді жылдам қосу әрекетін таңдау"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"Арнайы мүмкіндіктерді жылдам қосу"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"Хабарландыру тақтасын жабу"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"Mәзір"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"Медиафайл ойнату/кідірту"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"Жоғарғы Dpad түймесі"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"Төменгі Dpad түймесі"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"Сол жақ Dpad түймесі"</string> diff --git a/core/res/res/values-km/strings.xml b/core/res/res/values-km/strings.xml index 0aec1c323ec1..d5d4afd3b30e 100644 --- a/core/res/res/values-km/strings.xml +++ b/core/res/res/values-km/strings.xml @@ -2191,6 +2191,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"ម៉ឺនុយជ្រើសរើសផ្លូវកាត់ភាពងាយស្រួលនៅលើអេក្រង់"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"ផ្លូវកាត់ភាពងាយស្រួល"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"ច្រានចោលផ្ទាំងជូនដំណឹង"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"ម៉ឺនុយ"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"ចាក់/ផ្អាកមេឌៀ"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"Dpad ឡើងលើ"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"Dpad ចុះក្រោម"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"Dpad ឆ្វេង"</string> diff --git a/core/res/res/values-kn/strings.xml b/core/res/res/values-kn/strings.xml index 34e766d690f4..ade6707133ae 100644 --- a/core/res/res/values-kn/strings.xml +++ b/core/res/res/values-kn/strings.xml @@ -2064,7 +2064,7 @@ <string name="time_picker_text_input_mode_description" msgid="4761160667516611576">"ಸಮಯವನ್ನು ನಮೂದಿಸಲು ಪಠ್ಯದ ನಮೂನೆಗೆ ಬದಲಿಸಿ."</string> <string name="time_picker_radial_mode_description" msgid="1222342577115016953">"ಸಮಯವನ್ನು ನಮೂದಿಸಲು ಗಡಿಯಾರದ ನಮೂನೆಗೆ ಬದಲಿಸಿ."</string> <string name="autofill_picker_accessibility_title" msgid="4425806874792196599">"ಸ್ವಯಂತುಂಬುವಿಕೆ ಆಯ್ಕೆಗಳು"</string> - <string name="autofill_save_accessibility_title" msgid="1523225776218450005">"ಸ್ವಯಂ ಭರ್ತಿಗಾಗಿ ಉಳಿಸಿ"</string> + <string name="autofill_save_accessibility_title" msgid="1523225776218450005">"ಸ್ವಯಂ ಭರ್ತಿಗಾಗಿ ಸೇವ್ ಮಾಡಿ"</string> <string name="autofill_error_cannot_autofill" msgid="6528827648643138596">"ವಿಷಯಗಳು ಸ್ವಯಂಚಾಲಿತವಾಗಿ ಭರ್ತಿಯಾಗಲು ಸಾಧ್ಯವಿಲ್ಲ"</string> <string name="autofill_picker_no_suggestions" msgid="1076022650427481509">"ಸ್ವಯಂಭರ್ತಿ ಸಲಹೆಗಳಿಲ್ಲ"</string> <string name="autofill_picker_some_suggestions" msgid="5560549696296202701">"{count,plural, =1{ಒಂದು ಸ್ವಯಂ ಭರ್ತಿ ಸಲಹೆಯಿದೆ}one{# ಸ್ವಯಂ ಭರ್ತಿ ಸಲಹೆಗಳಿವೆ}other{# ಸ್ವಯಂ ಭರ್ತಿ ಸಲಹೆಗಳಿವೆ}}"</string> @@ -2191,6 +2191,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"ಸ್ಕ್ರೀನ್ನಲ್ಲಿನ ಆ್ಯಕ್ಸೆಸಿಬಿಲಿಟಿ ಶಾರ್ಟ್ಕಟ್ ಆಯ್ಕೆ"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"ಆ್ಯಕ್ಸೆಸಿಬಿಲಿಟಿ ಶಾರ್ಟ್ಕಟ್"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"ಅಧಿಸೂಚನೆಯ ಪರದೆಯನ್ನು ವಜಾಗೊಳಿಸಿ"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"ಮೆನು"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"ಮೀಡಿಯಾವನ್ನು ಪ್ಲೇ ಮಾಡಿ/ವಿರಾಮಗೊಳಿಸಿ"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"Dpad ನ ಮೇಲಿನ ಬಟನ್"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"Dpad ನ ಕೆಳಗಿನ ಬಟನ್"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"Dpad ನ ಎಡಭಾಗದ ಬಟನ್"</string> diff --git a/core/res/res/values-ko/strings.xml b/core/res/res/values-ko/strings.xml index d0e53f95786f..775b571e7981 100644 --- a/core/res/res/values-ko/strings.xml +++ b/core/res/res/values-ko/strings.xml @@ -2191,6 +2191,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"화면상의 접근성 바로가기 선택 도구"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"접근성 단축키"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"알림 창 닫기"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"메뉴"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"미디어 재생/일시중지"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"방향 패드 위쪽"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"방향 패드 아래"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"방향 패드 왼쪽"</string> diff --git a/core/res/res/values-ky/strings.xml b/core/res/res/values-ky/strings.xml index 145ddb3854f7..3bf33e7379fb 100644 --- a/core/res/res/values-ky/strings.xml +++ b/core/res/res/values-ky/strings.xml @@ -2191,6 +2191,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"Ыкчам иштетүү менюсу"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"Ыкчам иштетүү"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"Билдирмелер тактасын жабуу"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"Меню"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"Медиа файлды ойнотуу/тындыруу"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"Dpad\'дын жогорку баскычы"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"Dpad\'дын ылдыйкы баскычы"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"Dpad\'дын сол баскычы"</string> diff --git a/core/res/res/values-lo/strings.xml b/core/res/res/values-lo/strings.xml index f8516165af3b..7e664f99ebf3 100644 --- a/core/res/res/values-lo/strings.xml +++ b/core/res/res/values-lo/strings.xml @@ -2191,6 +2191,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"ຕົວເລືອກທາງລັດການຊ່ວຍເຂົ້າເຖິງຢູ່ໜ້າຈໍ"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"ທາງລັດການຊ່ວຍເຂົ້າເຖິງ"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"ປິດເງົາການແຈ້ງເຕືອນໄວ້"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"ເມນູ"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"ຫຼິ້ນ/ຢຸດສື່ຊົ່ວຄາວ"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"Dpad ຂຶ້ນ"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"Dpad ລົງ"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"Dpad ຊ້າຍ"</string> diff --git a/core/res/res/values-lt/strings.xml b/core/res/res/values-lt/strings.xml index 74dafa75f1dc..ba2eb3407833 100644 --- a/core/res/res/values-lt/strings.xml +++ b/core/res/res/values-lt/strings.xml @@ -2193,6 +2193,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"Ekrano pritaikomumo šaukinių parinkiklis"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"Pritaikomumo šaukinys"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"Atsisakyti pranešimų skydelio"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"Meniu"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"Leisti / pristabdyti mediją"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"Valdymo pultas – aukštyn"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"Valdymo pultas – žemyn"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"Valdymo pultas – kairėn"</string> diff --git a/core/res/res/values-lv/strings.xml b/core/res/res/values-lv/strings.xml index 0c30528d42b9..0c60a4dbf5cb 100644 --- a/core/res/res/values-lv/strings.xml +++ b/core/res/res/values-lv/strings.xml @@ -2192,6 +2192,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"Ekrāna pieejamības saīsnes atlasītājs"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"Pieejamības saīsne"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"Nerādīt paziņojumu paneli"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"Izvēlne"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"Sākt/apturēt multivides atskaņošanu"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"Virzienu slēdzis — augšup"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"Virzienu slēdzis — lejup"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"Virzienu slēdzis — pa kreisi"</string> diff --git a/core/res/res/values-mk/strings.xml b/core/res/res/values-mk/strings.xml index 7cd2a2ae1dea..110a582e6ac8 100644 --- a/core/res/res/values-mk/strings.xml +++ b/core/res/res/values-mk/strings.xml @@ -2191,6 +2191,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"Избирач на кратенка за пристапност на екранот"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"Кратенка за пристапност"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"Отфрлете го панелот за известување"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"Мени"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"Пушти/паузирај аудиовизуелни содржини"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"Навигациско копче за нагоре"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"Навигациско копче за надолу"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"Навигациско копче за налево"</string> diff --git a/core/res/res/values-ml/strings.xml b/core/res/res/values-ml/strings.xml index 6bcd0c19038e..542216075d8e 100644 --- a/core/res/res/values-ml/strings.xml +++ b/core/res/res/values-ml/strings.xml @@ -2191,6 +2191,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"സ്ക്രീനിലെ ഉപയോഗസഹായി കുറുക്കുവഴി ചൂസർ"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"ഉപയോഗസഹായി കുറുക്കുവഴി"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"അറിയിപ്പ് ഷെയ്ഡ് ഡിസ്മിസ് ചെയ്യുക"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"മെനു"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"മീഡിയ പ്ലേ ചെയ്യുക/താൽക്കാലികമായി നിർത്തുക"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"Dpad അപ്പ്"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"Dpad ഡൗൺ"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"Dpad ലെഫ്റ്റ്"</string> diff --git a/core/res/res/values-mn/strings.xml b/core/res/res/values-mn/strings.xml index de16d62bf4e5..f6b8a247625c 100644 --- a/core/res/res/values-mn/strings.xml +++ b/core/res/res/values-mn/strings.xml @@ -2191,6 +2191,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"Дэлгэц дээрх хандалтын товчлол сонгогч"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"Хандалтын товчлол"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"Мэдэгдлийн хураангуй самбарыг хаах"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"Цэс"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"Медиаг тоглуулах/түр зогсоох"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"Dpad дээш"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"Dpad доош"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"Dpad зүүн"</string> diff --git a/core/res/res/values-mr/strings.xml b/core/res/res/values-mr/strings.xml index a470a88c2140..79342b3720bb 100644 --- a/core/res/res/values-mr/strings.xml +++ b/core/res/res/values-mr/strings.xml @@ -2191,6 +2191,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"ऑन-स्क्रीन ॲक्सेसिबिलिटी शॉर्टकट निवडकर्ता"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"अॅक्सेसिबिलिटी शॉर्टकट"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"सूचना शेड डिसमिस करा"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"मेनू"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"मीडिया प्ले करा/थांबवा"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"Dpad चे वरील"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"Dpad चे खालचे"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"Dpad डावीकडील"</string> diff --git a/core/res/res/values-ms/strings.xml b/core/res/res/values-ms/strings.xml index e21db9f49311..ce72ab683350 100644 --- a/core/res/res/values-ms/strings.xml +++ b/core/res/res/values-ms/strings.xml @@ -2191,6 +2191,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"Pemilih Pintasan Kebolehaksesan Pada Skrin"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"Pintasan Kebolehaksesan"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"Ketepikan Bidai Pemberitahuan"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"Menu"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"Mainkan/Jeda Media"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"Dpad Atas"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"Dpad Bawah"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"Dpad Kiri"</string> @@ -2226,7 +2228,7 @@ <string name="miniresolver_private_space_messages_information" msgid="111285656327622118">"Anda hanya boleh menghantar mesej SMS daripada apl Messages peribadi anda."</string> <string name="miniresolver_use_personal_browser" msgid="776072682871133308">"Gunakan penyemak imbas peribadi"</string> <string name="miniresolver_use_work_browser" msgid="543575306251952994">"Gunakan penyemak imbas kerja"</string> - <string name="miniresolver_call" msgid="6386870060423480765">"Panggil"</string> + <string name="miniresolver_call" msgid="6386870060423480765">"Telefon"</string> <string name="miniresolver_switch" msgid="8011924662117617451">"Beralih"</string> <string name="PERSOSUBSTATE_SIM_NETWORK_ENTRY" msgid="8050953231914637819">"PIN buka kunci rangkaian SIM"</string> <string name="PERSOSUBSTATE_SIM_NETWORK_SUBSET_ENTRY" msgid="7164399703751688214">"PIN buka kunci subset rangkaian SIM"</string> diff --git a/core/res/res/values-my/strings.xml b/core/res/res/values-my/strings.xml index b32597cca2fb..6137e29ce86c 100644 --- a/core/res/res/values-my/strings.xml +++ b/core/res/res/values-my/strings.xml @@ -2191,6 +2191,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"ဖန်သားပြင်အတွက် အများသုံးစွဲနိုင်မှုဖြတ်လမ်းလင့်ခ် ရွေးချယ်စနစ်"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"အများသုံးနိုင်မှု ဖြတ်လမ်းလင့်ခ်"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"အကြောင်းကြားစာအကွက်ကို ပယ်ရန်"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"မီနူး"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"မီဒီယာ ဖွင့်ရန်/ခဏရပ်ရန်"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"Dpad အပေါ်"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"Dpad အောက်"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"Dpad ဘယ်"</string> diff --git a/core/res/res/values-nb/strings.xml b/core/res/res/values-nb/strings.xml index cd1a6d451be8..cd6f21bf2bfa 100644 --- a/core/res/res/values-nb/strings.xml +++ b/core/res/res/values-nb/strings.xml @@ -2191,6 +2191,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"Velger for tilgjengelighetssnarvei på skjermen"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"Tilgjengelighetssnarvei"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"Lukk varselpanelet"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"Meny"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"Media – spill av og sett på pause"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"Opp på styrepilene"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"Ned på styrepilene"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"Venstre på styrepilene"</string> diff --git a/core/res/res/values-ne/strings.xml b/core/res/res/values-ne/strings.xml index 4c6336049dd0..6278a5f9fe11 100644 --- a/core/res/res/values-ne/strings.xml +++ b/core/res/res/values-ne/strings.xml @@ -2191,6 +2191,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"सहज पहुँचका लागि स्क्रिनमा राखिने सर्टकट छान्ने मेनु"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"पहुँचको सर्टकट"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"सूचना कक्ष खारेज गर्नुहोस्"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"मेनु"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"मिडिया प्ले/पज"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"Dpad को माथिको बटन"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"Dpad को तलको बटन"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"Dpad को बायाँको बटन"</string> diff --git a/core/res/res/values-nl/strings.xml b/core/res/res/values-nl/strings.xml index 4b5e90308bb5..fcc47821f6fe 100644 --- a/core/res/res/values-nl/strings.xml +++ b/core/res/res/values-nl/strings.xml @@ -2191,6 +2191,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"Kiezer voor snelkoppeling voor toegankelijkheid op scherm"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"Snelkoppeling voor toegankelijkheid"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"Meldingenpaneel sluiten"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"Menu"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"Media afspelen/onderbreken"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"D-pad omhoog"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"D-pad omlaag"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"D-pad links"</string> diff --git a/core/res/res/values-or/strings.xml b/core/res/res/values-or/strings.xml index 2e1de29bca17..259f50a3f298 100644 --- a/core/res/res/values-or/strings.xml +++ b/core/res/res/values-or/strings.xml @@ -2191,6 +2191,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"ଅନ୍-ସ୍କ୍ରିନ୍ ଆକ୍ସେସିବିଲିଟୀ ସର୍ଟକଟ୍ ବାଛିବା ସୁବିଧା"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"ଆକ୍ସେସିବିଲିଟୀ ସର୍ଟକଟ୍"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"ବିଜ୍ଞପ୍ତି ସେଡକୁ ଖାରଜ କରନ୍ତୁ"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"ମେନୁ"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"ମିଡିଆ ପ୍ଲେ କରନ୍ତୁ/ବିରତ କରନ୍ତୁ"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"Dpad ଉପର"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"Dpad ତଳ"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"Dpad ବାମ"</string> diff --git a/core/res/res/values-pa/strings.xml b/core/res/res/values-pa/strings.xml index d9f2a69a961f..9fb81035dd62 100644 --- a/core/res/res/values-pa/strings.xml +++ b/core/res/res/values-pa/strings.xml @@ -2191,6 +2191,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"ਸਕ੍ਰੀਨ \'ਤੇ ਦਿਸਣ ਵਾਲੇ ਪਹੁੰਚਯੋਗਤਾ ਸ਼ਾਰਟਕੱਟ ਦਾ ਚੋਣਕਾਰ"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"ਪਹੁੰਚਯੋਗਤਾ ਸ਼ਾਰਟਕੱਟ"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"ਸੂਚਨਾ ਸ਼ੇਡ ਖਾਰਜ ਕਰੋ"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"ਮੀਨੂ"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"ਮੀਡੀਆ ਚਲਾਓ/ਰੋਕੋ"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"Dpad ਦਾ ਉੱਪਰਲਾ ਬਟਨ"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"Dpad ਦਾ ਹੇਠਲਾ ਬਟਨ"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"Dpad ਦਾ ਖੱਬੇ ਪਾਸੇ ਵਾਲਾ ਬਟਨ"</string> diff --git a/core/res/res/values-pl/strings.xml b/core/res/res/values-pl/strings.xml index 9d725a570d99..8b93be960462 100644 --- a/core/res/res/values-pl/strings.xml +++ b/core/res/res/values-pl/strings.xml @@ -2193,6 +2193,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"Wybierz ekranowy skrót ułatwień dostępu"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"Skrót ułatwień dostępu"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"Zamknij obszar powiadomień"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"Menu"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"Odtwórz/wstrzymaj multimedia"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"Dpad – w górę"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"Dpad – w dół"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"Dpad – w lewo"</string> diff --git a/core/res/res/values-pt-rBR/strings.xml b/core/res/res/values-pt-rBR/strings.xml index 148f13b0471d..f58ee98bdef7 100644 --- a/core/res/res/values-pt-rBR/strings.xml +++ b/core/res/res/values-pt-rBR/strings.xml @@ -2192,6 +2192,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"Seletor de atalho de acessibilidade na tela"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"Atalho de acessibilidade"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"Dispensar aba de notificações"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"Menu"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"Tocar/pausar mídia"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"Botão direcional: para cima"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"Botão direcional: para baixo"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"Botão direcional: para a esquerda"</string> diff --git a/core/res/res/values-pt-rPT/strings.xml b/core/res/res/values-pt-rPT/strings.xml index b3bd69474f62..1f8702634652 100644 --- a/core/res/res/values-pt-rPT/strings.xml +++ b/core/res/res/values-pt-rPT/strings.xml @@ -2192,6 +2192,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"Selecionador de atalhos de acessibilidade no ecrã"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"Atalho de acessibilidade"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"Ignorar o painel de notificações"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"Menu"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"Reproduzir/pausar multimédia"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"Teclado direcional: para cima"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"Teclado direcional: para baixo"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"Teclado direcional: para a esquerda"</string> diff --git a/core/res/res/values-pt/strings.xml b/core/res/res/values-pt/strings.xml index 148f13b0471d..f58ee98bdef7 100644 --- a/core/res/res/values-pt/strings.xml +++ b/core/res/res/values-pt/strings.xml @@ -2192,6 +2192,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"Seletor de atalho de acessibilidade na tela"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"Atalho de acessibilidade"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"Dispensar aba de notificações"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"Menu"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"Tocar/pausar mídia"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"Botão direcional: para cima"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"Botão direcional: para baixo"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"Botão direcional: para a esquerda"</string> diff --git a/core/res/res/values-ro/strings.xml b/core/res/res/values-ro/strings.xml index 3defacd787a3..e61ab659e248 100644 --- a/core/res/res/values-ro/strings.xml +++ b/core/res/res/values-ro/strings.xml @@ -2192,6 +2192,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"Selector de comenzi rapide de accesibilitate de pe ecran"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"Comandă rapidă de accesibilitate"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"Închide fereastra de notificări"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"Meniu"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"Redă / întrerupe conținutul media"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"Dpad sus"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"Dpad jos"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"Dpad stânga"</string> diff --git a/core/res/res/values-ru/strings.xml b/core/res/res/values-ru/strings.xml index 6499c7fc4de8..479505eea979 100644 --- a/core/res/res/values-ru/strings.xml +++ b/core/res/res/values-ru/strings.xml @@ -2193,6 +2193,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"Выбор действия для быстрого включения"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"Быстрое включение"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"Скрыть панель уведомлений"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"Меню"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"Воспроизведение и пауза"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"D-pad – вверх"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"D-pad – вниз"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"D-pad – влево"</string> diff --git a/core/res/res/values-si/strings.xml b/core/res/res/values-si/strings.xml index 1fd047c70a66..28c3a8fcb86d 100644 --- a/core/res/res/values-si/strings.xml +++ b/core/res/res/values-si/strings.xml @@ -2191,6 +2191,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"තිරය මත ප්රවේශ්යතා කෙටිමං තෝරනය"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"ප්රවේශ්යතා කෙටිමඟ"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"දැනුම්දීම් සෙවන ඉවත ලන්න"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"මෙනුව"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"මාධ්ය වාදනය/විරාමය"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"Dpad ඉහළ"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"Dpad පහළ"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"Dpad වම"</string> diff --git a/core/res/res/values-sk/strings.xml b/core/res/res/values-sk/strings.xml index e6262ed7b185..85583780a099 100644 --- a/core/res/res/values-sk/strings.xml +++ b/core/res/res/values-sk/strings.xml @@ -2193,6 +2193,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"Výber skratky dostupnosti na obrazovke"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"Skratka dostupnosti"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"Zavrieť panel upozornení"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"Ponuka"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"Prehrať / pozastaviť médium"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"Stlačiť tlačidlo nahor krížového ovládača"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"Stlačiť tlačidlo nadol krížového ovládača"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"Stlačiť tlačidlo doľava krížového ovládača"</string> diff --git a/core/res/res/values-sl/strings.xml b/core/res/res/values-sl/strings.xml index 37cf1783a04f..a364ad6db075 100644 --- a/core/res/res/values-sl/strings.xml +++ b/core/res/res/values-sl/strings.xml @@ -2193,6 +2193,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"Izbirnik zaslonske bližnjice za dostopnost"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"Bližnjica za dostopnost"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"Opusti zaslon z obvestili"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"Meni"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"Predvajaj/začasno zaustavi predstavnost"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"Smerni gumb gor"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"Smerni gumb dol"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"Smerni gumb levo"</string> diff --git a/core/res/res/values-sq/strings.xml b/core/res/res/values-sq/strings.xml index aa7cf3f951f7..58b4b972b78c 100644 --- a/core/res/res/values-sq/strings.xml +++ b/core/res/res/values-sq/strings.xml @@ -2191,6 +2191,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"Zgjedhësi i shkurtores së qasshmërisë në ekran"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"Shkurtorja e qasshmërisë"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"Hiq \"Strehën e njoftimeve\""</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"Menyja"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"Luaj/vendos në pauzë median"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"Lart në bllokun e drejtimit"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"Poshtë në bllokun e drejtimit"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"Majtas në bllokun e drejtimit"</string> diff --git a/core/res/res/values-sr/strings.xml b/core/res/res/values-sr/strings.xml index 4a41557a9df5..e8849cb7a413 100644 --- a/core/res/res/values-sr/strings.xml +++ b/core/res/res/values-sr/strings.xml @@ -2192,6 +2192,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"Алатка за бирање пречица за приступачност на екрану"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"Пречица за приступачност"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"Одбаци траку са обавештењима"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"Мени"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"Пусти/паузирај медије"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"нагоре на D-pad-у"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"надоле на D-pad-у"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"налево на D-pad-у"</string> diff --git a/core/res/res/values-sv/strings.xml b/core/res/res/values-sv/strings.xml index fb950c0ed313..7995ee3bb4b6 100644 --- a/core/res/res/values-sv/strings.xml +++ b/core/res/res/values-sv/strings.xml @@ -2191,6 +2191,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"Valfunktion för tillgänglighetsgenväg på skärmen"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"Aktivera tillgänglighet snabbt"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"Stäng meddelandepanelen"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"Meny"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"Spela upp/pausa"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"Styrkors, upp"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"Styrkors, ned"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"Styrkors, vänster"</string> diff --git a/core/res/res/values-sw/strings.xml b/core/res/res/values-sw/strings.xml index 4bba3145e186..0209f95ceebe 100644 --- a/core/res/res/values-sw/strings.xml +++ b/core/res/res/values-sw/strings.xml @@ -991,7 +991,7 @@ <string name="keyguard_password_enter_pin_password_code" msgid="7792964196473964340">"Ingiza PIN ili kufungua"</string> <string name="keyguard_password_wrong_pin_code" msgid="8583732939138432793">"Nambari ya PIN uliyoweka si sahihi."</string> <string name="keyguard_label_text" msgid="3841953694564168384">"Ili kufungua, bofya Menyu kisha 0."</string> - <string name="emergency_call_dialog_number_for_display" msgid="2978165477085612673">"Nambari ya dharura"</string> + <string name="emergency_call_dialog_number_for_display" msgid="2978165477085612673">"Namba ya dharura"</string> <string name="lockscreen_carrier_default" msgid="6192313772955399160">"Hakuna huduma"</string> <string name="lockscreen_screen_locked" msgid="7364905540516041817">"skrini imefungwa."</string> <string name="lockscreen_instructions_when_pattern_enabled" msgid="7982445492532123308">"Bonyeza Menyu ili kufungua au kupiga simu ya dharura."</string> @@ -2191,6 +2191,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"Kichagua Njia ya Mkato ya Ufikivu kwenye Skrini"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"Njia ya Mkato ya Ufikivu"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"Ondoa Sehemu ya Arifa"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"Menyu"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"Cheza/Sitisha Maudhui"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"Kitufe cha juu cha Dpad"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"Kitufe cha chini cha Dpad"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"Kitufe cha kushoto cha Dpad"</string> diff --git a/core/res/res/values-ta/strings.xml b/core/res/res/values-ta/strings.xml index 4038a68da45b..31ed93984ce1 100644 --- a/core/res/res/values-ta/strings.xml +++ b/core/res/res/values-ta/strings.xml @@ -2191,6 +2191,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"திரையிலுள்ள அணுகல்தன்மை ஷார்ட்கட்டிற்கான தேர்வி"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"அணுகல்தன்மை ஷார்ட்கட்"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"அறிவிப்பு விவரத்தை நிராகரி"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"மெனு"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"மீடியாவை இயக்குதல்/இடைநிறுத்துதல்"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"மேல் திசை காட்டும் பட்டன்"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"கீழ் திசை காட்டும் பட்டன்"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"இடது திசை காட்டும் பட்டன்"</string> diff --git a/core/res/res/values-te/strings.xml b/core/res/res/values-te/strings.xml index e7e0059111fe..010f1365bb20 100644 --- a/core/res/res/values-te/strings.xml +++ b/core/res/res/values-te/strings.xml @@ -2191,6 +2191,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"స్క్రీన్పై ఉండే యాక్సెసిబిలిటీ షార్ట్కట్ల ఎంపిక సాధనం"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"యాక్సెసిబిలిటీ షార్ట్కట్"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"నోటిఫికేషన్ తెరను తీసివేయండి"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"మెనూ"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"మీడియాను ప్లే/పాజ్ చేయండి"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"Dpad పైకి"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"Dpad కింద"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"Dpad ఎడమవైపున"</string> diff --git a/core/res/res/values-th/strings.xml b/core/res/res/values-th/strings.xml index 9c0a1591b6fd..37d5a0d463d3 100644 --- a/core/res/res/values-th/strings.xml +++ b/core/res/res/values-th/strings.xml @@ -2191,6 +2191,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"ตัวเลือกทางลัดการช่วยเหลือพิเศษบนหน้าจอ"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"ทางลัดการช่วยเหลือพิเศษ"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"ปิดหน้าต่างแจ้งเตือน"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"เมนู"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"เล่น/หยุดสื่อชั่วคราว"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"Dpad ขึ้น"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"Dpad ลง"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"Dpad ซ้าย"</string> diff --git a/core/res/res/values-tl/strings.xml b/core/res/res/values-tl/strings.xml index 5c4464c671a6..472edeac3736 100644 --- a/core/res/res/values-tl/strings.xml +++ b/core/res/res/values-tl/strings.xml @@ -2191,6 +2191,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"Tagapili ng Shortcut ng Accessibility sa Screen"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"Shortcut ng Accessibility"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"I-dismiss ang Notification Shade"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"Menu"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"I-Play/I-Pause ang Media"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"Dpad Up"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"Dpad Down"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"Dpad Left"</string> diff --git a/core/res/res/values-tr/strings.xml b/core/res/res/values-tr/strings.xml index 586295eb4e0b..6f2d9624722c 100644 --- a/core/res/res/values-tr/strings.xml +++ b/core/res/res/values-tr/strings.xml @@ -2191,6 +2191,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"Ekran Erişilebilirlik Kısayol Seçici"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"Erişilebilirlik Kısayolu"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"Bildirim Gölgesini Kapat"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"Menü"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"Medyayı Oynat/Duraklat"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"Dpad Yukarı"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"Dpad Aşağı"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"Dpad Sol"</string> diff --git a/core/res/res/values-uk/strings.xml b/core/res/res/values-uk/strings.xml index d7abf5b4466d..0f2f5a88e602 100644 --- a/core/res/res/values-uk/strings.xml +++ b/core/res/res/values-uk/strings.xml @@ -2193,6 +2193,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"Вибір екранного засобу спеціальних можливостей"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"Засіб спеціальних можливостей"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"Закрити панель сповіщень"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"Меню"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"Відтворити/призупинити медіаконтент"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"Кнопка \"вгору\" панелі керування"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"Кнопка \"вниз\" панелі керування"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"Кнопка \"вліво\" панелі керування"</string> diff --git a/core/res/res/values-ur/strings.xml b/core/res/res/values-ur/strings.xml index 9de4729bd951..59c11edc490e 100644 --- a/core/res/res/values-ur/strings.xml +++ b/core/res/res/values-ur/strings.xml @@ -2191,6 +2191,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"آن اسکرین ایکسیسبیلٹی شارٹ کٹ منتخب کنندہ"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"ایکسیسبیلٹی کا شارٹ کٹ"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"اطلاعاتی شیڈ برخاست کریں"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"مینیو"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"میڈیا چلائیں/موقوف کریں"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"Dpad اوپر کریں"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"Dpad نیچے کریں"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"Dpad بائیں کریں"</string> diff --git a/core/res/res/values-uz/strings.xml b/core/res/res/values-uz/strings.xml index a9fa3e685642..2c4a222767df 100644 --- a/core/res/res/values-uz/strings.xml +++ b/core/res/res/values-uz/strings.xml @@ -2191,6 +2191,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"Ekranda tezkor ishga tushirishni tanlagich"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"Tezkor ishga tushirish"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"Eslatma soyasini yopish"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"Menyu"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"Media ijro/pauza"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"Dpad – tepaga"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"Dpad – pastga"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"Dpad – chapga"</string> diff --git a/core/res/res/values-vi/strings.xml b/core/res/res/values-vi/strings.xml index 6c9d9cac023f..33c29cca40b0 100644 --- a/core/res/res/values-vi/strings.xml +++ b/core/res/res/values-vi/strings.xml @@ -2191,6 +2191,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"Bộ chọn lối tắt hỗ trợ tiếp cận trên màn hình"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"Lối tắt hỗ trợ tiếp cận"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"Đóng Ngăn thông báo"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"Trình đơn"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"Phát/Tạm dừng nội dung nghe nhìn"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"Chuyển lên trên bằng bàn phím di chuyển"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"Chuyển xuống dưới bằng bàn phím di chuyển"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"Chuyển sang trái bằng bàn phím di chuyển"</string> diff --git a/core/res/res/values-zh-rCN/strings.xml b/core/res/res/values-zh-rCN/strings.xml index f699ca659396..9d6b60a4d54e 100644 --- a/core/res/res/values-zh-rCN/strings.xml +++ b/core/res/res/values-zh-rCN/strings.xml @@ -2191,6 +2191,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"屏幕上的无障碍功能快捷方式选择器"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"无障碍功能快捷方式"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"关闭通知栏"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"菜单"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"媒体播放/暂停"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"向上方向键"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"向下方向键"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"向左方向键"</string> diff --git a/core/res/res/values-zh-rHK/strings.xml b/core/res/res/values-zh-rHK/strings.xml index c66f5f2ab841..86d3ae93951e 100644 --- a/core/res/res/values-zh-rHK/strings.xml +++ b/core/res/res/values-zh-rHK/strings.xml @@ -2191,6 +2191,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"螢幕無障礙功能捷徑選擇器"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"無障礙功能捷徑"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"關閉通知欄"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"選單"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"媒體播放/暫停"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"十字鍵向上鍵"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"十字鍵向下鍵"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"十字鍵向左鍵"</string> diff --git a/core/res/res/values-zh-rTW/strings.xml b/core/res/res/values-zh-rTW/strings.xml index a61a067958e8..e50d0e488e42 100644 --- a/core/res/res/values-zh-rTW/strings.xml +++ b/core/res/res/values-zh-rTW/strings.xml @@ -2191,6 +2191,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"螢幕上的無障礙捷徑選擇器"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"無障礙捷徑"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"關閉通知欄"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"選單"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"媒體播放/暫停"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"Dpad 向上移"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"Dpad 向下移"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"Dpad 向左移"</string> diff --git a/core/res/res/values-zu/strings.xml b/core/res/res/values-zu/strings.xml index 257bc424ceca..72fcbf3b69a0 100644 --- a/core/res/res/values-zu/strings.xml +++ b/core/res/res/values-zu/strings.xml @@ -2191,6 +2191,8 @@ <string name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" msgid="1057878690209817886">"Isikhethi sesinqamuleli sokufinyeleleka kusikrini"</string> <string name="accessibility_system_action_hardware_a11y_shortcut_label" msgid="5764644187715255107">"Isinqamuleli sokufinyeleleka"</string> <string name="accessibility_system_action_dismiss_notification_shade" msgid="8931637495533770352">"Cashisa Umthunzi Wesaziso"</string> + <string name="accessibility_system_action_menu_label" msgid="3385283204496447040">"Imenyu"</string> + <string name="accessibility_system_action_media_play_pause_label" msgid="1905647491347119748">"Ukudlala/Ukumisa Imidiya"</string> <string name="accessibility_system_action_dpad_up_label" msgid="1029042950229333782">"Phezulu kwe-Dpad"</string> <string name="accessibility_system_action_dpad_down_label" msgid="3441918448624921461">"Phansi kwe-Dpad"</string> <string name="accessibility_system_action_dpad_left_label" msgid="6557647179116479152">"Ngakwesokunxele se-Dpad"</string> diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index 4e133de7c483..00be9fe564da 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -3015,7 +3015,7 @@ <bool name="config_syncstorageengine_masterSyncAutomatically">true</bool> <!-- Maximum number of supported users --> - <integer name="config_multiuserMaximumUsers">1</integer> + <integer name="config_multiuserMaximumUsers">4</integer> <!-- Maximum number of users we allow to be running at a time --> <integer name="config_multiuserMaxRunningUsers">3</integer> @@ -5807,6 +5807,9 @@ <!-- The action name for the default profcollect report uploader app. --> <string name="config_defaultProfcollectReportUploaderAction" translatable="false"></string> + <!-- Names of packages excluded by Profcollect onCameraOpened observer. --> + <string-array name="config_profcollectOnCameraOpenedSkipPackages" translatable="false"></string-array> + <!-- The default value used for RawContacts.ACCOUNT_NAME when contacts are inserted without this column set. These contacts are stored locally on the device and will not be removed even if no android.account.Account with this name exists. A null string will be used if the diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml index 8e0b5f6d32c6..1a2f0ccb06ba 100644 --- a/core/res/res/values/strings.xml +++ b/core/res/res/values/strings.xml @@ -5981,6 +5981,10 @@ <string name="accessibility_system_action_hardware_a11y_shortcut_label">Accessibility Shortcut</string> <!-- Label for dismissing the notification shade [CHAR LIMIT=NONE] --> <string name="accessibility_system_action_dismiss_notification_shade">Dismiss Notification Shade</string> + <!-- Label for menu action [CHAR LIMIT=NONE] --> + <string name="accessibility_system_action_menu_label">Menu</string> + <!-- Label for media play/pause action [CHAR LIMIT=NONE] --> + <string name="accessibility_system_action_media_play_pause_label">Media Play/Pause</string> <!-- Label for Dpad up action [CHAR LIMIT=NONE] --> <string name="accessibility_system_action_dpad_up_label">Dpad Up</string> <!-- Label for Dpad down action [CHAR LIMIT=NONE] --> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 7251d747be79..06a4d550b204 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -4444,6 +4444,7 @@ <java-symbol type="bool" name="config_profcollectReportUploaderEnabled" /> <java-symbol type="string" name="config_defaultProfcollectReportUploaderApp" /> <java-symbol type="string" name="config_defaultProfcollectReportUploaderAction" /> + <java-symbol type="array" name="config_profcollectOnCameraOpenedSkipPackages" /> <java-symbol type="string" name="usb_device_resolve_prompt_warn" /> @@ -4461,6 +4462,8 @@ <java-symbol type="string" name="accessibility_system_action_on_screen_a11y_shortcut_chooser_label" /> <java-symbol type="string" name="accessibility_system_action_hardware_a11y_shortcut_label" /> <java-symbol type="string" name="accessibility_system_action_dismiss_notification_shade" /> + <java-symbol type="string" name="accessibility_system_action_menu_label" /> + <java-symbol type="string" name="accessibility_system_action_media_play_pause_label" /> <java-symbol type="string" name="accessibility_system_action_dpad_up_label" /> <java-symbol type="string" name="accessibility_system_action_dpad_down_label" /> <java-symbol type="string" name="accessibility_system_action_dpad_left_label" /> diff --git a/core/res/res/xml/sms_short_codes.xml b/core/res/res/xml/sms_short_codes.xml index 67cceb5d5343..581dee571a69 100644 --- a/core/res/res/xml/sms_short_codes.xml +++ b/core/res/res/xml/sms_short_codes.xml @@ -185,6 +185,9 @@ https://www.itu.int/dms_pub/itu-t/oth/02/02/T020200006B0001PDFE.pdf --> <shortcode country="it" pattern="\\d{5}" premium="44[0-4]\\d{2}|47[0-4]\\d{2}|48[0-4]\\d{2}|44[5-9]\\d{4}|47[5-9]\\d{4}|48[5-9]\\d{4}|455\\d{2}|499\\d{2}" free="116\\d{3}|4112503|40\\d{0,12}" standard="430\\d{2}|431\\d{2}|434\\d{4}|435\\d{4}|439\\d{7}" /> + <!-- Jordan: 1-5 digits (standard system default, not country specific) --> + <shortcode country="jo" pattern="\\d{1,5}" free="99066" /> + <!-- Japan: 8083 used by SOFTBANK_DCB_2 --> <shortcode country="jp" pattern="\\d{1,5}" free="8083" /> diff --git a/core/tests/coretests/Android.bp b/core/tests/coretests/Android.bp index 41696dfa782e..5793bbe306f1 100644 --- a/core/tests/coretests/Android.bp +++ b/core/tests/coretests/Android.bp @@ -284,3 +284,510 @@ android_ravenwood_test { ], auto_gen_config: true, } + +FLAKY_OR_IGNORED = [ + "androidx.test.filters.FlakyTest", + "org.junit.Ignore", +] + +test_module_config { + name: "FrameworksCoreTests_Presubmit", + base: "FrameworksCoreTests", + test_suites: [ + "device-tests", + "device-platinum-tests", + ], + include_annotations: ["android.platform.test.annotations.Presubmit"], + exclude_annotations: FLAKY_OR_IGNORED, +} + +test_module_config { + name: "FrameworksCoreTests_inputmethod", + base: "FrameworksCoreTests", + test_suites: [ + "device-tests", + "device-platinum-tests", + ], + include_filters: [ + "com.android.internal.inputmethod", + "android.view.inputmethod", + ], + exclude_annotations: ["androidx.test.filters.FlakyTest"], +} + +test_module_config { + name: "FrameworksCoreTests_context", + base: "FrameworksCoreTests", + test_suites: [ + "device-tests", + "device-platinum-tests", + ], + include_filters: ["android.content.ContextTest"], + exclude_annotations: FLAKY_OR_IGNORED, +} + +test_module_config { + name: "FrameworksCoreTests_keyguard_manager", + base: "FrameworksCoreTests", + test_suites: [ + "device-tests", + "device-platinum-tests", + ], + include_filters: ["android.app.KeyguardManagerTest"], + exclude_annotations: FLAKY_OR_IGNORED, +} + +test_module_config { + name: "FrameworksCoreTests_property_invalidated_cache", + base: "FrameworksCoreTests", + test_suites: [ + "device-tests", + "device-platinum-tests", + ], + include_filters: ["android.app.PropertyInvalidatedCacheTests"], + exclude_annotations: FLAKY_OR_IGNORED, +} + +test_module_config { + name: "FrameworksCoreTests_android_content", + base: "FrameworksCoreTests", + test_suites: [ + "device-tests", + "device-platinum-tests", + ], + include_filters: [ + "android.content.ContextTest", + "android.content.ComponentCallbacksControllerTest", + "android.content.ContextWrapperTest", + ], + exclude_annotations: FLAKY_OR_IGNORED, +} + +test_module_config { + name: "FrameworksCoreTests_sqlite", + base: "FrameworksCoreTests", + test_suites: [ + "device-tests", + "device-platinum-tests", + ], + include_filters: ["android.database.sqlite.SQLiteRawStatementTest"], + exclude_annotations: FLAKY_OR_IGNORED, +} + +test_module_config { + name: "FrameworksCoreTests_android_net", + base: "FrameworksCoreTests", + test_suites: [ + "device-tests", + "device-platinum-tests", + ], + include_filters: ["android.net"], + include_annotations: ["android.platform.test.annotations.Presubmit"], + exclude_annotations: FLAKY_OR_IGNORED, +} + +test_module_config { + name: "FrameworksCoreTests_battery_stats", + base: "FrameworksCoreTests", + test_suites: [ + "device-tests", + "device-platinum-tests", + ], + include_filters: ["com.android.internal.os.BatteryStatsTests"], + exclude_annotations: ["com.android.internal.os.SkipPresubmit"], +} + +test_module_config { + name: "FrameworksCoreTests_environment", + base: "FrameworksCoreTests", + test_suites: [ + "device-tests", + "device-platinum-tests", + ], + include_filters: ["android.os.EnvironmentTest"], +} + +test_module_config { + name: "FrameworksCoreTests_util_data_charset", + base: "FrameworksCoreTests", + test_suites: [ + "device-tests", + "device-platinum-tests", + ], + include_filters: [ + "com.android.internal.util.FastDataTest", + "android.util.CharsetUtilsTest", + ], +} + +test_module_config { + name: "FrameworksCoreTests_xml", + base: "FrameworksCoreTests", + test_suites: [ + "device-tests", + "device-platinum-tests", + ], + include_filters: [ + "android.util.XmlTest", + "android.util.BinaryXmlTest", + ], +} + +test_module_config { + name: "FrameworksCoreTests_util_apk", + base: "FrameworksCoreTests", + test_suites: [ + "device-tests", + "device-platinum-tests", + ], + include_filters: ["android.util.apk.SourceStampVerifierTest"], +} + +test_module_config { + name: "FrameworksCoreTests_textclassifier", + base: "FrameworksCoreTests", + test_suites: [ + "device-tests", + "device-platinum-tests", + ], + include_filters: ["android.view.textclassifier"], + exclude_annotations: ["androidx.test.filters.FlakyTest"], +} + +test_module_config { + name: "FrameworksCoreTests_internal_app", + base: "FrameworksCoreTests", + test_suites: [ + "device-tests", + "device-platinum-tests", + ], + include_filters: ["com.android.internal.app."], + exclude_filters: [ + "com.android.internal.app.WindowDecorActionBarTest", + "com.android.internal.app.IntentForwarderActivityTest", + ], +} + +test_module_config { + name: "FrameworksCoreTests_internal_content", + base: "FrameworksCoreTests", + test_suites: [ + "device-tests", + "device-platinum-tests", + ], + include_filters: ["com.android.internal.content."], +} + +test_module_config { + name: "FrameworksCoreTests_internal_infra", + base: "FrameworksCoreTests", + test_suites: [ + "device-tests", + "device-platinum-tests", + ], + include_filters: ["com.android.internal.infra."], +} + +test_module_config { + name: "FrameworksCoreTests_internal_jank", + base: "FrameworksCoreTests", + test_suites: [ + "device-tests", + "device-platinum-tests", + ], + include_filters: ["com.android.internal.jank"], + exclude_annotations: FLAKY_OR_IGNORED, +} + +test_module_config { + name: "FrameworksCoreTests_internal_os_binder", + base: "FrameworksCoreTests", + test_suites: [ + "device-tests", + "device-platinum-tests", + ], + include_filters: ["com.android.internal.os.BinderDeathDispatcherTest"], + exclude_annotations: ["com.android.internal.os.SkipPresubmit"], +} + +test_module_config { + name: "FrameworksCoreTests_internal_os_kernel", + base: "FrameworksCoreTests", + test_suites: [ + "device-tests", + "device-platinum-tests", + ], + include_filters: [ + "com.android.internal.os.KernelCpuUidClusterTimeReaderTest", + "com.android.internal.os.KernelCpuUidBpfMapReaderTest", + "com.android.internal.os.KernelCpuUidActiveTimeReaderTest", + "com.android.internal.os.KernelCpuUidFreqTimeReaderTest", + "com.android.internal.os.KernelSingleUidTimeReaderTest", + ], +} + +test_module_config { + name: "FrameworksCoreTests_server_power", + base: "FrameworksCoreTests", + test_suites: [ + "device-tests", + "device-platinum-tests", + ], + include_filters: ["com.android.server.power.stats.BstatsCpuTimesValidationTest"], +} + +test_module_config { + name: "FrameworksCoreTests_internal_security", + base: "FrameworksCoreTests", + test_suites: [ + "device-tests", + "device-platinum-tests", + ], + include_filters: ["com.android.internal.security."], + include_annotations: ["android.platform.test.annotations.Presubmit"], +} + +test_module_config { + name: "FrameworksCoreTests_internal_util_latency_tracker", + base: "FrameworksCoreTests", + test_suites: [ + "device-tests", + "device-platinum-tests", + ], + include_filters: ["com.android.internal.util.LatencyTrackerTest"], + exclude_annotations: FLAKY_OR_IGNORED, +} + +test_module_config { + name: "FrameworksCoreTests_content_capture_options", + base: "FrameworksCoreTests", + test_suites: [ + "device-tests", + "device-platinum-tests", + ], + include_filters: ["android.content.ContentCaptureOptionsTest"], + exclude_annotations: FLAKY_OR_IGNORED, +} + +test_module_config { + name: "FrameworksCoreTests_android_content_integrity", + base: "FrameworksCoreTests", + test_suites: [ + "device-tests", + "device-platinum-tests", + ], + include_filters: ["android.content.integrity."], +} + +test_module_config { + name: "FrameworksCoreTests_android_content_pm_PreSubmit", + base: "FrameworksCoreTests", + test_suites: [ + "device-tests", + "device-platinum-tests", + ], + include_filters: ["android.content.pm."], + include_annotations: ["android.platform.test.annotations.Presubmit"], + exclude_annotations: FLAKY_OR_IGNORED, +} + +test_module_config { + name: "FrameworksCoreTests_android_content_pm_PostSubmit", + base: "FrameworksCoreTests", + test_suites: [ + "device-tests", + "device-platinum-tests", + ], + include_filters: ["android.content.pm."], + include_annotations: ["android.platform.test.annotations.Postsubmit"], + exclude_annotations: FLAKY_OR_IGNORED, +} + +test_module_config { + name: "FrameworksCoreTests_android_content_res", + base: "FrameworksCoreTests", + test_suites: [ + "device-tests", + "device-platinum-tests", + ], + include_filters: ["android.content.res."], + include_annotations: ["android.platform.test.annotations.Presubmit"], + exclude_annotations: [ + "androidx.test.filters.FlakyTest", + "android.platform.test.annotations.Postsubmit", + "org.junit.Ignore", + ], +} + +test_module_config { + name: "FrameworksCoreTests_android_content_res_PostSubmit", + base: "FrameworksCoreTests", + test_suites: [ + "device-tests", + "device-platinum-tests", + ], + include_filters: ["android.content.res."], + include_annotations: ["android.platform.test.annotations.Postsubmit"], + exclude_annotations: FLAKY_OR_IGNORED, +} + +test_module_config { + name: "FrameworksCoreTests_android_service", + base: "FrameworksCoreTests", + test_suites: [ + "device-tests", + "device-platinum-tests", + ], + include_filters: [ + "android.service.euicc", + "android.service.notification", + "android.service.quicksettings", + "android.service.settings.suggestions", + "android.service.controls.templates", + "android.service.controls.actions", + "android.service.controls", + ], + exclude_annotations: ["org.junit.Ignore"], +} + +test_module_config { + name: "FrameworksCoreTests_android_view_contentcapture", + base: "FrameworksCoreTests", + test_suites: [ + "device-tests", + "device-platinum-tests", + ], + include_filters: ["android.view.contentcapture"], + exclude_annotations: FLAKY_OR_IGNORED, +} + +test_module_config { + name: "FrameworksCoreTests_android_view_contentprotection", + base: "FrameworksCoreTests", + test_suites: [ + "device-tests", + "device-platinum-tests", + ], + include_filters: ["android.view.contentprotection"], + exclude_annotations: FLAKY_OR_IGNORED, +} + +test_module_config { + name: "FrameworksCoreTests_com_android_internal_content_Presubmit", + base: "FrameworksCoreTests", + test_suites: [ + "device-tests", + "device-platinum-tests", + ], + include_filters: ["com.android.internal.content."], + include_annotations: ["android.platform.test.annotations.Presubmit"], + exclude_annotations: FLAKY_OR_IGNORED, +} + +test_module_config { + name: "FrameworksCoreTests_drawable", + base: "FrameworksCoreTests", + test_suites: [ + "device-tests", + "device-platinum-tests", + ], + include_filters: ["android.graphics.drawable.IconTest"], +} + +test_module_config { + name: "FrameworksCoreTests_accessibility_NO_FLAKES", + base: "FrameworksCoreTests", + test_suites: [ + "device-tests", + "device-platinum-tests", + ], + include_filters: [ + "com.android.internal.accessibility", + "android.accessibilityservice", + "android.view.accessibility", + ], + exclude_annotations: ["androidx.test.filters.FlakyTest"], +} + +test_module_config { + name: "FrameworksCoreTests_accessibility", + base: "FrameworksCoreTests", + test_suites: [ + "device-tests", + "device-platinum-tests", + ], + include_filters: [ + "com.android.internal.accessibility", + "android.accessibilityservice", + "android.view.accessibility", + ], +} + +test_module_config { + name: "FrameworksCoreTests_usage", + base: "FrameworksCoreTests", + test_suites: [ + "device-tests", + "device-platinum-tests", + ], + include_filters: ["android.app.usage"], +} + +test_module_config { + name: "FrameworksCoreTests_fastdata", + base: "FrameworksCoreTests", + test_suites: [ + "device-tests", + "device-platinum-tests", + ], + include_filters: ["com.android.internal.util.FastDataTest"], +} + +test_module_config { + name: "FrameworksCoreTests_hardware_input", + base: "FrameworksCoreTests", + test_suites: [ + "device-tests", + "device-platinum-tests", + ], + include_filters: ["android.hardware.input"], +} + +test_module_config { + name: "FrameworksCoreTests_view_verified", + base: "FrameworksCoreTests", + test_suites: [ + "device-tests", + "device-platinum-tests", + ], + include_filters: [ + "android.view.VerifiedMotionEventTest", + "android.view.VerifiedKeyEventTest", + ], +} + +test_module_config { + name: "FrameworksCoreTests_jank", + base: "FrameworksCoreTests", + test_suites: [ + "device-tests", + "device-platinum-tests", + ], + include_filters: [ + "com.android.internal.jank.FrameTrackerTest", + "com.android.internal.jank.InteractionJankMonitorTest", + "com.android.internal.util.LatencyTrackerTest", + ], + exclude_annotations: FLAKY_OR_IGNORED, +} + +test_module_config { + name: "FrameworksCoreTests_Platinum", + base: "FrameworksCoreTests", + test_suites: [ + "device-tests", + "device-platinum-tests", + ], + include_annotations: ["android.platform.test.annotations.PlatinumTest"], + exclude_annotations: FLAKY_OR_IGNORED, +} diff --git a/core/tests/coretests/src/android/animation/OWNERS b/core/tests/coretests/src/android/animation/OWNERS new file mode 100644 index 000000000000..1eefb3a3dc65 --- /dev/null +++ b/core/tests/coretests/src/android/animation/OWNERS @@ -0,0 +1 @@ +include /core/java/android/animation/OWNERS diff --git a/core/tests/coretests/src/android/content/ContentResolverTest.java b/core/tests/coretests/src/android/content/ContentResolverTest.java index 7b70b412e62b..c8015d43b404 100644 --- a/core/tests/coretests/src/android/content/ContentResolverTest.java +++ b/core/tests/coretests/src/android/content/ContentResolverTest.java @@ -87,7 +87,7 @@ public class ContentResolverTest { bitmap.compress(Bitmap.CompressFormat.PNG, 90, mImage.getOutputStream()); final AssetFileDescriptor afd = new AssetFileDescriptor( - new ParcelFileDescriptor(mImage.getFileDescriptor()), 0, mSize, null); + ParcelFileDescriptor.dup(mImage.getFileDescriptor()), 0, mSize, null); when(mProvider.openTypedAssetFile(any(), any(), any(), any(), any())).thenReturn( afd); } diff --git a/core/tests/coretests/src/android/content/TEST_MAPPING b/core/tests/coretests/src/android/content/TEST_MAPPING index bbc2458f5d8b..fd9fda3ab96a 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 2920716f5d5d..d22fe84f3d84 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 978d80cb52f6..9ab438ef9fd2 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 4ea6e40a7225..4cce70e86e66 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/net/NetworkKeyTest.java b/core/tests/coretests/src/android/net/NetworkKeyTest.java index b13bcd1311f6..444ed51fa823 100644 --- a/core/tests/coretests/src/android/net/NetworkKeyTest.java +++ b/core/tests/coretests/src/android/net/NetworkKeyTest.java @@ -25,7 +25,7 @@ import android.net.wifi.ScanResult; import android.net.wifi.WifiInfo; import android.net.wifi.WifiManager; -import androidx.test.runner.AndroidJUnit4; +import androidx.test.ext.junit.runners.AndroidJUnit4; import org.junit.Before; import org.junit.Test; diff --git a/core/tests/coretests/src/android/net/NetworkRecommendationProviderTest.java b/core/tests/coretests/src/android/net/NetworkRecommendationProviderTest.java index 3e45a79951d3..46f22cec4213 100644 --- a/core/tests/coretests/src/android/net/NetworkRecommendationProviderTest.java +++ b/core/tests/coretests/src/android/net/NetworkRecommendationProviderTest.java @@ -26,7 +26,7 @@ import static org.mockito.Matchers.eq; import android.Manifest.permission; import android.content.Context; -import androidx.test.runner.AndroidJUnit4; +import androidx.test.ext.junit.runners.AndroidJUnit4; import org.junit.Before; import org.junit.Test; diff --git a/core/tests/coretests/src/android/net/OWNERS b/core/tests/coretests/src/android/net/OWNERS index beb77dc8f4fd..831f444c6ed4 100644 --- a/core/tests/coretests/src/android/net/OWNERS +++ b/core/tests/coretests/src/android/net/OWNERS @@ -1,5 +1,5 @@ include /services/core/java/com/android/server/net/OWNERS -per-file SSL*,Url* = prb@google.com,oth@google.com,narayan@google.com,ngeoffray@google.com +per-file SSL*,Url* = file:platform/libcore:main:/OWNERS_net_tests per-file SntpClient* = file:/services/core/java/com/android/server/timedetector/OWNERS per-file Uri* = varunshah@google.com diff --git a/core/tests/coretests/src/android/net/SSLCertificateSocketFactoryTest.java b/core/tests/coretests/src/android/net/SSLCertificateSocketFactoryTest.java index bc12e727c5f0..7413ede92914 100644 --- a/core/tests/coretests/src/android/net/SSLCertificateSocketFactoryTest.java +++ b/core/tests/coretests/src/android/net/SSLCertificateSocketFactoryTest.java @@ -19,7 +19,7 @@ package android.net; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; -import androidx.test.runner.AndroidJUnit4; +import androidx.test.ext.junit.runners.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/core/tests/coretests/src/android/net/ScoredNetworkTest.java b/core/tests/coretests/src/android/net/ScoredNetworkTest.java index d984d86e1147..63eeaa1e97e0 100644 --- a/core/tests/coretests/src/android/net/ScoredNetworkTest.java +++ b/core/tests/coretests/src/android/net/ScoredNetworkTest.java @@ -26,7 +26,7 @@ import static org.junit.Assert.fail; import android.os.Bundle; import android.os.Parcel; -import androidx.test.runner.AndroidJUnit4; +import androidx.test.ext.junit.runners.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/core/tests/coretests/src/android/net/SntpClientTest.java b/core/tests/coretests/src/android/net/SntpClientTest.java index 267fc2b636d6..024d614814a1 100644 --- a/core/tests/coretests/src/android/net/SntpClientTest.java +++ b/core/tests/coretests/src/android/net/SntpClientTest.java @@ -29,7 +29,7 @@ import android.net.sntp.Timestamp64; import android.platform.test.annotations.Presubmit; import android.util.Log; -import androidx.test.runner.AndroidJUnit4; +import androidx.test.ext.junit.runners.AndroidJUnit4; import libcore.util.HexEncoding; diff --git a/core/tests/coretests/src/android/net/sntp/Duration64Test.java b/core/tests/coretests/src/android/net/sntp/Duration64Test.java index b2285962f82d..b177e18a5d8a 100644 --- a/core/tests/coretests/src/android/net/sntp/Duration64Test.java +++ b/core/tests/coretests/src/android/net/sntp/Duration64Test.java @@ -23,7 +23,7 @@ import static org.junit.Assert.assertTrue; import android.platform.test.annotations.Presubmit; -import androidx.test.runner.AndroidJUnit4; +import androidx.test.ext.junit.runners.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/core/tests/coretests/src/android/net/sntp/Timestamp64Test.java b/core/tests/coretests/src/android/net/sntp/Timestamp64Test.java index 200c80e81588..9f95132a8437 100644 --- a/core/tests/coretests/src/android/net/sntp/Timestamp64Test.java +++ b/core/tests/coretests/src/android/net/sntp/Timestamp64Test.java @@ -23,7 +23,7 @@ import static org.junit.Assert.fail; import android.platform.test.annotations.Presubmit; -import androidx.test.runner.AndroidJUnit4; +import androidx.test.ext.junit.runners.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/core/tests/coretests/src/android/os/FileUtilsTest.java b/core/tests/coretests/src/android/os/FileUtilsTest.java index 78a2c1c4ddbe..b25263c138b3 100644 --- a/core/tests/coretests/src/android/os/FileUtilsTest.java +++ b/core/tests/coretests/src/android/os/FileUtilsTest.java @@ -54,7 +54,7 @@ import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import android.os.FileUtils.MemoryPipe; -import android.platform.test.annotations.IgnoreUnderRavenwood; +import android.platform.test.annotations.DisabledOnRavenwood; import android.platform.test.ravenwood.RavenwoodRule; import android.provider.DocumentsContract.Document; import android.system.Os; @@ -158,7 +158,7 @@ public class FileUtilsTest { } @Test - @IgnoreUnderRavenwood(blockedBy = MemoryPipe.class) + @DisabledOnRavenwood(blockedBy = MemoryPipe.class) public void testCopy_FileToPipe() throws Exception { for (int size : DATA_SIZES) { final File src = new File(mTarget, "src"); @@ -179,7 +179,7 @@ public class FileUtilsTest { } @Test - @IgnoreUnderRavenwood(blockedBy = MemoryPipe.class) + @DisabledOnRavenwood(blockedBy = MemoryPipe.class) public void testCopy_PipeToFile() throws Exception { for (int size : DATA_SIZES) { final File dest = new File(mTarget, "dest"); @@ -199,7 +199,7 @@ public class FileUtilsTest { } @Test - @IgnoreUnderRavenwood(blockedBy = MemoryPipe.class) + @DisabledOnRavenwood(blockedBy = MemoryPipe.class) public void testCopy_PipeToPipe() throws Exception { for (int size : DATA_SIZES) { byte[] expected = new byte[size]; @@ -217,7 +217,7 @@ public class FileUtilsTest { } @Test - @IgnoreUnderRavenwood(blockedBy = MemoryPipe.class) + @DisabledOnRavenwood(blockedBy = MemoryPipe.class) public void testCopy_ShortPipeToFile() throws Exception { byte[] source = new byte[33_000_000]; new Random().nextBytes(source); @@ -259,9 +259,9 @@ public class FileUtilsTest { assertArrayEquals(expected, actual); } - //TODO(ravenwood) Remove the _$noRavenwood suffix and add @RavenwoodIgnore instead @Test - public void testCopy_SocketToFile_FileToSocket$noRavenwood() throws Exception { + @DisabledOnRavenwood(reason = "Missing Os methods in Ravenwood") + public void testCopy_SocketToFile_FileToSocket() throws Exception { for (int size : DATA_SIZES ) { final File src = new File(mTarget, "src"); final File dest = new File(mTarget, "dest"); @@ -512,7 +512,7 @@ public class FileUtilsTest { } @Test - @IgnoreUnderRavenwood(blockedBy = android.webkit.MimeTypeMap.class) + @DisabledOnRavenwood(blockedBy = android.webkit.MimeTypeMap.class) public void testBuildUniqueFile_normal() throws Exception { assertNameEquals("test.jpg", FileUtils.buildUniqueFile(mTarget, "image/jpeg", "test")); assertNameEquals("test.jpg", FileUtils.buildUniqueFile(mTarget, "image/jpeg", "test.jpg")); @@ -532,7 +532,7 @@ public class FileUtilsTest { } @Test - @IgnoreUnderRavenwood(blockedBy = android.webkit.MimeTypeMap.class) + @DisabledOnRavenwood(blockedBy = android.webkit.MimeTypeMap.class) public void testBuildUniqueFile_unknown() throws Exception { assertNameEquals("test", FileUtils.buildUniqueFile(mTarget, "application/octet-stream", "test")); @@ -546,7 +546,7 @@ public class FileUtilsTest { } @Test - @IgnoreUnderRavenwood(blockedBy = android.webkit.MimeTypeMap.class) + @DisabledOnRavenwood(blockedBy = android.webkit.MimeTypeMap.class) public void testBuildUniqueFile_dir() throws Exception { assertNameEquals("test", FileUtils.buildUniqueFile(mTarget, Document.MIME_TYPE_DIR, "test")); new File(mTarget, "test").mkdir(); @@ -561,7 +561,7 @@ public class FileUtilsTest { } @Test - @IgnoreUnderRavenwood(blockedBy = android.webkit.MimeTypeMap.class) + @DisabledOnRavenwood(blockedBy = android.webkit.MimeTypeMap.class) public void testBuildUniqueFile_increment() throws Exception { assertNameEquals("test.jpg", FileUtils.buildUniqueFile(mTarget, "image/jpeg", "test.jpg")); new File(mTarget, "test.jpg").createNewFile(); @@ -581,7 +581,7 @@ public class FileUtilsTest { } @Test - @IgnoreUnderRavenwood(blockedBy = android.webkit.MimeTypeMap.class) + @DisabledOnRavenwood(blockedBy = android.webkit.MimeTypeMap.class) public void testBuildUniqueFile_mimeless() throws Exception { assertNameEquals("test.jpg", FileUtils.buildUniqueFile(mTarget, "test.jpg")); new File(mTarget, "test.jpg").createNewFile(); @@ -677,8 +677,7 @@ public class FileUtilsTest { } @Test - @IgnoreUnderRavenwood(reason = "Requires kernel support") - public void testTranslateMode() throws Exception { + public void testTranslateMode() { assertTranslate("r", O_RDONLY, MODE_READ_ONLY); assertTranslate("rw", O_RDWR | O_CREAT, @@ -697,8 +696,7 @@ public class FileUtilsTest { } @Test - @IgnoreUnderRavenwood(reason = "Requires kernel support") - public void testMalformedTransate_int() throws Exception { + public void testMalformedTransate_int() { try { // The non-standard Linux access mode 3 should throw // an IllegalArgumentException. @@ -709,8 +707,7 @@ public class FileUtilsTest { } @Test - @IgnoreUnderRavenwood(reason = "Requires kernel support") - public void testMalformedTransate_string() throws Exception { + public void testMalformedTransate_string() { try { // The non-standard Linux access mode 3 should throw // an IllegalArgumentException. @@ -721,8 +718,7 @@ public class FileUtilsTest { } @Test - @IgnoreUnderRavenwood(reason = "Requires kernel support") - public void testTranslateMode_Invalid() throws Exception { + public void testTranslateMode_Invalid() { try { translateModeStringToPosix("rwx"); fail(); @@ -736,8 +732,7 @@ public class FileUtilsTest { } @Test - @IgnoreUnderRavenwood(reason = "Requires kernel support") - public void testTranslateMode_Access() throws Exception { + public void testTranslateMode_Access() { assertEquals(O_RDONLY, translateModeAccessToPosix(F_OK)); assertEquals(O_RDONLY, translateModeAccessToPosix(R_OK)); assertEquals(O_WRONLY, translateModeAccessToPosix(W_OK)); @@ -746,7 +741,7 @@ public class FileUtilsTest { } @Test - @IgnoreUnderRavenwood(reason = "Requires kernel support") + @DisabledOnRavenwood(reason = "Requires kernel support") public void testConvertToModernFd() throws Exception { final String nonce = String.valueOf(System.nanoTime()); diff --git a/core/tests/coretests/src/android/service/TEST_MAPPING b/core/tests/coretests/src/android/service/TEST_MAPPING index bec72d988e74..21f248d3d799 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 f8beac2814db..c2cf40dc4ebe 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 b3583a7f6ab1..3d09da303b0f 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 3cd4e17d820b..3ef1ac1e6978 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 9aed8be4f10f..4a46244e0162 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/core/tests/coretests/src/com/android/internal/jank/CujTest.java b/core/tests/coretests/src/com/android/internal/jank/CujTest.java index bf35ed0a1601..2362a4c925f9 100644 --- a/core/tests/coretests/src/com/android/internal/jank/CujTest.java +++ b/core/tests/coretests/src/com/android/internal/jank/CujTest.java @@ -35,7 +35,6 @@ import org.junit.Test; import java.lang.reflect.Field; import java.lang.reflect.Modifier; import java.util.Arrays; -import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; @@ -47,26 +46,30 @@ import java.util.stream.Stream; public class CujTest { private static final String ENUM_NAME_PREFIX = "UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__"; - private static final Set<String> DEPRECATED_VALUES = new HashSet<>() { - { - add(ENUM_NAME_PREFIX + "IME_INSETS_ANIMATION"); - } - }; - private static final Map<Integer, String> ENUM_NAME_EXCEPTION_MAP = new HashMap<>() { - { - put(Cuj.CUJ_NOTIFICATION_ADD, getEnumName("SHADE_NOTIFICATION_ADD")); - put(Cuj.CUJ_NOTIFICATION_HEADS_UP_APPEAR, getEnumName("SHADE_HEADS_UP_APPEAR")); - put(Cuj.CUJ_NOTIFICATION_APP_START, getEnumName("SHADE_APP_LAUNCH")); - put(Cuj.CUJ_NOTIFICATION_HEADS_UP_DISAPPEAR, getEnumName("SHADE_HEADS_UP_DISAPPEAR")); - put(Cuj.CUJ_NOTIFICATION_REMOVE, getEnumName("SHADE_NOTIFICATION_REMOVE")); - put(Cuj.CUJ_NOTIFICATION_SHADE_EXPAND_COLLAPSE, getEnumName("NOTIFICATION_SHADE_SWIPE")); - put(Cuj.CUJ_NOTIFICATION_SHADE_QS_EXPAND_COLLAPSE, getEnumName("SHADE_QS_EXPAND_COLLAPSE")); - put(Cuj.CUJ_NOTIFICATION_SHADE_QS_SCROLL_SWIPE, getEnumName("SHADE_QS_SCROLL_SWIPE")); - put(Cuj.CUJ_NOTIFICATION_SHADE_ROW_EXPAND, getEnumName("SHADE_ROW_EXPAND")); - put(Cuj.CUJ_NOTIFICATION_SHADE_ROW_SWIPE, getEnumName("SHADE_ROW_SWIPE")); - put(Cuj.CUJ_NOTIFICATION_SHADE_SCROLL_FLING, getEnumName("SHADE_SCROLL_FLING")); - } - }; + private static final Set<String> DEPRECATED_VALUES = Set.of( + ENUM_NAME_PREFIX + "IME_INSETS_ANIMATION" + ); + private static final Map<Integer, String> ENUM_NAME_EXCEPTION_MAP = Map.ofEntries( + Map.entry(Cuj.CUJ_NOTIFICATION_ADD, getEnumName("SHADE_NOTIFICATION_ADD")), + Map.entry(Cuj.CUJ_NOTIFICATION_HEADS_UP_APPEAR, getEnumName("SHADE_HEADS_UP_APPEAR")), + Map.entry(Cuj.CUJ_NOTIFICATION_APP_START, getEnumName("SHADE_APP_LAUNCH")), + Map.entry( + Cuj.CUJ_NOTIFICATION_HEADS_UP_DISAPPEAR, + getEnumName("SHADE_HEADS_UP_DISAPPEAR")), + Map.entry(Cuj.CUJ_NOTIFICATION_REMOVE, getEnumName("SHADE_NOTIFICATION_REMOVE")), + Map.entry( + Cuj.CUJ_NOTIFICATION_SHADE_EXPAND_COLLAPSE, + getEnumName("NOTIFICATION_SHADE_SWIPE")), + Map.entry( + Cuj.CUJ_NOTIFICATION_SHADE_QS_EXPAND_COLLAPSE, + getEnumName("SHADE_QS_EXPAND_COLLAPSE")), + Map.entry( + Cuj.CUJ_NOTIFICATION_SHADE_QS_SCROLL_SWIPE, + getEnumName("SHADE_QS_SCROLL_SWIPE")), + Map.entry(Cuj.CUJ_NOTIFICATION_SHADE_ROW_EXPAND, getEnumName("SHADE_ROW_EXPAND")), + Map.entry(Cuj.CUJ_NOTIFICATION_SHADE_ROW_SWIPE, getEnumName("SHADE_ROW_SWIPE")), + Map.entry(Cuj.CUJ_NOTIFICATION_SHADE_SCROLL_FLING, getEnumName("SHADE_SCROLL_FLING")) + ); @Rule public final Expect mExpect = Expect.create(); diff --git a/core/tests/coretests/src/com/android/internal/widget/LockPatternUtilsTest.java b/core/tests/coretests/src/com/android/internal/widget/LockPatternUtilsTest.java index b90480a1e794..92a7d8ef890d 100644 --- a/core/tests/coretests/src/com/android/internal/widget/LockPatternUtilsTest.java +++ b/core/tests/coretests/src/com/android/internal/widget/LockPatternUtilsTest.java @@ -68,6 +68,7 @@ import org.mockito.ArgumentCaptor; import java.nio.charset.StandardCharsets; import java.util.List; +import java.util.concurrent.CompletableFuture; @RunWith(AndroidJUnit4.class) @SmallTest @@ -316,6 +317,40 @@ public class LockPatternUtilsTest { assertNotEquals(UserHandle.USER_CURRENT_OR_SELF, LockPatternUtils.USER_REPAIR_MODE); } + @Test + public void testWriteRepairModeCredential_mainThread() { + createTestLockSettings(); + var context = InstrumentationRegistry.getTargetContext(); + + var future = new CompletableFuture<Exception>(); + context.getMainThreadHandler().post(() -> { + try { + mLockPatternUtils.writeRepairModeCredential(USER_ID); + future.complete(null); + } catch (Exception e) { + future.complete(e); + } + }); + + var e = future.join(); + assertThat(e).isNotNull(); + assertThat(e.getMessage()).contains("should not be called from the main thread"); + } + + @Test + public void testWriteRepairModeCredential() throws Exception { + var ils = createTestLockSettings(); + + when(ils.writeRepairModeCredential(USER_ID)).thenReturn(false); + assertThat(mLockPatternUtils.writeRepairModeCredential(USER_ID)).isFalse(); + + when(ils.writeRepairModeCredential(USER_ID)).thenReturn(true); + assertThat(mLockPatternUtils.writeRepairModeCredential(USER_ID)).isTrue(); + + when(ils.writeRepairModeCredential(USER_ID)).thenThrow(new RemoteException()); + assertThat(mLockPatternUtils.writeRepairModeCredential(USER_ID)).isFalse(); + } + private TestStrongAuthTracker createStrongAuthTracker() { final Context context = new ContextWrapper(InstrumentationRegistry.getTargetContext()); return new TestStrongAuthTracker(context, Looper.getMainLooper()); diff --git a/core/tests/resourceflaggingtests/OWNERS b/core/tests/resourceflaggingtests/OWNERS new file mode 100644 index 000000000000..10950a193b25 --- /dev/null +++ b/core/tests/resourceflaggingtests/OWNERS @@ -0,0 +1 @@ +include /core/java/android/app/RESOURCES_OWNERS diff --git a/data/etc/Android.bp b/data/etc/Android.bp index 050f9b5e264f..8f85617acae3 100644 --- a/data/etc/Android.bp +++ b/data/etc/Android.bp @@ -78,6 +78,12 @@ prebuilt_etc { 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/OWNERS b/data/etc/OWNERS index 701d145fe805..85dae631cac3 100644 --- a/data/etc/OWNERS +++ b/data/etc/OWNERS @@ -1,6 +1,5 @@ include /PACKAGE_MANAGER_OWNERS -alanstokes@google.com cbrubaker@google.com hackbod@android.com hackbod@google.com diff --git a/data/etc/oem-defined-uids.xml b/data/etc/oem-defined-uids.xml new file mode 100644 index 000000000000..87435b9cd04a --- /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/data/etc/platform.xml b/data/etc/platform.xml index 65615e62c3df..7b96699f7f71 100644 --- a/data/etc/platform.xml +++ b/data/etc/platform.xml @@ -325,10 +325,12 @@ <!-- These are the standard packages that are allowed to always have internet access while in power save mode, even if they aren't in the foreground. --> <allow-in-power-save package="com.android.providers.downloads" /> + <allow-in-power-save package="com.android.rkpdapp" /> <!-- These are the standard packages that are allowed to always have internet access while in data mode, even if they aren't in the foreground. --> <allow-in-data-usage-save package="com.android.providers.downloads" /> + <allow-in-data-usage-save package="com.android.rkpdapp" /> <!-- This is a core platform component that needs to freely run in the background --> <allow-in-power-save package="com.android.cellbroadcastreceiver.module" /> diff --git a/data/etc/privapp-permissions-platform.xml b/data/etc/privapp-permissions-platform.xml index 5d4139e4be8c..1fe6ca7dc14f 100644 --- a/data/etc/privapp-permissions-platform.xml +++ b/data/etc/privapp-permissions-platform.xml @@ -505,6 +505,7 @@ applications that come with the platform <permission name="android.permission.RENOUNCE_PERMISSIONS" /> <permission name="android.permission.WRITE_EMBEDDED_SUBSCRIPTIONS" /> <permission name="android.permission.GET_PROCESS_STATE_AND_OOM_SCORE" /> + <permission name="android.permission.READ_DROPBOX_DATA" /> <permission name="android.permission.READ_LOGS" /> <permission name="android.permission.BRIGHTNESS_SLIDER_USAGE" /> <permission name="android.permission.ACCESS_AMBIENT_LIGHT_STATS" /> diff --git a/data/keyboards/Vendor_054c_Product_05c4.idc b/data/keyboards/Vendor_054c_Product_05c4.idc index 2da622745baf..45b5207c6730 100644 --- a/data/keyboards/Vendor_054c_Product_05c4.idc +++ b/data/keyboards/Vendor_054c_Product_05c4.idc @@ -51,7 +51,7 @@ sensor.gyroscope.power = 0.8 # fingers, it prevents tapping to click because it thinks the finger's moving # too fast. # -# Since this touchpad doesn't seem to have to drumroll issues, we can safely +# Since this touchpad doesn't seem to have drumroll issues, we can safely # disable drumroll detection. gestureProp.Drumroll_Suppression_Enable = 0 @@ -60,3 +60,11 @@ gestureProp.Drumroll_Suppression_Enable = 0 # from the palm classifier to increase the usable area of the pad. gestureProp.Palm_Edge_Zone_Width = 0 gestureProp.Tap_Exclusion_Border_Width = 0 + +# Touchpad is small, scale up the pointer movements to make it more practical +# to use. +gestureProp.Point_X_Out_Scale = 2.5 +gestureProp.Point_Y_Out_Scale = 2.5 + +# TODO(b/351326684): Ideally "Scroll X Out Scale" and "Scroll Y Out Scale" +# should be adjusted as well. Currently not supported in IDC files. diff --git a/data/keyboards/Vendor_054c_Product_09cc.idc b/data/keyboards/Vendor_054c_Product_09cc.idc index 2a1a4fc62b24..45b5207c6730 100644 --- a/data/keyboards/Vendor_054c_Product_09cc.idc +++ b/data/keyboards/Vendor_054c_Product_09cc.idc @@ -60,3 +60,11 @@ gestureProp.Drumroll_Suppression_Enable = 0 # from the palm classifier to increase the usable area of the pad. gestureProp.Palm_Edge_Zone_Width = 0 gestureProp.Tap_Exclusion_Border_Width = 0 + +# Touchpad is small, scale up the pointer movements to make it more practical +# to use. +gestureProp.Point_X_Out_Scale = 2.5 +gestureProp.Point_Y_Out_Scale = 2.5 + +# TODO(b/351326684): Ideally "Scroll X Out Scale" and "Scroll Y Out Scale" +# should be adjusted as well. Currently not supported in IDC files. diff --git a/data/keyboards/Vendor_054c_Product_0ce6.idc b/data/keyboards/Vendor_054c_Product_0ce6.idc new file mode 100644 index 000000000000..48027e715649 --- /dev/null +++ b/data/keyboards/Vendor_054c_Product_0ce6.idc @@ -0,0 +1,31 @@ +# Copyright 2024 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# +# Sony Playstation(R) DualSense 5 Controller +# + +## Touchpad ## + +# Because of the way this touchpad is positioned, touches around the edges are +# no more likely to be palms than ones in the middle, so remove the edge zones +# from the palm classifier to increase the usable area of the pad. +gestureProp.Palm_Edge_Zone_Width = 0 +gestureProp.Tap_Exclusion_Border_Width = 0 + +gestureProp.Point_X_Out_Scale = 2.0 +gestureProp.Point_Y_Out_Scale = 2.0 + +# TODO(b/351326684): Ideally "Scroll X Out Scale" and "Scroll Y Out Scale" +# should be adjusted as well. Currently not supported in IDC files. diff --git a/data/keyboards/Vendor_054c_Product_0df2.idc b/data/keyboards/Vendor_054c_Product_0df2.idc new file mode 100644 index 000000000000..4bcf0bef458a --- /dev/null +++ b/data/keyboards/Vendor_054c_Product_0df2.idc @@ -0,0 +1,31 @@ +# Copyright 2024 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# +# Sony Playstation(R) DualSense Edge 5 Controller +# + +## Touchpad ## + +# Because of the way this touchpad is positioned, touches around the edges are +# no more likely to be palms than ones in the middle, so remove the edge zones +# from the palm classifier to increase the usable area of the pad. +gestureProp.Palm_Edge_Zone_Width = 0 +gestureProp.Tap_Exclusion_Border_Width = 0 + +gestureProp.Point_X_Out_Scale = 2.0 +gestureProp.Point_Y_Out_Scale = 2.0 + +# TODO(b/351326684): Ideally "Scroll X Out Scale" and "Scroll Y Out Scale" +# should be adjusted as well. Currently not supported in IDC files. diff --git a/errorprone/java/com/google/errorprone/bugpatterns/android/RequiresPermissionChecker.java b/errorprone/java/com/google/errorprone/bugpatterns/android/RequiresPermissionChecker.java index 7c7cb18afc4d..9887c272e7f8 100644 --- a/errorprone/java/com/google/errorprone/bugpatterns/android/RequiresPermissionChecker.java +++ b/errorprone/java/com/google/errorprone/bugpatterns/android/RequiresPermissionChecker.java @@ -55,9 +55,9 @@ import com.sun.source.util.TreeScanner; import com.sun.tools.javac.code.Symbol; import com.sun.tools.javac.code.Symbol.ClassSymbol; import com.sun.tools.javac.code.Symbol.MethodSymbol; -import com.sun.tools.javac.code.Symbol.VarSymbol; import com.sun.tools.javac.code.Type; import com.sun.tools.javac.code.Type.ClassType; +import com.sun.tools.javac.tree.JCTree.JCNewClass; import java.util.ArrayList; import java.util.Arrays; @@ -67,7 +67,6 @@ import java.util.List; import java.util.Optional; import java.util.Set; import java.util.concurrent.atomic.AtomicReference; -import java.util.function.Predicate; import java.util.regex.Pattern; import javax.lang.model.element.Name; @@ -125,6 +124,12 @@ public final class RequiresPermissionChecker extends BugChecker instanceMethod() .onDescendantOf("android.content.Context") .withNameMatching(Pattern.compile("^send(Ordered|Sticky)?Broadcast.*$"))); + private static final Matcher<ExpressionTree> SEND_BROADCAST_AS_USER = + methodInvocation( + instanceMethod() + .onDescendantOf("android.content.Context") + .withNameMatching( + Pattern.compile("^send(Ordered|Sticky)?Broadcast.*AsUser.*$"))); private static final Matcher<ExpressionTree> SEND_PENDING_INTENT = methodInvocation( instanceMethod() .onDescendantOf("android.app.PendingIntent") @@ -306,18 +311,6 @@ public final class RequiresPermissionChecker extends BugChecker } } - private static ExpressionTree findArgumentByParameterName(MethodInvocationTree tree, - Predicate<String> paramName) { - final MethodSymbol sym = ASTHelpers.getSymbol(tree); - final List<VarSymbol> params = sym.getParameters(); - for (int i = 0; i < params.size(); i++) { - if (paramName.test(params.get(i).name.toString())) { - return tree.getArguments().get(i); - } - } - return null; - } - private static Name resolveName(ExpressionTree tree) { if (tree instanceof IdentifierTree) { return ((IdentifierTree) tree).getName(); @@ -345,76 +338,85 @@ public final class RequiresPermissionChecker extends BugChecker private static ParsedRequiresPermission parseBroadcastSourceRequiresPermission( MethodInvocationTree methodTree, VisitorState state) { - final ExpressionTree arg = findArgumentByParameterName(methodTree, - (name) -> name.toLowerCase().contains("intent")); - if (arg instanceof IdentifierTree) { - final Name argName = ((IdentifierTree) arg).getName(); - final MethodTree method = state.findEnclosing(MethodTree.class); - final AtomicReference<ParsedRequiresPermission> res = new AtomicReference<>(); - method.accept(new TreeScanner<Void, Void>() { - private ParsedRequiresPermission last; - - @Override - public Void visitMethodInvocation(MethodInvocationTree tree, Void param) { - if (Objects.equal(methodTree, tree)) { - res.set(last); - } else { - final Name name = resolveName(tree.getMethodSelect()); - if (Objects.equal(argName, name) - && INTENT_SET_ACTION.matches(tree, state)) { - last = parseIntentAction(tree); + if (methodTree.getArguments().size() < 1) { + return null; + } + final ExpressionTree arg = methodTree.getArguments().get(0); + if (!(arg instanceof IdentifierTree)) { + return null; + } + final Name argName = ((IdentifierTree) arg).getName(); + final MethodTree method = state.findEnclosing(MethodTree.class); + final AtomicReference<ParsedRequiresPermission> res = new AtomicReference<>(); + method.accept(new TreeScanner<Void, Void>() { + private ParsedRequiresPermission mLast; + + @Override + public Void visitMethodInvocation(MethodInvocationTree tree, Void param) { + if (Objects.equal(methodTree, tree)) { + res.set(mLast); + } else { + final Name name = resolveName(tree.getMethodSelect()); + if (Objects.equal(argName, name) && INTENT_SET_ACTION.matches(tree, state)) { + mLast = parseIntentAction(tree); + } else if (name == null && tree.getMethodSelect() instanceof MemberSelectTree) { + ExpressionTree innerTree = + ((MemberSelectTree) tree.getMethodSelect()).getExpression(); + if (innerTree instanceof JCNewClass) { + mLast = parseIntentAction((NewClassTree) innerTree); } } - return super.visitMethodInvocation(tree, param); } + return super.visitMethodInvocation(tree, param); + } - @Override - public Void visitAssignment(AssignmentTree tree, Void param) { - final Name name = resolveName(tree.getVariable()); - final Tree init = tree.getExpression(); - if (Objects.equal(argName, name) - && init instanceof NewClassTree) { - last = parseIntentAction((NewClassTree) init); - } - return super.visitAssignment(tree, param); + @Override + public Void visitAssignment(AssignmentTree tree, Void param) { + final Name name = resolveName(tree.getVariable()); + final Tree init = tree.getExpression(); + if (Objects.equal(argName, name) && init instanceof NewClassTree) { + mLast = parseIntentAction((NewClassTree) init); } + return super.visitAssignment(tree, param); + } - @Override - public Void visitVariable(VariableTree tree, Void param) { - final Name name = tree.getName(); - final ExpressionTree init = tree.getInitializer(); - if (Objects.equal(argName, name) - && init instanceof NewClassTree) { - last = parseIntentAction((NewClassTree) init); - } - return super.visitVariable(tree, param); + @Override + public Void visitVariable(VariableTree tree, Void param) { + final Name name = tree.getName(); + final ExpressionTree init = tree.getInitializer(); + if (Objects.equal(argName, name) && init instanceof NewClassTree) { + mLast = parseIntentAction((NewClassTree) init); } - }, null); - return res.get(); - } - return null; + return super.visitVariable(tree, param); + } + }, null); + return res.get(); } private static ParsedRequiresPermission parseBroadcastTargetRequiresPermission( MethodInvocationTree tree, VisitorState state) { - final ExpressionTree arg = findArgumentByParameterName(tree, - (name) -> name.toLowerCase().contains("permission")); final ParsedRequiresPermission res = new ParsedRequiresPermission(); - if (arg != null) { - arg.accept(new TreeScanner<Void, Void>() { - @Override - public Void visitIdentifier(IdentifierTree tree, Void param) { - res.addConstValue(tree); - return super.visitIdentifier(tree, param); - } - - @Override - public Void visitMemberSelect(MemberSelectTree tree, Void param) { - res.addConstValue(tree); - return super.visitMemberSelect(tree, param); - } - }, null); + int permission_position = 1; + if (SEND_BROADCAST_AS_USER.matches(tree, state)) { + permission_position = 2; } + if (tree.getArguments().size() < permission_position + 1) { + return res; + } + final ExpressionTree arg = tree.getArguments().get(permission_position); + arg.accept(new TreeScanner<Void, Void>() { + @Override + public Void visitIdentifier(IdentifierTree tree, Void param) { + res.addConstValue(tree); + return super.visitIdentifier(tree, param); + } + + @Override + public Void visitMemberSelect(MemberSelectTree tree, Void param) { + res.addConstValue(tree); + return super.visitMemberSelect(tree, param); + } + }, null); return res; } diff --git a/errorprone/tests/java/com/google/errorprone/bugpatterns/android/RequiresPermissionCheckerTest.java b/errorprone/tests/java/com/google/errorprone/bugpatterns/android/RequiresPermissionCheckerTest.java index e53372d97f3d..05fde7c4fe57 100644 --- a/errorprone/tests/java/com/google/errorprone/bugpatterns/android/RequiresPermissionCheckerTest.java +++ b/errorprone/tests/java/com/google/errorprone/bugpatterns/android/RequiresPermissionCheckerTest.java @@ -412,6 +412,19 @@ public class RequiresPermissionCheckerTest { " context.sendBroadcast(intent);", " }", " }", + " public void exampleWithChainedMethod(Context context) {", + " Intent intent = new Intent(FooManager.ACTION_RED)", + " .putExtra(\"foo\", 42);", + " context.sendBroadcast(intent, FooManager.PERMISSION_RED);", + " context.sendBroadcastWithMultiplePermissions(intent,", + " new String[] { FooManager.PERMISSION_RED });", + " }", + " public void exampleWithAsUser(Context context) {", + " Intent intent = new Intent(FooManager.ACTION_RED);", + " context.sendBroadcastAsUser(intent, 42, FooManager.PERMISSION_RED);", + " context.sendBroadcastAsUserMultiplePermissions(intent, 42,", + " new String[] { FooManager.PERMISSION_RED });", + " }", "}") .doTest(); } diff --git a/errorprone/tests/res/android/content/Context.java b/errorprone/tests/res/android/content/Context.java index efc4fb122435..9d622ffaf120 100644 --- a/errorprone/tests/res/android/content/Context.java +++ b/errorprone/tests/res/android/content/Context.java @@ -36,4 +36,15 @@ public class Context { public void sendBroadcastWithMultiplePermissions(Intent intent, String[] receiverPermissions) { throw new UnsupportedOperationException(); } + + /* Fake user type for test purposes */ + public void sendBroadcastAsUser(Intent intent, int user, String receiverPermission) { + throw new UnsupportedOperationException(); + } + + /* Fake user type for test purposes */ + public void sendBroadcastAsUserMultiplePermissions( + Intent intent, int user, String[] receiverPermissions) { + throw new UnsupportedOperationException(); + } } diff --git a/errorprone/tests/res/android/content/Intent.java b/errorprone/tests/res/android/content/Intent.java index 288396e60577..7ccea784754a 100644 --- a/errorprone/tests/res/android/content/Intent.java +++ b/errorprone/tests/res/android/content/Intent.java @@ -24,4 +24,8 @@ public class Intent { public Intent setAction(String action) { throw new UnsupportedOperationException(); } + + public Intent putExtra(String extra, int value) { + throw new UnsupportedOperationException(); + } } diff --git a/graphics/java/android/graphics/drawable/TEST_MAPPING b/graphics/java/android/graphics/drawable/TEST_MAPPING index 1018702e01c5..4f064522b037 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/keystore/java/android/security/AndroidKeyStoreMaintenance.java b/keystore/java/android/security/AndroidKeyStoreMaintenance.java index 24aea371c094..ecf4eb4502df 100644 --- a/keystore/java/android/security/AndroidKeyStoreMaintenance.java +++ b/keystore/java/android/security/AndroidKeyStoreMaintenance.java @@ -17,7 +17,6 @@ package android.security; import android.annotation.NonNull; -import android.annotation.Nullable; import android.os.RemoteException; import android.os.ServiceManager; import android.os.ServiceSpecificException; @@ -112,29 +111,6 @@ public class AndroidKeyStoreMaintenance { } /** - * Informs Keystore 2.0 about changing user's password - * - * @param userId - Android user id of the user - * @param password - a secret derived from the synthetic password provided by the - * LockSettingsService - * @return 0 if successful or a {@code ResponseCode} - * @hide - */ - public static int onUserPasswordChanged(int userId, @Nullable byte[] password) { - StrictMode.noteDiskWrite(); - try { - getService().onUserPasswordChanged(userId, password); - return 0; - } catch (ServiceSpecificException e) { - Log.e(TAG, "onUserPasswordChanged failed", e); - return e.errorCode; - } catch (Exception e) { - Log.e(TAG, "Can not connect to keystore", e); - return SYSTEM_ERROR; - } - } - - /** * Tells Keystore that a user's LSKF is being removed, ie the user's lock screen is changing to * Swipe or None. Keystore uses this notification to delete the user's auth-bound keys. * diff --git a/keystore/java/android/security/KeyChain.java b/keystore/java/android/security/KeyChain.java index 4b367e0e5b4b..f9fd3694835e 100644 --- a/keystore/java/android/security/KeyChain.java +++ b/keystore/java/android/security/KeyChain.java @@ -66,6 +66,7 @@ import java.util.Collection; import java.util.List; import java.util.Locale; import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; import javax.security.auth.x500.X500Principal; @@ -376,6 +377,8 @@ public final class KeyChain { */ public static final int KEY_ATTESTATION_FAILURE = 4; + private static final int BIND_KEY_CHAIN_SERVICE_TIMEOUT_MS = 30 * 1000; + /** * Used by DPC or delegated app in * {@link android.app.admin.DeviceAdminReceiver#onChoosePrivateKeyAlias} or @@ -1120,7 +1123,10 @@ public final class KeyChain { context.unbindService(keyChainServiceConnection); throw new AssertionError("could not bind to KeyChainService"); } - countDownLatch.await(); + if (!countDownLatch.await(BIND_KEY_CHAIN_SERVICE_TIMEOUT_MS, TimeUnit.MILLISECONDS)) { + context.unbindService(keyChainServiceConnection); + throw new AssertionError("binding to KeyChainService timeout"); + } IKeyChainService service = keyChainService.get(); if (service != null) { return new KeyChainConnection(context, keyChainServiceConnection, service); diff --git a/libs/WindowManager/Shell/OWNERS b/libs/WindowManager/Shell/OWNERS index ebebd8a52c9a..c6044a45200d 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, nmusgrave@google.com, pbdr@google.com, tkachenkoi@google.com, mpodolian@google.com, liranb@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 5ecba380fb60..a36b21f0408c 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/res/values-be/strings.xml b/libs/WindowManager/Shell/res/values-be/strings.xml index eeec5788767d..234441639fb7 100644 --- a/libs/WindowManager/Shell/res/values-be/strings.xml +++ b/libs/WindowManager/Shell/res/values-be/strings.xml @@ -57,7 +57,7 @@ <string name="accessibility_action_start_one_handed" msgid="5070337354072861426">"Запусціць рэжым кіравання адной рукой"</string> <string name="accessibility_action_stop_one_handed" msgid="1369940261782179442">"Выйсці з рэжыму кіравання адной рукой"</string> <string name="bubbles_settings_button_description" msgid="1301286017420516912">"Налады ўсплывальных чатаў у праграме \"<xliff:g id="APP_NAME">%1$s</xliff:g>\""</string> - <string name="bubble_overflow_button_content_description" msgid="8160974472718594382">"Дадатковае меню"</string> + <string name="bubble_overflow_button_content_description" msgid="8160974472718594382">"Меню з пашырэннем"</string> <string name="bubble_accessibility_action_add_back" msgid="1830101076853540953">"Зноў дадаць у стос"</string> <string name="bubble_content_description_single" msgid="8495748092720065813">"<xliff:g id="NOTIFICATION_TITLE">%1$s</xliff:g> ад праграмы \"<xliff:g id="APP_NAME">%2$s</xliff:g>\""</string> <string name="bubble_content_description_stack" msgid="8071515017164630429">"<xliff:g id="NOTIFICATION_TITLE">%1$s</xliff:g> ад праграмы \"<xliff:g id="APP_NAME">%2$s</xliff:g>\" і яшчэ <xliff:g id="BUBBLE_COUNT">%3$d</xliff:g>"</string> diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/compatui/OWNERS b/libs/WindowManager/Shell/src/com/android/wm/shell/compatui/OWNERS new file mode 100644 index 000000000000..1875675296a8 --- /dev/null +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/compatui/OWNERS @@ -0,0 +1,4 @@ +# WM shell sub-module compat ui owners +mariiasand@google.com +gracielawputri@google.com +mcarli@google.com diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/OWNERS b/libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/OWNERS index 1385f42bc676..afdda8ff865e 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/OWNERS +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/OWNERS @@ -2,6 +2,9 @@ atsjenk@google.com jorgegil@google.com madym@google.com -nmusgrave@google.com pbdr@google.com tkachenkoi@google.com +vaniadesmonda@google.com +pragyabajoria@google.com +uysalorhan@google.com +gsennton@google.com 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 8a0eea0a9bdd..83b5bf658459 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/freeform/OWNERS +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/freeform/OWNERS @@ -5,3 +5,9 @@ madym@google.com nmusgrave@google.com pbdr@google.com tkachenkoi@google.com +vaniadesmonda@google.com +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 69c41675e989..e49b03d9bf72 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 @@ -114,7 +114,6 @@ public class OneShotRemoteHandler implements Transitions.TransitionHandler { 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 d2e6a12c583c..c3a70bb7d0b7 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 @@ -724,7 +724,11 @@ public class Transitions implements RemoteCallable<Transitions>, 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/util/OWNERS b/libs/WindowManager/Shell/src/com/android/wm/shell/util/OWNERS new file mode 100644 index 000000000000..482aaab6bc74 --- /dev/null +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/util/OWNERS @@ -0,0 +1 @@ +per-file KtProtolog.kt = file:platform/development:/tools/winscope/OWNERS 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 4417209b85ed..3f828f547920 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 b8a19ad35307..5df525eb7113 100644 --- a/libs/WindowManager/Shell/tests/OWNERS +++ b/libs/WindowManager/Shell/tests/OWNERS @@ -9,9 +9,14 @@ hwwang@google.com chenghsiuchang@google.com atsjenk@google.com jorgegil@google.com -nmusgrave@google.com +vaniadesmonda@google.com pbdr@google.com tkachenkoi@google.com mpodolian@google.com jeremysim@google.com peanutbutter@google.com +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 8ddc57240129..49ee8f7ac4eb 100644 --- a/libs/androidfw/PosixUtils.cpp +++ b/libs/androidfw/PosixUtils.cpp @@ -119,7 +119,7 @@ ProcResult ExecuteBinary(const std::vector<std::string>& argv) { auto err = ReadFile(stderr[0]); result.stderr_str = err ? std::move(*err) : ""; close(stderr[0]); - return std::move(result); + return result; } } diff --git a/libs/hwui/Properties.cpp b/libs/hwui/Properties.cpp index 5d3bc89b40dd..d184f64b1c2c 100644 --- a/libs/hwui/Properties.cpp +++ b/libs/hwui/Properties.cpp @@ -101,6 +101,8 @@ float Properties::maxHdrHeadroomOn8bit = 5.f; // TODO: Refine this number bool Properties::clipSurfaceViews = false; bool Properties::hdr10bitPlus = false; +int Properties::timeoutMultiplier = 1; + StretchEffectBehavior Properties::stretchEffectBehavior = StretchEffectBehavior::ShaderHWUI; DrawingEnabled Properties::drawingEnabled = DrawingEnabled::NotInitialized; @@ -174,6 +176,8 @@ bool Properties::load() { base::GetBoolProperty("debug.hwui.clip_surfaceviews", hwui_flags::clip_surfaceviews()); hdr10bitPlus = hwui_flags::hdr_10bit_plus(); + timeoutMultiplier = android::base::GetIntProperty("ro.hw_timeout_multiplier", 1); + return (prevDebugLayersUpdates != debugLayersUpdates) || (prevDebugOverdraw != debugOverdraw); } diff --git a/libs/hwui/Properties.h b/libs/hwui/Properties.h index d3176f6879d2..e2646422030e 100644 --- a/libs/hwui/Properties.h +++ b/libs/hwui/Properties.h @@ -343,6 +343,8 @@ public: static bool clipSurfaceViews; static bool hdr10bitPlus; + static int timeoutMultiplier; + static StretchEffectBehavior getStretchEffectBehavior() { return stretchEffectBehavior; } diff --git a/libs/hwui/Readback.cpp b/libs/hwui/Readback.cpp index afe4c3896ed2..2f15722a23e0 100644 --- a/libs/hwui/Readback.cpp +++ b/libs/hwui/Readback.cpp @@ -91,8 +91,10 @@ void Readback::copySurfaceInto(ANativeWindow* window, const std::shared_ptr<Copy { ATRACE_NAME("sync_wait"); - if (sourceFence != -1 && sync_wait(sourceFence.get(), 500 /* ms */) != NO_ERROR) { - ALOGE("Timeout (500ms) exceeded waiting for buffer fence, abandoning readback attempt"); + int syncWaitTimeoutMs = 500 * Properties::timeoutMultiplier; + if (sourceFence != -1 && sync_wait(sourceFence.get(), syncWaitTimeoutMs) != NO_ERROR) { + ALOGE("Timeout (%dms) exceeded waiting for buffer fence, abandoning readback attempt", + syncWaitTimeoutMs); return request->onCopyFinished(CopyResult::Timeout); } } @@ -109,9 +111,8 @@ void Readback::copySurfaceInto(ANativeWindow* window, const std::shared_ptr<Copy sk_sp<SkColorSpace> colorSpace = DataSpaceToColorSpace(static_cast<android_dataspace>(dataspace)); - sk_sp<SkImage> image = - SkImages::DeferredFromAHardwareBuffer(sourceBuffer.get(), kPremul_SkAlphaType, - colorSpace); + sk_sp<SkImage> image = SkImages::DeferredFromAHardwareBuffer(sourceBuffer.get(), + kPremul_SkAlphaType, colorSpace); if (!image.get()) { return request->onCopyFinished(CopyResult::UnknownError); diff --git a/libs/nativehelper_jvm/Android.bp b/libs/nativehelper_jvm/Android.bp new file mode 100644 index 000000000000..b5b70283551a --- /dev/null +++ b/libs/nativehelper_jvm/Android.bp @@ -0,0 +1,19 @@ +package { + default_applicable_licenses: ["frameworks_base_license"], +} + +cc_library_host_static { + name: "libnativehelper_jvm", + srcs: [ + "JNIPlatformHelp.c", + "JniConstants.c", + "file_descriptor_jni.c", + ], + whole_static_libs: ["libnativehelper_any_vm"], + export_static_lib_headers: ["libnativehelper_any_vm"], + target: { + windows: { + enabled: true, + }, + }, +} diff --git a/libs/nativehelper_jvm/JNIPlatformHelp.c b/libs/nativehelper_jvm/JNIPlatformHelp.c new file mode 100644 index 000000000000..9df31a8caa7f --- /dev/null +++ b/libs/nativehelper_jvm/JNIPlatformHelp.c @@ -0,0 +1,104 @@ +/* + * 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. + */ + +#include <nativehelper/JNIPlatformHelp.h> + +#include <stddef.h> + +#include "JniConstants.h" + +static int GetBufferPosition(JNIEnv* env, jobject nioBuffer) { + return(*env)->GetIntField(env, nioBuffer, JniConstants_NioBuffer_position(env)); +} + +static int GetBufferLimit(JNIEnv* env, jobject nioBuffer) { + return(*env)->GetIntField(env, nioBuffer, JniConstants_NioBuffer_limit(env)); +} + +static int GetBufferElementSizeShift(JNIEnv* env, jobject nioBuffer) { + jclass byteBufferClass = JniConstants_NioByteBufferClass(env); + jclass shortBufferClass = JniConstants_NioShortBufferClass(env); + jclass charBufferClass = JniConstants_NioCharBufferClass(env); + jclass intBufferClass = JniConstants_NioIntBufferClass(env); + jclass floatBufferClass = JniConstants_NioFloatBufferClass(env); + jclass longBufferClass = JniConstants_NioLongBufferClass(env); + jclass doubleBufferClass = JniConstants_NioDoubleBufferClass(env); + + // Check the type of the Buffer + if ((*env)->IsInstanceOf(env, nioBuffer, byteBufferClass)) { + return 0; + } else if ((*env)->IsInstanceOf(env, nioBuffer, shortBufferClass) || + (*env)->IsInstanceOf(env, nioBuffer, charBufferClass)) { + return 1; + } else if ((*env)->IsInstanceOf(env, nioBuffer, intBufferClass) || + (*env)->IsInstanceOf(env, nioBuffer, floatBufferClass)) { + return 2; + } else if ((*env)->IsInstanceOf(env, nioBuffer, longBufferClass) || + (*env)->IsInstanceOf(env, nioBuffer, doubleBufferClass)) { + return 3; + } + return 0; +} + +jarray jniGetNioBufferBaseArray(JNIEnv* env, jobject nioBuffer) { + jmethodID hasArrayMethod = JniConstants_NioBuffer_hasArray(env); + jboolean hasArray = (*env)->CallBooleanMethod(env, nioBuffer, hasArrayMethod); + if (hasArray) { + jmethodID arrayMethod = JniConstants_NioBuffer_array(env); + return (*env)->CallObjectMethod(env, nioBuffer, arrayMethod); + } else { + return NULL; + } +} + +int jniGetNioBufferBaseArrayOffset(JNIEnv* env, jobject nioBuffer) { + jmethodID hasArrayMethod = JniConstants_NioBuffer_hasArray(env); + jboolean hasArray = (*env)->CallBooleanMethod(env, nioBuffer, hasArrayMethod); + if (hasArray) { + jmethodID arrayOffsetMethod = JniConstants_NioBuffer_arrayOffset(env); + jint arrayOffset = (*env)->CallIntMethod(env, nioBuffer, arrayOffsetMethod); + const int position = GetBufferPosition(env, nioBuffer); + jint elementSizeShift = GetBufferElementSizeShift(env, nioBuffer); + return (arrayOffset + position) << elementSizeShift; + } else { + return 0; + } +} + +jlong jniGetNioBufferPointer(JNIEnv* env, jobject nioBuffer) { + // in Java 11, the address field of a HeapByteBuffer contains a non-zero value despite + // HeapByteBuffer being a non-direct buffer. In that case, this should still return 0. + jmethodID isDirectMethod = JniConstants_NioBuffer_isDirect(env); + jboolean isDirect = (*env)->CallBooleanMethod(env, nioBuffer, isDirectMethod); + if (isDirect == JNI_FALSE) { + return 0L; + } + jlong baseAddress = (*env)->GetLongField(env, nioBuffer, JniConstants_NioBuffer_address(env)); + if (baseAddress != 0) { + const int position = GetBufferPosition(env, nioBuffer); + const int shift = GetBufferElementSizeShift(env, nioBuffer); + baseAddress += position << shift; + } + return baseAddress; +} + +jlong jniGetNioBufferFields(JNIEnv* env, jobject nioBuffer, + jint* position, jint* limit, jint* elementSizeShift) { + *position = GetBufferPosition(env, nioBuffer); + *limit = GetBufferLimit(env, nioBuffer); + *elementSizeShift = GetBufferElementSizeShift(env, nioBuffer); + return (*env)->GetLongField(env, nioBuffer, JniConstants_NioBuffer_address(env)); +} diff --git a/libs/nativehelper_jvm/JniConstants.c b/libs/nativehelper_jvm/JniConstants.c new file mode 100644 index 000000000000..ca58f61070ba --- /dev/null +++ b/libs/nativehelper_jvm/JniConstants.c @@ -0,0 +1,199 @@ +/* + * 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. + */ + +#include "JniConstants.h" + +#include <pthread.h> +#include <stdbool.h> +#include <stddef.h> +#include <string.h> + +#define LOG_TAG "JniConstants" +#include <log/log.h> + +// jclass constants list: +// <class, signature, androidOnly> +#define JCLASS_CONSTANTS_LIST(V) \ + V(FileDescriptor, "java/io/FileDescriptor", false) \ + V(NioBuffer, "java/nio/Buffer", false) \ + V(NioByteBuffer, "java/nio/ByteBuffer", false) \ + V(NioShortBuffer, "java/nio/ShortBuffer", false) \ + V(NioCharBuffer, "java/nio/CharBuffer", false) \ + V(NioIntBuffer, "java/nio/IntBuffer", false) \ + V(NioFloatBuffer, "java/nio/FloatBuffer", false) \ + V(NioLongBuffer, "java/nio/LongBuffer", false) \ + V(NioDoubleBuffer, "java/nio/DoubleBuffer", false) + +// jmethodID's of public methods constants list: +// <Class, method, method-string, signature, is_static> +#define JMETHODID_CONSTANTS_LIST(V) \ + V(FileDescriptor, init, "<init>", "()V", false) \ + V(NioBuffer, array, "array", "()Ljava/lang/Object;", false) \ + V(NioBuffer, hasArray, "hasArray", "()Z", false) \ + V(NioBuffer, isDirect, "isDirect", "()Z", false) \ + V(NioBuffer, arrayOffset, "arrayOffset", "()I", false) + +// jfieldID constants list: +// <Class, field, signature, is_static> +#define JFIELDID_CONSTANTS_LIST(V) \ + V(FileDescriptor, fd, "I", false) \ + V(NioBuffer, address, "J", false) \ + V(NioBuffer, limit, "I", false) \ + V(NioBuffer, position, "I", false) + +#define CLASS_NAME(cls) g_ ## cls +#define METHOD_NAME(cls, method) g_ ## cls ## _ ## method +#define FIELD_NAME(cls, field) g_ ## cls ## _ ## field + +// +// Declare storage for cached classes, methods and fields. +// + +#define JCLASS_DECLARE_STORAGE(cls, ...) \ + static jclass CLASS_NAME(cls) = NULL; +JCLASS_CONSTANTS_LIST(JCLASS_DECLARE_STORAGE) +#undef JCLASS_DECLARE_STORAGE + +#define JMETHODID_DECLARE_STORAGE(cls, method, ...) \ + static jmethodID METHOD_NAME(cls, method) = NULL; +JMETHODID_CONSTANTS_LIST(JMETHODID_DECLARE_STORAGE) +#undef JMETHODID_DECLARE_STORAGE + +#define JFIELDID_DECLARE_STORAGE(cls, field, ...) \ + static jfieldID FIELD_NAME(cls, field) = NULL; +JFIELDID_CONSTANTS_LIST(JFIELDID_DECLARE_STORAGE) +#undef JFIELDID_DECLARE_STORAGE + +// +// Helper methods +// + +static jclass FindClass(JNIEnv* env, const char* signature, bool androidOnly) { + jclass cls = (*env)->FindClass(env, signature); + if (cls == NULL) { + LOG_ALWAYS_FATAL_IF(!androidOnly, "Class not found: %s", signature); + return NULL; + } + return (*env)->NewGlobalRef(env, cls); +} + +static jmethodID FindMethod(JNIEnv* env, jclass cls, + const char* name, const char* signature, bool isStatic) { + jmethodID method; + if (isStatic) { + method = (*env)->GetStaticMethodID(env, cls, name, signature); + } else { + method = (*env)->GetMethodID(env, cls, name, signature); + } + LOG_ALWAYS_FATAL_IF(method == NULL, "Method not found: %s:%s", name, signature); + return method; +} + +static jfieldID FindField(JNIEnv* env, jclass cls, + const char* name, const char* signature, bool isStatic) { + jfieldID field; + if (isStatic) { + field = (*env)->GetStaticFieldID(env, cls, name, signature); + } else { + field = (*env)->GetFieldID(env, cls, name, signature); + } + LOG_ALWAYS_FATAL_IF(field == NULL, "Field not found: %s:%s", name, signature); + return field; +} + +static pthread_once_t g_initialized = PTHREAD_ONCE_INIT; +static JNIEnv* g_init_env; + +static void InitializeConstants() { + // Initialize cached classes. +#define JCLASS_INITIALIZE(cls, signature, androidOnly) \ + CLASS_NAME(cls) = FindClass(g_init_env, signature, androidOnly); + JCLASS_CONSTANTS_LIST(JCLASS_INITIALIZE) +#undef JCLASS_INITIALIZE + + // Initialize cached methods. +#define JMETHODID_INITIALIZE(cls, method, name, signature, isStatic) \ + METHOD_NAME(cls, method) = \ + FindMethod(g_init_env, CLASS_NAME(cls), name, signature, isStatic); + JMETHODID_CONSTANTS_LIST(JMETHODID_INITIALIZE) +#undef JMETHODID_INITIALIZE + + // Initialize cached fields. +#define JFIELDID_INITIALIZE(cls, field, signature, isStatic) \ + FIELD_NAME(cls, field) = \ + FindField(g_init_env, CLASS_NAME(cls), #field, signature, isStatic); + JFIELDID_CONSTANTS_LIST(JFIELDID_INITIALIZE) +#undef JFIELDID_INITIALIZE +} + +void EnsureInitialized(JNIEnv* env) { + // This method has to be called in every cache accesses because library can be built + // 2 different ways and existing usage for compat version doesn't have a good hook for + // initialization and is widely used. + g_init_env = env; + pthread_once(&g_initialized, InitializeConstants); +} + +// API exported by libnativehelper_api.h. + +void jniUninitializeConstants() { + // Uninitialize cached classes, methods and fields. + // + // NB we assume the runtime is stopped at this point and do not delete global + // references. +#define JCLASS_INVALIDATE(cls, ...) CLASS_NAME(cls) = NULL; + JCLASS_CONSTANTS_LIST(JCLASS_INVALIDATE); +#undef JCLASS_INVALIDATE + +#define JMETHODID_INVALIDATE(cls, method, ...) METHOD_NAME(cls, method) = NULL; + JMETHODID_CONSTANTS_LIST(JMETHODID_INVALIDATE); +#undef JMETHODID_INVALIDATE + +#define JFIELDID_INVALIDATE(cls, field, ...) FIELD_NAME(cls, field) = NULL; + JFIELDID_CONSTANTS_LIST(JFIELDID_INVALIDATE); +#undef JFIELDID_INVALIDATE + + // If jniConstantsUninitialize is called, runtime has shutdown. Reset + // state as some tests re-start the runtime. + pthread_once_t o = PTHREAD_ONCE_INIT; + memcpy(&g_initialized, &o, sizeof(o)); +} + +// +// Accessors +// + +#define JCLASS_ACCESSOR_IMPL(cls, ...) \ +jclass JniConstants_ ## cls ## Class(JNIEnv* env) { \ + EnsureInitialized(env); \ + return CLASS_NAME(cls); \ +} +JCLASS_CONSTANTS_LIST(JCLASS_ACCESSOR_IMPL) +#undef JCLASS_ACCESSOR_IMPL + +#define JMETHODID_ACCESSOR_IMPL(cls, method, ...) \ +jmethodID JniConstants_ ## cls ## _ ## method(JNIEnv* env) { \ + EnsureInitialized(env); \ + return METHOD_NAME(cls, method); \ +} +JMETHODID_CONSTANTS_LIST(JMETHODID_ACCESSOR_IMPL) + +#define JFIELDID_ACCESSOR_IMPL(cls, field, ...) \ +jfieldID JniConstants_ ## cls ## _ ## field(JNIEnv* env) { \ + EnsureInitialized(env); \ + return FIELD_NAME(cls, field); \ +} +JFIELDID_CONSTANTS_LIST(JFIELDID_ACCESSOR_IMPL) diff --git a/libs/nativehelper_jvm/JniConstants.h b/libs/nativehelper_jvm/JniConstants.h new file mode 100644 index 000000000000..e7a266d72509 --- /dev/null +++ b/libs/nativehelper_jvm/JniConstants.h @@ -0,0 +1,63 @@ +/* + * Copyright 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include <sys/cdefs.h> + +#include <jni.h> + +__BEGIN_DECLS + +// +// Classes in constants cache. +// +// NB The implementations of these methods are generated by the JCLASS_ACCESSOR_IMPL macro in +// JniConstants.c. +// +jclass JniConstants_FileDescriptorClass(JNIEnv* env); +jclass JniConstants_NioByteBufferClass(JNIEnv* env); +jclass JniConstants_NioShortBufferClass(JNIEnv* env); +jclass JniConstants_NioCharBufferClass(JNIEnv* env); +jclass JniConstants_NioIntBufferClass(JNIEnv* env); +jclass JniConstants_NioFloatBufferClass(JNIEnv* env); +jclass JniConstants_NioLongBufferClass(JNIEnv* env); +jclass JniConstants_NioDoubleBufferClass(JNIEnv* env); + +// +// Methods in the constants cache. +// +// NB The implementations of these methods are generated by the JMETHODID_ACCESSOR_IMPL macro in +// JniConstants.c. +// +jmethodID JniConstants_FileDescriptor_init(JNIEnv* env); +jmethodID JniConstants_NioBuffer_array(JNIEnv* env); +jmethodID JniConstants_NioBuffer_arrayOffset(JNIEnv* env); +jmethodID JniConstants_NioBuffer_hasArray(JNIEnv* env); +jmethodID JniConstants_NioBuffer_isDirect(JNIEnv* env); + +// +// Fields in the constants cache. +// +// NB The implementations of these methods are generated by the JFIELDID_ACCESSOR_IMPL macro in +// JniConstants.c. +// +jfieldID JniConstants_FileDescriptor_fd(JNIEnv* env); +jfieldID JniConstants_NioBuffer_address(JNIEnv* env); +jfieldID JniConstants_NioBuffer_limit(JNIEnv* env); +jfieldID JniConstants_NioBuffer_position(JNIEnv* env); + +__END_DECLS diff --git a/libs/nativehelper_jvm/OWNERS b/libs/nativehelper_jvm/OWNERS new file mode 100644 index 000000000000..5d55f6e4319b --- /dev/null +++ b/libs/nativehelper_jvm/OWNERS @@ -0,0 +1,7 @@ +# Bug component: 326772 + +include /libs/hwui/OWNERS +include platform/libnativehelper:/OWNERS + +diegoperez@google.com +jgaillard@google.com diff --git a/libs/nativehelper_jvm/README b/libs/nativehelper_jvm/README new file mode 100644 index 000000000000..755c42261f43 --- /dev/null +++ b/libs/nativehelper_jvm/README @@ -0,0 +1,2 @@ +libnativehelper_jvm is a JVM-compatible version of libnativehelper. +It should be used instead of libnativehelper whenever a host library is meant to run on a JVM.
\ No newline at end of file diff --git a/libs/nativehelper_jvm/file_descriptor_jni.c b/libs/nativehelper_jvm/file_descriptor_jni.c new file mode 100644 index 000000000000..36880cd586ca --- /dev/null +++ b/libs/nativehelper_jvm/file_descriptor_jni.c @@ -0,0 +1,47 @@ +/* + * 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. + */ + +#include <android/file_descriptor_jni.h> + +#include <stddef.h> + +#define LOG_TAG "file_descriptor_jni" +#include <log/log.h> + +#include "JniConstants.h" + +static void EnsureArgumentIsFileDescriptor(JNIEnv* env, jobject instance) { + LOG_ALWAYS_FATAL_IF(instance == NULL, "FileDescriptor is NULL"); + jclass jifd = JniConstants_FileDescriptorClass(env); + LOG_ALWAYS_FATAL_IF(!(*env)->IsInstanceOf(env, instance, jifd), + "Argument is not a FileDescriptor"); +} + +JNIEXPORT _Nullable jobject AFileDescriptor_create(JNIEnv* env) { + return (*env)->NewObject(env, + JniConstants_FileDescriptorClass(env), + JniConstants_FileDescriptor_init(env)); +} + +JNIEXPORT int AFileDescriptor_getFd(JNIEnv* env, jobject fileDescriptor) { + EnsureArgumentIsFileDescriptor(env, fileDescriptor); + return (*env)->GetIntField(env, fileDescriptor, JniConstants_FileDescriptor_fd(env)); +} + +JNIEXPORT void AFileDescriptor_setFd(JNIEnv* env, jobject fileDescriptor, int fd) { + EnsureArgumentIsFileDescriptor(env, fileDescriptor); + (*env)->SetIntField(env, fileDescriptor, JniConstants_FileDescriptor_fd(env), fd); +} diff --git a/location/Android.bp b/location/Android.bp index 5ba35ac3328a..10ca97d74660 100644 --- a/location/Android.bp +++ b/location/Android.bp @@ -30,15 +30,17 @@ java_sdk_library { "app-compat-annotations", "unsupportedappusage", // for android.compat.annotation.UnsupportedAppUsage ], - hidden_api_packages: [ - "com.android.internal.location", - ], aidl: { include_dirs: [ "frameworks/base/location/java", "frameworks/base/core/java", ], }, + lint: { + warning_checks: [ + "FlaggedApi", + ], + }, } platform_compat_config { diff --git a/location/TEST_MAPPING b/location/TEST_MAPPING index 10da632e7b6f..256affd1040d 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/location/java/com/android/internal/location/GpsNetInitiatedHandler.java b/location/java/com/android/internal/location/GpsNetInitiatedHandler.java index 0d5af50d08b5..8b6194fa66f5 100644 --- a/location/java/com/android/internal/location/GpsNetInitiatedHandler.java +++ b/location/java/com/android/internal/location/GpsNetInitiatedHandler.java @@ -27,6 +27,7 @@ import android.telephony.TelephonyManager; import android.telephony.emergency.EmergencyNumber; import android.util.Log; +import com.android.internal.annotations.KeepForWeakReference; import com.android.internal.telephony.flags.Flags; import java.util.concurrent.TimeUnit; @@ -94,6 +95,7 @@ public class GpsNetInitiatedHandler { // The internal implementation of TelephonyManager uses WeakReference so we have to keep a // reference here. + @KeepForWeakReference private final EmergencyCallListener mEmergencyCallListener = new EmergencyCallListener(); private final EmergencyCallCallback mEmergencyCallCallback; diff --git a/location/java/com/android/internal/location/package-info.java b/location/java/com/android/internal/location/package-info.java new file mode 100644 index 000000000000..25573c15ce59 --- /dev/null +++ b/location/java/com/android/internal/location/package-info.java @@ -0,0 +1,22 @@ +/* + * 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. + */ + +/** + * Exclude from API surfaces + * + * @hide + */ +package com.android.internal.location; diff --git a/media/java/android/media/AudioSystem.java b/media/java/android/media/AudioSystem.java index d148afd3c15d..2d0e7abbe890 100644 --- a/media/java/android/media/AudioSystem.java +++ b/media/java/android/media/AudioSystem.java @@ -1636,7 +1636,8 @@ public class AudioSystem /** @hide */ public static final int FORCE_ENCODED_SURROUND_NEVER = 13; /** @hide */ public static final int FORCE_ENCODED_SURROUND_ALWAYS = 14; /** @hide */ public static final int FORCE_ENCODED_SURROUND_MANUAL = 15; - /** @hide */ public static final int NUM_FORCE_CONFIG = 16; + /** @hide */ public static final int FORCE_BT_BLE = 16; + /** @hide */ public static final int NUM_FORCE_CONFIG = 17; /** @hide */ public static final int FORCE_DEFAULT = FORCE_NONE; /** @hide */ @@ -1658,6 +1659,7 @@ public class AudioSystem case FORCE_ENCODED_SURROUND_NEVER: return "FORCE_ENCODED_SURROUND_NEVER"; case FORCE_ENCODED_SURROUND_ALWAYS: return "FORCE_ENCODED_SURROUND_ALWAYS"; case FORCE_ENCODED_SURROUND_MANUAL: return "FORCE_ENCODED_SURROUND_MANUAL"; + case FORCE_BT_BLE: return "FORCE_BT_BLE"; default: return "unknown config (" + config + ")" ; } } diff --git a/media/java/android/media/MediaCodec.java b/media/java/android/media/MediaCodec.java index 3ba0d599fde8..e575daeb8d29 100644 --- a/media/java/android/media/MediaCodec.java +++ b/media/java/android/media/MediaCodec.java @@ -5143,9 +5143,9 @@ final public class MediaCodec { * of negative QP and positive QP are chosen wisely, the overall viewing experience can be * improved. * <p> - * If byte array size is too small than the expected size, components may ignore the - * configuration silently. If the byte array exceeds the expected size, components shall use - * the initial portion and ignore the rest. + * If byte array size is smaller than the expected size, components will ignore the + * configuration and print an error message. If the byte array exceeds the expected size, + * components will use the initial portion and ignore the rest. * <p> * The scope of this key is throughout the encoding session until it is reconfigured during * running state. @@ -5159,7 +5159,8 @@ final public class MediaCodec { * Set the region of interest as QpOffset-Rects on the next queued input frame. * <p> * The associated value is a String in the format "Top1,Left1-Bottom1,Right1=Offset1;Top2, - * Left2-Bottom2,Right2=Offset2;...". Co-ordinates (Top, Left), (Top, Right), (Bottom, Left) + * Left2-Bottom2,Right2=Offset2;...". If the configuration doesn't follow this pattern, + * it will be ignored. Co-ordinates (Top, Left), (Top, Right), (Bottom, Left) * and (Bottom, Right) form the vertices of bounding box of region of interest in pixels. * Pixel (0, 0) points to the top-left corner of the frame. Offset is the suggested * quantization parameter (QP) offset of the blocks in the bounding box. The bounding box @@ -5171,9 +5172,10 @@ final public class MediaCodec { * negative QP and positive QP are chosen wisely, the overall viewing experience can be * improved. * <p> - * If Roi rect is not valid that is bounding box width is < 0 or bounding box height is < 0, - * components may ignore the configuration silently. If Roi rect extends outside frame - * boundaries, then rect shall be clamped to the frame boundaries. + * If roi (region of interest) rect is outside the frame boundaries, that is, left < 0 or + * top < 0 or right > width or bottom > height, then rect shall be clamped to the frame + * boundaries. If roi rect is not valid, that is left > right or top > bottom, then the + * parameter setting is ignored. * <p> * The scope of this key is throughout the encoding session until it is reconfigured during * running state. @@ -5261,6 +5263,8 @@ final public class MediaCodec { * main thread.) */ public void setCallback(@Nullable /* MediaCodec. */ Callback cb, @Nullable Handler handler) { + boolean setCallbackStallFlag = + GetFlag(() -> android.media.codec.Flags.setCallbackStall()); if (cb != null) { synchronized (mListenerLock) { EventHandler newHandler = getEventHandlerOn(handler, mCallbackHandler); @@ -5268,7 +5272,7 @@ final public class MediaCodec { // even if we were to extend this to be callable dynamically, it must // be called when codec is flushed, so no messages are pending. if (newHandler != mCallbackHandler) { - if (android.media.codec.Flags.setCallbackStall()) { + if (setCallbackStallFlag) { logAndRun( "[new handler] removeMessages(SET_CALLBACK)", () -> { @@ -5287,7 +5291,7 @@ final public class MediaCodec { } } } else if (mCallbackHandler != null) { - if (android.media.codec.Flags.setCallbackStall()) { + if (setCallbackStallFlag) { logAndRun( "[null handler] removeMessages(SET_CALLBACK)", () -> { diff --git a/media/java/android/media/tv/TvView.java b/media/java/android/media/tv/TvView.java index e604cb7e918b..82e6ed3d9597 100644 --- a/media/java/android/media/tv/TvView.java +++ b/media/java/android/media/tv/TvView.java @@ -91,7 +91,7 @@ public class TvView extends ViewGroup { 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 @@ public class TvView extends ViewGroup { 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.bp b/media/jni/Android.bp index e619e1c7425f..7f487e51f7e8 100644 --- a/media/jni/Android.bp +++ b/media/jni/Android.bp @@ -79,7 +79,6 @@ cc_library_shared { "libcamera_client", "libmtp", "libpiex", - "libprocessgroup", "libandroidfw", "libhidlallocatorutils", "libhidlbase", diff --git a/media/jni/JetPlayer.h b/media/jni/JetPlayer.h index bb569bcad7be..4cc266dec445 100644 --- a/media/jni/JetPlayer.h +++ b/media/jni/JetPlayer.h @@ -40,7 +40,7 @@ public: static const int JET_NUMQUEUEDSEGMENT_UPDATE = 3; static const int JET_PAUSE_UPDATE = 4; - JetPlayer(void *javaJetPlayer, + explicit JetPlayer(void *javaJetPlayer, int maxTracks = 32, int trackBufferSize = 1200); ~JetPlayer(); @@ -69,7 +69,6 @@ private: void fireUpdateOnStatusChange(); void fireEventsFromJetQueue(); - JetPlayer() {} // no default constructor void dump(); void dumpJetStatus(S_JET_STATUS* pJetStatus); @@ -96,7 +95,7 @@ private: class JetPlayerThread : public Thread { public: - JetPlayerThread(JetPlayer *player) : mPlayer(player) { + explicit JetPlayerThread(JetPlayer *player) : mPlayer(player) { } protected: @@ -106,8 +105,7 @@ private: JetPlayer *mPlayer; bool threadLoop() { - int result; - result = mPlayer->render(); + mPlayer->render(); return false; } diff --git a/media/jni/android_media_MediaCodecLinearBlock.h b/media/jni/android_media_MediaCodecLinearBlock.h index 060abfdc1ee5..ffbf0a826b4a 100644 --- a/media/jni/android_media_MediaCodecLinearBlock.h +++ b/media/jni/android_media_MediaCodecLinearBlock.h @@ -62,7 +62,7 @@ struct JMediaCodecLinearBlock { 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/native/graphics/jni/Android.bp b/native/graphics/jni/Android.bp index 746c280edc70..0fb3049f63d8 100644 --- a/native/graphics/jni/Android.bp +++ b/native/graphics/jni/Android.bp @@ -23,6 +23,9 @@ package { cc_library_shared { name: "libjnigraphics", + defaults: [ + "bug_24465209_workaround", + ], cflags: [ "-Wall", @@ -47,13 +50,6 @@ cc_library_shared { static_libs: ["libarect"], - arch: { - arm: { - // TODO: This is to work around b/24465209. Remove after root cause is fixed - pack_relocations: false, - ldflags: ["-Wl,--hash-style=both"], - }, - }, host_supported: true, target: { android: { @@ -131,3 +127,30 @@ cc_fuzz { "-DPNG_MUTATOR_DEFINE_LIBFUZZER_CUSTOM_MUTATOR", ], } + +cc_fuzz { + name: "imagedecoder_heif_fuzzer", + defaults: ["imagedecoder_fuzzer_defaults"], + team: "trendy_team_android_core_graphics_stack", + shared_libs: [ + "libfakeservicemanager", + ], + target: { + android: { + shared_libs: [ + "libmediaplayerservice", + "libmediaextractorservice", + ], + }, + host: { + static_libs: [ + "libbinder_random_parcel", + "libcutils", + ], + }, + }, + include_dirs: ["frameworks/av/services/mediaextractor"], + cflags: [ + "-DFUZZ_HEIF_FORMAT", + ], +} diff --git a/native/graphics/jni/fuzz/fuzz_imagedecoder.cpp b/native/graphics/jni/fuzz/fuzz_imagedecoder.cpp index 6743997fb152..f739e4a1d1a2 100644 --- a/native/graphics/jni/fuzz/fuzz_imagedecoder.cpp +++ b/native/graphics/jni/fuzz/fuzz_imagedecoder.cpp @@ -18,6 +18,16 @@ #include <binder/IPCThreadState.h> #include <fuzzer/FuzzedDataProvider.h> +#ifdef FUZZ_HEIF_FORMAT +#include <fakeservicemanager/FakeServiceManager.h> +#ifdef __ANDROID__ +#include <MediaExtractorService.h> +#include <MediaPlayerService.h> +#else +#include <fuzzbinder/random_binder.h> +#endif //__ANDROID__ +#endif // FUZZ_HEIF_FORMAT + #ifdef PNG_MUTATOR_DEFINE_LIBFUZZER_CUSTOM_MUTATOR #include <fuzz/png_mutator.h> #endif @@ -31,8 +41,42 @@ struct PixelFreer { using PixelPointer = std::unique_ptr<void, PixelFreer>; +#ifndef FUZZ_HEIF_FORMAT +#define FOURCC(c1, c2, c3, c4) ((c1) << 24 | (c2) << 16 | (c3) << 8 | (c4)) +/** Reverse all 4 bytes in a 32bit value. + e.g. 0x12345678 -> 0x78563412 +*/ +static uint32_t endianSwap32(uint32_t value) { + return ((value & 0xFF) << 24) | ((value & 0xFF00) << 8) | ((value & 0xFF0000) >> 8) | + (value >> 24); +} + +static bool isFtyp(const uint8_t* data, size_t size) { + constexpr int32_t headerSize = 8; + constexpr int32_t chunkTypeOffset = 4; + constexpr int32_t ftypFourCCVal = FOURCC('f', 't', 'y', 'p'); + if (size >= headerSize) { + const uint32_t* chunk = reinterpret_cast<const uint32_t*>(data + chunkTypeOffset); + if (endianSwap32(*chunk) == ftypFourCCVal) { + return true; + } + } + return false; +} +#endif + AImageDecoder* init(const uint8_t* data, size_t size, bool useFileDescriptor) { AImageDecoder* decoder = nullptr; +#ifndef FUZZ_HEIF_FORMAT + if (isFtyp(data, size)) { + /* We want to ignore HEIF data when fuzzing non-HEIF image decoders. Use 'FTYP' + * as a signal to ignore, though note that this excludes more than just HEIF. + * But when this code was added, `AImageDecoder` did not support any formats + * in 'FTYP' besides HEIF. + */ + return nullptr; + } +#endif // FUZZ_HEIF_FORMAT if (useFileDescriptor) { constexpr char testFd[] = "tempFd"; int32_t fileDesc = open(testFd, O_RDWR | O_CREAT | O_TRUNC); @@ -47,6 +91,27 @@ AImageDecoder* init(const uint8_t* data, size_t size, bool useFileDescriptor) { extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { FuzzedDataProvider dataProvider = FuzzedDataProvider(data, size); +#ifdef FUZZ_HEIF_FORMAT + /** + * For image formats like HEIF, a new metadata object is + * created which requires "media.player" service running + */ + static std::once_flag callOnceHEIF; + std::call_once(callOnceHEIF, [&]() { + android::sp<android::IServiceManager> fakeServiceManager = + new android::FakeServiceManager(); + setDefaultServiceManager(fakeServiceManager); +#ifdef __ANDROID__ + android::MediaPlayerService::instantiate(); + android::MediaExtractorService::instantiate(); +#else + auto binderExtractor = android::getRandomBinder(&dataProvider); + auto binderPlayer = android::getRandomBinder(&dataProvider); + fakeServiceManager->addService(android::String16("media.extractor"), binderExtractor); + fakeServiceManager->addService(android::String16("media.player"), binderPlayer); +#endif //__ANDROID__ + }); +#endif // FUZZ_HEIF_FORMAT /** * Use maximum of 80% of buffer for creating decoder and save at least * 20% buffer for fuzzing other APIs diff --git a/nfc/Android.bp b/nfc/Android.bp index 13ac2311bde3..0282e6f5c246 100644 --- a/nfc/Android.bp +++ b/nfc/Android.bp @@ -61,9 +61,6 @@ java_sdk_library { "android.nfc", "com.android.nfc", ], - hidden_api_packages: [ - "com.android.nfc", - ], impl_library_visibility: [ "//frameworks/base:__subpackages__", "//cts/hostsidetests/multidevices/nfc:__subpackages__", diff --git a/nfc/api/current.txt b/nfc/api/current.txt index cf7aea405756..447e980adaee 100644 --- a/nfc/api/current.txt +++ b/nfc/api/current.txt @@ -220,11 +220,14 @@ package android.nfc.cardemulation { 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 @@ package android.nfc.cardemulation { 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 3375e18c001d..25a01b9c1b8d 100644 --- a/nfc/api/system-current.txt +++ b/nfc/api/system-current.txt @@ -57,14 +57,34 @@ package android.nfc { @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 @@ package android.nfc.cardemulation { 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 761c8e63df81..c7a618125add 100644 --- a/nfc/api/system-lint-baseline.txt +++ b/nfc/api/system-lint-baseline.txt @@ -9,6 +9,18 @@ BroadcastBehavior: android.nfc.NfcAdapter#ACTION_TRANSACTION_DETECTED: 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#close(): 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/AvailableNfcAntenna.java b/nfc/java/android/nfc/AvailableNfcAntenna.java index 6e6512a04971..e76aeb07f106 100644 --- a/nfc/java/android/nfc/AvailableNfcAntenna.java +++ b/nfc/java/android/nfc/AvailableNfcAntenna.java @@ -28,13 +28,13 @@ import android.os.Parcelable; public final class AvailableNfcAntenna implements Parcelable { /** * Location of the antenna on the Y axis in millimeters. - * 0 is the bottom-left when the user is facing the screen + * 0 is the top-left when the user is facing the screen * and the device orientation is Portrait. */ private final int mLocationX; /** * Location of the antenna on the Y axis in millimeters. - * 0 is the bottom-left when the user is facing the screen + * 0 is the top-left when the user is facing the screen * and the device orientation is Portrait. */ private final int mLocationY; @@ -46,7 +46,7 @@ public final class AvailableNfcAntenna implements Parcelable { /** * Location of the antenna on the X axis in millimeters. - * 0 is the bottom-left when the user is facing the screen + * 0 is the top-left when the user is facing the screen * and the device orientation is Portrait. */ public int getLocationX() { @@ -55,7 +55,7 @@ public final class AvailableNfcAntenna implements Parcelable { /** * Location of the antenna on the Y axis in millimeters. - * 0 is the bottom-left when the user is facing the screen + * 0 is the top-left when the user is facing the screen * and the device orientation is Portrait. */ public int getLocationY() { diff --git a/nfc/java/android/nfc/INfcAdapter.aidl b/nfc/java/android/nfc/INfcAdapter.aidl index fd77820afc81..6c0f93354683 100644 --- a/nfc/java/android/nfc/INfcAdapter.aidl +++ b/nfc/java/android/nfc/INfcAdapter.aidl @@ -88,7 +88,7 @@ interface INfcAdapter 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); @@ -104,6 +104,7 @@ interface INfcAdapter void notifyPollingLoop(in PollingFrame frame); void notifyHceDeactivated(); + void notifyTestHceData(in int technology, in byte[] data); int sendVendorNciMessage(int mt, int gid, int oid, in byte[] payload); void registerVendorExtensionCallback(in INfcVendorNciCallback callbacks); void unregisterVendorExtensionCallback(in INfcVendorNciCallback callbacks); @@ -112,4 +113,5 @@ interface INfcAdapter 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 cb97f23e813c..79f1275ec629 100644 --- a/nfc/java/android/nfc/INfcCardEmulation.aidl +++ b/nfc/java/android/nfc/INfcCardEmulation.aidl @@ -48,6 +48,6 @@ interface INfcCardEmulation 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 6c9096d5d03e..c19a44ba0ff1 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/NfcActivityManager.java b/nfc/java/android/nfc/NfcActivityManager.java index 0e40db612708..0eb846d6c72a 100644 --- a/nfc/java/android/nfc/NfcActivityManager.java +++ b/nfc/java/android/nfc/NfcActivityManager.java @@ -236,11 +236,7 @@ public final class NfcActivityManager extends IAppCallback.Stub public void setReaderMode(Binder token, int flags, Bundle extras) { if (DBG) Log.d(TAG, "Setting reader mode"); - try { - NfcAdapter.sService.setReaderMode(token, this, flags, extras); - } catch (RemoteException e) { - mAdapter.attemptDeadServiceRecovery(e); - } + NfcAdapter.callService(() -> NfcAdapter.sService.setReaderMode(token, this, flags, extras)); } /** @@ -248,19 +244,11 @@ public final class NfcActivityManager extends IAppCallback.Stub * Makes IPC call - do not hold lock. */ void requestNfcServiceCallback() { - try { - NfcAdapter.sService.setAppCallback(this); - } catch (RemoteException e) { - mAdapter.attemptDeadServiceRecovery(e); - } + NfcAdapter.callService(() -> NfcAdapter.sService.setAppCallback(this)); } void verifyNfcPermission() { - try { - NfcAdapter.sService.verifyNfcPermission(); - } catch (RemoteException e) { - mAdapter.attemptDeadServiceRecovery(e); - } + NfcAdapter.callService(() -> NfcAdapter.sService.verifyNfcPermission()); } @Override @@ -406,11 +394,8 @@ public final class NfcActivityManager extends IAppCallback.Stub } private void changeDiscoveryTech(Binder token, int pollTech, int listenTech) { - try { - NfcAdapter.sService.updateDiscoveryTechnology(token, pollTech, listenTech); - } catch (RemoteException e) { - mAdapter.attemptDeadServiceRecovery(e); - } + NfcAdapter.callService( + () -> NfcAdapter.sService.updateDiscoveryTechnology(token, pollTech, listenTech)); } } diff --git a/nfc/java/android/nfc/NfcAdapter.java b/nfc/java/android/nfc/NfcAdapter.java index 1dfc81e2108e..525e2c58a82c 100644 --- a/nfc/java/android/nfc/NfcAdapter.java +++ b/nfc/java/android/nfc/NfcAdapter.java @@ -922,8 +922,8 @@ public final class NfcAdapter { * @hide */ @UnsupportedAppUsage - public INfcAdapter getService() { - isEnabled(); // NOP call to recover sService if it is stale + public static INfcAdapter getService() { + isEnabledStatic(); // NOP call to recover sService if it is stale return sService; } @@ -931,8 +931,8 @@ public final class NfcAdapter { * Returns the binder interface to the tag service. * @hide */ - public INfcTag getTagService() { - isEnabled(); // NOP call to recover sTagService if it is stale + public static INfcTag getTagService() { + isEnabledStatic(); // NOP call to recover sTagService if it is stale return sTagService; } @@ -940,8 +940,8 @@ public final class NfcAdapter { * Returns the binder interface to the card emulation service. * @hide */ - public INfcCardEmulation getCardEmulationService() { - isEnabled(); + public static INfcCardEmulation getCardEmulationService() { + isEnabledStatic(); return sCardEmulationService; } @@ -949,8 +949,8 @@ public final class NfcAdapter { * Returns the binder interface to the NFC-F card emulation service. * @hide */ - public INfcFCardEmulation getNfcFCardEmulationService() { - isEnabled(); + public static INfcFCardEmulation getNfcFCardEmulationService() { + isEnabledStatic(); return sNfcFCardEmulationService; } @@ -963,22 +963,9 @@ public final class NfcAdapter { throw new UnsupportedOperationException("You need a context on NfcAdapter to use the " + " NFC extras APIs"); } - try { - return sService.getNfcDtaInterface(mContext.getPackageName()); - } catch (RemoteException e) { - attemptDeadServiceRecovery(e); - // Try one more time - if (sService == null) { - Log.e(TAG, "Failed to recover NFC Service."); - return null; - } - try { - return sService.getNfcDtaInterface(mContext.getPackageName()); - } catch (RemoteException ee) { - Log.e(TAG, "Failed to recover NFC Service."); - } - return null; - } + return callServiceReturn(() -> sService.getNfcDtaInterface(mContext.getPackageName()), + null); + } /** @@ -986,14 +973,14 @@ public final class NfcAdapter { * @hide */ @UnsupportedAppUsage - public void attemptDeadServiceRecovery(Exception e) { + public static void attemptDeadServiceRecovery(RemoteException e) { Log.e(TAG, "NFC service dead - attempting to recover", e); INfcAdapter service = getServiceInterface(); if (service == null) { Log.e(TAG, "could not retrieve NFC service during service recovery"); // nothing more can be done now, sService is still stale, we'll hit // this recovery path again later - return; + e.rethrowAsRuntimeException(); } // assigning to sService is not thread-safe, but this is best-effort code // and on a well-behaved system should never happen @@ -1006,7 +993,7 @@ public final class NfcAdapter { Log.e(TAG, "could not retrieve NFC tag service during service recovery"); // nothing more can be done now, sService is still stale, we'll hit // this recovery path again later - return; + ee.rethrowAsRuntimeException(); } } @@ -1027,24 +1014,27 @@ public final class NfcAdapter { "could not retrieve NFC-F card emulation service during service recovery"); } } - - return; } - private boolean isCardEmulationEnabled() { + private static boolean isCardEmulationEnabled() { if (sHasCeFeature) { return (sCardEmulationService != null || sNfcFCardEmulationService != null); } return false; } - private boolean isTagReadingEnabled() { + private static boolean isTagReadingEnabled() { if (sHasNfcFeature) { return sTagService != null; } return false; } + private static boolean isEnabledStatic() { + boolean serviceState = callServiceReturn(() -> sService.getState() == STATE_ON, false); + return serviceState + && (isTagReadingEnabled() || isCardEmulationEnabled() || sHasNfcWlcFeature); + } /** * Return true if this NFC Adapter has any features enabled. @@ -1059,24 +1049,7 @@ public final class NfcAdapter { * @return true if this NFC Adapter has any features enabled */ public boolean isEnabled() { - boolean serviceState = false; - try { - serviceState = sService.getState() == STATE_ON; - } catch (RemoteException e) { - attemptDeadServiceRecovery(e); - // Try one more time - if (sService == null) { - Log.e(TAG, "Failed to recover NFC Service."); - return false; - } - try { - serviceState = sService.getState() == STATE_ON; - } catch (RemoteException ee) { - Log.e(TAG, "Failed to recover NFC Service."); - } - } - return serviceState - && (isTagReadingEnabled() || isCardEmulationEnabled() || sHasNfcWlcFeature); + return isEnabledStatic(); } /** @@ -1095,22 +1068,8 @@ public final class NfcAdapter { @SystemApi @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE) public @AdapterState int getAdapterState() { - try { - return sService.getState(); - } catch (RemoteException e) { - attemptDeadServiceRecovery(e); - // Try one more time - if (sService == null) { - Log.e(TAG, "Failed to recover NFC Service."); - return NfcAdapter.STATE_OFF; - } - try { - return sService.getState(); - } catch (RemoteException ee) { - Log.e(TAG, "Failed to recover NFC Service."); - } - return NfcAdapter.STATE_OFF; - } + return callServiceReturn(() -> sService.getState(), NfcAdapter.STATE_OFF); + } /** @@ -1134,22 +1093,8 @@ public final class NfcAdapter { @FlaggedApi(Flags.FLAG_NFC_STATE_CHANGE) @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public boolean enable() { - try { - return sService.enable(mContext.getPackageName()); - } catch (RemoteException e) { - attemptDeadServiceRecovery(e); - // Try one more time - if (sService == null) { - Log.e(TAG, "Failed to recover NFC Service."); - return false; - } - try { - return sService.enable(mContext.getPackageName()); - } catch (RemoteException ee) { - Log.e(TAG, "Failed to recover NFC Service."); - } - return false; - } + return callServiceReturn(() -> sService.enable(mContext.getPackageName()), false); + } /** @@ -1175,22 +1120,9 @@ public final class NfcAdapter { @FlaggedApi(Flags.FLAG_NFC_STATE_CHANGE) @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public boolean disable() { - try { - return sService.disable(true, mContext.getPackageName()); - } catch (RemoteException e) { - attemptDeadServiceRecovery(e); - // Try one more time - if (sService == null) { - Log.e(TAG, "Failed to recover NFC Service."); - return false; - } - try { - return sService.disable(true, mContext.getPackageName()); - } catch (RemoteException ee) { - Log.e(TAG, "Failed to recover NFC Service."); - } - return false; - } + return callServiceReturn(() -> sService.disable(true, mContext.getPackageName()), + false); + } /** @@ -1200,22 +1132,9 @@ public final class NfcAdapter { @SystemApi @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public boolean disable(boolean persist) { - try { - return sService.disable(persist, mContext.getPackageName()); - } catch (RemoteException e) { - attemptDeadServiceRecovery(e); - // Try one more time - if (sService == null) { - Log.e(TAG, "Failed to recover NFC Service."); - return false; - } - try { - return sService.disable(persist, mContext.getPackageName()); - } catch (RemoteException ee) { - Log.e(TAG, "Failed to recover NFC Service."); - } - return false; - } + return callServiceReturn(() -> sService.disable(persist, mContext.getPackageName()), + false); + } /** @@ -1224,29 +1143,21 @@ public final class NfcAdapter { * @hide */ public void pausePolling(int timeoutInMs) { - try { - sService.pausePolling(timeoutInMs); - } catch (RemoteException e) { - attemptDeadServiceRecovery(e); - } + callService(() -> sService.pausePolling(timeoutInMs)); } /** - * Returns whether the device supports observer mode or not. When observe - * mode is enabled, the NFC hardware will listen for NFC readers, but not - * respond to them. When observe mode is disabled, the NFC hardware will - * resoond to the reader and proceed with the transaction. + * Returns whether the device supports observe mode or not. When observe mode is enabled, the + * NFC hardware will listen to NFC readers, but not respond to them. While enabled, observed + * polling frames will be sent to the APDU service (see {@link #setObserveModeEnabled(boolean)}. + * When observe mode is disabled (or if it's not supported), the NFC hardware will automatically + * respond to the reader and proceed with the transaction. * @return true if the mode is supported, false otherwise. */ @FlaggedApi(Flags.FLAG_NFC_OBSERVE_MODE) public boolean isObserveModeSupported() { - try { - return sService.isObserveModeSupported(); - } catch (RemoteException e) { - attemptDeadServiceRecovery(e); - return false; - } + return callServiceReturn(() -> sService.isObserveModeSupported(), false); } /** @@ -1257,12 +1168,7 @@ public final class NfcAdapter { @FlaggedApi(Flags.FLAG_NFC_OBSERVE_MODE) public boolean isObserveModeEnabled() { - try { - return sService.isObserveModeEnabled(); - } catch (RemoteException e) { - attemptDeadServiceRecovery(e); - return false; - } + return callServiceReturn(() -> sService.isObserveModeEnabled(), false); } /** @@ -1270,9 +1176,10 @@ public final class NfcAdapter { * and simply observe and notify the APDU service of polling loop frames. See * {@link #isObserveModeSupported()} for a description of observe mode. 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 return false. + * application via {@link android.nfc.cardemulation.CardEmulation#setPreferredService(Activity, + * android.content.ComponentName)} or the current Default Wallet Role Holder + * {@link android.app.role.RoleManager#ROLE_WALLET}), otherwise a call to this method will fail + * and return false. * * @param enabled false disables observe mode to allow the transaction to proceed while true * enables observe mode and does not allow transactions to proceed. @@ -1286,12 +1193,8 @@ public final class NfcAdapter { throw new UnsupportedOperationException("You need a context on NfcAdapter to use the " + " observe mode APIs"); } - try { - return sService.setObserveMode(enabled, mContext.getPackageName()); - } catch (RemoteException e) { - attemptDeadServiceRecovery(e); - return false; - } + return callServiceReturn(() -> sService.setObserveMode(enabled, mContext.getPackageName()), + false); } /** @@ -1301,11 +1204,7 @@ public final class NfcAdapter { * @hide */ public void resumePolling() { - try { - sService.resumePolling(); - } catch (RemoteException e) { - attemptDeadServiceRecovery(e); - } + callService(() -> sService.resumePolling()); } /** @@ -1724,15 +1623,10 @@ public final class NfcAdapter { if (activity == null || intent == null) { throw new NullPointerException(); } - try { - TechListParcel parcel = null; - if (techLists != null && techLists.length > 0) { - parcel = new TechListParcel(techLists); - } - sService.setForegroundDispatch(intent, filters, parcel); - } catch (RemoteException e) { - attemptDeadServiceRecovery(e); - } + final TechListParcel parcel = (techLists != null && techLists.length > 0) + ? new TechListParcel(techLists) + : null; + callService(() -> sService.setForegroundDispatch(intent, filters, parcel)); } /** @@ -1756,11 +1650,7 @@ public final class NfcAdapter { throw new UnsupportedOperationException(); } } - try { - sService.setForegroundDispatch(null, null, null); - } catch (RemoteException e) { - attemptDeadServiceRecovery(e); - } + callService(() -> sService.setForegroundDispatch(null, null, null)); } /** @@ -1841,11 +1731,7 @@ public final class NfcAdapter { } Binder token = new Binder(); int flags = enable ? ENABLE_POLLING_FLAGS : DISABLE_POLLING_FLAGS; - try { - NfcAdapter.sService.setReaderMode(token, null, flags, null); - } catch (RemoteException e) { - attemptDeadServiceRecovery(e); - } + callService(() -> sService.setReaderMode(token, null, flags, null)); } /** @@ -1917,12 +1803,8 @@ public final class NfcAdapter { && ((pollTechnology & FLAG_SET_DEFAULT_TECH) == FLAG_SET_DEFAULT_TECH || (listenTechnology & FLAG_SET_DEFAULT_TECH) == FLAG_SET_DEFAULT_TECH)) { Binder token = new Binder(); - try { - NfcAdapter.sService.updateDiscoveryTechnology(token, - pollTechnology, listenTechnology); - } catch (RemoteException e) { - attemptDeadServiceRecovery(e); - } + callService( () -> + sService.updateDiscoveryTechnology(token, pollTechnology, listenTechnology)); } else { mNfcActivityManager.setDiscoveryTech(activity, pollTechnology, listenTechnology); } @@ -2057,22 +1939,8 @@ public final class NfcAdapter { if (!sHasNfcFeature && !sHasCeFeature) { throw new UnsupportedOperationException(); } - try { - return sService.setNfcSecure(enable); - } catch (RemoteException e) { - attemptDeadServiceRecovery(e); - // Try one more time - if (sService == null) { - Log.e(TAG, "Failed to recover NFC Service."); - return false; - } - try { - return sService.setNfcSecure(enable); - } catch (RemoteException ee) { - Log.e(TAG, "Failed to recover NFC Service."); - } - return false; - } + return callServiceReturn(() -> sService.setNfcSecure(enable), false); + } /** @@ -2088,22 +1956,8 @@ public final class NfcAdapter { if (!sHasNfcFeature && !sHasCeFeature) { throw new UnsupportedOperationException(); } - try { - return sService.deviceSupportsNfcSecure(); - } catch (RemoteException e) { - attemptDeadServiceRecovery(e); - // Try one more time - if (sService == null) { - Log.e(TAG, "Failed to recover NFC Service."); - return false; - } - try { - return sService.deviceSupportsNfcSecure(); - } catch (RemoteException ee) { - Log.e(TAG, "Failed to recover NFC Service."); - } - return false; - } + return callServiceReturn(() -> sService.deviceSupportsNfcSecure(), false); + } /** @@ -2121,22 +1975,8 @@ public final class NfcAdapter { if (!sHasNfcFeature && !sHasCeFeature) { throw new UnsupportedOperationException(); } - try { - return sService.getNfcAntennaInfo(); - } catch (RemoteException e) { - attemptDeadServiceRecovery(e); - // Try one more time - if (sService == null) { - Log.e(TAG, "Failed to recover NFC Service."); - return null; - } - try { - return sService.getNfcAntennaInfo(); - } catch (RemoteException ee) { - Log.e(TAG, "Failed to recover NFC Service."); - } - return null; - } + return callServiceReturn(() -> sService.getNfcAntennaInfo(), null); + } /** @@ -2154,22 +1994,8 @@ public final class NfcAdapter { if (!sHasNfcFeature && !sHasCeFeature) { throw new UnsupportedOperationException(); } - try { - return sService.isNfcSecureEnabled(); - } catch (RemoteException e) { - attemptDeadServiceRecovery(e); - // Try one more time - if (sService == null) { - Log.e(TAG, "Failed to recover NFC Service."); - return false; - } - try { - return sService.isNfcSecureEnabled(); - } catch (RemoteException ee) { - Log.e(TAG, "Failed to recover NFC Service."); - } - return false; - } + return callServiceReturn(() -> sService.isNfcSecureEnabled(), false); + } /** @@ -2185,22 +2011,9 @@ public final class NfcAdapter { if (!sHasNfcFeature) { throw new UnsupportedOperationException(); } - try { - return sService.enableReaderOption(enable); - } catch (RemoteException e) { - attemptDeadServiceRecovery(e); - // Try one more time - if (sService == null) { - Log.e(TAG, "Failed to recover NFC Service."); - return false; - } - try { - return sService.enableReaderOption(enable); - } catch (RemoteException ee) { - Log.e(TAG, "Failed to recover NFC Service."); - } - return false; - } + return callServiceReturn(() -> + sService.enableReaderOption(enable, mContext.getPackageName()), false); + } /** @@ -2214,22 +2027,8 @@ public final class NfcAdapter { if (!sHasNfcFeature) { throw new UnsupportedOperationException(); } - try { - return sService.isReaderOptionSupported(); - } catch (RemoteException e) { - attemptDeadServiceRecovery(e); - // Try one more time - if (sService == null) { - Log.e(TAG, "Failed to recover NFC Service."); - return false; - } - try { - return sService.isReaderOptionSupported(); - } catch (RemoteException ee) { - Log.e(TAG, "Failed to recover NFC Service."); - } - return false; - } + return callServiceReturn(() -> sService.isReaderOptionSupported(), false); + } /** @@ -2245,22 +2044,8 @@ public final class NfcAdapter { if (!sHasNfcFeature) { throw new UnsupportedOperationException(); } - try { - return sService.isReaderOptionEnabled(); - } catch (RemoteException e) { - attemptDeadServiceRecovery(e); - // Try one more time - if (sService == null) { - Log.e(TAG, "Failed to recover NFC Service."); - return false; - } - try { - return sService.isReaderOptionEnabled(); - } catch (RemoteException ee) { - Log.e(TAG, "Failed to recover NFC Service."); - } - return false; - } + return callServiceReturn(() -> sService.isReaderOptionEnabled(), false); + } /** @@ -2388,11 +2173,9 @@ public final class NfcAdapter { synchronized (mLock) { mTagRemovedListener = iListener; } - try { - return sService.ignore(tag.getServiceHandle(), debounceMs, iListener); - } catch (RemoteException e) { - return false; - } + final ITagRemovedCallback.Stub passedListener = iListener; + return callServiceReturn(() -> + sService.ignore(tag.getServiceHandle(), debounceMs, passedListener), false); } /** @@ -2406,11 +2189,7 @@ public final class NfcAdapter { if (tag == null) { throw new NullPointerException("tag cannot be null"); } - try { - sService.dispatch(tag); - } catch (RemoteException e) { - attemptDeadServiceRecovery(e); - } + callService(() -> sService.dispatch(tag)); } /** @@ -2446,8 +2225,10 @@ public final class NfcAdapter { synchronized (mLock) { if (mNfcUnlockHandlers.containsKey(unlockHandler)) { // update the tag technologies - sService.removeNfcUnlockHandler(mNfcUnlockHandlers.get(unlockHandler)); - mNfcUnlockHandlers.remove(unlockHandler); + callService(() -> { + sService.removeNfcUnlockHandler(mNfcUnlockHandlers.get(unlockHandler)); + mNfcUnlockHandlers.remove(unlockHandler); + }); } INfcUnlockHandler.Stub iHandler = new INfcUnlockHandler.Stub() { @@ -2456,20 +2237,18 @@ public final class NfcAdapter { return unlockHandler.onUnlockAttempted(tag); } }; - - sService.addNfcUnlockHandler(iHandler, - Tag.getTechCodesFromStrings(tagTechnologies)); - mNfcUnlockHandlers.put(unlockHandler, iHandler); + return callServiceReturn(() -> { + sService.addNfcUnlockHandler( + iHandler, Tag.getTechCodesFromStrings(tagTechnologies)); + mNfcUnlockHandlers.put(unlockHandler, iHandler); + return true; + }, false); } - } catch (RemoteException e) { - attemptDeadServiceRecovery(e); - return false; } catch (IllegalArgumentException e) { Log.e(TAG, "Unable to register LockscreenDispatch", e); return false; } - return true; } /** @@ -2486,17 +2265,14 @@ public final class NfcAdapter { throw new UnsupportedOperationException(); } } - try { - synchronized (mLock) { - if (mNfcUnlockHandlers.containsKey(unlockHandler)) { + synchronized (mLock) { + if (mNfcUnlockHandlers.containsKey(unlockHandler)) { + return callServiceReturn(() -> { sService.removeNfcUnlockHandler(mNfcUnlockHandlers.remove(unlockHandler)); - } - - return true; + return true; + }, false); } - } catch (RemoteException e) { - attemptDeadServiceRecovery(e); - return false; + return true; } } @@ -2509,22 +2285,9 @@ public final class NfcAdapter { throw new UnsupportedOperationException("You need a context on NfcAdapter to use the " + " NFC extras APIs"); } - try { - return sService.getNfcAdapterExtrasInterface(mContext.getPackageName()); - } catch (RemoteException e) { - attemptDeadServiceRecovery(e); - // Try one more time - if (sService == null) { - Log.e(TAG, "Failed to recover NFC Service."); - return null; - } - try { - return sService.getNfcAdapterExtrasInterface(mContext.getPackageName()); - } catch (RemoteException ee) { - Log.e(TAG, "Failed to recover NFC Service."); - } - return null; - } + return callServiceReturn(() -> + sService.getNfcAdapterExtrasInterface(mContext.getPackageName()), null); + } void enforceResumed(Activity activity) { @@ -2569,22 +2332,8 @@ public final class NfcAdapter { if (!sHasNfcFeature && !sHasCeFeature) { throw new UnsupportedOperationException(); } - try { - return sService.setControllerAlwaysOn(value); - } catch (RemoteException e) { - attemptDeadServiceRecovery(e); - // Try one more time - if (sService == null) { - Log.e(TAG, "Failed to recover NFC Service."); - return false; - } - try { - return sService.setControllerAlwaysOn(value); - } catch (RemoteException ee) { - Log.e(TAG, "Failed to recover NFC Service."); - } - return false; - } + return callServiceReturn(() -> sService.setControllerAlwaysOn(value), false); + } /** @@ -2600,22 +2349,8 @@ public final class NfcAdapter { @SystemApi @RequiresPermission(android.Manifest.permission.NFC_SET_CONTROLLER_ALWAYS_ON) public boolean isControllerAlwaysOn() { - try { - return sService.isControllerAlwaysOn(); - } catch (RemoteException e) { - attemptDeadServiceRecovery(e); - // Try one more time - if (sService == null) { - Log.e(TAG, "Failed to recover NFC Service."); - return false; - } - try { - return sService.isControllerAlwaysOn(); - } catch (RemoteException ee) { - Log.e(TAG, "Failed to recover NFC Service."); - } - return false; - } + return callServiceReturn(() -> sService.isControllerAlwaysOn(), false); + } /** @@ -2634,22 +2369,8 @@ public final class NfcAdapter { if (!sHasNfcFeature && !sHasCeFeature) { throw new UnsupportedOperationException(); } - try { - return sService.isControllerAlwaysOnSupported(); - } catch (RemoteException e) { - attemptDeadServiceRecovery(e); - // Try one more time - if (sService == null) { - Log.e(TAG, "Failed to recover NFC Service."); - return false; - } - try { - return sService.isControllerAlwaysOnSupported(); - } catch (RemoteException ee) { - Log.e(TAG, "Failed to recover NFC Service."); - } - return false; - } + return callServiceReturn(() -> sService.isControllerAlwaysOnSupported(), false); + } /** @@ -2719,21 +2440,9 @@ public final class NfcAdapter { Log.e(TAG, "TagIntentAppPreference is not supported"); throw new UnsupportedOperationException(); } - try { - return sService.setTagIntentAppPreferenceForUser(userId, pkg, allow); - } catch (RemoteException e) { - attemptDeadServiceRecovery(e); - // Try one more time - if (sService == null) { - Log.e(TAG, "Failed to recover NFC Service."); - } - try { - return sService.setTagIntentAppPreferenceForUser(userId, pkg, allow); - } catch (RemoteException ee) { - Log.e(TAG, "Failed to recover NFC Service."); - } - return TAG_INTENT_APP_PREF_RESULT_UNAVAILABLE; - } + return callServiceReturn(() -> + sService.setTagIntentAppPreferenceForUser(userId, pkg, allow), + TAG_INTENT_APP_PREF_RESULT_UNAVAILABLE); } @@ -2771,26 +2480,8 @@ public final class NfcAdapter { Log.e(TAG, "TagIntentAppPreference is not supported"); throw new UnsupportedOperationException(); } - try { - Map<String, Boolean> result = (Map<String, Boolean>) sService - .getTagIntentAppPreferenceForUser(userId); - return result; - } catch (RemoteException e) { - attemptDeadServiceRecovery(e); - // Try one more time - if (sService == null) { - Log.e(TAG, "Failed to recover NFC Service."); - return Collections.emptyMap(); - } - try { - Map<String, Boolean> result = (Map<String, Boolean>) sService - .getTagIntentAppPreferenceForUser(userId); - return result; - } catch (RemoteException ee) { - Log.e(TAG, "Failed to recover NFC Service."); - } - return Collections.emptyMap(); - } + return callServiceReturn( () -> + sService.getTagIntentAppPreferenceForUser(userId), Collections.emptyMap()); } /** @@ -2808,22 +2499,8 @@ public final class NfcAdapter { if (!sHasNfcFeature) { throw new UnsupportedOperationException(); } - try { - return sService.isTagIntentAppPreferenceSupported(); - } catch (RemoteException e) { - attemptDeadServiceRecovery(e); - // Try one more time - if (sService == null) { - Log.e(TAG, "Failed to recover NFC Service."); - return false; - } - try { - return sService.isTagIntentAppPreferenceSupported(); - } catch (RemoteException ee) { - Log.e(TAG, "Failed to recover NFC Service."); - } - return false; - } + return callServiceReturn(() -> sService.isTagIntentAppPreferenceSupported(), false); + } /** @@ -2836,24 +2513,61 @@ public final class NfcAdapter { @TestApi @FlaggedApi(Flags.FLAG_NFC_READ_POLLING_LOOP) public void notifyPollingLoop(@NonNull PollingFrame pollingFrame) { + callService(() -> sService.notifyPollingLoop(pollingFrame)); + } + + + /** + * Notifies the system of new HCE data for tests. + * + * @hide + */ + @FlaggedApi(Flags.FLAG_NFC_READ_POLLING_LOOP) + public void notifyTestHceData(int technology, byte[] data) { + callService(() -> sService.notifyTestHceData(technology, data)); + } + + /** @hide */ + interface ServiceCall { + void call() throws RemoteException; + } + /** @hide */ + static void callService(ServiceCall call) { try { if (sService == null) { - attemptDeadServiceRecovery(null); + attemptDeadServiceRecovery(new RemoteException("NFC Service is null")); } - sService.notifyPollingLoop(pollingFrame); + call.call(); } catch (RemoteException e) { attemptDeadServiceRecovery(e); - // Try one more time + try { + call.call(); + } catch (RemoteException ee) { + ee.rethrowAsRuntimeException(); + } + } + } + /** @hide */ + interface ServiceCallReturn<T> { + T call() throws RemoteException; + } + /** @hide */ + static <T> T callServiceReturn(ServiceCallReturn<T> call, T defaultReturn) { + try { if (sService == null) { - Log.e(TAG, "Failed to recover NFC Service."); - return; + attemptDeadServiceRecovery(new RemoteException("NFC Service is null")); } + return call.call(); + } catch (RemoteException e) { + attemptDeadServiceRecovery(e); + // Try one more time try { - sService.notifyPollingLoop(pollingFrame); + return call.call(); } catch (RemoteException ee) { - Log.e(TAG, "Failed to recover NFC Service."); + ee.rethrowAsRuntimeException(); } } + return defaultReturn; } /** @@ -2864,24 +2578,7 @@ public final class NfcAdapter { @TestApi @FlaggedApi(Flags.FLAG_NFC_READ_POLLING_LOOP) public void notifyHceDeactivated() { - try { - if (sService == null) { - attemptDeadServiceRecovery(null); - } - sService.notifyHceDeactivated(); - } catch (RemoteException e) { - attemptDeadServiceRecovery(e); - // Try one more time - if (sService == null) { - Log.e(TAG, "Failed to recover NFC Service."); - return; - } - try { - sService.notifyHceDeactivated(); - } catch (RemoteException ee) { - Log.e(TAG, "Failed to recover NFC Service."); - } - } + callService(() -> sService.notifyHceDeactivated()); } /** @@ -2897,22 +2594,7 @@ public final class NfcAdapter { if (!sHasNfcWlcFeature) { throw new UnsupportedOperationException(); } - try { - return sService.setWlcEnabled(enable); - } catch (RemoteException e) { - attemptDeadServiceRecovery(e); - // Try one more time - if (sService == null) { - Log.e(TAG, "Failed to recover NFC Service."); - return false; - } - try { - return sService.setWlcEnabled(enable); - } catch (RemoteException ee) { - Log.e(TAG, "Failed to recover NFC Service."); - } - return false; - } + return callServiceReturn(() -> sService.setWlcEnabled(enable), false); } /** @@ -2927,22 +2609,8 @@ public final class NfcAdapter { if (!sHasNfcWlcFeature) { throw new UnsupportedOperationException(); } - try { - return sService.isWlcEnabled(); - } catch (RemoteException e) { - attemptDeadServiceRecovery(e); - // Try one more time - if (sService == null) { - Log.e(TAG, "Failed to recover NFC Service."); - return false; - } - try { - return sService.isWlcEnabled(); - } catch (RemoteException ee) { - Log.e(TAG, "Failed to recover NFC Service."); - } - return false; - } + return callServiceReturn(() -> sService.isWlcEnabled(), false); + } /** @@ -3021,22 +2689,8 @@ public final class NfcAdapter { if (!sHasNfcWlcFeature) { throw new UnsupportedOperationException(); } - try { - return sService.getWlcListenerDeviceInfo(); - } catch (RemoteException e) { - attemptDeadServiceRecovery(e); - // Try one more time - if (sService == null) { - Log.e(TAG, "Failed to recover NFC Service."); - return null; - } - try { - return sService.getWlcListenerDeviceInfo(); - } catch (RemoteException ee) { - Log.e(TAG, "Failed to recover NFC Service."); - } - return null; - } + return callServiceReturn(() -> sService.getWlcListenerDeviceInfo(), null); + } /** diff --git a/nfc/java/android/nfc/NfcAntennaInfo.java b/nfc/java/android/nfc/NfcAntennaInfo.java index b002ca21e8e3..c57b2e029cc5 100644 --- a/nfc/java/android/nfc/NfcAntennaInfo.java +++ b/nfc/java/android/nfc/NfcAntennaInfo.java @@ -64,9 +64,9 @@ public final class NfcAntennaInfo implements Parcelable { /** * Whether the device is foldable. When the device is foldable, - * the 0, 0 is considered to be bottom-left when the device is unfolded and + * the 0, 0 is considered to be top-left when the device is unfolded and * the screens are facing the user. For non-foldable devices 0, 0 - * is bottom-left when the user is facing the screen. + * is top-left when the user is facing the screen. */ public boolean isDeviceFoldable() { return mDeviceFoldable; diff --git a/nfc/java/android/nfc/NfcOemExtension.java b/nfc/java/android/nfc/NfcOemExtension.java index f6138a63fae4..6c02edd0eafa 100644 --- a/nfc/java/android/nfc/NfcOemExtension.java +++ b/nfc/java/android/nfc/NfcOemExtension.java @@ -18,15 +18,31 @@ package android.nfc; 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 @@ public final class NfcOemExtension { 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 @@ public final class NfcOemExtension { * @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 @@ -89,13 +244,11 @@ public final class NfcOemExtension { + "registering"); throw new IllegalArgumentException(); } - try { + NfcAdapter.callService(() -> { NfcAdapter.sService.registerOemExtensionCallback(mOemNfcExtensionCallback); mCallback = callback; mExecutor = executor; - } catch (RemoteException e) { - mAdapter.attemptDeadServiceRecovery(e); - } + }); } } @@ -117,13 +270,11 @@ public final class NfcOemExtension { Log.e(TAG, "Callback not registered"); throw new IllegalArgumentException(); } - try { + NfcAdapter.callService(() -> { NfcAdapter.sService.unregisterOemExtensionCallback(mOemNfcExtensionCallback); mCallback = null; mExecutor = null; - } catch (RemoteException e) { - mAdapter.attemptDeadServiceRecovery(e); - } + }); } } @@ -134,11 +285,7 @@ public final class NfcOemExtension { @FlaggedApi(Flags.FLAG_NFC_OEM_EXTENSION) @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public void clearPreference() { - try { - NfcAdapter.sService.clearPreference(); - } catch (RemoteException e) { - mAdapter.attemptDeadServiceRecovery(e); - } + NfcAdapter.callService(() -> NfcAdapter.sService.clearPreference()); } /** @@ -147,11 +294,7 @@ public final class NfcOemExtension { @FlaggedApi(Flags.FLAG_NFC_OEM_EXTENSION) @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public void synchronizeScreenState() { - try { - NfcAdapter.sService.setScreenState(); - } catch (RemoteException e) { - mAdapter.attemptDeadServiceRecovery(e); - } + NfcAdapter.callService(() -> NfcAdapter.sService.setScreenState()); } /** @@ -162,11 +305,20 @@ public final class NfcOemExtension { @FlaggedApi(Flags.FLAG_NFC_OEM_EXTENSION) @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public void maybeTriggerFirmwareUpdate() { - try { - NfcAdapter.sService.checkFirmware(); - } catch (RemoteException e) { - mAdapter.attemptDeadServiceRecovery(e); - } + 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 { @@ -184,5 +336,162 @@ public final class NfcOemExtension { } } } + @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 2fe2ce39813b..0605dbe130d3 100644 --- a/nfc/java/android/nfc/cardemulation/CardEmulation.java +++ b/nfc/java/android/nfc/cardemulation/CardEmulation.java @@ -23,6 +23,7 @@ import android.annotation.Nullable; 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; 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 @@ public final class CardEmulation { * 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>(); @@ -219,24 +237,9 @@ public final class CardEmulation { * <p class="note">Requires the {@link android.Manifest.permission#NFC} permission. */ public boolean isDefaultServiceForCategory(ComponentName service, String category) { - try { - return sService.isDefaultServiceForCategory(mContext.getUser().getIdentifier(), - service, category); - } catch (RemoteException e) { - // Try one more time - recoverService(); - if (sService == null) { - Log.e(TAG, "Failed to recover CardEmulationService."); - return false; - } - try { - return sService.isDefaultServiceForCategory(mContext.getUser().getIdentifier(), - service, category); - } catch (RemoteException ee) { - Log.e(TAG, "Failed to recover CardEmulationService."); - return false; - } - } + return callServiceReturn(() -> + sService.isDefaultServiceForCategory( + mContext.getUser().getIdentifier(), service, category), false); } /** @@ -251,24 +254,9 @@ public final class CardEmulation { * <p class="note">Requires the {@link android.Manifest.permission#NFC} permission. */ public boolean isDefaultServiceForAid(ComponentName service, String aid) { - try { - return sService.isDefaultServiceForAid(mContext.getUser().getIdentifier(), - service, aid); - } catch (RemoteException e) { - // Try one more time - recoverService(); - if (sService == null) { - Log.e(TAG, "Failed to recover CardEmulationService."); - return false; - } - try { - return sService.isDefaultServiceForAid(mContext.getUser().getIdentifier(), - service, aid); - } catch (RemoteException ee) { - Log.e(TAG, "Failed to reach CardEmulationService."); - return false; - } - } + return callServiceReturn(() -> + sService.isDefaultServiceForAid( + mContext.getUser().getIdentifier(), service, aid), false); } /** @@ -331,22 +319,8 @@ public final class CardEmulation { */ public int getSelectionModeForCategory(String category) { if (CATEGORY_PAYMENT.equals(category)) { - boolean paymentRegistered = false; - try { - paymentRegistered = sService.isDefaultPaymentRegistered(); - } catch (RemoteException e) { - recoverService(); - if (sService == null) { - Log.e(TAG, "Failed to recover CardEmulationService."); - return SELECTION_MODE_ALWAYS_ASK; - } - try { - paymentRegistered = sService.isDefaultPaymentRegistered(); - } catch (RemoteException ee) { - Log.e(TAG, "Failed to reach CardEmulationService."); - return SELECTION_MODE_ALWAYS_ASK; - } - } + boolean paymentRegistered = callServiceReturn(() -> + sService.isDefaultPaymentRegistered(), false); if (paymentRegistered) { return SELECTION_MODE_PREFER_DEFAULT; } else { @@ -369,13 +343,9 @@ public final class CardEmulation { @FlaggedApi(Flags.FLAG_NFC_OBSERVE_MODE) public boolean setShouldDefaultToObserveModeForService(@NonNull ComponentName service, boolean enable) { - try { - return sService.setShouldDefaultToObserveModeForService( - mContext.getUser().getIdentifier(), service, enable); - } catch (RemoteException e) { - Log.e(TAG, "Failed to reach CardEmulationService."); - } - return false; + return callServiceReturn(() -> + sService.setShouldDefaultToObserveModeForService( + mContext.getUser().getIdentifier(), service, enable), false); } /** @@ -396,27 +366,11 @@ public final class CardEmulation { @FlaggedApi(Flags.FLAG_NFC_READ_POLLING_LOOP) public boolean registerPollingLoopFilterForService(@NonNull ComponentName service, @NonNull String pollingLoopFilter, boolean autoTransact) { - pollingLoopFilter = validatePollingLoopFilter(pollingLoopFilter); - - try { - return sService.registerPollingLoopFilterForService(mContext.getUser().getIdentifier(), - service, pollingLoopFilter, autoTransact); - } catch (RemoteException e) { - // Try one more time - recoverService(); - if (sService == null) { - Log.e(TAG, "Failed to recover CardEmulationService."); - return false; - } - try { - return sService.registerPollingLoopFilterForService( - mContext.getUser().getIdentifier(), service, - pollingLoopFilter, autoTransact); - } catch (RemoteException ee) { - Log.e(TAG, "Failed to reach CardEmulationService."); - return false; - } - } + final String pollingLoopFilterV = validatePollingLoopFilter(pollingLoopFilter); + return callServiceReturn(() -> + sService.registerPollingLoopFilterForService( + mContext.getUser().getIdentifier(), service, pollingLoopFilterV, autoTransact), + false); } /** @@ -431,27 +385,10 @@ public final class CardEmulation { @FlaggedApi(Flags.FLAG_NFC_READ_POLLING_LOOP) public boolean removePollingLoopFilterForService(@NonNull ComponentName service, @NonNull String pollingLoopFilter) { - pollingLoopFilter = validatePollingLoopFilter(pollingLoopFilter); - - try { - return sService.removePollingLoopFilterForService(mContext.getUser().getIdentifier(), - service, pollingLoopFilter); - } catch (RemoteException e) { - // Try one more time - recoverService(); - if (sService == null) { - Log.e(TAG, "Failed to recover CardEmulationService."); - return false; - } - try { - return sService.removePollingLoopFilterForService( - mContext.getUser().getIdentifier(), service, - pollingLoopFilter); - } catch (RemoteException ee) { - Log.e(TAG, "Failed to reach CardEmulationService."); - return false; - } - } + final String pollingLoopFilterV = validatePollingLoopFilter(pollingLoopFilter); + return callServiceReturn(() -> + sService.removePollingLoopFilterForService( + mContext.getUser().getIdentifier(), service, pollingLoopFilterV), false); } @@ -477,28 +414,13 @@ public final class CardEmulation { @FlaggedApi(Flags.FLAG_NFC_READ_POLLING_LOOP) public boolean registerPollingLoopPatternFilterForService(@NonNull ComponentName service, @NonNull String pollingLoopPatternFilter, boolean autoTransact) { - pollingLoopPatternFilter = validatePollingLoopPatternFilter(pollingLoopPatternFilter); - - try { - return sService.registerPollingLoopPatternFilterForService( - mContext.getUser().getIdentifier(), - service, pollingLoopPatternFilter, autoTransact); - } catch (RemoteException e) { - // Try one more time - recoverService(); - if (sService == null) { - Log.e(TAG, "Failed to recover CardEmulationService."); - return false; - } - try { - return sService.registerPollingLoopPatternFilterForService( - mContext.getUser().getIdentifier(), service, - pollingLoopPatternFilter, autoTransact); - } catch (RemoteException ee) { - Log.e(TAG, "Failed to reach CardEmulationService."); - return false; - } - } + final String pollingLoopPatternFilterV = + validatePollingLoopPatternFilter(pollingLoopPatternFilter); + return callServiceReturn(() -> + sService.registerPollingLoopPatternFilterForService( + mContext.getUser().getIdentifier(), service, pollingLoopPatternFilterV, + autoTransact), + false); } /** @@ -518,27 +440,11 @@ public final class CardEmulation { @FlaggedApi(Flags.FLAG_NFC_READ_POLLING_LOOP) public boolean removePollingLoopPatternFilterForService(@NonNull ComponentName service, @NonNull String pollingLoopPatternFilter) { - pollingLoopPatternFilter = validatePollingLoopPatternFilter(pollingLoopPatternFilter); - - try { - return sService.removePollingLoopPatternFilterForService( - mContext.getUser().getIdentifier(), service, pollingLoopPatternFilter); - } catch (RemoteException e) { - // Try one more time - recoverService(); - if (sService == null) { - Log.e(TAG, "Failed to recover CardEmulationService."); - return false; - } - try { - return sService.removePollingLoopPatternFilterForService( - mContext.getUser().getIdentifier(), service, - pollingLoopPatternFilter); - } catch (RemoteException ee) { - Log.e(TAG, "Failed to reach CardEmulationService."); - return false; - } - } + final String pollingLoopPatternFilterV = + validatePollingLoopPatternFilter(pollingLoopPatternFilter); + return callServiceReturn(() -> + sService.removePollingLoopPatternFilterForService( + mContext.getUser().getIdentifier(), service, pollingLoopPatternFilterV), false); } /** @@ -563,25 +469,10 @@ public final class CardEmulation { */ public boolean registerAidsForService(ComponentName service, String category, List<String> aids) { - AidGroup aidGroup = new AidGroup(aids, category); - try { - return sService.registerAidGroupForService(mContext.getUser().getIdentifier(), - service, aidGroup); - } catch (RemoteException e) { - // Try one more time - recoverService(); - if (sService == null) { - Log.e(TAG, "Failed to recover CardEmulationService."); - return false; - } - try { - return sService.registerAidGroupForService(mContext.getUser().getIdentifier(), - service, aidGroup); - } catch (RemoteException ee) { - Log.e(TAG, "Failed to reach CardEmulationService."); - return false; - } - } + final AidGroup aidGroup = new AidGroup(aids, category); + return callServiceReturn(() -> + sService.registerAidGroupForService( + mContext.getUser().getIdentifier(), service, aidGroup), false); } /** @@ -603,27 +494,9 @@ public final class CardEmulation { @RequiresPermission(android.Manifest.permission.NFC) @NonNull public boolean unsetOffHostForService(@NonNull ComponentName service) { - NfcAdapter adapter = NfcAdapter.getDefaultAdapter(mContext); - if (adapter == null) { - return false; - } - - try { - return sService.unsetOffHostForService(mContext.getUser().getIdentifier(), service); - } catch (RemoteException e) { - // Try one more time - recoverService(); - if (sService == null) { - Log.e(TAG, "Failed to recover CardEmulationService."); - return false; - } - try { - return sService.unsetOffHostForService(mContext.getUser().getIdentifier(), service); - } catch (RemoteException ee) { - Log.e(TAG, "Failed to reach CardEmulationService."); - return false; - } - } + return callServiceReturn(() -> + sService.unsetOffHostForService( + mContext.getUser().getIdentifier(), service), false); } /** @@ -662,8 +535,6 @@ public final class CardEmulation { @NonNull public boolean setOffHostForService(@NonNull ComponentName service, @NonNull String offHostSecureElement) { - boolean validSecureElement = false; - NfcAdapter adapter = NfcAdapter.getDefaultAdapter(mContext); if (adapter == null || offHostSecureElement == null) { return false; @@ -684,25 +555,10 @@ public final class CardEmulation { } else if (offHostSecureElement.equals("SIM")) { offHostSecureElement = "SIM1"; } - - try { - return sService.setOffHostForService(mContext.getUser().getIdentifier(), service, - offHostSecureElement); - } catch (RemoteException e) { - // Try one more time - recoverService(); - if (sService == null) { - Log.e(TAG, "Failed to recover CardEmulationService."); - return false; - } - try { - return sService.setOffHostForService(mContext.getUser().getIdentifier(), service, - offHostSecureElement); - } catch (RemoteException ee) { - Log.e(TAG, "Failed to reach CardEmulationService."); - return false; - } - } + final String offHostSecureElementV = new String(offHostSecureElement); + return callServiceReturn(() -> + sService.setOffHostForService( + mContext.getUser().getIdentifier(), service, offHostSecureElementV), false); } /** @@ -720,25 +576,10 @@ public final class CardEmulation { * @return The list of AIDs registered for this category, or null if it couldn't be found. */ public List<String> getAidsForService(ComponentName service, String category) { - try { - AidGroup group = sService.getAidGroupForService(mContext.getUser().getIdentifier(), - service, category); - return (group != null ? group.getAids() : null); - } catch (RemoteException e) { - recoverService(); - if (sService == null) { - Log.e(TAG, "Failed to recover CardEmulationService."); - return null; - } - try { - AidGroup group = sService.getAidGroupForService(mContext.getUser().getIdentifier(), - service, category); - return (group != null ? group.getAids() : null); - } catch (RemoteException ee) { - Log.e(TAG, "Failed to recover CardEmulationService."); - return null; - } - } + AidGroup group = callServiceReturn(() -> + sService.getAidGroupForService( + mContext.getUser().getIdentifier(), service, category), null); + return (group != null ? group.getAids() : null); } /** @@ -757,24 +598,9 @@ public final class CardEmulation { * @return whether the group was successfully removed. */ public boolean removeAidsForService(ComponentName service, String category) { - try { - return sService.removeAidGroupForService(mContext.getUser().getIdentifier(), service, - category); - } catch (RemoteException e) { - // Try one more time - recoverService(); - if (sService == null) { - Log.e(TAG, "Failed to recover CardEmulationService."); - return false; - } - try { - return sService.removeAidGroupForService(mContext.getUser().getIdentifier(), - service, category); - } catch (RemoteException ee) { - Log.e(TAG, "Failed to reach CardEmulationService."); - return false; - } - } + return callServiceReturn(() -> + sService.removeAidGroupForService( + mContext.getUser().getIdentifier(), service, category), false); } /** @@ -811,22 +637,7 @@ public final class CardEmulation { if (activity == null || service == null) { throw new NullPointerException("activity or service or category is null"); } - try { - return sService.setPreferredService(service); - } catch (RemoteException e) { - // Try one more time - recoverService(); - if (sService == null) { - Log.e(TAG, "Failed to recover CardEmulationService."); - return false; - } - try { - return sService.setPreferredService(service); - } catch (RemoteException ee) { - Log.e(TAG, "Failed to reach CardEmulationService."); - return false; - } - } + return callServiceReturn(() -> sService.setPreferredService(service), false); } /** @@ -843,22 +654,7 @@ public final class CardEmulation { if (activity == null) { throw new NullPointerException("activity is null"); } - try { - return sService.unsetPreferredService(); - } catch (RemoteException e) { - // Try one more time - recoverService(); - if (sService == null) { - Log.e(TAG, "Failed to recover CardEmulationService."); - return false; - } - try { - return sService.unsetPreferredService(); - } catch (RemoteException ee) { - Log.e(TAG, "Failed to reach CardEmulationService."); - return false; - } - } + return callServiceReturn(() -> sService.unsetPreferredService(), false); } /** @@ -872,21 +668,7 @@ public final class CardEmulation { * @return whether AID prefix registering is supported on this device. */ public boolean supportsAidPrefixRegistration() { - try { - return sService.supportsAidPrefixRegistration(); - } catch (RemoteException e) { - recoverService(); - if (sService == null) { - Log.e(TAG, "Failed to recover CardEmulationService."); - return false; - } - try { - return sService.supportsAidPrefixRegistration(); - } catch (RemoteException ee) { - Log.e(TAG, "Failed to reach CardEmulationService."); - return false; - } - } + return callServiceReturn(() -> sService.supportsAidPrefixRegistration(), false); } /** @@ -897,25 +679,9 @@ public final class CardEmulation { @RequiresPermission(android.Manifest.permission.NFC_PREFERRED_PAYMENT_INFO) @Nullable public List<String> getAidsForPreferredPaymentService() { - try { - ApduServiceInfo serviceInfo = sService.getPreferredPaymentService( - mContext.getUser().getIdentifier()); - return (serviceInfo != null ? serviceInfo.getAids() : null); - } catch (RemoteException e) { - recoverService(); - if (sService == null) { - Log.e(TAG, "Failed to recover CardEmulationService."); - throw e.rethrowFromSystemServer(); - } - try { - ApduServiceInfo serviceInfo = - sService.getPreferredPaymentService(mContext.getUser().getIdentifier()); - return (serviceInfo != null ? serviceInfo.getAids() : null); - } catch (RemoteException ee) { - Log.e(TAG, "Failed to recover CardEmulationService."); - throw e.rethrowFromSystemServer(); - } - } + ApduServiceInfo serviceInfo = callServiceReturn(() -> + sService.getPreferredPaymentService(mContext.getUser().getIdentifier()), null); + return (serviceInfo != null ? serviceInfo.getAids() : null); } /** @@ -944,40 +710,16 @@ public final class CardEmulation { @RequiresPermission(android.Manifest.permission.NFC_PREFERRED_PAYMENT_INFO) @Nullable public String getRouteDestinationForPreferredPaymentService() { - try { - ApduServiceInfo serviceInfo = sService.getPreferredPaymentService( - mContext.getUser().getIdentifier()); - if (serviceInfo != null) { - if (!serviceInfo.isOnHost()) { - return serviceInfo.getOffHostSecureElement() == null ? - "OffHost" : serviceInfo.getOffHostSecureElement(); - } - return "Host"; - } - return null; - } catch (RemoteException e) { - recoverService(); - if (sService == null) { - Log.e(TAG, "Failed to recover CardEmulationService."); - throw e.rethrowFromSystemServer(); - } - try { - ApduServiceInfo serviceInfo = - sService.getPreferredPaymentService(mContext.getUser().getIdentifier()); - if (serviceInfo != null) { - if (!serviceInfo.isOnHost()) { - return serviceInfo.getOffHostSecureElement() == null ? - "Offhost" : serviceInfo.getOffHostSecureElement(); - } - return "Host"; - } - return null; - - } catch (RemoteException ee) { - Log.e(TAG, "Failed to recover CardEmulationService."); - throw e.rethrowFromSystemServer(); + ApduServiceInfo serviceInfo = callServiceReturn(() -> + sService.getPreferredPaymentService(mContext.getUser().getIdentifier()), null); + if (serviceInfo != null) { + if (!serviceInfo.isOnHost()) { + return serviceInfo.getOffHostSecureElement() == null ? + "OffHost" : serviceInfo.getOffHostSecureElement(); } + return "Host"; } + return null; } /** @@ -995,115 +737,44 @@ public final class CardEmulation { @RequiresPermission(android.Manifest.permission.NFC_PREFERRED_PAYMENT_INFO) @Nullable public CharSequence getDescriptionForPreferredPaymentService() { - try { - ApduServiceInfo serviceInfo = sService.getPreferredPaymentService( - mContext.getUser().getIdentifier()); - return (serviceInfo != null ? serviceInfo.getDescription() : null); - } catch (RemoteException e) { - recoverService(); - if (sService == null) { - Log.e(TAG, "Failed to recover CardEmulationService."); - throw e.rethrowFromSystemServer(); - } - try { - ApduServiceInfo serviceInfo = - sService.getPreferredPaymentService(mContext.getUser().getIdentifier()); - return (serviceInfo != null ? serviceInfo.getDescription() : null); - } catch (RemoteException ee) { - Log.e(TAG, "Failed to recover CardEmulationService."); - throw e.rethrowFromSystemServer(); - } - } + ApduServiceInfo serviceInfo = callServiceReturn(() -> + sService.getPreferredPaymentService(mContext.getUser().getIdentifier()), null); + return (serviceInfo != null ? serviceInfo.getDescription() : null); } /** * @hide */ public boolean setDefaultServiceForCategory(ComponentName service, String category) { - try { - return sService.setDefaultServiceForCategory(mContext.getUser().getIdentifier(), - service, category); - } catch (RemoteException e) { - // Try one more time - recoverService(); - if (sService == null) { - Log.e(TAG, "Failed to recover CardEmulationService."); - return false; - } - try { - return sService.setDefaultServiceForCategory(mContext.getUser().getIdentifier(), - service, category); - } catch (RemoteException ee) { - Log.e(TAG, "Failed to reach CardEmulationService."); - return false; - } - } + return callServiceReturn(() -> + sService.setDefaultServiceForCategory( + mContext.getUser().getIdentifier(), service, category), false); } /** * @hide */ public boolean setDefaultForNextTap(ComponentName service) { - try { - return sService.setDefaultForNextTap(mContext.getUser().getIdentifier(), service); - } catch (RemoteException e) { - // Try one more time - recoverService(); - if (sService == null) { - Log.e(TAG, "Failed to recover CardEmulationService."); - return false; - } - try { - return sService.setDefaultForNextTap(mContext.getUser().getIdentifier(), service); - } catch (RemoteException ee) { - Log.e(TAG, "Failed to reach CardEmulationService."); - return false; - } - } + return callServiceReturn(() -> + sService.setDefaultForNextTap( + mContext.getUser().getIdentifier(), service), false); } /** * @hide */ public boolean setDefaultForNextTap(int userId, ComponentName service) { - try { - return sService.setDefaultForNextTap(userId, service); - } catch (RemoteException e) { - // Try one more time - recoverService(); - if (sService == null) { - Log.e(TAG, "Failed to recover CardEmulationService."); - return false; - } - try { - return sService.setDefaultForNextTap(userId, service); - } catch (RemoteException ee) { - Log.e(TAG, "Failed to reach CardEmulationService."); - return false; - } - } + return callServiceReturn(() -> + sService.setDefaultForNextTap(userId, service), false); } /** * @hide */ public List<ApduServiceInfo> getServices(String category) { - try { - return sService.getServices(mContext.getUser().getIdentifier(), category); - } catch (RemoteException e) { - // Try one more time - recoverService(); - if (sService == null) { - Log.e(TAG, "Failed to recover CardEmulationService."); - return null; - } - try { - return sService.getServices(mContext.getUser().getIdentifier(), category); - } catch (RemoteException ee) { - Log.e(TAG, "Failed to reach CardEmulationService."); - return null; - } - } + return callServiceReturn(() -> + sService.getServices( + mContext.getUser().getIdentifier(), category), null); } /** @@ -1117,22 +788,8 @@ public final class CardEmulation { @FlaggedApi(Flags.FLAG_ENABLE_NFC_MAINLINE) @NonNull public List<ApduServiceInfo> getServices(@NonNull String category, @UserIdInt int userId) { - try { - return sService.getServices(userId, category); - } catch (RemoteException e) { - // Try one more time - recoverService(); - if (sService == null) { - Log.e(TAG, "Failed to recover CardEmulationService."); - return null; - } - try { - return sService.getServices(userId, category); - } catch (RemoteException ee) { - Log.e(TAG, "Failed to reach CardEmulationService."); - return null; - } - } + return callServiceReturn(() -> + sService.getServices(userId, category), null); } /** @@ -1222,29 +879,26 @@ public final class CardEmulation { if (service == null) { throw new NullPointerException("activity or service or category is null"); } - try { - return sService.setServiceEnabledForCategoryOther(userId, service, status); - } catch (RemoteException e) { - // Try one more time - recoverService(); - if (sService == null) { - Log.e(TAG, "Failed to recover CardEmulationService."); - return false; - } - try { - return sService.setServiceEnabledForCategoryOther(userId, service, status); - } catch (RemoteException ee) { - Log.e(TAG, "Failed to reach CardEmulationService."); - return false; - } - } + return callServiceReturn(() -> + 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> @@ -1252,39 +906,40 @@ public final class CardEmulation { * 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."); } - try { - return sService.overrideRoutingTable(UserHandle.myUserId(), protocol, technology); - } catch (RemoteException e) { - // Try one more time - recoverService(); - if (sService == null) { - Log.e(TAG, "Failed to recover CardEmulationService."); - return false; - } - try { - return sService.overrideRoutingTable(UserHandle.myUserId(), protocol, technology); - } catch (RemoteException ee) { - Log.e(TAG, "Failed to reach CardEmulationService."); - return false; - } + if (protocol == null && technology == null) { + throw new IllegalArgumentException(("Both Protocol and Technology are null.")); } + callService(() -> + sService.overrideRoutingTable( + mContext.getUser().getIdentifier(), + protocol, + technology, + mContext.getPackageName())); } /** @@ -1292,38 +947,19 @@ public final class CardEmulation { * 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."); } - try { - return sService.recoverRoutingTable(UserHandle.myUserId()); - } catch (RemoteException e) { - // Try one more time - recoverService(); - if (sService == null) { - Log.e(TAG, "Failed to recover CardEmulationService."); - return false; - } - try { - return sService.recoverRoutingTable(UserHandle.myUserId()); - } catch (RemoteException ee) { - Log.e(TAG, "Failed to reach CardEmulationService."); - return false; - } - } - } - - void recoverService() { - NfcAdapter adapter = NfcAdapter.getDefaultAdapter(mContext); - sService = adapter.getCardEmulationService(); + callService(() -> + sService.recoverRoutingTable( + mContext.getUser().getIdentifier())); } /** @@ -1351,4 +987,53 @@ public final class CardEmulation { return ComponentName.unflattenFromString(defaultPaymentComponent); } + + /** @hide */ + interface ServiceCall { + void call() throws RemoteException; + } + /** @hide */ + public static void callService(ServiceCall call) { + try { + if (sService == null) { + NfcAdapter.attemptDeadServiceRecovery( + new RemoteException("NFC CardEmulation Service is null")); + sService = NfcAdapter.getCardEmulationService(); + } + call.call(); + } catch (RemoteException e) { + NfcAdapter.attemptDeadServiceRecovery(e); + sService = NfcAdapter.getCardEmulationService(); + try { + call.call(); + } catch (RemoteException ee) { + ee.rethrowAsRuntimeException(); + } + } + } + /** @hide */ + interface ServiceCallReturn<T> { + T call() throws RemoteException; + } + /** @hide */ + public static <T> T callServiceReturn(ServiceCallReturn<T> call, T defaultReturn) { + try { + if (sService == null) { + NfcAdapter.attemptDeadServiceRecovery( + new RemoteException("NFC CardEmulation Service is null")); + sService = NfcAdapter.getCardEmulationService(); + } + return call.call(); + } catch (RemoteException e) { + NfcAdapter.attemptDeadServiceRecovery(e); + sService = NfcAdapter.getCardEmulationService(); + // Try one more time + try { + return call.call(); + } catch (RemoteException ee) { + ee.rethrowAsRuntimeException(); + } + } + return defaultReturn; + } } diff --git a/nfc/java/android/nfc/cardemulation/HostApduService.java b/nfc/java/android/nfc/cardemulation/HostApduService.java index c3c74a6fd265..cd8e19c54565 100644 --- a/nfc/java/android/nfc/cardemulation/HostApduService.java +++ b/nfc/java/android/nfc/cardemulation/HostApduService.java @@ -242,6 +242,16 @@ public abstract class HostApduService extends Service { /** * @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 @@ public abstract class HostApduService extends Service { 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 @@ public abstract class HostApduService extends Service { * @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 b242a76ffae4..0fda91d2b48e 100644 --- a/nfc/java/android/nfc/flags.aconfig +++ b/nfc/java/android/nfc/flags.aconfig @@ -2,6 +2,14 @@ package: "android.nfc" 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" @@ -110,3 +118,26 @@ flag { bug: "321311407" } +flag { + name: "nfc_persist_log" + is_exported: true + namespace: "nfc" + description: "Enable NFC persistent log support" + 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/nfc/lint-baseline.xml b/nfc/lint-baseline.xml index 1dfdd29e480a..d0f797e5c6b8 100644 --- a/nfc/lint-baseline.xml +++ b/nfc/lint-baseline.xml @@ -210,4 +210,59 @@ column="23"/> </issue> + <issue + id="FlaggedApi" + message="Method `PollingFrame()` is a flagged API and should be inside an `if (Flags.nfcReadPollingLoop())` check (or annotate the surrounding method `handleMessage` with `@FlaggedApi(Flags.FLAG_NFC_READ_POLLING_LOOP) to transfer requirement to caller`)" + errorLine1=" pollingFrames.add(new PollingFrame(frame));" + errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~"> + <location + file="frameworks/base/nfc/java/android/nfc/cardemulation/HostApduService.java" + line="335" + column="43"/> + </issue> + + <issue + id="FlaggedApi" + message="Method `processPollingFrames()` is a flagged API and should be inside an `if (Flags.nfcReadPollingLoop())` check (or annotate the surrounding method `handleMessage` with `@FlaggedApi(Flags.FLAG_NFC_READ_POLLING_LOOP) to transfer requirement to caller`)" + errorLine1=" processPollingFrames(pollingFrames);" + errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> + <location + file="frameworks/base/nfc/java/android/nfc/cardemulation/HostApduService.java" + line="337" + column="21"/> + </issue> + + <issue + id="FlaggedApi" + message="Method `NfcOemExtension()` is a flagged API and should be inside an `if (Flags.nfcOemExtension())` check (or annotate the surrounding method `NfcAdapter` with `@FlaggedApi(Flags.FLAG_NFC_OEM_EXTENSION) to transfer requirement to caller`)" + errorLine1=" mNfcOemExtension = new NfcOemExtension(mContext, this);" + errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> + <location + file="frameworks/base/nfc/java/android/nfc/NfcAdapter.java" + line="895" + column="28"/> + </issue> + + <issue + id="FlaggedApi" + message="Method `onVendorNciResponse()` is a flagged API and should be inside an `if (Flags.nfcVendorCmd())` check (or annotate the surrounding method `onVendorResponseReceived` with `@FlaggedApi(Flags.FLAG_NFC_VENDOR_CMD) to transfer requirement to caller`)" + errorLine1=" executor.execute(() -> callback.onVendorNciResponse(gid, oid, payload));" + errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> + <location + file="frameworks/base/nfc/java/android/nfc/NfcVendorNciCallbackListener.java" + line="88" + column="44"/> + </issue> + + <issue + id="FlaggedApi" + message="Method `onVendorNciNotification()` is a flagged API and should be inside an `if (Flags.nfcVendorCmd())` check (or annotate the surrounding method `onVendorNotificationReceived` with `@FlaggedApi(Flags.FLAG_NFC_VENDOR_CMD) to transfer requirement to caller`)" + errorLine1=" executor.execute(() -> callback.onVendorNciNotification(gid, oid, payload));" + errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> + <location + file="frameworks/base/nfc/java/android/nfc/NfcVendorNciCallbackListener.java" + line="106" + column="44"/> + </issue> + </issues>
\ No newline at end of file diff --git a/packages/BackupRestoreConfirmation/res/values-el/strings.xml b/packages/BackupRestoreConfirmation/res/values-el/strings.xml index 02234990606c..7142edf17c69 100644 --- a/packages/BackupRestoreConfirmation/res/values-el/strings.xml +++ b/packages/BackupRestoreConfirmation/res/values-el/strings.xml @@ -16,7 +16,7 @@ <resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> - <string name="backup_confirm_title" msgid="827563724209303345">"Πλήρης δημιουργία αντιγράφων ασφαλείας"</string> + <string name="backup_confirm_title" msgid="827563724209303345">"Πλήρης δημιουργία αντιγράφου ασφαλείας"</string> <string name="restore_confirm_title" msgid="5469365809567486602">"Πλήρης επαναφορά"</string> <string name="backup_confirm_text" msgid="1878021282758896593">"Έχει ζητηθεί ένα πλήρες αντίγραφο ασφαλείας όλων των δεδομένων σε έναν συνδεδεμένο επιτραπέζιο υπολογιστή. Θέλετε να επιτραπεί αυτή η ενέργεια;\n\nΑν δεν έχετε ζητήσει οι ίδιοι αυτό το αντίγραφο ασφαλείας, μην επιτρέψετε την ενέργεια."</string> <string name="allow_backup_button_label" msgid="4217228747769644068">"Δημιουργία αντιγράφων ασφαλείας για τα δεδομένα μου"</string> diff --git a/packages/CompanionDeviceManager/src/com/android/companiondevicemanager/CompanionAssociationActivity.java b/packages/CompanionDeviceManager/src/com/android/companiondevicemanager/CompanionAssociationActivity.java index f98908cf2d56..5770c5104dee 100644 --- a/packages/CompanionDeviceManager/src/com/android/companiondevicemanager/CompanionAssociationActivity.java +++ b/packages/CompanionDeviceManager/src/com/android/companiondevicemanager/CompanionAssociationActivity.java @@ -27,6 +27,8 @@ import static android.view.WindowManager.LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTE import static com.android.companiondevicemanager.CompanionDeviceDiscoveryService.DiscoveryState; import static com.android.companiondevicemanager.CompanionDeviceDiscoveryService.DiscoveryState.FINISHED_TIMEOUT; +import static com.android.companiondevicemanager.CompanionDeviceDiscoveryService.LOCK; +import static com.android.companiondevicemanager.CompanionDeviceDiscoveryService.sDiscoveryStarted; import static com.android.companiondevicemanager.CompanionDeviceResources.PROFILE_ICONS; import static com.android.companiondevicemanager.CompanionDeviceResources.PROFILE_NAMES; import static com.android.companiondevicemanager.CompanionDeviceResources.PROFILE_PERMISSIONS; @@ -326,8 +328,12 @@ public class CompanionAssociationActivity extends FragmentActivity implements private void onDiscoveryStateChanged(DiscoveryState newState) { if (newState == FINISHED_TIMEOUT && CompanionDeviceDiscoveryService.getScanResult().getValue().isEmpty()) { - cancel(/* discoveryTimeOut */ true, - /* userRejected */ false, /* internalError */ false); + synchronized (LOCK) { + if (sDiscoveryStarted) { + cancel(/* discoveryTimeOut */ true, + /* userRejected */ false, /* internalError */ false); + } + } } } @@ -568,6 +574,8 @@ public class CompanionAssociationActivity extends FragmentActivity implements updateSingleDeviceUi(); + if (mRequest.isSkipPrompt()) return; + mSummary.setVisibility(View.VISIBLE); mButtonAllow.setVisibility(View.VISIBLE); mButtonNotAllow.setVisibility(View.VISIBLE); diff --git a/packages/CompanionDeviceManager/src/com/android/companiondevicemanager/CompanionDeviceDiscoveryService.java b/packages/CompanionDeviceManager/src/com/android/companiondevicemanager/CompanionDeviceDiscoveryService.java index e809433a1261..6c1bc4ededce 100644 --- a/packages/CompanionDeviceManager/src/com/android/companiondevicemanager/CompanionDeviceDiscoveryService.java +++ b/packages/CompanionDeviceManager/src/com/android/companiondevicemanager/CompanionDeviceDiscoveryService.java @@ -90,9 +90,6 @@ public class CompanionDeviceDiscoveryService extends Service { new MutableLiveData<>(Collections.emptyList()); private static MutableLiveData<DiscoveryState> sStateLiveData = new MutableLiveData<>(DiscoveryState.NOT_STARTED); - private static final Object LOCK = new Object(); - @GuardedBy("LOCK") - private static boolean sDiscoveryStarted = false; private BluetoothManager mBtManager; private BluetoothAdapter mBtAdapter; @@ -109,6 +106,10 @@ public class CompanionDeviceDiscoveryService extends Service { private boolean mStopAfterFirstMatch; + static final Object LOCK = new Object(); + @GuardedBy("LOCK") + static boolean sDiscoveryStarted = false; + /** * A state enum for devices' discovery. */ @@ -127,6 +128,7 @@ public class CompanionDeviceDiscoveryService extends Service { return false; } } + sScanResultsLiveData.setValue(Collections.emptyList()); requireNonNull(associationRequest); final Intent intent = new Intent(context, CompanionDeviceDiscoveryService.class); intent.setAction(ACTION_START_DISCOVERY); @@ -192,7 +194,6 @@ public class CompanionDeviceDiscoveryService extends Service { sDiscoveryStarted = true; } mStopAfterFirstMatch = request.isSingleDevice(); - sScanResultsLiveData.setValue(Collections.emptyList()); sStateLiveData.setValue(DiscoveryState.IN_PROGRESS); final List<DeviceFilter<?>> allFilters = request.getDeviceFilters(); diff --git a/packages/CrashRecovery/aconfig/flags.aconfig b/packages/CrashRecovery/aconfig/flags.aconfig index 80412321d60b..225f8c685fe1 100644 --- a/packages/CrashRecovery/aconfig/flags.aconfig +++ b/packages/CrashRecovery/aconfig/flags.aconfig @@ -26,8 +26,8 @@ flag { } flag { - name: "reenable_settings_resets" + name: "deprecate_flags_and_settings_resets" namespace: "modularization" - description: "Re-enables settings resets only, deletes flag resets" + description: "Deletes flag and settings resets" bug: "333847376" } diff --git a/packages/CredentialManager/res/values-be/strings.xml b/packages/CredentialManager/res/values-be/strings.xml index 2d98870eaec6..2976e66f800f 100644 --- a/packages/CredentialManager/res/values-be/strings.xml +++ b/packages/CredentialManager/res/values-be/strings.xml @@ -52,7 +52,7 @@ <string name="create_passkey_in_other_device_title" msgid="2360053098931886245">"Стварыць ключ доступу на іншай прыладзе?"</string> <string name="save_password_on_other_device_title" msgid="5829084591948321207">"Захаваць пароль на іншай прыладзе?"</string> <string name="save_sign_in_on_other_device_title" msgid="2827990118560134692">"Захаваць спосаб уваходу на іншай прыладзе?"</string> - <string name="use_provider_for_all_title" msgid="4201020195058980757">"Выкарыстоўваць папку \"<xliff:g id="PROVIDERINFODISPLAYNAME">%1$s</xliff:g>\" для ўсіх спосабаў уваходу?"</string> + <string name="use_provider_for_all_title" msgid="4201020195058980757">"Выкарыстоўваць <xliff:g id="PROVIDERINFODISPLAYNAME">%1$s</xliff:g> для ўсіх спосабаў уваходу?"</string> <string name="use_provider_for_all_description" msgid="1998772715863958997">"Каб вам было прасцей уваходзіць у сістэму, вашы паролі і ключы доступу будуць захоўвацца ў менеджары пароляў для <xliff:g id="USERNAME">%1$s</xliff:g>."</string> <string name="set_as_default" msgid="4415328591568654603">"Выкарыстоўваць стандартна"</string> <string name="settings" msgid="6536394145760913145">"Налады"</string> diff --git a/packages/CredentialManager/res/values-eu/strings.xml b/packages/CredentialManager/res/values-eu/strings.xml index 6a4974de2cb6..66ad31b3927c 100644 --- a/packages/CredentialManager/res/values-eu/strings.xml +++ b/packages/CredentialManager/res/values-eu/strings.xml @@ -52,7 +52,7 @@ <string name="create_passkey_in_other_device_title" msgid="2360053098931886245">"Beste gailu batean sarbide-gako bat sortu nahi duzu?"</string> <string name="save_password_on_other_device_title" msgid="5829084591948321207">"Beste gailu batean pasahitza gorde nahi duzu?"</string> <string name="save_sign_in_on_other_device_title" msgid="2827990118560134692">"Beste gailu batean saioa hasteko modua gorde nahi duzu?"</string> - <string name="use_provider_for_all_title" msgid="4201020195058980757">"<xliff:g id="PROVIDERINFODISPLAYNAME">%1$s</xliff:g> erabili nahi duzu kredentzial guztietarako?"</string> + <string name="use_provider_for_all_title" msgid="4201020195058980757">"<xliff:g id="PROVIDERINFODISPLAYNAME">%1$s</xliff:g> erabili nahi duzu beti saioa hasteko?"</string> <string name="use_provider_for_all_description" msgid="1998772715863958997">"<xliff:g id="USERNAME">%1$s</xliff:g> erabiltzailearen pasahitz-kudeatzaile honek pasahitzak eta sarbide-gakoak gordeko ditu saioa erraz has dezazun"</string> <string name="set_as_default" msgid="4415328591568654603">"Ezarri lehenetsi gisa"</string> <string name="settings" msgid="6536394145760913145">"Ezarpenak"</string> diff --git a/packages/CredentialManager/res/values-kn/strings.xml b/packages/CredentialManager/res/values-kn/strings.xml index 897f444af2c5..ffbe7c8c60f9 100644 --- a/packages/CredentialManager/res/values-kn/strings.xml +++ b/packages/CredentialManager/res/values-kn/strings.xml @@ -53,7 +53,7 @@ <string name="save_password_on_other_device_title" msgid="5829084591948321207">"ಇನ್ನೊಂದು ಸಾಧನದಲ್ಲಿ ಪಾಸ್ವರ್ಡ್ ಉಳಿಸಬೇಕೆ?"</string> <string name="save_sign_in_on_other_device_title" msgid="2827990118560134692">"ಮತ್ತೊಂದು ಸಾಧನದಲ್ಲಿ ಸೈನ್-ಇನ್ ಅನ್ನು ಉಳಿಸಬೇಕೆ?"</string> <string name="use_provider_for_all_title" msgid="4201020195058980757">"ನಿಮ್ಮ ಎಲ್ಲಾ ಸೈನ್-ಇನ್ಗಳಿಗಾಗಿ <xliff:g id="PROVIDERINFODISPLAYNAME">%1$s</xliff:g> ಅನ್ನು ಬಳಸಬೇಕೇ?"</string> - <string name="use_provider_for_all_description" msgid="1998772715863958997">"<xliff:g id="USERNAME">%1$s</xliff:g> ಗಾಗಿ ಈ ಪಾಸ್ವರ್ಡ್ ನಿರ್ವಾಹಕವು ನಿಮಗೆ ಸುಲಭವಾಗಿ ಸೈನ್ ಇನ್ ಮಾಡುವುದಕ್ಕೆ ಸಹಾಯ ಮಾಡಲು ನಿಮ್ಮ ಪಾಸ್ವರ್ಡ್ಗಳು ಮತ್ತು ಪಾಸ್ಕೀಗಳನ್ನು ಸಂಗ್ರಹಿಸುತ್ತದೆ"</string> + <string name="use_provider_for_all_description" msgid="1998772715863958997">"<xliff:g id="USERNAME">%1$s</xliff:g> ಗಾಗಿ ಈ ಪಾಸ್ವರ್ಡ್ ನಿರ್ವಾಹಕವು ನಿಮಗೆ ಸುಲಭವಾಗಿ ಸೈನ್ ಇನ್ ಮಾಡುವುದಕ್ಕೆ ಸಹಾಯ ಮಾಡಲು ನಿಮ್ಮ ಪಾಸ್ವರ್ಡ್ಗಳು ಮತ್ತು ಪಾಸ್ಕೀಗಳನ್ನು ಸ್ಟೋರ್ ಮಾಡುತ್ತದೆ"</string> <string name="set_as_default" msgid="4415328591568654603">"ಡೀಫಾಲ್ಟ್ ಆಗಿ ಸೆಟ್ ಮಾಡಿ"</string> <string name="settings" msgid="6536394145760913145">"ಸೆಟ್ಟಿಂಗ್ಗಳು"</string> <string name="use_once" msgid="9027366575315399714">"ಒಂದು ಬಾರಿ ಬಳಸಿ"</string> diff --git a/packages/CredentialManager/res/values-ky/strings.xml b/packages/CredentialManager/res/values-ky/strings.xml index 4172b51f1a77..f54e1b2184eb 100644 --- a/packages/CredentialManager/res/values-ky/strings.xml +++ b/packages/CredentialManager/res/values-ky/strings.xml @@ -52,7 +52,7 @@ <string name="create_passkey_in_other_device_title" msgid="2360053098931886245">"Башка түзмөктө киргизүүчү ачкычты түзөсүзбү?"</string> <string name="save_password_on_other_device_title" msgid="5829084591948321207">"Сырсөздү башка түзмөктө сактайсызбы?"</string> <string name="save_sign_in_on_other_device_title" msgid="2827990118560134692">"Кирүү маалыматын башка түзмөктө сактайсызбы?"</string> - <string name="use_provider_for_all_title" msgid="4201020195058980757">"<xliff:g id="PROVIDERINFODISPLAYNAME">%1$s</xliff:g> бардык аккаунттарга кирүү үчүн колдонулсунбу?"</string> + <string name="use_provider_for_all_title" msgid="4201020195058980757">"<xliff:g id="PROVIDERINFODISPLAYNAME">%1$s</xliff:g> бардык аккаунттарга кирүү үчүн колдоносузбу?"</string> <string name="use_provider_for_all_description" msgid="1998772715863958997">"Сырсөздөрүңүздү жана киргизүүчү ачкычтарыңызды <xliff:g id="USERNAME">%1$s</xliff:g> аккаунтуңуздагы сырсөздөрдү башкаргычка сактап коюп, каалаган убакта колдоно берсеңиз болот"</string> <string name="set_as_default" msgid="4415328591568654603">"Демейки катары коюу"</string> <string name="settings" msgid="6536394145760913145">"Параметрлер"</string> diff --git a/packages/CredentialManager/res/values-mr/strings.xml b/packages/CredentialManager/res/values-mr/strings.xml index 7eebec596bce..10b651b82ebb 100644 --- a/packages/CredentialManager/res/values-mr/strings.xml +++ b/packages/CredentialManager/res/values-mr/strings.xml @@ -52,7 +52,7 @@ <string name="create_passkey_in_other_device_title" msgid="2360053098931886245">"दुसऱ्या डिव्हाइसवर पासकी तयार करायची आहे का?"</string> <string name="save_password_on_other_device_title" msgid="5829084591948321207">"दुसऱ्या डिव्हाइसवर पासवर्ड सेव्ह करायचा आहे का?"</string> <string name="save_sign_in_on_other_device_title" msgid="2827990118560134692">"दुसऱ्या डिव्हाइसवर साइन-इन सेव्ह करायचे आहे का?"</string> - <string name="use_provider_for_all_title" msgid="4201020195058980757">"तुमच्या सर्व साइन-इन साठी <xliff:g id="PROVIDERINFODISPLAYNAME">%1$s</xliff:g>वापरायचे का?"</string> + <string name="use_provider_for_all_title" msgid="4201020195058980757">"तुमच्या सर्व साइन-इन साठी <xliff:g id="PROVIDERINFODISPLAYNAME">%1$s</xliff:g> वापरायचे का?"</string> <string name="use_provider_for_all_description" msgid="1998772715863958997">"तुम्हाला सहजरीत्या साइन इन करण्यात मदत करण्यासाठी हा <xliff:g id="USERNAME">%1$s</xliff:g> चा पासवर्ड व्यवस्थापक तुमचे पासवर्ड आणि पासकी स्टोअर करेल"</string> <string name="set_as_default" msgid="4415328591568654603">"डिफॉल्ट म्हणून सेट करा"</string> <string name="settings" msgid="6536394145760913145">"सेटिंग्ज"</string> diff --git a/packages/CredentialManager/res/values-pa/strings.xml b/packages/CredentialManager/res/values-pa/strings.xml index 309299cbf88c..3381ece77edf 100644 --- a/packages/CredentialManager/res/values-pa/strings.xml +++ b/packages/CredentialManager/res/values-pa/strings.xml @@ -52,7 +52,7 @@ <string name="create_passkey_in_other_device_title" msgid="2360053098931886245">"ਕੀ ਕਿਸੇ ਹੋਰ ਡੀਵਾਈਸ \'ਤੇ ਪਾਸਕੀ ਬਣਾਉਣੀ ਹੈ?"</string> <string name="save_password_on_other_device_title" msgid="5829084591948321207">"ਕੀ ਕਿਸੇ ਹੋਰ ਡੀਵਾਈਸ \'ਤੇ ਪਾਸਵਰਡ ਰੱਖਿਅਤ ਕਰਨਾ ਹੈ?"</string> <string name="save_sign_in_on_other_device_title" msgid="2827990118560134692">"ਕੀ ਕਿਸੇ ਹੋਰ ਡੀਵਾਈਸ \'ਤੇ ਸਾਈਨ-ਇਨ ਕ੍ਰੀਡੈਂਸ਼ੀਅਲ ਰੱਖਿਅਤ ਕਰਨੇ ਹਨ?"</string> - <string name="use_provider_for_all_title" msgid="4201020195058980757">"ਕੀ ਆਪਣੇ ਸਾਰੇ ਸਾਈਨ-ਇਨਾਂ ਲਈ<xliff:g id="PROVIDERINFODISPLAYNAME">%1$s</xliff:g> ਦੀ ਵਰਤੋਂ ਕਰਨੀ ਹੈ?"</string> + <string name="use_provider_for_all_title" msgid="4201020195058980757">"ਕੀ ਆਪਣੇ ਸਾਰੇ ਸਾਈਨ-ਇਨਾਂ ਲਈ <xliff:g id="PROVIDERINFODISPLAYNAME">%1$s</xliff:g> ਦੀ ਵਰਤੋਂ ਕਰਨੀ ਹੈ?"</string> <string name="use_provider_for_all_description" msgid="1998772715863958997">"<xliff:g id="USERNAME">%1$s</xliff:g> ਦਾ ਇਹ Password Manager ਆਸਾਨੀ ਨਾਲ ਸਾਈਨ-ਇਨ ਕਰਨ ਵਿੱਚ ਤੁਹਾਡੀ ਮਦਦ ਕਰਨ ਲਈ ਤੁਹਾਡੇ ਪਾਸਵਰਡਾਂ ਅਤੇ ਪਾਸਕੀਆਂ ਨੂੰ ਸਟੋਰ ਕਰੇਗਾ"</string> <string name="set_as_default" msgid="4415328591568654603">"ਪੂਰਵ-ਨਿਰਧਾਰਿਤ ਵਜੋਂ ਸੈੱਟ ਕਰੋ"</string> <string name="settings" msgid="6536394145760913145">"ਸੈਟਿੰਗਾਂ"</string> diff --git a/packages/CredentialManager/res/values-pl/strings.xml b/packages/CredentialManager/res/values-pl/strings.xml index caa7b09b9c22..651488776c22 100644 --- a/packages/CredentialManager/res/values-pl/strings.xml +++ b/packages/CredentialManager/res/values-pl/strings.xml @@ -52,7 +52,7 @@ <string name="create_passkey_in_other_device_title" msgid="2360053098931886245">"Utworzyć klucz dostępu na innym urządzeniu?"</string> <string name="save_password_on_other_device_title" msgid="5829084591948321207">"Zapisać hasło na innym urządzeniu?"</string> <string name="save_sign_in_on_other_device_title" msgid="2827990118560134692">"Zapisać sposób logowania się na innym urządzeniu?"</string> - <string name="use_provider_for_all_title" msgid="4201020195058980757">"Używać usługi <xliff:g id="PROVIDERINFODISPLAYNAME">%1$s</xliff:g> w przypadku wszystkich danych logowania?"</string> + <string name="use_provider_for_all_title" msgid="4201020195058980757">"Używać usługi <xliff:g id="PROVIDERINFODISPLAYNAME">%1$s</xliff:g> do wszystkich danych logowania?"</string> <string name="use_provider_for_all_description" msgid="1998772715863958997">"Menedżer haseł na koncie <xliff:g id="USERNAME">%1$s</xliff:g> będzie zapisywał Twoje hasła i klucze dostępu, aby ułatwić Ci logowanie"</string> <string name="set_as_default" msgid="4415328591568654603">"Ustaw jako domyślną"</string> <string name="settings" msgid="6536394145760913145">"Ustawienia"</string> diff --git a/packages/CredentialManager/res/values-ro/strings.xml b/packages/CredentialManager/res/values-ro/strings.xml index 9e42dbb5604b..6f12bee3034e 100644 --- a/packages/CredentialManager/res/values-ro/strings.xml +++ b/packages/CredentialManager/res/values-ro/strings.xml @@ -53,7 +53,7 @@ <string name="save_password_on_other_device_title" msgid="5829084591948321207">"Salvezi parola pe alt dispozitiv?"</string> <string name="save_sign_in_on_other_device_title" msgid="2827990118560134692">"Salvezi datele de conectare pe alt dispozitiv?"</string> <string name="use_provider_for_all_title" msgid="4201020195058980757">"Folosești <xliff:g id="PROVIDERINFODISPLAYNAME">%1$s</xliff:g> pentru toate conectările?"</string> - <string name="use_provider_for_all_description" msgid="1998772715863958997">"Managerul de parole pentru <xliff:g id="USERNAME">%1$s</xliff:g> îți va stoca parolele și cheile de acces, pentru a te ajuta să te conectezi cu ușurință"</string> + <string name="use_provider_for_all_description" msgid="1998772715863958997">"Managerul de parole pentru <xliff:g id="USERNAME">%1$s</xliff:g> îți va stoca parolele și cheile de acces, pentru a te ajuta să te conectezi cu ușurință."</string> <string name="set_as_default" msgid="4415328591568654603">"Setează ca prestabilite"</string> <string name="settings" msgid="6536394145760913145">"Setări"</string> <string name="use_once" msgid="9027366575315399714">"Folosește o dată"</string> diff --git a/packages/CredentialManager/res/values-ru/strings.xml b/packages/CredentialManager/res/values-ru/strings.xml index 936ff79817a6..13a782b37d41 100644 --- a/packages/CredentialManager/res/values-ru/strings.xml +++ b/packages/CredentialManager/res/values-ru/strings.xml @@ -52,7 +52,7 @@ <string name="create_passkey_in_other_device_title" msgid="2360053098931886245">"Создать ключ доступа на другом устройстве?"</string> <string name="save_password_on_other_device_title" msgid="5829084591948321207">"Сохранить пароль на другом устройстве?"</string> <string name="save_sign_in_on_other_device_title" msgid="2827990118560134692">"Сохранить учетные данные на другом устройстве?"</string> - <string name="use_provider_for_all_title" msgid="4201020195058980757">"Всегда входить с помощью приложения \"<xliff:g id="PROVIDERINFODISPLAYNAME">%1$s</xliff:g>\"?"</string> + <string name="use_provider_for_all_title" msgid="4201020195058980757">"Всегда использовать <xliff:g id="PROVIDERINFODISPLAYNAME">%1$s</xliff:g> для входа?"</string> <string name="use_provider_for_all_description" msgid="1998772715863958997">"В этом менеджере паролей пользователь <xliff:g id="USERNAME">%1$s</xliff:g> сможет сохранять пароли и ключи доступа для быстрого входа."</string> <string name="set_as_default" msgid="4415328591568654603">"Использовать по умолчанию"</string> <string name="settings" msgid="6536394145760913145">"Настройки"</string> diff --git a/packages/CredentialManager/res/values-ta/strings.xml b/packages/CredentialManager/res/values-ta/strings.xml index 96d267622967..d359a73e0fe5 100644 --- a/packages/CredentialManager/res/values-ta/strings.xml +++ b/packages/CredentialManager/res/values-ta/strings.xml @@ -53,7 +53,7 @@ <string name="save_password_on_other_device_title" msgid="5829084591948321207">"வேறொரு சாதனத்தில் கடவுச்சொல்லைச் சேமிக்கவா?"</string> <string name="save_sign_in_on_other_device_title" msgid="2827990118560134692">"வேறொரு சாதனத்தில் உள்நுழைவைச் சேமிக்கவா?"</string> <string name="use_provider_for_all_title" msgid="4201020195058980757">"உங்கள் அனைத்து உள்நுழைவுகளுக்கும் <xliff:g id="PROVIDERINFODISPLAYNAME">%1$s</xliff:g>ஐப் பயன்படுத்தவா?"</string> - <string name="use_provider_for_all_description" msgid="1998772715863958997">"<xliff:g id="USERNAME">%1$s</xliff:g> என்ற மின்னஞ்சல் முகவரிக்கான இந்தக் கடவுச்சொல் நிர்வாகி உங்கள் கடவுச்சொற்களையும் கடவுச்சாவிகளையும் சேமித்து நீங்கள் எளிதாக உள்நுழைய உதவும்"</string> + <string name="use_provider_for_all_description" msgid="1998772715863958997">"<xliff:g id="USERNAME">%1$s</xliff:g> என்ற கணக்குக்கான இந்தக் கடவுச்சொல் நிர்வாகி உங்கள் கடவுச்சொற்களையும் கடவுச்சாவிகளையும் சேமித்து நீங்கள் எளிதாக உள்நுழைய உதவும்"</string> <string name="set_as_default" msgid="4415328591568654603">"இயல்பானதாக அமை"</string> <string name="settings" msgid="6536394145760913145">"அமைப்புகள்"</string> <string name="use_once" msgid="9027366575315399714">"ஒருமுறை பயன்படுத்தவும்"</string> diff --git a/packages/CredentialManager/res/values-tr/strings.xml b/packages/CredentialManager/res/values-tr/strings.xml index b423b2c6b005..d8d6ffd766e1 100644 --- a/packages/CredentialManager/res/values-tr/strings.xml +++ b/packages/CredentialManager/res/values-tr/strings.xml @@ -56,7 +56,7 @@ <string name="use_provider_for_all_description" msgid="1998772715863958997">"<xliff:g id="USERNAME">%1$s</xliff:g> için bu şifre yöneticisi, şifrelerinizi ve geçiş anahtarlarınızı saklayarak kolayca oturum açmanıza yardımcı olur"</string> <string name="set_as_default" msgid="4415328591568654603">"Varsayılan olarak ayarla"</string> <string name="settings" msgid="6536394145760913145">"Ayarlar"</string> - <string name="use_once" msgid="9027366575315399714">"Bir kez kullanın"</string> + <string name="use_once" msgid="9027366575315399714">"Bir kez kullan"</string> <string name="more_options_usage_passwords_passkeys" msgid="3470113942332934279">"<xliff:g id="PASSWORDSNUMBER">%1$s</xliff:g> şifre • <xliff:g id="PASSKEYSNUMBER">%2$s</xliff:g> geçiş anahtarı"</string> <string name="more_options_usage_passwords" msgid="1632047277723187813">"<xliff:g id="PASSWORDSNUMBER">%1$s</xliff:g> şifre"</string> <string name="more_options_usage_passkeys" msgid="5390320437243042237">"<xliff:g id="PASSKEYSNUMBER">%1$s</xliff:g> geçiş anahtarı"</string> diff --git a/packages/CredentialManager/res/values-uk/strings.xml b/packages/CredentialManager/res/values-uk/strings.xml index e7461308bab5..2c483bd165ad 100644 --- a/packages/CredentialManager/res/values-uk/strings.xml +++ b/packages/CredentialManager/res/values-uk/strings.xml @@ -52,7 +52,7 @@ <string name="create_passkey_in_other_device_title" msgid="2360053098931886245">"Створити ключ доступу на іншому пристрої?"</string> <string name="save_password_on_other_device_title" msgid="5829084591948321207">"Зберегти пароль на іншому пристрої?"</string> <string name="save_sign_in_on_other_device_title" msgid="2827990118560134692">"Зберегти дані для входу на іншому пристрої?"</string> - <string name="use_provider_for_all_title" msgid="4201020195058980757">"Використовувати сервіс <xliff:g id="PROVIDERINFODISPLAYNAME">%1$s</xliff:g> в усіх випадках входу?"</string> + <string name="use_provider_for_all_title" msgid="4201020195058980757">"Завжди використовувати <xliff:g id="PROVIDERINFODISPLAYNAME">%1$s</xliff:g> для входу?"</string> <string name="use_provider_for_all_description" msgid="1998772715863958997">"Цей менеджер паролів для користувача <xliff:g id="USERNAME">%1$s</xliff:g> зберігатиме ваші паролі й ключі доступу, щоб ви могли легко входити в облікові записи"</string> <string name="set_as_default" msgid="4415328591568654603">"Вибрати за умовчанням"</string> <string name="settings" msgid="6536394145760913145">"Налаштування"</string> diff --git a/packages/CredentialManager/res/values-zh-rHK/strings.xml b/packages/CredentialManager/res/values-zh-rHK/strings.xml index c6ac74358be4..c01ccbe46f96 100644 --- a/packages/CredentialManager/res/values-zh-rHK/strings.xml +++ b/packages/CredentialManager/res/values-zh-rHK/strings.xml @@ -56,7 +56,7 @@ <string name="use_provider_for_all_description" msgid="1998772715863958997">"此密碼管理工具將儲存「<xliff:g id="USERNAME">%1$s</xliff:g>」的密碼和密鑰,協助你輕鬆登入"</string> <string name="set_as_default" msgid="4415328591568654603">"設定為預設"</string> <string name="settings" msgid="6536394145760913145">"設定"</string> - <string name="use_once" msgid="9027366575315399714">"單次使用"</string> + <string name="use_once" msgid="9027366575315399714">"使用一次"</string> <string name="more_options_usage_passwords_passkeys" msgid="3470113942332934279">"<xliff:g id="PASSWORDSNUMBER">%1$s</xliff:g> 個密碼 • <xliff:g id="PASSKEYSNUMBER">%2$s</xliff:g> 個密鑰"</string> <string name="more_options_usage_passwords" msgid="1632047277723187813">"<xliff:g id="PASSWORDSNUMBER">%1$s</xliff:g> 個密碼"</string> <string name="more_options_usage_passkeys" msgid="5390320437243042237">"<xliff:g id="PASSKEYSNUMBER">%1$s</xliff:g> 個密鑰"</string> diff --git a/packages/CredentialManager/res/values-zh-rTW/strings.xml b/packages/CredentialManager/res/values-zh-rTW/strings.xml index 6b22e36d1daa..2d1e8e1fe2fe 100644 --- a/packages/CredentialManager/res/values-zh-rTW/strings.xml +++ b/packages/CredentialManager/res/values-zh-rTW/strings.xml @@ -56,7 +56,7 @@ <string name="use_provider_for_all_description" msgid="1998772715863958997">"<xliff:g id="USERNAME">%1$s</xliff:g> 的密碼管理工具會儲存密碼和密碼金鑰,協助你輕鬆登入"</string> <string name="set_as_default" msgid="4415328591568654603">"設為預設"</string> <string name="settings" msgid="6536394145760913145">"設定"</string> - <string name="use_once" msgid="9027366575315399714">"單次使用"</string> + <string name="use_once" msgid="9027366575315399714">"僅限這次"</string> <string name="more_options_usage_passwords_passkeys" msgid="3470113942332934279">"<xliff:g id="PASSWORDSNUMBER">%1$s</xliff:g> 個密碼 • <xliff:g id="PASSKEYSNUMBER">%2$s</xliff:g> 個密碼金鑰"</string> <string name="more_options_usage_passwords" msgid="1632047277723187813">"<xliff:g id="PASSWORDSNUMBER">%1$s</xliff:g> 個密碼"</string> <string name="more_options_usage_passkeys" msgid="5390320437243042237">"<xliff:g id="PASSKEYSNUMBER">%1$s</xliff:g> 個密碼金鑰"</string> diff --git a/packages/CtsShim/Android.bp b/packages/CtsShim/Android.bp index baafe7ba570c..a94c8c56a31f 100644 --- a/packages/CtsShim/Android.bp +++ b/packages/CtsShim/Android.bp @@ -61,7 +61,6 @@ android_app_import { "com.android.apex.cts.shim.v1", "com.android.apex.cts.shim.v2", "com.android.apex.cts.shim.v2_legacy", - "com.android.apex.cts.shim.v2_no_hashtree", "com.android.apex.cts.shim.v2_sdk_target_p", "com.android.apex.cts.shim.v3", ], @@ -102,7 +101,6 @@ android_app_import { "com.android.apex.cts.shim.v1", "com.android.apex.cts.shim.v2", "com.android.apex.cts.shim.v2_legacy", - "com.android.apex.cts.shim.v2_no_hashtree", "com.android.apex.cts.shim.v2_sdk_target_p", "com.android.apex.cts.shim.v3", ], diff --git a/packages/CtsShim/build/Android.bp b/packages/CtsShim/build/Android.bp index d6b7ecf5819d..5b3d47e9f74d 100644 --- a/packages/CtsShim/build/Android.bp +++ b/packages/CtsShim/build/Android.bp @@ -93,7 +93,6 @@ android_app { "com.android.apex.cts.shim.v1", "com.android.apex.cts.shim.v2", "com.android.apex.cts.shim.v2_apk_in_apex_upgrades", - "com.android.apex.cts.shim.v2_no_hashtree", "com.android.apex.cts.shim.v2_legacy", "com.android.apex.cts.shim.v2_sdk_target_p", "com.android.apex.cts.shim.v2_unsigned_payload", @@ -200,7 +199,6 @@ android_app { "com.android.apex.cts.shim.v1", "com.android.apex.cts.shim.v2", "com.android.apex.cts.shim.v2_apk_in_apex_upgrades", - "com.android.apex.cts.shim.v2_no_hashtree", "com.android.apex.cts.shim.v2_legacy", "com.android.apex.cts.shim.v2_sdk_target_p", "com.android.apex.cts.shim.v2_unsigned_payload", diff --git a/packages/CtsShim/build/jni/Android.bp b/packages/CtsShim/build/jni/Android.bp index 2dbf2a212cc3..ac85d2b60327 100644 --- a/packages/CtsShim/build/jni/Android.bp +++ b/packages/CtsShim/build/jni/Android.bp @@ -33,7 +33,6 @@ cc_library_shared { "com.android.apex.cts.shim.v1", "com.android.apex.cts.shim.v2", "com.android.apex.cts.shim.v2_apk_in_apex_upgrades", - "com.android.apex.cts.shim.v2_no_hashtree", "com.android.apex.cts.shim.v2_legacy", "com.android.apex.cts.shim.v2_sdk_target_p", "com.android.apex.cts.shim.v2_unsigned_payload", diff --git a/packages/EasterEgg/src/com/android/egg/paint/PaintActivity.java b/packages/EasterEgg/src/com/android/egg/paint/PaintActivity.java index ac47fbda09c6..391b16d38f0f 100644 --- a/packages/EasterEgg/src/com/android/egg/paint/PaintActivity.java +++ b/packages/EasterEgg/src/com/android/egg/paint/PaintActivity.java @@ -23,7 +23,6 @@ import static android.view.MotionEvent.ACTION_UP; import android.app.Activity; import android.content.res.Configuration; -import android.graphics.Bitmap; import android.graphics.Color; import android.os.Bundle; import android.view.MotionEvent; @@ -38,9 +37,7 @@ import android.widget.Magnifier; import com.android.egg.R; -import java.util.ArrayList; import java.util.Arrays; -import java.util.Collections; import java.util.stream.IntStream; public class PaintActivity extends Activity { @@ -60,31 +57,28 @@ public class PaintActivity extends Activity { private View.OnClickListener buttonHandler = new View.OnClickListener() { @Override public void onClick(View view) { - switch (view.getId()) { - case R.id.btnBrush: - view.setSelected(true); - hideToolbar(colors); - toggleToolbar(brushes); - break; - case R.id.btnColor: - view.setSelected(true); - hideToolbar(brushes); - toggleToolbar(colors); - break; - case R.id.btnClear: - painting.clear(); - break; - case R.id.btnSample: - sampling = true; - view.setSelected(true); - break; - case R.id.btnZen: - painting.setZenMode(!painting.getZenMode()); - view.animate() - .setStartDelay(200) - .setInterpolator(new OvershootInterpolator()) - .rotation(painting.getZenMode() ? 0f : 90f); - break; + // With non final fields in the R class we can't switch on the + // id since the case values are no longer constants. + int viewId = view.getId(); + if (viewId == R.id.btnBrush) { + view.setSelected(true); + hideToolbar(colors); + toggleToolbar(brushes); + } else if (viewId == R.id.btnColor) { + view.setSelected(true); + hideToolbar(brushes); + toggleToolbar(colors); + } else if (viewId == R.id.btnClear) { + painting.clear(); + } else if (viewId == R.id.btnSample) { + sampling = true; + view.setSelected(true); + } else if (viewId == R.id.btnZen) { + painting.setZenMode(!painting.getZenMode()); + view.animate() + .setStartDelay(200) + .setInterpolator(new OvershootInterpolator()) + .rotation(painting.getZenMode() ? 0f : 90f); } } }; diff --git a/packages/PackageInstaller/res/values-be/strings.xml b/packages/PackageInstaller/res/values-be/strings.xml index a4c309767125..987e0dcf43fd 100644 --- a/packages/PackageInstaller/res/values-be/strings.xml +++ b/packages/PackageInstaller/res/values-be/strings.xml @@ -35,7 +35,7 @@ <string name="install_failed_incompatible" product="tablet" msgid="6019021440094927928">"Праграма не ўсталявана, таму што яна несумяшчальная з вашым планшэтам."</string> <string name="install_failed_incompatible" product="tv" msgid="2890001324362291683">"Гэта праграма несумяшчальная з вашым тэлевізарам."</string> <string name="install_failed_incompatible" product="default" msgid="7254630419511645826">"Праграма не ўсталявана, таму што яна несумяшчальная з вашым тэлефонам."</string> - <string name="install_failed_invalid_apk" msgid="8581007676422623930">"Праграма не ўсталявана, таму што пакет, магчыма, з\'яўляецца несапраўдным."</string> + <string name="install_failed_invalid_apk" msgid="8581007676422623930">"Праграма не ўсталявана, таму што пакет, магчыма, з’яўляецца несапраўдным."</string> <string name="install_failed_msg" product="tablet" msgid="6298387264270562442">"На вашым планшэце не ўдалося ўсталяваць праграму \"<xliff:g id="APP_NAME">%1$s</xliff:g>\"."</string> <string name="install_failed_msg" product="tv" msgid="1920009940048975221">"На вашым тэлевізары не ўдалося ўсталяваць праграму \"<xliff:g id="APP_NAME">%1$s</xliff:g>\"."</string> <string name="install_failed_msg" product="default" msgid="6484461562647915707">"На вашым тэлефоне не ўдалося ўсталяваць праграму \"<xliff:g id="APP_NAME">%1$s</xliff:g>\"."</string> diff --git a/packages/PackageInstaller/src/com/android/packageinstaller/UnarchiveErrorFragment.java b/packages/PackageInstaller/src/com/android/packageinstaller/UnarchiveErrorFragment.java index d33433f3983b..2fb32a7da432 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 @@ public class UnarchiveErrorFragment extends DialogFragment implements 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/PrintSpooler/res/values-es-rUS/strings.xml b/packages/PrintSpooler/res/values-es-rUS/strings.xml index 476614b1a60d..9f88f144a77e 100644 --- a/packages/PrintSpooler/res/values-es-rUS/strings.xml +++ b/packages/PrintSpooler/res/values-es-rUS/strings.xml @@ -56,9 +56,9 @@ <string name="print_select_printer" msgid="7388760939873368698">"Seleccionar impresora"</string> <string name="print_forget_printer" msgid="5035287497291910766">"No recordar impresora"</string> <plurals name="print_search_result_count_utterance" formatted="false" msgid="6997663738361080868"> - <item quantity="many">Se encontraron <xliff:g id="COUNT_1">%1$s</xliff:g> impresoras.</item> - <item quantity="other">Se encontraron <xliff:g id="COUNT_1">%1$s</xliff:g> impresoras.</item> - <item quantity="one">Se encontró <xliff:g id="COUNT_0">%1$s</xliff:g> impresora.</item> + <item quantity="many"><xliff:g id="COUNT_1">%1$s</xliff:g> de impresoras encontradas</item> + <item quantity="other"><xliff:g id="COUNT_1">%1$s</xliff:g> impresoras encontradas</item> + <item quantity="one"><xliff:g id="COUNT_0">%1$s</xliff:g> impresora encontrada</item> </plurals> <string name="printer_extended_description_template" msgid="1366699227703381874">"<xliff:g id="PRINT_SERVICE_LABEL">%1$s</xliff:g> - <xliff:g id="PRINTER_DESCRIPTION">%2$s</xliff:g>"</string> <string name="printer_info_desc" msgid="7181988788991581654">"Más información sobre esta impresora"</string> @@ -77,9 +77,9 @@ <string name="disabled_services_title" msgid="7313253167968363211">"Servicios inhabilitados"</string> <string name="all_services_title" msgid="5578662754874906455">"Todos los servicios"</string> <plurals name="print_services_recommendation_subtitle" formatted="false" msgid="5678487708807185138"> - <item quantity="many">Instala para ver <xliff:g id="COUNT_1">%1$s</xliff:g> impresoras</item> - <item quantity="other">Instala para ver <xliff:g id="COUNT_1">%1$s</xliff:g> impresoras</item> - <item quantity="one">Instala para ver <xliff:g id="COUNT_0">%1$s</xliff:g> impresora</item> + <item quantity="many">Instala para descubrir <xliff:g id="COUNT_1">%1$s</xliff:g> de impresoras</item> + <item quantity="other">Instala para descubrir <xliff:g id="COUNT_1">%1$s</xliff:g> impresoras</item> + <item quantity="one">Instala para descubrir <xliff:g id="COUNT_0">%1$s</xliff:g> impresora</item> </plurals> <string name="printing_notification_title_template" msgid="295903957762447362">"Imprimiendo <xliff:g id="PRINT_JOB_NAME">%1$s</xliff:g>"</string> <string name="cancelling_notification_title_template" msgid="1821759594704703197">"Cancelando <xliff:g id="PRINT_JOB_NAME">%1$s</xliff:g>"</string> diff --git a/packages/PrintSpooler/res/values-es/strings.xml b/packages/PrintSpooler/res/values-es/strings.xml index 507b2a7a8f25..104a1bf578a0 100644 --- a/packages/PrintSpooler/res/values-es/strings.xml +++ b/packages/PrintSpooler/res/values-es/strings.xml @@ -56,9 +56,9 @@ <string name="print_select_printer" msgid="7388760939873368698">"Seleccionar impresora"</string> <string name="print_forget_printer" msgid="5035287497291910766">"Olvidar impresora"</string> <plurals name="print_search_result_count_utterance" formatted="false" msgid="6997663738361080868"> - <item quantity="many">Se han encontrado <xliff:g id="COUNT_1">%1$s</xliff:g> impresoras</item> - <item quantity="other">Se han encontrado <xliff:g id="COUNT_1">%1$s</xliff:g> impresoras</item> - <item quantity="one">Se ha encontrado <xliff:g id="COUNT_0">%1$s</xliff:g> impresora</item> + <item quantity="many"><xliff:g id="COUNT_1">%1$s</xliff:g> impresoras encontradas</item> + <item quantity="other"><xliff:g id="COUNT_1">%1$s</xliff:g> impresoras encontradas</item> + <item quantity="one"><xliff:g id="COUNT_0">%1$s</xliff:g> impresora encontrada</item> </plurals> <string name="printer_extended_description_template" msgid="1366699227703381874">"<xliff:g id="PRINT_SERVICE_LABEL">%1$s</xliff:g> - <xliff:g id="PRINTER_DESCRIPTION">%2$s</xliff:g>"</string> <string name="printer_info_desc" msgid="7181988788991581654">"Más información sobre esta impresora"</string> diff --git a/packages/PrintSpooler/res/values-fr-rCA/strings.xml b/packages/PrintSpooler/res/values-fr-rCA/strings.xml index c2b82afa238a..fb885574449c 100644 --- a/packages/PrintSpooler/res/values-fr-rCA/strings.xml +++ b/packages/PrintSpooler/res/values-fr-rCA/strings.xml @@ -56,9 +56,9 @@ <string name="print_select_printer" msgid="7388760939873368698">"Sélectionner une imprimante"</string> <string name="print_forget_printer" msgid="5035287497291910766">"Supprimer l\'imprimante"</string> <plurals name="print_search_result_count_utterance" formatted="false" msgid="6997663738361080868"> - <item quantity="one"><xliff:g id="COUNT_1">%1$s</xliff:g> imprimante trouvée</item> - <item quantity="many"><xliff:g id="COUNT_1">%1$s</xliff:g> imprimante trouvées</item> - <item quantity="other"><xliff:g id="COUNT_1">%1$s</xliff:g> imprimante trouvées</item> + <item quantity="one"><xliff:g id="COUNT_1">%1$s</xliff:g> imprimante trouvée</item> + <item quantity="many"><xliff:g id="COUNT_1">%1$s</xliff:g> d\'imprimantes trouvées</item> + <item quantity="other"><xliff:g id="COUNT_1">%1$s</xliff:g> imprimantes trouvées</item> </plurals> <string name="printer_extended_description_template" msgid="1366699227703381874">"<xliff:g id="PRINT_SERVICE_LABEL">%1$s</xliff:g> - <xliff:g id="PRINTER_DESCRIPTION">%2$s</xliff:g>"</string> <string name="printer_info_desc" msgid="7181988788991581654">"Plus d\'information sur cette imprimante"</string> @@ -96,7 +96,7 @@ <item msgid="2762241247228983754">"Couleur"</item> </string-array> <string-array name="duplex_mode_labels"> - <item msgid="3882302912790928315">"Aucune"</item> + <item msgid="3882302912790928315">"Aucun"</item> <item msgid="7296563835355641719">"Bord long"</item> <item msgid="79513688117503758">"Bord court"</item> </string-array> diff --git a/packages/PrintSpooler/res/values-it/strings.xml b/packages/PrintSpooler/res/values-it/strings.xml index 2a64d3debf58..fc03e6449cf8 100644 --- a/packages/PrintSpooler/res/values-it/strings.xml +++ b/packages/PrintSpooler/res/values-it/strings.xml @@ -56,7 +56,7 @@ <string name="print_select_printer" msgid="7388760939873368698">"Seleziona stampante"</string> <string name="print_forget_printer" msgid="5035287497291910766">"Elimina stampante"</string> <plurals name="print_search_result_count_utterance" formatted="false" msgid="6997663738361080868"> - <item quantity="many"><xliff:g id="COUNT_1">%1$s</xliff:g> stampanti trovate</item> + <item quantity="many"><xliff:g id="COUNT_1">%1$s</xliff:g> di stampanti trovate</item> <item quantity="other"><xliff:g id="COUNT_1">%1$s</xliff:g> stampanti trovate</item> <item quantity="one"><xliff:g id="COUNT_0">%1$s</xliff:g> stampante trovata</item> </plurals> @@ -77,9 +77,9 @@ <string name="disabled_services_title" msgid="7313253167968363211">"Servizi disattivati"</string> <string name="all_services_title" msgid="5578662754874906455">"Tutti i servizi"</string> <plurals name="print_services_recommendation_subtitle" formatted="false" msgid="5678487708807185138"> - <item quantity="many">Installa per rilevare <xliff:g id="COUNT_1">%1$s</xliff:g> stampanti</item> - <item quantity="other">Installa per rilevare <xliff:g id="COUNT_1">%1$s</xliff:g> stampanti</item> - <item quantity="one">Installa per rilevare <xliff:g id="COUNT_0">%1$s</xliff:g> stampante</item> + <item quantity="many">Installa per individuare <xliff:g id="COUNT_1">%1$s</xliff:g> di stampanti</item> + <item quantity="other">Installa per individuare <xliff:g id="COUNT_1">%1$s</xliff:g> stampanti</item> + <item quantity="one">Installa per individuare <xliff:g id="COUNT_0">%1$s</xliff:g> stampante</item> </plurals> <string name="printing_notification_title_template" msgid="295903957762447362">"Stampa di <xliff:g id="PRINT_JOB_NAME">%1$s</xliff:g>"</string> <string name="cancelling_notification_title_template" msgid="1821759594704703197">"Annullamento di <xliff:g id="PRINT_JOB_NAME">%1$s</xliff:g>"</string> @@ -96,7 +96,7 @@ <item msgid="2762241247228983754">"A colori"</item> </string-array> <string-array name="duplex_mode_labels"> - <item msgid="3882302912790928315">"Nessuno"</item> + <item msgid="3882302912790928315">"Nessuna"</item> <item msgid="7296563835355641719">"Lato lungo"</item> <item msgid="79513688117503758">"Lato corto"</item> </string-array> diff --git a/packages/SettingsLib/OWNERS b/packages/SettingsLib/OWNERS index 5966c9f759fb..e4bc7b4660e1 100644 --- a/packages/SettingsLib/OWNERS +++ b/packages/SettingsLib/OWNERS @@ -11,3 +11,6 @@ ykhung@google.com # Exempt resource files (because they are in a flat directory and too hard to manage via OWNERS) per-file *.xml=* + +# Notification-related utilities +per-file **/notification/** = file:/packages/SystemUI/src/com/android/systemui/statusbar/notification/OWNERS diff --git a/packages/SettingsLib/ProfileSelector/res/values-fr-rCA/strings.xml b/packages/SettingsLib/ProfileSelector/res/values-fr-rCA/strings.xml index c9ba591a9aeb..0e74e4d3dc77 100644 --- a/packages/SettingsLib/ProfileSelector/res/values-fr-rCA/strings.xml +++ b/packages/SettingsLib/ProfileSelector/res/values-fr-rCA/strings.xml @@ -18,6 +18,6 @@ <resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string name="settingslib_category_personal" msgid="1142302328104700620">"Personnel"</string> - <string name="settingslib_category_work" msgid="4867750733682444676">"Professionnel"</string> + <string name="settingslib_category_work" msgid="4867750733682444676">"Profil professionnel"</string> <string name="settingslib_category_private" msgid="5039276873477591386">"Privé"</string> </resources> diff --git a/packages/SettingsLib/SearchWidget/res/values-fa/strings.xml b/packages/SettingsLib/SearchWidget/res/values-fa/strings.xml index 2c9aaa5e9f95..2babdd8a54f0 100644 --- a/packages/SettingsLib/SearchWidget/res/values-fa/strings.xml +++ b/packages/SettingsLib/SearchWidget/res/values-fa/strings.xml @@ -17,5 +17,5 @@ <resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> - <string name="search_menu" msgid="1914043873178389845">"تنظیمات جستجو"</string> + <string name="search_menu" msgid="1914043873178389845">"جستجوی «تنظیمات»"</string> </resources> diff --git a/packages/SettingsLib/res/values-be/strings.xml b/packages/SettingsLib/res/values-be/strings.xml index 95586eaf9da5..f48407fdb9e0 100644 --- a/packages/SettingsLib/res/values-be/strings.xml +++ b/packages/SettingsLib/res/values-be/strings.xml @@ -345,7 +345,7 @@ <string name="adb_warning_title" msgid="7708653449506485728">"Дазволіць адладку па USB?"</string> <string name="adb_warning_message" msgid="8145270656419669221">"Адладка па USB прызначана толькі для мэт распрацоўкі. Яна можа выкарыстоўвацца, каб капіраваць даныя паміж камп\'ютарам і прыладай, усталёўваць праграмы на прыладзе без папярэдняга апавяшчэння і чытаць даныя журнала."</string> <string name="adbwifi_warning_title" msgid="727104571653031865">"Дазволіць адладку па Wi-Fi?"</string> - <string name="adbwifi_warning_message" msgid="8005936574322702388">"Адладка па Wi-Fi прызначана толькі для мэт распрацоўкі. Яна можа выкарыстоўвацца, каб капіраваць даныя паміж камп\'ютарам і прыладай, усталёўваць праграмы на прыладзе без апавяшчэння і чытаць даныя журнала."</string> + <string name="adbwifi_warning_message" msgid="8005936574322702388">"Адладка па Wi-Fi прызначана толькі для мэт распрацоўкі. Яна можа выкарыстоўвацца, каб капіраваць даныя паміж камп’ютарам і прыладай, усталёўваць праграмы на прыладзе без апавяшчэння і чытаць даныя журнала."</string> <string name="adb_keys_warning_message" msgid="2968555274488101220">"Скасаваць доступ да адладкі па USB з усіх камп\'ютараў, на якiх вы уваходзiлi ў сiстэму?"</string> <string name="dev_settings_warning_title" msgid="8251234890169074553">"Дазволiць налады распрацоўшчыка?"</string> <string name="dev_settings_warning_message" msgid="37741686486073668">"Гэтыя налады прызначаны толькi для распрацоўшыкаў. Яны могуць выклікаць збоi прылад i ўсталяваных на iх прыкладанняў, а таксама перашкаджаць iх працы."</string> diff --git a/packages/SettingsLib/res/values-ka/strings.xml b/packages/SettingsLib/res/values-ka/strings.xml index 4efebc5002c9..d923a02b1b83 100644 --- a/packages/SettingsLib/res/values-ka/strings.xml +++ b/packages/SettingsLib/res/values-ka/strings.xml @@ -94,9 +94,7 @@ <string name="bluetooth_connected_no_headset_battery_level" msgid="2661863370509206428">"დაკავშირებულია (ტელეფონი არ არის). ბატარეის დონე: <xliff:g id="BATTERY_LEVEL_AS_PERCENTAGE">%1$s</xliff:g><xliff:g id="ACTIVE_DEVICE">%2$s</xliff:g>"</string> <string name="bluetooth_connected_no_a2dp_battery_level" msgid="6499078454894324287">"დაკავშირებულია (მედია არ არის). ბატარეა: <xliff:g id="BATTERY_LEVEL_AS_PERCENTAGE">%1$s</xliff:g><xliff:g id="ACTIVE_DEVICE">%2$s</xliff:g>"</string> <string name="bluetooth_connected_no_headset_no_a2dp_battery_level" msgid="8477440576953067242">"დაკავშირებულია (ტელეფონი ან მედია არ არის). ბატარეის დონე: <xliff:g id="BATTERY_LEVEL_AS_PERCENTAGE">%1$s</xliff:g><xliff:g id="ACTIVE_DEVICE">%2$s</xliff:g>"</string> - <!-- String.format failed for translation --> - <!-- no translation found for bluetooth_active_battery_level (2685517576209066008) --> - <skip /> + <string name="bluetooth_active_battery_level" msgid="2685517576209066008">"აქტიური. <xliff:g id="BATTERY_LEVEL_AS_PERCENTAGE">%1$s</xliff:g>%% ბატარეა."</string> <string name="bluetooth_active_battery_level_untethered" msgid="4961338936672922617">"აქტიური. მარცხენა: <xliff:g id="BATTERY_LEVEL_AS_PERCENTAGE_0">%1$s</xliff:g>, მარჯვენა: <xliff:g id="BATTERY_LEVEL_AS_PERCENTAGE_1">%2$s</xliff:g> ბატარეა."</string> <string name="bluetooth_active_battery_level_untethered_left" msgid="2895644748625343977">"აქტიური. მარცხენა ბატარეის დონე: <xliff:g id="BATTERY_LEVEL_AS_PERCENTAGE">%1$s</xliff:g>."</string> <string name="bluetooth_active_battery_level_untethered_right" msgid="7407517998880370179">"აქტიური. მარჯვენა ბატარეის დონე: <xliff:g id="BATTERY_LEVEL_AS_PERCENTAGE">%1$s</xliff:g>."</string> @@ -112,9 +110,7 @@ <string name="bluetooth_hearing_aid_left_active" msgid="8330226430756799572">"აქტიური (მხოლოდ მარცხენა)"</string> <string name="bluetooth_hearing_aid_right_active" msgid="2244728507170385397">"აქტიური (მხოლოდ მარჯვენა)"</string> <string name="bluetooth_hearing_aid_left_and_right_active" msgid="4294571497939983181">"აქტიური (მარცხენა და მარჯვენა)"</string> - <!-- String.format failed for translation --> - <!-- no translation found for bluetooth_active_media_only_battery_level (7772517511061834073) --> - <skip /> + <string name="bluetooth_active_media_only_battery_level" msgid="7772517511061834073">"აქტიური (მხოლოდ მედია). <xliff:g id="BATTERY_LEVEL_AS_PERCENTAGE">%1$s</xliff:g>%% ბატარეა."</string> <string name="bluetooth_active_media_only_battery_level_untethered" msgid="7444753133664620926">"აქტიური (მხოლოდ მედია), მარცხენა: <xliff:g id="BATTERY_LEVEL_AS_PERCENTAGE_0">%1$s</xliff:g>, მარჯვენა:<xliff:g id="BATTERY_LEVEL_AS_PERCENTAGE_1">%2$s</xliff:g> ბატარეა."</string> <string name="bluetooth_battery_level_lea_support" msgid="5968584103507988820">"დაკავშირებული (აუდიოს გაზიარება მხარდაჭერილია). ბატარეა <xliff:g id="BATTERY_LEVEL_AS_PERCENTAGE">%1$s</xliff:g>."</string> <string name="bluetooth_battery_level_untethered_lea_support" msgid="803110681688633362">"დაკავშირებული (აუდიოს გაზიარება მხარდაჭერილია). მარცხენა: ბატარეა <xliff:g id="BATTERY_LEVEL_AS_PERCENTAGE_0">%1$s</xliff:g>, მარჯვენა: ბატარეა <xliff:g id="BATTERY_LEVEL_AS_PERCENTAGE_1">%2$s</xliff:g>"</string> diff --git a/packages/SettingsLib/res/values-vi/strings.xml b/packages/SettingsLib/res/values-vi/strings.xml index 4539dc9fde95..24148a241dfc 100644 --- a/packages/SettingsLib/res/values-vi/strings.xml +++ b/packages/SettingsLib/res/values-vi/strings.xml @@ -239,7 +239,7 @@ <string name="category_work" msgid="4014193632325996115">"Công việc"</string> <string name="category_private" msgid="4244892185452788977">"Riêng tư"</string> <string name="category_clone" msgid="1554511758987195974">"Nhân bản"</string> - <string name="development_settings_title" msgid="140296922921597393">"Tùy chọn cho nhà phát triển"</string> + <string name="development_settings_title" msgid="140296922921597393">"Tuỳ chọn cho nhà phát triển"</string> <string name="development_settings_enable" msgid="4285094651288242183">"Bật tùy chọn nhà phát triển"</string> <string name="development_settings_summary" msgid="8718917813868735095">"Đặt tùy chọn cho phát triển ứng dụng"</string> <string name="development_settings_not_available" msgid="355070198089140951">"Tùy chọn dành cho nhà phát triển không khả dụng cho người dùng này"</string> diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDeviceManager.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDeviceManager.java index cb6a93002ea7..8b6351e3c289 100644 --- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDeviceManager.java +++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDeviceManager.java @@ -40,7 +40,7 @@ public class CachedBluetoothDeviceManager { private static final String TAG = "CachedBluetoothDeviceManager"; private static final boolean DEBUG = BluetoothUtils.D; - @VisibleForTesting static int sLateBondingTimeoutMillis = 5000; // 5s + @VisibleForTesting static int sLateBondingTimeoutMillis = 10000; // 10s private Context mContext; private final LocalBluetoothManager mBtManager; diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/OWNERS b/packages/SettingsLib/src/com/android/settingslib/bluetooth/OWNERS index 7669e79b42be..f8c3a93cd3c7 100644 --- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/OWNERS +++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/OWNERS @@ -1,9 +1,4 @@ # Default reviewers for this and subdirectories. -siyuanh@google.com -hughchen@google.com -timhypeng@google.com -robertluo@google.com -songferngwang@google.com yqian@google.com chelseahao@google.com yiyishen@google.com diff --git a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/bluetooth/OWNERS b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/bluetooth/OWNERS new file mode 100644 index 000000000000..134a56ecb27e --- /dev/null +++ b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/bluetooth/OWNERS @@ -0,0 +1 @@ +include /packages/SettingsLib/src/com/android/settingslib/bluetooth/OWNERS diff --git a/packages/SettingsProvider/test/src/com/android/providers/settings/DeviceConfigServiceTest.java b/packages/SettingsProvider/test/src/com/android/providers/settings/DeviceConfigServiceTest.java index 8dd51b2b8d11..8de0c35ffa12 100644 --- a/packages/SettingsProvider/test/src/com/android/providers/settings/DeviceConfigServiceTest.java +++ b/packages/SettingsProvider/test/src/com/android/providers/settings/DeviceConfigServiceTest.java @@ -22,8 +22,6 @@ import static junit.framework.Assert.assertNull; import android.content.ContentResolver; import android.os.Bundle; -import android.platform.test.annotations.RequiresFlagsDisabled; -import android.platform.test.annotations.RequiresFlagsEnabled; import android.platform.test.flag.junit.CheckFlagsRule; import android.platform.test.flag.junit.DeviceFlagsValueProvider; import android.provider.Settings; @@ -73,24 +71,9 @@ public class DeviceConfigServiceTest { } /** - * Test that setting overrides are properly disabled when the flag is off. - */ - @Test - @RequiresFlagsDisabled("com.android.providers.settings.support_overrides") - public void testOverrideDisabled() throws IOException { - final String newValue = "value2"; - - executeShellCommand("device_config put " + sNamespace + " " + sKey + " " + sValue); - executeShellCommand("device_config override " + sNamespace + " " + sKey + " " + newValue); - String result = readShellCommandOutput("device_config get " + sNamespace + " " + sKey); - assertEquals(sValue + "\n", result); - } - - /** * Test that overrides are readable and can be cleared. */ @Test - @RequiresFlagsEnabled("com.android.providers.settings.support_overrides") public void testOverride() throws IOException { final String newValue = "value2"; diff --git a/packages/Shell/AndroidManifest.xml b/packages/Shell/AndroidManifest.xml index 04d30ed6f001..0b5187c44821 100644 --- a/packages/Shell/AndroidManifest.xml +++ b/packages/Shell/AndroidManifest.xml @@ -65,6 +65,7 @@ <uses-permission android:name="com.android.voicemail.permission.ADD_VOICEMAIL" /> <uses-permission android:name="android.permission.WRITE_EMBEDDED_SUBSCRIPTIONS" /> <uses-permission android:name="android.permission.GET_PROCESS_STATE_AND_OOM_SCORE" /> + <uses-permission android:name="android.permission.READ_DROPBOX_DATA" /> <uses-permission android:name="android.permission.READ_LOGS" /> <uses-permission android:name="android.permission.BRIGHTNESS_SLIDER_USAGE" /> <uses-permission android:name="android.permission.ACCESS_AMBIENT_LIGHT_STATS" /> diff --git a/packages/SoundPicker/src/com/android/soundpicker/RingtonePickerActivity.java b/packages/SoundPicker/src/com/android/soundpicker/RingtonePickerActivity.java index 0dd9275503a9..8c3cce4087c1 100644 --- a/packages/SoundPicker/src/com/android/soundpicker/RingtonePickerActivity.java +++ b/packages/SoundPicker/src/com/android/soundpicker/RingtonePickerActivity.java @@ -255,8 +255,8 @@ public final class RingtonePickerActivity extends AlertActivity implements p.mTitle = getString(com.android.internal.R.string.ringtone_picker_title); } } else { - // Make sure intents don't inject HTML elements. - p.mTitle = Html.escapeHtml(p.mTitle.toString()); + // Make sure intents don't inject spannable elements. + p.mTitle = p.mTitle.toString(); } setupAlert(); diff --git a/packages/SystemUI/OWNERS b/packages/SystemUI/OWNERS index e03ac3de7e4e..795b39576391 100644 --- a/packages/SystemUI/OWNERS +++ b/packages/SystemUI/OWNERS @@ -8,6 +8,7 @@ achalke@google.com acul@google.com adamcohen@google.com aioana@google.com +alexchau@google.com alexflo@google.com andonian@google.com amiko@google.com @@ -89,8 +90,10 @@ rahulbanerjee@google.com rgl@google.com roosa@google.com saff@google.com +samcackett@google.com santie@google.com shanh@google.com +silvajordan@google.com snoeberger@google.com spdonghao@google.com steell@google.com @@ -103,6 +106,7 @@ tkachenkoi@google.com tracyzhou@google.com tsuji@google.com twickham@google.com +uwaisashraf@google.com vadimt@google.com valiiftime@google.com vanjan@google.com diff --git a/packages/SystemUI/TEST_MAPPING b/packages/SystemUI/TEST_MAPPING index deab81856afa..16dd4e5a800e 100644 --- a/packages/SystemUI/TEST_MAPPING +++ b/packages/SystemUI/TEST_MAPPING @@ -81,7 +81,7 @@ ] } ], - + "postsubmit": [ { // Permission indicators @@ -93,7 +93,7 @@ ] } ], - + // v2/sysui/suite/test-mapping-sysui-screenshot-test "sysui-screenshot-test": [ { @@ -131,7 +131,7 @@ ] } ], - + // v2/sysui/suite/test-mapping-sysui-screenshot-test-staged "sysui-screenshot-test-staged": [ { @@ -156,5 +156,13 @@ } ] } + ], + "sysui-robo-test": [ + { + "name": "SystemUIGoogleRoboRNGTests" + }, + { + "name": "SystemUIGoogleRobo2RNGTests" + } ] } diff --git a/packages/SystemUI/accessibility/accessibilitymenu/src/com/android/systemui/accessibility/accessibilitymenu/model/A11yMenuShortcut.java b/packages/SystemUI/accessibility/accessibilitymenu/src/com/android/systemui/accessibility/accessibilitymenu/model/A11yMenuShortcut.java index 66a2fae0c4c3..c698d18bfde8 100644 --- a/packages/SystemUI/accessibility/accessibilitymenu/src/com/android/systemui/accessibility/accessibilitymenu/model/A11yMenuShortcut.java +++ b/packages/SystemUI/accessibility/accessibilitymenu/src/com/android/systemui/accessibility/accessibilitymenu/model/A11yMenuShortcut.java @@ -19,7 +19,6 @@ import android.util.Log; import com.android.systemui.accessibility.accessibilitymenu.R; -import java.util.HashMap; import java.util.Map; /** @@ -52,80 +51,80 @@ public class A11yMenuShortcut { private static final int LABEL_TEXT_INDEX = 3; /** Map stores all shortcut resource IDs that is in matching order of defined shortcut. */ - private static final Map<ShortcutId, int[]> sShortcutResource = new HashMap<>() {{ - put(ShortcutId.ID_ASSISTANT_VALUE, new int[] { + private static final Map<ShortcutId, int[]> sShortcutResource = Map.ofEntries( + Map.entry(ShortcutId.ID_ASSISTANT_VALUE, new int[] { R.drawable.ic_logo_a11y_assistant_24dp, R.color.assistant_color, R.string.assistant_utterance, R.string.assistant_label, - }); - put(ShortcutId.ID_A11YSETTING_VALUE, new int[] { + }), + Map.entry(ShortcutId.ID_A11YSETTING_VALUE, new int[] { R.drawable.ic_logo_a11y_settings_24dp, R.color.a11y_settings_color, R.string.a11y_settings_label, R.string.a11y_settings_label, - }); - put(ShortcutId.ID_POWER_VALUE, new int[] { + }), + Map.entry(ShortcutId.ID_POWER_VALUE, new int[] { R.drawable.ic_logo_a11y_power_24dp, R.color.power_color, R.string.power_utterance, R.string.power_label, - }); - put(ShortcutId.ID_RECENT_VALUE, new int[] { + }), + Map.entry(ShortcutId.ID_RECENT_VALUE, new int[] { R.drawable.ic_logo_a11y_recent_apps_24dp, R.color.recent_apps_color, R.string.recent_apps_label, R.string.recent_apps_label, - }); - put(ShortcutId.ID_LOCKSCREEN_VALUE, new int[] { + }), + Map.entry(ShortcutId.ID_LOCKSCREEN_VALUE, new int[] { R.drawable.ic_logo_a11y_lock_24dp, R.color.lockscreen_color, R.string.lockscreen_label, R.string.lockscreen_label, - }); - put(ShortcutId.ID_QUICKSETTING_VALUE, new int[] { + }), + Map.entry(ShortcutId.ID_QUICKSETTING_VALUE, new int[] { R.drawable.ic_logo_a11y_quick_settings_24dp, R.color.quick_settings_color, R.string.quick_settings_label, R.string.quick_settings_label, - }); - put(ShortcutId.ID_NOTIFICATION_VALUE, new int[] { + }), + Map.entry(ShortcutId.ID_NOTIFICATION_VALUE, new int[] { R.drawable.ic_logo_a11y_notifications_24dp, R.color.notifications_color, R.string.notifications_label, R.string.notifications_label, - }); - put(ShortcutId.ID_SCREENSHOT_VALUE, new int[] { + }), + Map.entry(ShortcutId.ID_SCREENSHOT_VALUE, new int[] { R.drawable.ic_logo_a11y_screenshot_24dp, R.color.screenshot_color, R.string.screenshot_utterance, R.string.screenshot_label, - }); - put(ShortcutId.ID_BRIGHTNESS_UP_VALUE, new int[] { + }), + Map.entry(ShortcutId.ID_BRIGHTNESS_UP_VALUE, new int[] { R.drawable.ic_logo_a11y_brightness_up_24dp, R.color.brightness_color, R.string.brightness_up_label, R.string.brightness_up_label, - }); - put(ShortcutId.ID_BRIGHTNESS_DOWN_VALUE, new int[] { + }), + Map.entry(ShortcutId.ID_BRIGHTNESS_DOWN_VALUE, new int[] { R.drawable.ic_logo_a11y_brightness_down_24dp, R.color.brightness_color, R.string.brightness_down_label, R.string.brightness_down_label, - }); - put(ShortcutId.ID_VOLUME_UP_VALUE, new int[] { + }), + Map.entry(ShortcutId.ID_VOLUME_UP_VALUE, new int[] { R.drawable.ic_logo_a11y_volume_up_24dp, R.color.volume_color, R.string.volume_up_label, R.string.volume_up_label, - }); - put(ShortcutId.ID_VOLUME_DOWN_VALUE, new int[] { + }), + Map.entry(ShortcutId.ID_VOLUME_DOWN_VALUE, new int[] { R.drawable.ic_logo_a11y_volume_down_24dp, R.color.volume_color, R.string.volume_down_label, R.string.volume_down_label, - }); - }}; + }) + ); /** Shortcut id used to identify. */ private int mShortcutId = ShortcutId.UNSPECIFIED_ID_VALUE.ordinal(); diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/CommunalHub.kt b/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/CommunalHub.kt index 927890e9d6af..6d85693cc055 100644 --- a/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/CommunalHub.kt +++ b/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/CommunalHub.kt @@ -526,7 +526,7 @@ private fun BoxScope.CommunalHubLazyGrid( } } else { CommunalContent( - modifier = cardModifier.animateItemPlacement(), + modifier = cardModifier.animateItem(), model = list[index], viewModel = viewModel, size = size, diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/GridDragDropState.kt b/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/GridDragDropState.kt index 33d2cc40cb06..45a485fb0ec6 100644 --- a/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/GridDragDropState.kt +++ b/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/GridDragDropState.kt @@ -267,7 +267,7 @@ fun LazyGridItemScope.DraggableItem( alpha = itemAlpha } } else { - Modifier.animateItemPlacement() + Modifier.animateItem() } Box(modifier) { diff --git a/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/OWNERS b/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/OWNERS new file mode 100644 index 000000000000..f6f98e934dde --- /dev/null +++ b/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/OWNERS @@ -0,0 +1 @@ +include /packages/SystemUI/src/com/android/systemui/keyguard/OWNERS diff --git a/packages/SystemUI/res-product/values-am/strings.xml b/packages/SystemUI/res-product/values-am/strings.xml index b8b2df8c1e73..49e5d52912ef 100644 --- a/packages/SystemUI/res-product/values-am/strings.xml +++ b/packages/SystemUI/res-product/values-am/strings.xml @@ -58,9 +58,9 @@ <string name="high_temp_dialog_message" product="default" msgid="4272882413847595625">"የእርስዎ ስልክ በራስ-ሰር ለመቀዝቀዝ ይሞክራል። አሁንም ስልክዎን መጠቀም ይችላሉ ነገር ግን ቀትፋፋ ሆኖ ሊያሄድ ይችላል።\n\nአንዴ ስልክዎ ከቀዘቀዘ በኋላ በመደበኛነት ያሄዳል።"</string> <string name="high_temp_dialog_message" product="device" msgid="263861943935989046">"መሣሪያዎ በራስ-ሰር ለመቀዝቀዝ ይሞክራል። አሁንም መሣሪያዎን መጠቀም ይችላሉ ነገር ግን ቀርፋፋ ሆኖ ሊያሄድ ይችላል።\n\nአንዴ መሣሪያዎ ከቀዘቀዘ በኋላ በመደበኛነት ያሄዳል"</string> <string name="high_temp_dialog_message" product="tablet" msgid="5613713326841935537">"ጡባዊዎ በራስ-ሰር ለመቀዝቀዝ ይሞክራል። አሁንም ጡባዊዎን መጠቀም ይችላሉ ነገር ግን ቀርፋፋ ሆኖ ሊያሄድ ይችላል።\n\nአንዴ ጡባዊዎ ከቀዘቀዘ በኋላ በመደበኛነት ያሄዳል።"</string> - <string name="security_settings_sfps_enroll_find_sensor_message" product="tablet" msgid="3726972508570143945">"የጣት አሻራ ዳሳሹ የማብሪያ/ማጥፊያ ቁልፉ ላይ ነው። በጡባዊው ጫፍ ላይ ከፍ ካለው የድምፅ አዝራር ቀጥሎ ያለው ጠፍጣፋ አዝራር ነው።"</string> - <string name="security_settings_sfps_enroll_find_sensor_message" product="device" msgid="2929467060295094725">"የጣት አሻራ ዳሳሹ የማብሪያ/ማጥፊያ ቁልፉ ላይ ነው። በመሣሪያው ጫፍ ላይ ከፍ ካለው የድምፅ አዝራር ቀጥሎ ያለው ጠፍጣፋ አዝራር ነው።"</string> - <string name="security_settings_sfps_enroll_find_sensor_message" product="default" msgid="8582726566542997639">"የጣት አሻራ ዳሳሹ የማብሪያ/ማጥፊያ ቁልፉ ላይ ነው። በስልኩ ጫፍ ላይ ከፍ ካለው የድምፅ አዝራር ቀጥሎ ያለው ጠፍጣፋ አዝራር ነው።"</string> + <string name="security_settings_sfps_enroll_find_sensor_message" product="tablet" msgid="3726972508570143945">"የጣት አሻራ ዳሳሹ የማብሪያ/ማጥፊያ ቁልፉ ላይ ነው። በጡባዊው በማንኛውም ጠርዝ ላይ ከፍ ካለው የድምፅ አዝራር ቀጥሎ ያለው ጠፍጣፋ አዝራር ነው።"</string> + <string name="security_settings_sfps_enroll_find_sensor_message" product="device" msgid="2929467060295094725">"የጣት አሻራ ዳሳሹ የማብሪያ/ማጥፊያ ቁልፉ ላይ ነው። በመሣሪያው በማንኛውም ጠርዝ ላይ ከፍ ካለው የድምፅ አዝራር ቀጥሎ ያለው ጠፍጣፋ አዝራር ነው።"</string> + <string name="security_settings_sfps_enroll_find_sensor_message" product="default" msgid="8582726566542997639">"የጣት አሻራ ዳሳሹ የማብሪያ/ማጥፊያ ቁልፉ ላይ ነው። በስልኩ በማንኛውም ጠርዝ ላይ ከፍ ካለው የድምፅ አዝራር ቀጥሎ ያለው ጠፍጣፋ አዝራር ነው።"</string> <string name="global_action_lock_message" product="default" msgid="7092460751050168771">"ለተጨማሪ አማራጮች የእርስዎን ስልክ ይክፈቱ"</string> <string name="global_action_lock_message" product="tablet" msgid="1024230056230539493">"ለተጨማሪ አማራጮች የእርስዎን ጡባዊ ይክፈቱ"</string> <string name="global_action_lock_message" product="device" msgid="3165224897120346096">"ለተጨማሪ አማራጮች የእርስዎን መሣሪያ ይክፈቱ"</string> diff --git a/packages/SystemUI/res-product/values-ar/strings.xml b/packages/SystemUI/res-product/values-ar/strings.xml index 0ddb911f44aa..d365ef2ee5df 100644 --- a/packages/SystemUI/res-product/values-ar/strings.xml +++ b/packages/SystemUI/res-product/values-ar/strings.xml @@ -58,9 +58,9 @@ <string name="high_temp_dialog_message" product="default" msgid="4272882413847595625">"سيحاول الهاتف تخفيض درجة حرارته تلقائيًا. سيظل بإمكانك استخدام هاتفك، ولكنه قد يعمل بشكل أبطأ.\n\nبعد أن تنخفض درجة حرارة الهاتف، سيستعيد سرعته المعتادة."</string> <string name="high_temp_dialog_message" product="device" msgid="263861943935989046">"سيحاول جهازك تخفيض درجة حرارته تلقائيًا. سيظل بإمكانك استخدام جهازك، ولكنه قد يعمل بشكل أبطأ.\n\nبعد أن تنخفض درجة حرارة الجهاز، سيستعيد سرعته المعتادة."</string> <string name="high_temp_dialog_message" product="tablet" msgid="5613713326841935537">"سيحاول جهازك اللوحي تخفيض درجة حرارته تلقائيًا. سيظل بإمكانك استخدام جهازك اللوحي، ولكنه قد يعمل بشكل أبطأ.\n\nبعد أن تنخفض درجة حرارة الجهاز اللوحي، سيستعيد سرعته المعتادة."</string> - <string name="security_settings_sfps_enroll_find_sensor_message" product="tablet" msgid="3726972508570143945">"توجد أداة استشعار بصمة الإصبع على زر التشغيل. زر التشغيل هو الزر المسطّح بجانب زرَّي التحكّم بمستوى الصوت البارزَين في الجزء الجانبي من الجهاز اللوحي."</string> + <string name="security_settings_sfps_enroll_find_sensor_message" product="tablet" msgid="3726972508570143945">"توجد أداة استشعار بصمة الإصبع على زر التشغيل. زر التشغيل هو الزر المسطّح بجانب زرَّي التحكّم بمستوى الصوت البارزَين في إحدى حواف الجهاز اللوحي."</string> <string name="security_settings_sfps_enroll_find_sensor_message" product="device" msgid="2929467060295094725">"توجد أداة استشعار بصمة الإصبع على زر التشغيل. زر التشغيل هو الزر المسطّح بجانب زرَّي التحكّم بمستوى الصوت البارزَين في الجزء الجانبي من الجهاز."</string> - <string name="security_settings_sfps_enroll_find_sensor_message" product="default" msgid="8582726566542997639">"توجد أداة استشعار بصمة الإصبع على زر التشغيل. زر التشغيل هو الزر المسطّح بجانب زرَّي التحكّم بمستوى الصوت البارزَين في الجزء الجانبي من الهاتف."</string> + <string name="security_settings_sfps_enroll_find_sensor_message" product="default" msgid="8582726566542997639">"توجد أداة استشعار بصمة الإصبع على زر التشغيل. زر التشغيل هو الزر المسطّح بجانب زرَّي التحكّم بمستوى الصوت البارزَين في إحدى حواف الهاتف."</string> <string name="global_action_lock_message" product="default" msgid="7092460751050168771">"يمكنك فتح قفل هاتفك للوصول إلى مزيد من الخيارات."</string> <string name="global_action_lock_message" product="tablet" msgid="1024230056230539493">"يمكنك فتح قفل جهازك اللوحي للوصول إلى مزيد من الخيارات."</string> <string name="global_action_lock_message" product="device" msgid="3165224897120346096">"يمكنك فتح قفل جهازك للوصول إلى مزيد من الخيارات."</string> diff --git a/packages/SystemUI/res-product/values-be/strings.xml b/packages/SystemUI/res-product/values-be/strings.xml index f9ef0d5f1ebf..9b2658eeec89 100644 --- a/packages/SystemUI/res-product/values-be/strings.xml +++ b/packages/SystemUI/res-product/values-be/strings.xml @@ -58,9 +58,9 @@ <string name="high_temp_dialog_message" product="default" msgid="4272882413847595625">"Ваш тэлефон будзе астываць аўтаматычна. Вы можаце і далей ім карыстацца, але ён можа працаваць больш павольна.\n\nПасля таго як тэлефон астыне, ён будзе працаваць у звычайным рэжыме."</string> <string name="high_temp_dialog_message" product="device" msgid="263861943935989046">"Ваша прылада будзе астываць аўтаматычна. Вы можаце і далей ёй карыстацца, але яна можа працаваць больш павольна.\n\nПасля таго як прылада астыне, яна будзе працаваць у звычайным рэжыме."</string> <string name="high_temp_dialog_message" product="tablet" msgid="5613713326841935537">"Ваш планшэт будзе астываць аўтаматычна. Вы можаце і далей ім карыстацца, але ён можа працаваць больш павольна.\n\nПасля таго як планшэт астыне, ён будзе працаваць у звычайным рэжыме."</string> - <string name="security_settings_sfps_enroll_find_sensor_message" product="tablet" msgid="3726972508570143945">"Сканер адбіткаў пальцаў знаходзіцца на кнопцы сілкавання. Гэта плоская кнопка побач з выпуклай кнопкай гучнасці на бакавой грані планшэта."</string> + <string name="security_settings_sfps_enroll_find_sensor_message" product="tablet" msgid="3726972508570143945">"Сканер адбіткаў пальцаў знаходзіцца на кнопцы сілкавання. Гэта плоская кнопка побач з выпуклай кнопкай гучнасці на адной з бакавых паверхняў планшэта."</string> <string name="security_settings_sfps_enroll_find_sensor_message" product="device" msgid="2929467060295094725">"Сканер адбіткаў пальцаў знаходзіцца на кнопцы сілкавання. Гэта плоская кнопка побач з выпуклай кнопкай гучнасці на бакавой грані прылады."</string> - <string name="security_settings_sfps_enroll_find_sensor_message" product="default" msgid="8582726566542997639">"Сканер адбіткаў пальцаў знаходзіцца на кнопцы сілкавання. Гэта плоская кнопка побач з выпуклай кнопкай гучнасці на бакавой грані тэлефона."</string> + <string name="security_settings_sfps_enroll_find_sensor_message" product="default" msgid="8582726566542997639">"Сканер адбіткаў пальцаў знаходзіцца на кнопцы сілкавання. Гэта плоская кнопка побач з выпуклай кнопкай гучнасці на адной з бакавых паверхняў тэлефона."</string> <string name="global_action_lock_message" product="default" msgid="7092460751050168771">"Каб адкрыць іншыя параметры, разблакіруйце тэлефон"</string> <string name="global_action_lock_message" product="tablet" msgid="1024230056230539493">"Каб адкрыць іншыя параметры, разблакіруйце планшэт"</string> <string name="global_action_lock_message" product="device" msgid="3165224897120346096">"Каб адкрыць іншыя параметры, разблакіруйце прыладу"</string> diff --git a/packages/SystemUI/res-product/values-is/strings.xml b/packages/SystemUI/res-product/values-is/strings.xml index 0f3f71cb9979..a39dd2daec8d 100644 --- a/packages/SystemUI/res-product/values-is/strings.xml +++ b/packages/SystemUI/res-product/values-is/strings.xml @@ -58,7 +58,7 @@ <string name="high_temp_dialog_message" product="default" msgid="4272882413847595625">"Síminn reynir að kæla sig sjálfkrafa. Þú getur áfram notað símann en hann gæti verið hægvirkari.\n\nÞegar síminn hefur kælt sig mun hann virka eðlilega."</string> <string name="high_temp_dialog_message" product="device" msgid="263861943935989046">"Tækið reynir að kæla sig sjálfkrafa. Þú getur áfram notað tækið en það gæti verið hægvirkara.\n\nÞegar tækið hefur kælt sig mun það virka eðlilega."</string> <string name="high_temp_dialog_message" product="tablet" msgid="5613713326841935537">"Spjaldtölvan reynir að kæla sig sjálfkrafa. Þú getur áfram notað spjaldtölvuna en hún gæti verið hægvirkari.\n\nÞegar spjaldtölvan hefur kælt sig mun hún virka eðlilega."</string> - <string name="security_settings_sfps_enroll_find_sensor_message" product="tablet" msgid="3726972508570143945">"Fingrafaralesarinn er á aflrofanum. Það er flati hnappurinn við hliðina á upphleypta hljóðstyrkshnappnum á hlið spjaldtölvunnar."</string> + <string name="security_settings_sfps_enroll_find_sensor_message" product="tablet" msgid="3726972508570143945">"Fingrafaralesarinn er á aflrofanum. Það er flati hnappurinn við hliðina á upphleypta hljóðstyrkshnappnum á brún spjaldtölvunnar."</string> <string name="security_settings_sfps_enroll_find_sensor_message" product="device" msgid="2929467060295094725">"Fingrafaralesarinn er á aflrofanum. Það er flati hnappurinn við hliðina á upphleypta hljóðstyrkshnappnum á hlið tækisins."</string> <string name="security_settings_sfps_enroll_find_sensor_message" product="default" msgid="8582726566542997639">"Fingrafaralesarinn er á aflrofanum. Það er flati hnappurinn við hliðina á upphleypta hljóðstyrkshnappnum á hlið símans."</string> <string name="global_action_lock_message" product="default" msgid="7092460751050168771">"Taktu símann úr lás til að fá fleiri valkosti"</string> diff --git a/packages/SystemUI/res/layout/screen_share_dialog.xml b/packages/SystemUI/res/layout/screen_share_dialog.xml index 2616e8ae25e8..aa083ad9fdea 100644 --- a/packages/SystemUI/res/layout/screen_share_dialog.xml +++ b/packages/SystemUI/res/layout/screen_share_dialog.xml @@ -46,7 +46,7 @@ android:layout_marginTop="@dimen/screenrecord_title_margin_top" android:gravity="center"/> <Spinner - android:id="@+id/screen_share_mode_spinner" + android:id="@+id/screen_share_mode_options" android:layout_width="match_parent" android:layout_height="@dimen/screenrecord_spinner_height" android:layout_marginTop="@dimen/screenrecord_spinner_margin" diff --git a/packages/SystemUI/res/values-af/strings.xml b/packages/SystemUI/res/values-af/strings.xml index ecb2e5829f2a..7cb31efcdc48 100644 --- a/packages/SystemUI/res/values-af/strings.xml +++ b/packages/SystemUI/res/values-af/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"Ontsluit met gesig. Druk om voort te gaan."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"Gesig is herken. Druk om voort te gaan."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"Gesig is herken. Druk die ontsluitikoon om voort te gaan."</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"Ontsluit met gesig. Tik om voort te gaan."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"Gestaaf"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"Kanselleer stawing"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"Meer opsies"</string> diff --git a/packages/SystemUI/res/values-am/strings.xml b/packages/SystemUI/res/values-am/strings.xml index f6c3b2ac96eb..dc1258dd6a3d 100644 --- a/packages/SystemUI/res/values-am/strings.xml +++ b/packages/SystemUI/res/values-am/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"በመልክ ተከፍቷል። ለመቀጠል ይጫኑ።"</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"መልክ ተለይቶ ታውቋል። ለመቀጠል ይጫኑ።"</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"መልክ ተለይቶ ታውቋል። ለመቀጠል የመክፈቻ አዶውን ይጫኑ።"</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"በመልክ ተከፍቷል። ለመቀጠል መታ ያድርጉ።"</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"የተረጋገጠ"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"ማረጋገጥን ሰርዝ"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"ተጨማሪ አማራጮች"</string> diff --git a/packages/SystemUI/res/values-ar/strings.xml b/packages/SystemUI/res/values-ar/strings.xml index 04a5c9a647cc..170cf1cf8d91 100644 --- a/packages/SystemUI/res/values-ar/strings.xml +++ b/packages/SystemUI/res/values-ar/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"تم فتح الجهاز بالتعرّف على وجهك. اضغط للمتابعة."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"تم التعرّف على الوجه. اضغط للمتابعة."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"تم التعرّف على الوجه. للمتابعة، اضغط على رمز فتح القفل."</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"تمّ فتح قفل جهازك باستخدام بصمة الوجه. انقر للمتابعة."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"مصادقة"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"إلغاء المصادقة"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"مزيد من الخيارات"</string> diff --git a/packages/SystemUI/res/values-as/strings.xml b/packages/SystemUI/res/values-as/strings.xml index 7738b5bc5bd0..eb3a860ba481 100644 --- a/packages/SystemUI/res/values-as/strings.xml +++ b/packages/SystemUI/res/values-as/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"মুখাৱয়বৰ জৰিয়তে আনলক কৰা হৈছে। অব্যাহত ৰাখিবলৈ টিপক।"</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"মুখাৱয়ব চিনাক্ত কৰা হৈছে। অব্যাহত ৰাখিবলৈ টিপক।"</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"মুখাৱয়ব চিনাক্ত কৰা হৈছে। অব্যাহত ৰাখিবলৈ আনলক কৰক চিহ্নটোত টিপক।"</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"মুখাৱয়বৰ জৰিয়তে আনলক কৰা হৈছে। অব্যাহত ৰাখিবলৈ টিপক।"</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"বিশ্বাসযোগ্যতা প্ৰমাণীকৰণ কৰা হ’ল"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"বিশ্বাসযোগ্যতা প্ৰমাণীকৰণ বাতিল কৰক"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"অধিক বিকল্প"</string> diff --git a/packages/SystemUI/res/values-az/strings.xml b/packages/SystemUI/res/values-az/strings.xml index 6a4d454ba236..c0757398ab2c 100644 --- a/packages/SystemUI/res/values-az/strings.xml +++ b/packages/SystemUI/res/values-az/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"Üz ilə kiliddən çıxarılıb. Davam etmək üçün basın."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"Üz tanınıb. Davam etmək üçün basın."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"Üz tanınıb. \"Kiliddən çıxar\" ikonasına basıb davam edin."</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"Üz ilə kiliddən çıxarılıb. Davam etmək üçün toxunun."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"Doğrulandı"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"İdentifikasiyanı ləğv edin"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"Digər seçimlər"</string> diff --git a/packages/SystemUI/res/values-b+sr+Latn/strings.xml b/packages/SystemUI/res/values-b+sr+Latn/strings.xml index 02f2cebfd38a..28e9e3182f16 100644 --- a/packages/SystemUI/res/values-b+sr+Latn/strings.xml +++ b/packages/SystemUI/res/values-b+sr+Latn/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"Otključano je licem. Pritisnite da biste nastavili."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"Lice je prepoznato. Pritisnite da biste nastavili."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"Lice prepoznato. Pritisnite ikonu otključavanja za nastavak."</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"Otključano je licem. Dodirnite da biste nastavili."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"Identitet je potvrđen"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"Otkažite potvrdu identiteta"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"Još opcija"</string> diff --git a/packages/SystemUI/res/values-be/strings.xml b/packages/SystemUI/res/values-be/strings.xml index 90eba5721d0c..a146b3bff0b2 100644 --- a/packages/SystemUI/res/values-be/strings.xml +++ b/packages/SystemUI/res/values-be/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"Разблакіравана распазнаваннем твару. Націсніце для працягу."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"Твар распазнаны. Націсніце для працягу."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"Твар распазнаны. Для працягу націсніце значок разблакіроўкі."</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"Твар распазнаны. Націсніце, каб працягнуць."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"Распазнана"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"Скасаваць аўтэнтыфікацыю"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"Іншыя варыянты"</string> @@ -711,7 +710,7 @@ <string name="notification_channel_summary_automatic_promoted" msgid="1301710305149590426">"<b>Стан:</b> Ацэнена як важнае"</string> <string name="notification_channel_summary_automatic_demoted" msgid="1831303964660807700">"<b>Стан:</b> Ацэнена як няважнае"</string> <string name="notification_channel_summary_priority_baseline" msgid="46674690072551234">"З\'яўляецца ўверсе раздзела размоў і паказвае на экране блакіроўкі відарыс профілю"</string> - <string name="notification_channel_summary_priority_bubble" msgid="1275413109619074576">"З\'яўляецца ўверсе раздзела размоў як усплывальнае апавяшчэнне, якое паказвае на экране блакіроўкі відарыс профілю"</string> + <string name="notification_channel_summary_priority_bubble" msgid="1275413109619074576">"З’яўляецца ўверсе раздзела размоў як усплывальнае апавяшчэнне, якое паказвае на экране блакіроўкі відарыс профілю"</string> <string name="notification_channel_summary_priority_dnd" msgid="6665395023264154361">"З\'яўляецца ўверсе раздзела размоў, перарывае рэжым \"Не турбаваць\" і паказвае на экране блакіроўкі відарыс профілю"</string> <string name="notification_channel_summary_priority_all" msgid="7151752959650048285">"З\'яўляецца ўверсе раздзела размоў як усплывальнае апавяшчэнне, якое перарывае рэжым \"Не турбаваць\" і паказвае на экране блакіроўкі відарыс профілю"</string> <string name="notification_priority_title" msgid="2079708866333537093">"Прыярытэт"</string> @@ -1178,7 +1177,7 @@ <string name="game_status" msgid="1340694320630973259">"Ідзе гульня"</string> <string name="empty_user_name" msgid="3389155775773578300">"Сябры"</string> <string name="empty_status" msgid="5938893404951307749">"Паразмаўляем у чаце!"</string> - <string name="status_before_loading" msgid="1500477307859631381">"Неўзабаве з\'явіцца змесціва"</string> + <string name="status_before_loading" msgid="1500477307859631381">"Неўзабаве з’явіцца змесціва"</string> <string name="missed_call" msgid="4228016077700161689">"Прапушчаны выклік"</string> <string name="messages_count_overflow_indicator" msgid="7850934067082006043">"<xliff:g id="NUMBER">%d</xliff:g>+"</string> <string name="people_tile_description" msgid="8154966188085545556">"Глядзець нядаўнія паведамленні, прапушчаныя выклікі і абнаўленні стану"</string> diff --git a/packages/SystemUI/res/values-bg/strings.xml b/packages/SystemUI/res/values-bg/strings.xml index d3c3e76684df..80cb62f7835c 100644 --- a/packages/SystemUI/res/values-bg/strings.xml +++ b/packages/SystemUI/res/values-bg/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"Отключено с лице. Натиснете, за да продължите."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"Лицето бе разпознато. Натиснете, за да продължите."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"Лицето бе разпознато. Продължете чрез иконата за отключване."</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"Отключено с лице. Докоснете, за да продължите."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"Удостоверено"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"Анулиране на удостоверяването"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"Още опции"</string> diff --git a/packages/SystemUI/res/values-bn/strings.xml b/packages/SystemUI/res/values-bn/strings.xml index b584d1c1ced4..f4c32ac61846 100644 --- a/packages/SystemUI/res/values-bn/strings.xml +++ b/packages/SystemUI/res/values-bn/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"ফেসের সাহায্যে আনলক করা হয়েছে। চালিয়ে যেতে প্রেস করুন।"</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"ফেস শনাক্ত করা হয়েছে। চালিয়ে যেতে প্রেস করুন।"</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"ফেস শনাক্ত করা হয়েছে। চালিয়ে যেতে আনলক আইকন প্রেস করুন।"</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"ফেসের সাহায্যে আনলক করা হয়েছে। চালিয়ে যেতে ট্যাপ করুন।"</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"প্রমাণীকৃত"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"যাচাইকরণ বাতিল করুন"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"আরও বিকল্প"</string> diff --git a/packages/SystemUI/res/values-bs/strings.xml b/packages/SystemUI/res/values-bs/strings.xml index 0ecdd6b3fefb..db01c0a6ba04 100644 --- a/packages/SystemUI/res/values-bs/strings.xml +++ b/packages/SystemUI/res/values-bs/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"Otključano licem. Pritisnite da nastavite."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"Lice prepoznato. Pritisnite da nastavite."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"Lice prepoznato. Pritisnite ikonu za otklj. da nastavite."</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"Otključano je licem. Dodirnite da nastavite."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"Autentificirano"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"Otkažite autentifikaciju"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"Više opcija"</string> diff --git a/packages/SystemUI/res/values-ca/strings.xml b/packages/SystemUI/res/values-ca/strings.xml index 7e2b6c220eed..82677bf8ce2c 100644 --- a/packages/SystemUI/res/values-ca/strings.xml +++ b/packages/SystemUI/res/values-ca/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"S\'ha desbloquejat amb la cara. Prem per continuar."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"S\'ha reconegut la cara. Prem per continuar."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"S\'ha reconegut la cara. Prem la icona per continuar."</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"S\'ha desbloquejat amb la cara. Toca per continuar."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"Autenticat"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"Cancel·la l\'autenticació"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"Més opcions"</string> diff --git a/packages/SystemUI/res/values-cs/strings.xml b/packages/SystemUI/res/values-cs/strings.xml index 87c2008c1b58..d61901fb4df5 100644 --- a/packages/SystemUI/res/values-cs/strings.xml +++ b/packages/SystemUI/res/values-cs/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"Odemknuto obličejem. Pokračujte stisknutím."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"Obličej rozpoznán. Pokračujte stisknutím."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"Obličej rozpoznán. Klepněte na ikonu odemknutí."</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"Odemknuto obličejem. Pokračujte klepnutím."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"Ověřeno"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"Zrušit ověření"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"Další možnosti"</string> diff --git a/packages/SystemUI/res/values-da/strings.xml b/packages/SystemUI/res/values-da/strings.xml index 0abf2a42a28c..812cb068bff2 100644 --- a/packages/SystemUI/res/values-da/strings.xml +++ b/packages/SystemUI/res/values-da/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"Låst op ved hjælp af ansigt. Tryk for at fortsætte."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"Ansigt genkendt. Tryk for at fortsætte."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"Ansigt genkendt. Tryk på oplåsningsikonet for at fortsætte."</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"Låst op ved hjælp af ansigt. Tryk for at fortsætte."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"Godkendt"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"Annuller godkendelsen"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"Flere valgmuligheder"</string> diff --git a/packages/SystemUI/res/values-de/strings.xml b/packages/SystemUI/res/values-de/strings.xml index b042a5a46ca1..647379eaccd2 100644 --- a/packages/SystemUI/res/values-de/strings.xml +++ b/packages/SystemUI/res/values-de/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"Gerät mit dem Gesicht entsperrt. Tippe, um fortzufahren."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"Gesicht erkannt. Tippe, um fortzufahren."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"Gesicht erkannt. Tippe zum Fortfahren auf das Symbol „Entsperren“."</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"Per Gesichtserkennung entsperrt. Tippe, um fortzufahren."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"Authentifiziert"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"Authentifizierung abbrechen"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"Weitere Optionen"</string> diff --git a/packages/SystemUI/res/values-el/strings.xml b/packages/SystemUI/res/values-el/strings.xml index 3b5431cd22c2..9489bbf6d554 100644 --- a/packages/SystemUI/res/values-el/strings.xml +++ b/packages/SystemUI/res/values-el/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"Ξεκλείδωμα με αναγνώριση προσώπου. Πατήστε για συνέχεια."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"Το πρόσωπο αναγνωρίστηκε. Πατήστε για συνέχεια."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"Το πρόσωπο αναγνωρ. Πατήστε το εικον. ξεκλειδ. για συνέχεια."</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"Ξεκλείδωμα με αναγνώριση προσώπου. Πατήστε για συνέχεια."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"Ολοκληρώθηκε ο έλεγχος ταυτότητας"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"Ακύρωση ελέγχου ταυτότητας"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"Περισσότερες επιλογές"</string> diff --git a/packages/SystemUI/res/values-en-rAU/strings.xml b/packages/SystemUI/res/values-en-rAU/strings.xml index 8c156f5ada5c..8db45700c40a 100644 --- a/packages/SystemUI/res/values-en-rAU/strings.xml +++ b/packages/SystemUI/res/values-en-rAU/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"Unlocked by face. Press to continue."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"Face recognised. Press to continue."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"Face recognised. Press the unlock icon to continue."</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"Unlocked by face. Tap to continue."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"Authenticated"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"Cancel authentication"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"More options"</string> diff --git a/packages/SystemUI/res/values-en-rGB/strings.xml b/packages/SystemUI/res/values-en-rGB/strings.xml index 8c156f5ada5c..8db45700c40a 100644 --- a/packages/SystemUI/res/values-en-rGB/strings.xml +++ b/packages/SystemUI/res/values-en-rGB/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"Unlocked by face. Press to continue."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"Face recognised. Press to continue."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"Face recognised. Press the unlock icon to continue."</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"Unlocked by face. Tap to continue."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"Authenticated"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"Cancel authentication"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"More options"</string> diff --git a/packages/SystemUI/res/values-en-rIN/strings.xml b/packages/SystemUI/res/values-en-rIN/strings.xml index 8c156f5ada5c..8db45700c40a 100644 --- a/packages/SystemUI/res/values-en-rIN/strings.xml +++ b/packages/SystemUI/res/values-en-rIN/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"Unlocked by face. Press to continue."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"Face recognised. Press to continue."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"Face recognised. Press the unlock icon to continue."</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"Unlocked by face. Tap to continue."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"Authenticated"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"Cancel authentication"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"More options"</string> diff --git a/packages/SystemUI/res/values-es-rUS/strings.xml b/packages/SystemUI/res/values-es-rUS/strings.xml index c8b175ea3c32..06422fa20ec2 100644 --- a/packages/SystemUI/res/values-es-rUS/strings.xml +++ b/packages/SystemUI/res/values-es-rUS/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"Desbloqueo con rostro. Presiona para continuar."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"Rostro reconocido. Presiona para continuar."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"Rostro reconocido. Presiona el desbloqueo para continuar."</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"Se desbloqueó con el rostro. Presiona para continuar."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"Autenticado"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"Cancelar autenticación"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"Más opciones"</string> diff --git a/packages/SystemUI/res/values-es/strings.xml b/packages/SystemUI/res/values-es/strings.xml index a6a71fc37aa4..9d52c0eb526a 100644 --- a/packages/SystemUI/res/values-es/strings.xml +++ b/packages/SystemUI/res/values-es/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"Desbloqueado con la cara. Pulsa para continuar."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"Cara reconocida. Pulsa para continuar."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"Cara reconocida. Pulsa el icono de desbloquear para continuar."</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"Desbloqueado con la cara. Toca para continuar."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"Se ha autenticado"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"Cancelar autenticación"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"Más opciones"</string> diff --git a/packages/SystemUI/res/values-es/tiles_states_strings.xml b/packages/SystemUI/res/values-es/tiles_states_strings.xml index 5dbb2c132f4c..08644e1cbe40 100644 --- a/packages/SystemUI/res/values-es/tiles_states_strings.xml +++ b/packages/SystemUI/res/values-es/tiles_states_strings.xml @@ -43,7 +43,7 @@ </string-array> <string-array name="tile_states_cell"> <item msgid="1235899788959500719">"No disponible"</item> - <item msgid="2074416252859094119">"Desactivadas"</item> + <item msgid="2074416252859094119">"Desactivado"</item> <item msgid="287997784730044767">"Activado"</item> </string-array> <string-array name="tile_states_battery"> @@ -189,6 +189,6 @@ <string-array name="tile_states_hearing_devices"> <item msgid="1235334096484287173">"No disponibles"</item> <item msgid="3079622119444911877">"Desactivados"</item> - <item msgid="3028994095749238254">"Activados"</item> + <item msgid="3028994095749238254">"Activado"</item> </string-array> </resources> diff --git a/packages/SystemUI/res/values-et/strings.xml b/packages/SystemUI/res/values-et/strings.xml index cc1dc42791fd..3186f478e8ac 100644 --- a/packages/SystemUI/res/values-et/strings.xml +++ b/packages/SystemUI/res/values-et/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"Avati näoga. Vajutage jätkamiseks."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"Nägu tuvastati. Vajutage jätkamiseks."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"Nägu tuvastati. Jätkamiseks vajutage avamise ikooni."</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"Avati näoga. Puudutage jätkamiseks."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"Autenditud"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"Tühista autentimine"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"Rohkem valikuid"</string> diff --git a/packages/SystemUI/res/values-eu/strings.xml b/packages/SystemUI/res/values-eu/strings.xml index f0b23be81146..7241cb49ba30 100644 --- a/packages/SystemUI/res/values-eu/strings.xml +++ b/packages/SystemUI/res/values-eu/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"Aurpegiaren bidez desblokeatu da. Sakatu aurrera egiteko."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"Ezagutu da aurpegia. Sakatu aurrera egiteko."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"Ezagutu da aurpegia. Aurrera egiteko, sakatu desblokeatzeko ikonoa."</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"Aurpegiaren bidez desblokeatu da. Sakatu hau aurrera egiteko."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"Autentifikatuta"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"Utzi bertan behera autentifikazioa"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"Aukera gehiago"</string> diff --git a/packages/SystemUI/res/values-fa/strings.xml b/packages/SystemUI/res/values-fa/strings.xml index f28e395a4444..7710d939a486 100644 --- a/packages/SystemUI/res/values-fa/strings.xml +++ b/packages/SystemUI/res/values-fa/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"قفلْ با چهره باز شد. برای ادامه، فشار دهید."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"چهره شناسایی شد. برای ادامه، فشار دهید."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"چهره شناسایی شد. برای ادامه، نماد قفلگشایی را فشار دهید."</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"قفل با چهره باز شد. برای ادامه ضربه بزنید."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"راستیآزماییشده"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"لغو اصالتسنجی"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"گزینههای بیشتر"</string> diff --git a/packages/SystemUI/res/values-fi/strings.xml b/packages/SystemUI/res/values-fi/strings.xml index 06ffd9fc1478..886576f1e1a4 100644 --- a/packages/SystemUI/res/values-fi/strings.xml +++ b/packages/SystemUI/res/values-fi/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"Avattu kasvojen avulla. Jatka painamalla."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"Kasvot tunnistettu. Jatka painamalla."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"Kasvot tunnistettu. Jatka lukituksen avauskuvakkeella."</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"Avattu kasvojen avulla. Jatka napauttamalla."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"Todennettu"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"Peruuta todennus"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"Lisää vaihtoehtoja"</string> diff --git a/packages/SystemUI/res/values-fr-rCA/strings.xml b/packages/SystemUI/res/values-fr-rCA/strings.xml index 4310833ebe87..f635b69a6f9a 100644 --- a/packages/SystemUI/res/values-fr-rCA/strings.xml +++ b/packages/SystemUI/res/values-fr-rCA/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"Déverr. par reconnaissance faciale. Appuyez pour continuer."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"Visage reconnu. Appuyez pour continuer."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"Visage reconnu. Appuyez sur Déverrouiller pour continuer."</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"Déverrouillé avec le visage. Touchez pour continuer."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"Authentifié"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"Annuler l\'authentification"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"Plus d\'options"</string> diff --git a/packages/SystemUI/res/values-fr-rCA/tiles_states_strings.xml b/packages/SystemUI/res/values-fr-rCA/tiles_states_strings.xml index 52b763b4028d..f12634faecbb 100644 --- a/packages/SystemUI/res/values-fr-rCA/tiles_states_strings.xml +++ b/packages/SystemUI/res/values-fr-rCA/tiles_states_strings.xml @@ -38,7 +38,7 @@ </string-array> <string-array name="tile_states_wifi"> <item msgid="8054147400538405410">"Non disponible"</item> - <item msgid="4293012229142257455">"Désactivé"</item> + <item msgid="4293012229142257455">"Désactivée"</item> <item msgid="6221288736127914861">"Activé"</item> </string-array> <string-array name="tile_states_cell"> @@ -53,7 +53,7 @@ </string-array> <string-array name="tile_states_dnd"> <item msgid="467587075903158357">"Non disponible"</item> - <item msgid="5376619709702103243">"Désactivé"</item> + <item msgid="5376619709702103243">"Désactivée"</item> <item msgid="4875147066469902392">"Activé"</item> </string-array> <string-array name="tile_states_flashlight"> @@ -68,12 +68,12 @@ </string-array> <string-array name="tile_states_bt"> <item msgid="5330252067413512277">"Non disponible"</item> - <item msgid="5315121904534729843">"Désactivé"</item> + <item msgid="5315121904534729843">"Désactivée"</item> <item msgid="503679232285959074">"Activé"</item> </string-array> <string-array name="tile_states_airplane"> <item msgid="1985366811411407764">"Non disponible"</item> - <item msgid="4801037224991420996">"Désactivé"</item> + <item msgid="4801037224991420996">"Désactivée"</item> <item msgid="1982293347302546665">"Activé"</item> </string-array> <string-array name="tile_states_location"> @@ -83,7 +83,7 @@ </string-array> <string-array name="tile_states_hotspot"> <item msgid="3145597331197351214">"Non disponible"</item> - <item msgid="5715725170633593906">"Désactivé"</item> + <item msgid="5715725170633593906">"Désactivée"</item> <item msgid="2075645297847971154">"Activé"</item> </string-array> <string-array name="tile_states_color_correction"> @@ -103,7 +103,7 @@ </string-array> <string-array name="tile_states_dark"> <item msgid="2762596907080603047">"Non disponible"</item> - <item msgid="400477985171353">"Désactivé"</item> + <item msgid="400477985171353">"Désactivée"</item> <item msgid="630890598801118771">"Activé"</item> </string-array> <string-array name="tile_states_work"> @@ -143,7 +143,7 @@ </string-array> <string-array name="tile_states_cameratoggle"> <item msgid="6680671247180519913">"Non disponible"</item> - <item msgid="4765607635752003190">"Désactivé"</item> + <item msgid="4765607635752003190">"Désactivée"</item> <item msgid="1697460731949649844">"Activé"</item> </string-array> <string-array name="tile_states_mictoggle"> @@ -153,7 +153,7 @@ </string-array> <string-array name="tile_states_controls"> <item msgid="8199009425335668294">"Non disponibles"</item> - <item msgid="4544919905196727508">"Désactivées"</item> + <item msgid="4544919905196727508">"Désactivée"</item> <item msgid="3422023746567004609">"Activées"</item> </string-array> <string-array name="tile_states_wallet"> diff --git a/packages/SystemUI/res/values-fr/strings.xml b/packages/SystemUI/res/values-fr/strings.xml index d51152d5fdb6..d568998896a3 100644 --- a/packages/SystemUI/res/values-fr/strings.xml +++ b/packages/SystemUI/res/values-fr/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"Déverrouillé par visage. Appuyez pour continuer."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"Visage reconnu. Appuyez pour continuer."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"Visage reconnu. Appuyez sur l\'icône de déverrouillage pour continuer."</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"Déverrouillé par le visage. Appuyez pour continuer."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"Authentifié"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"Annuler l\'authentification"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"Plus d\'options"</string> diff --git a/packages/SystemUI/res/values-gl/strings.xml b/packages/SystemUI/res/values-gl/strings.xml index 42a8882fcaf2..bf9aa533bfbd 100644 --- a/packages/SystemUI/res/values-gl/strings.xml +++ b/packages/SystemUI/res/values-gl/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"Usouse o desbloqueo facial. Preme para continuar."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"Recoñeceuse a cara. Preme para continuar."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"Recoñeceuse a cara. Preme a icona de desbloquear."</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"Usouse o desbloqueo facial. Toca para continuar."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"Autenticado"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"Cancelar a autenticación"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"Máis opcións"</string> diff --git a/packages/SystemUI/res/values-gu/strings.xml b/packages/SystemUI/res/values-gu/strings.xml index 58c123f41c54..4dff8d00dd8b 100644 --- a/packages/SystemUI/res/values-gu/strings.xml +++ b/packages/SystemUI/res/values-gu/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"ચહેરા દ્વારા અનલૉક કર્યું. આગળ વધવા માટે દબાવો."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"ચહેરો ઓળખ્યો. આગળ વધવા માટે દબાવો."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"ચહેરો ઓળખ્યો. આગળ વધવા \'અનલૉક કરો\' આઇકન દબાવો."</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"ચહેરા દ્વારા અનલૉક કર્યું. ચાલુ રાખવા માટે ટૅપ કરો."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"પ્રમાણિત"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"પ્રમાણીકરણ રદ કરો"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"વધુ વિકલ્પો"</string> diff --git a/packages/SystemUI/res/values-hi/strings.xml b/packages/SystemUI/res/values-hi/strings.xml index e733ace1ba7c..e226f54e151c 100644 --- a/packages/SystemUI/res/values-hi/strings.xml +++ b/packages/SystemUI/res/values-hi/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"चेहरे से अनलॉक किया गया. जारी रखने के लिए टैप करें."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"चेहरे की पहचान हो गई. जारी रखने के लिए टैप करें."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"चेहरे की पहचान हो गई. जारी रखने के लिए अनलॉक आइकॉन को टैप करें."</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"चेहरे से अनलॉक किया गया. जारी रखने के लिए टैप करें."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"पुष्टि हो गई"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"पुष्टि करने की प्रोसेस को रद्द करें"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"ज़्यादा विकल्प"</string> diff --git a/packages/SystemUI/res/values-hr/strings.xml b/packages/SystemUI/res/values-hr/strings.xml index 44f59284fae7..14395961d3d0 100644 --- a/packages/SystemUI/res/values-hr/strings.xml +++ b/packages/SystemUI/res/values-hr/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"Otključano pomoću lica. Pritisnite da biste nastavili."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"Lice je prepoznato. Pritisnite da biste nastavili."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"Lice je prepoznato. Pritisnite ikonu otključavanja da biste nastavili."</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"Otključano licem. Dodirnite za nastavak."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"Autentifikacija izvršena"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"Otkaži autentifikaciju"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"Više opcija"</string> diff --git a/packages/SystemUI/res/values-hu/strings.xml b/packages/SystemUI/res/values-hu/strings.xml index 55bd27316f5a..10865669424e 100644 --- a/packages/SystemUI/res/values-hu/strings.xml +++ b/packages/SystemUI/res/values-hu/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"Zárolás arccal feloldva. Koppintson a folytatáshoz."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"Arc felismerve. Koppintson a folytatáshoz."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"Arc felismerve. A folytatáshoz koppintson a Feloldásra."</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"Zárolás arccal feloldva. Koppintson a folytatáshoz."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"Hitelesítve"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"Hitelesítés megszakítása"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"További lehetőségek"</string> diff --git a/packages/SystemUI/res/values-hy/strings.xml b/packages/SystemUI/res/values-hy/strings.xml index 34258d0ac3b9..e828ab95c7b2 100644 --- a/packages/SystemUI/res/values-hy/strings.xml +++ b/packages/SystemUI/res/values-hy/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"Ապակողպվել է դեմքով։ Սեղմեք շարունակելու համար։"</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"Դեմքը ճանաչվեց։ Սեղմեք շարունակելու համար։"</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"Դեմքը ճանաչվեց։ Սեղմեք ապակողպման պատկերակը։"</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"Ապակողպվել է դեմքով։ Հպեք շարունակելու համար:"</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"Նույնականացված է"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"Չեղարկել իսկորոշումը"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"Լրացուցիչ ընտրանքներ"</string> diff --git a/packages/SystemUI/res/values-in/strings.xml b/packages/SystemUI/res/values-in/strings.xml index d4a0b9a31b2a..7a69863a8daf 100644 --- a/packages/SystemUI/res/values-in/strings.xml +++ b/packages/SystemUI/res/values-in/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"Kunci dibuka dengan wajah. Tekan untuk melanjutkan."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"Wajah dikenali. Tekan untuk melanjutkan."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"Wajah dikenali. Tekan ikon buka kunci untuk melanjutkan."</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"Kunci dibuka dengan wajah. Ketuk untuk melanjutkan."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"Diautentikasi"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"Batalkan Autentikasi"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"Opsi Lainnya"</string> diff --git a/packages/SystemUI/res/values-is/strings.xml b/packages/SystemUI/res/values-is/strings.xml index 002c47cedadb..b9ad4ecff94c 100644 --- a/packages/SystemUI/res/values-is/strings.xml +++ b/packages/SystemUI/res/values-is/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"Opnað með andliti. Ýttu til að halda áfram."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"Andlitið var greint. Ýttu til að halda áfram."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"Andlitið var greint. Ýttu á opnunartáknið til að halda áfr."</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"Opnað með andliti. Ýttu til að halda áfram."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"Auðkennt"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"Hætta við auðkenningu"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"Fleiri valkostir"</string> diff --git a/packages/SystemUI/res/values-it/strings.xml b/packages/SystemUI/res/values-it/strings.xml index f341ed0ab6b5..7225e1623c4a 100644 --- a/packages/SystemUI/res/values-it/strings.xml +++ b/packages/SystemUI/res/values-it/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"Sbloccato con il volto. Premi per continuare."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"Volto riconosciuto. Premi per continuare."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"Volto riconosciuto. Premi l\'icona Sblocca e continua."</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"Sbloccato con il volto. Tocca per continuare."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"Autenticazione eseguita"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"Annulla autenticazione"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"Altre opzioni"</string> diff --git a/packages/SystemUI/res/values-iw/strings.xml b/packages/SystemUI/res/values-iw/strings.xml index 0d3da6990ee9..2c9e3a0133a9 100644 --- a/packages/SystemUI/res/values-iw/strings.xml +++ b/packages/SystemUI/res/values-iw/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"הנעילה בוטלה באמצעות זיהוי הפנים. יש ללחוץ כדי להמשיך."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"הפנים זוהו. יש ללחוץ כדי להמשיך."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"הפנים זוהו. להמשך יש ללחוץ על סמל ביטול הנעילה."</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"הנעילה בוטלה באמצעות זיהוי הפנים. צריך להקיש כדי להמשיך."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"מאומת"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"ביטול האימות"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"אפשרויות נוספות"</string> diff --git a/packages/SystemUI/res/values-ja/strings.xml b/packages/SystemUI/res/values-ja/strings.xml index 05e4d43ba8e6..e2269cdd81e2 100644 --- a/packages/SystemUI/res/values-ja/strings.xml +++ b/packages/SystemUI/res/values-ja/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"顔でロック解除しました。押して続行してください。"</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"顔を認識しました。押して続行してください。"</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"顔を認識しました。ロック解除アイコンを押して続行します。"</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"顔認証でロック解除しました。タップして続行します。"</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"認証済み"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"認証をキャンセルします"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"その他のオプション"</string> diff --git a/packages/SystemUI/res/values-ka/strings.xml b/packages/SystemUI/res/values-ka/strings.xml index 28ebdd6988d4..1579ead90401 100644 --- a/packages/SystemUI/res/values-ka/strings.xml +++ b/packages/SystemUI/res/values-ka/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"განიბლოკა სახით. დააჭირეთ გასაგრძელებლად."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"ამოცნობილია სახით. დააჭირეთ გასაგრძელებლად."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"ამოცნობილია სახით. გასაგრძელებლად დააჭირეთ განბლოკვის ხატულას."</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"განიბლოკა სახით. შეეხეთ გასაგრძელებლად."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"ავტორიზებულია"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"ავტორიზაციის გაუქმება"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"სხვა ვარიანტები"</string> diff --git a/packages/SystemUI/res/values-kk/strings.xml b/packages/SystemUI/res/values-kk/strings.xml index 2b5f1a094852..94c5fead19ca 100644 --- a/packages/SystemUI/res/values-kk/strings.xml +++ b/packages/SystemUI/res/values-kk/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"Бетпен ашылды. Жалғастыру үшін басыңыз."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"Бет танылды. Жалғастыру үшін басыңыз."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"Бет танылды. Жалғастыру үшін құлыпты ашу белгішесін басыңыз."</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"Бетпен ашылды. Жалғастыру үшін түртіңіз."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"Аутентификацияланған"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"Аутентификациядан бас тарту"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"Қосымша опциялар"</string> diff --git a/packages/SystemUI/res/values-km/strings.xml b/packages/SystemUI/res/values-km/strings.xml index 36ab7984c720..8298a367ae1c 100644 --- a/packages/SystemUI/res/values-km/strings.xml +++ b/packages/SystemUI/res/values-km/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"បានដោះសោដោយប្រើមុខ។ សូមចុច ដើម្បីបន្ត។"</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"បានស្គាល់មុខ។ សូមចុច ដើម្បីបន្ត។"</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"បានស្គាល់មុខ។ សូមចុចរូបដោះសោ ដើម្បីបន្ត។"</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"បានដោះសោដោយប្រើមុខ។ ចុច ដើម្បីបន្ត។"</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"បានផ្ទៀងផ្ទាត់"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"បោះបង់ការផ្ទៀងផ្ទាត់"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"ជម្រើសច្រើនទៀត"</string> diff --git a/packages/SystemUI/res/values-kn/strings.xml b/packages/SystemUI/res/values-kn/strings.xml index b272c335a639..95ff606355a7 100644 --- a/packages/SystemUI/res/values-kn/strings.xml +++ b/packages/SystemUI/res/values-kn/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"ಮುಖವನ್ನು ಬಳಸಿ ಅನ್ಲಾಕ್ ಮಾಡಲಾಗಿದೆ. ಮುಂದುವರಿಯಲು ಒತ್ತಿ."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"ಮುಖ ಗುರುತಿಸಲಾಗಿದೆ. ಮುಂದುವರಿಯಲು ಒತ್ತಿ."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"ಮುಖ ಗುರುತಿಸಲಾಗಿದೆ. ಮುಂದುವರಿಯಲು ಅನ್ಲಾಕ್ ಐಕಾನ್ ಅನ್ನು ಒತ್ತಿ."</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"ಮುಖವನ್ನು ಬಳಸಿ ಅನ್ಲಾಕ್ ಮಾಡಲಾಗಿದೆ. ಮುಂದುವರಿಯಲು ಟ್ಯಾಪ್ ಮಾಡಿ."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"ದೃಢೀಕರಿಸಲಾಗಿದೆ"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"ದೃಢೀಕರಣವನ್ನು ರದ್ದುಗೊಳಿಸಿ"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"ಇನ್ನಷ್ಟು ಆಯ್ಕೆಗಳು"</string> diff --git a/packages/SystemUI/res/values-ko/strings.xml b/packages/SystemUI/res/values-ko/strings.xml index c54143b4d965..e64be093f611 100644 --- a/packages/SystemUI/res/values-ko/strings.xml +++ b/packages/SystemUI/res/values-ko/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"얼굴 인식으로 잠금 해제되었습니다. 계속하려면 누르세요."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"얼굴이 인식되었습니다. 계속하려면 누르세요."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"얼굴이 인식되었습니다. 계속하려면 아이콘을 누르세요."</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"얼굴 인식으로 잠금 해제되었습니다. 계속하려면 탭하세요."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"인증됨"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"인증 취소"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"옵션 더보기"</string> diff --git a/packages/SystemUI/res/values-ky/strings.xml b/packages/SystemUI/res/values-ky/strings.xml index 5fa3f8770add..610349d99890 100644 --- a/packages/SystemUI/res/values-ky/strings.xml +++ b/packages/SystemUI/res/values-ky/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"Кулпуну жүзүңүз менен ачтыңыз. Улантуу үчүн басыңыз."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"Жүз таанылды. Улантуу үчүн басыңыз."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"Жүз таанылды. Улантуу үчүн кулпусун ачуу сүрөтчөсүн басыңыз."</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"Кулпусун жүзүңүз менен ачтыңыз. Улантуу үчүн таптап коюңуз."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"Аныктыгы текшерилди"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"Аныктыгын текшерүүнү жокко чыгаруу"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"Дагы параметрлер"</string> diff --git a/packages/SystemUI/res/values-lo/strings.xml b/packages/SystemUI/res/values-lo/strings.xml index 5b42b7452f52..3ef281d55385 100644 --- a/packages/SystemUI/res/values-lo/strings.xml +++ b/packages/SystemUI/res/values-lo/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"ປົດລັອກດ້ວຍໜ້າແລ້ວ. ກົດເພື່ອສືບຕໍ່."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"ຈຳແນກໜ້າໄດ້ແລ້ວ. ກົດເພື່ອສືບຕໍ່."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"ຈຳແນກໜ້າໄດ້ແລ້ວ. ກົດໄອຄອນປົດລັອກເພື່ອສືບຕໍ່."</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"ປົດລັອກດ້ວຍໃບໜ້າແລ້ວ. ແຕະເພື່ອສືບຕໍ່."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"ຮັບຮອງຄວາມຖືກຕ້ອງແລ້ວ"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"ຍົກເລີກການພິສູດຢືນຢັນ"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"ຕົວເລືອກເພີ່ມເຕີມ"</string> diff --git a/packages/SystemUI/res/values-lt/strings.xml b/packages/SystemUI/res/values-lt/strings.xml index 2db05c70fb21..03fc6257405c 100644 --- a/packages/SystemUI/res/values-lt/strings.xml +++ b/packages/SystemUI/res/values-lt/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"Atrakinta pagal veidą. Paspauskite, jei norite tęsti."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"Veidas atpažintas. Paspauskite, jei norite tęsti."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"Veidas atpažintas. Tęskite paspaudę atrakinimo piktogramą."</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"Atrakinta pagal veidą. Palieskite ir tęskite."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"Autentifikuota"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"Atšaukti autentifikavimą"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"Daugiau parinkčių"</string> diff --git a/packages/SystemUI/res/values-lv/strings.xml b/packages/SystemUI/res/values-lv/strings.xml index cde7d83ca570..0d258e11c818 100644 --- a/packages/SystemUI/res/values-lv/strings.xml +++ b/packages/SystemUI/res/values-lv/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"Ierīce atbloķēta ar seju. Nospiediet, lai turpinātu."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"Seja atpazīta. Nospiediet, lai turpinātu."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"Seja atpazīta. Lai turpinātu, nospiediet atbloķēšanas ikonu."</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"Ierīce atbloķēta pēc sejas. Pieskarieties, lai turpinātu."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"Autentifikācija veikta"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"Atcelt autentificēšanu"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"Citas opcijas"</string> diff --git a/packages/SystemUI/res/values-mk/strings.xml b/packages/SystemUI/res/values-mk/strings.xml index 10a4f58ae0bd..778cf3ef1b0f 100644 --- a/packages/SystemUI/res/values-mk/strings.xml +++ b/packages/SystemUI/res/values-mk/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"Отклучено со лик. Притиснете за да продолжите."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"Лицето е препознаено. Притиснете за да продолжите."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"Лицето е препознаено. Притиснете ја иконата за отклучување за да продолжите."</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"Отклучено со лик. Допрете за да продолжите."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"Проверена"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"Откажување автентикација"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"Повеќе опции"</string> diff --git a/packages/SystemUI/res/values-ml/strings.xml b/packages/SystemUI/res/values-ml/strings.xml index a4eb077cc30f..0f4d499476ee 100644 --- a/packages/SystemUI/res/values-ml/strings.xml +++ b/packages/SystemUI/res/values-ml/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"മുഖം ഉപയോഗിച്ച് അൺലോക്ക് ചെയ്തു. തുടരാൻ അമർത്തുക."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"മുഖം തിരിച്ചറിഞ്ഞു. തുടരാൻ അമർത്തുക."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"മുഖം തിരിച്ചറിഞ്ഞു. തുടരാൻ അൺലോക്ക് ഐക്കൺ അമർത്തുക."</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"മുഖം വഴി അൺലോക്കുചെയ്തു. തുടരാൻ ടാപ്പ് ചെയ്യുക."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"പരിശോധിച്ചുറപ്പിച്ചു"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"പരിശോധിച്ചുറപ്പിക്കൽ റദ്ദാക്കുക"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"കൂടുതൽ ഓപ്ഷനുകൾ"</string> diff --git a/packages/SystemUI/res/values-mn/strings.xml b/packages/SystemUI/res/values-mn/strings.xml index 5aaaf1cfe065..d3a42bba8289 100644 --- a/packages/SystemUI/res/values-mn/strings.xml +++ b/packages/SystemUI/res/values-mn/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"Царайгаар түгжээг тайлсан. Үргэлжлүүлэхийн тулд дарна уу."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"Царайг таньсан. Үргэлжлүүлэхийн тулд дарна уу."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"Царайг таньсан. Үргэлжлүүлэх бол түгжээг тайлах дүрсийг дар."</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"Царайгаар түгжээг тайлсан. Үргэлжлүүлэхийн тулд товшино уу."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"Баталгаажуулагдсан"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"Баталгаажуулалтыг цуцлах"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"Бусад сонголт"</string> diff --git a/packages/SystemUI/res/values-mr/strings.xml b/packages/SystemUI/res/values-mr/strings.xml index 69c052d50aa9..583c8d200505 100644 --- a/packages/SystemUI/res/values-mr/strings.xml +++ b/packages/SystemUI/res/values-mr/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"चेहऱ्याने अनलॉक केले आहे. पुढे सुरू ठेवण्यासाठी प्रेस करा."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"चेहरा ओळखला आहे. पुढे सुरू ठेवण्यासाठी प्रेस करा."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"चेहरा ओळखला आहे. पुढे सुरू ठेवण्यासाठी अनलॉक करा आयकन प्रेस करा."</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"चेहऱ्याने अनलॉक केले आहे. सुरू ठेवण्यासाठी टॅप करा."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"ऑथेंटिकेशन केलेले"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"ऑथेंटिकेशन रद्द करा"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"अधिक पर्याय"</string> diff --git a/packages/SystemUI/res/values-ms/strings.xml b/packages/SystemUI/res/values-ms/strings.xml index d32c2fc4be9c..ec93add51e90 100644 --- a/packages/SystemUI/res/values-ms/strings.xml +++ b/packages/SystemUI/res/values-ms/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"Dibuka kunci dengan wajah. Tekan untuk meneruskan."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"Wajah dicam. Tekan untuk meneruskan."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"Wajah dicam. Tekan ikon buka kunci untuk meneruskan."</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"Dibuka kunci dengan wajah. Ketik untuk meneruskan proses."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"Disahkan"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"Batalkan Pengesahan"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"Lagi Pilihan"</string> diff --git a/packages/SystemUI/res/values-my/strings.xml b/packages/SystemUI/res/values-my/strings.xml index 5a5a9395d327..5707f88c952c 100644 --- a/packages/SystemUI/res/values-my/strings.xml +++ b/packages/SystemUI/res/values-my/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"မျက်နှာဖြင့် ဖွင့်ထားသည်။ ရှေ့ဆက်ရန် နှိပ်ပါ။"</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"မျက်နှာ မှတ်မိသည်။ ရှေ့ဆက်ရန် နှိပ်ပါ။"</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"မျက်နှာ မှတ်မိသည်။ ရှေ့ဆက်ရန် လော့ခ်ဖွင့်သင်္ကေတကို နှိပ်ပါ။"</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"မျက်နှာဖြင့် ဖွင့်ထားသည်။ ဆက်လုပ်ရန် တို့ပါ။"</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"အထောက်အထားစိစစ်ပြီးပြီ"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"အထောက်အထားစိစစ်ခြင်းကို ပယ်ဖျက်ရန်"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"နောက်ထပ်ရွေးစရာများ"</string> diff --git a/packages/SystemUI/res/values-nb/strings.xml b/packages/SystemUI/res/values-nb/strings.xml index 874bb2871737..42a6b0cee72d 100644 --- a/packages/SystemUI/res/values-nb/strings.xml +++ b/packages/SystemUI/res/values-nb/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"Låst opp med ansiktet. Trykk for å fortsette."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"Ansiktet er gjenkjent. Trykk for å fortsette."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"Ansiktet er gjenkjent. Trykk på lås opp-ikon for å fortsette"</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"Låst opp med ansiktet. Trykk for å fortsette."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"Autentisert"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"Avbryt autentisering"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"Flere alternativer"</string> diff --git a/packages/SystemUI/res/values-ne/strings.xml b/packages/SystemUI/res/values-ne/strings.xml index f05c2378ae90..e75ae701bbf0 100644 --- a/packages/SystemUI/res/values-ne/strings.xml +++ b/packages/SystemUI/res/values-ne/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"अनुहार प्रयोग गरी अनलक गरियो। जारी राख्न थिच्नुहोस्।"</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"अनुहार पहिचान गरियो। जारी राख्न थिच्नुहोस्।"</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"अनुहार पहिचान गरियो। जारी राख्न अनलक आइकनमा थिच्नुहोस्।"</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"अनुहार प्रयोग गरी अनलक गरिएको छ। जारी राख्न ट्याप गर्नुहोस्।"</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"प्रमाणीकरण गरियो"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"प्रमाणीकरण रद्द गर्नुहोस्"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"थप विकल्पहरू"</string> diff --git a/packages/SystemUI/res/values-nl/strings.xml b/packages/SystemUI/res/values-nl/strings.xml index e9713179c92b..132418a35e23 100644 --- a/packages/SystemUI/res/values-nl/strings.xml +++ b/packages/SystemUI/res/values-nl/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"Ontgrendeld via gezicht. Druk om door te gaan."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"Gezicht herkend. Druk om door te gaan."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"Gezicht herkend. Druk op het ontgrendelicoon."</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"Ontgrendeld via gezicht. Tik om door te gaan."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"Geverifieerd"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"Verificatie annuleren"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"Meer opties"</string> diff --git a/packages/SystemUI/res/values-or/strings.xml b/packages/SystemUI/res/values-or/strings.xml index 61e5004e8972..a998362f3070 100644 --- a/packages/SystemUI/res/values-or/strings.xml +++ b/packages/SystemUI/res/values-or/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"ଫେସ ମାଧ୍ୟମରେ ଅନଲକ କରାଯାଇଛି। ଜାରି ରଖିବାକୁ ଦବାନ୍ତୁ।"</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"ଫେସ ଚିହ୍ନଟ କରାଯାଇଛି। ଜାରି ରଖିବାକୁ ଦବାନ୍ତୁ।"</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"ଫେସ ଚିହ୍ନଟ କରାଯାଇଛି। ଜାରି ରଖିବାକୁ ଅନଲକ ଆଇକନ ଦବାନ୍ତୁ।"</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"ଫେସ ମାଧ୍ୟମରେ ଅନଲକ କରାଯାଇଛି। ଜାରି ରଖିବାକୁ ଟାପ କରନ୍ତୁ।"</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"ପ୍ରାମାଣିକତା ହୋଇଛି"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"ପ୍ରମାଣୀକରଣକୁ ବାତିଲ କରନ୍ତୁ"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"ଅଧିକ ବିକଳ୍ପ"</string> diff --git a/packages/SystemUI/res/values-pa/strings.xml b/packages/SystemUI/res/values-pa/strings.xml index 093c44e99a00..53a9b83a4838 100644 --- a/packages/SystemUI/res/values-pa/strings.xml +++ b/packages/SystemUI/res/values-pa/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"ਚਿਹਰੇ ਰਾਹੀਂ ਅਣਲਾਕ ਕੀਤਾ ਗਿਆ। ਜਾਰੀ ਰੱਖਣ ਲਈ ਦਬਾਓ।"</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"ਚਿਹਰੇ ਦੀ ਪਛਾਣ ਹੋਈ। ਜਾਰੀ ਰੱਖਣ ਲਈ ਦਬਾਓ।"</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"ਚਿਹਰੇ ਦੀ ਪਛਾਣ ਹੋਈ। ਜਾਰੀ ਰੱਖਣ ਲਈ \'ਅਣਲਾਕ ਕਰੋ\' ਪ੍ਰਤੀਕ ਨੂੰ ਦਬਾਓ।"</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"ਚਿਹਰੇ ਰਾਹੀਂ ਅਣਲਾਕ ਕੀਤਾ ਗਿਆ। ਜਾਰੀ ਰੱਖਣ ਲਈ ਟੈਪ ਕਰੋ।"</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"ਪ੍ਰਮਾਣਿਤ ਹੋਇਆ"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"ਪ੍ਰਮਾਣੀਕਰਨ ਰੱਦ ਕਰੋ"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"ਹੋਰ ਵਿਕਲਪ"</string> diff --git a/packages/SystemUI/res/values-pl/strings.xml b/packages/SystemUI/res/values-pl/strings.xml index e4ca61cf2ed4..666cc15e14bf 100644 --- a/packages/SystemUI/res/values-pl/strings.xml +++ b/packages/SystemUI/res/values-pl/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"Odblokowano rozpoznawaniem twarzy. Kliknij, aby kontynuować."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"Twarz rozpoznana. Kliknij, aby kontynuować."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"Twarz rozpoznana. Aby kontynuować, kliknij ikonę odblokowywania."</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"Odblokowano skanem twarzy. Kliknij, aby przejść dalej."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"Uwierzytelniono"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"Anuluj uwierzytelnianie"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"Więcej opcji"</string> diff --git a/packages/SystemUI/res/values-pt-rBR/strings.xml b/packages/SystemUI/res/values-pt-rBR/strings.xml index 5b9833bfac01..b693067dec97 100644 --- a/packages/SystemUI/res/values-pt-rBR/strings.xml +++ b/packages/SystemUI/res/values-pt-rBR/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"Desbloqueado pelo rosto. Pressione para continuar."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"Rosto reconhecido. Pressione para continuar."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"Rosto reconhecido. Pressione o ícone para continuar."</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"Desbloqueado pelo rosto. Toque para continuar."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"Autenticado"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"Cancelar autenticação"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"Mais opções"</string> diff --git a/packages/SystemUI/res/values-pt-rPT/strings.xml b/packages/SystemUI/res/values-pt-rPT/strings.xml index 152799431805..416150225402 100644 --- a/packages/SystemUI/res/values-pt-rPT/strings.xml +++ b/packages/SystemUI/res/values-pt-rPT/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"Desbloqueado com o rosto. Prima para continuar."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"Rosto reconhecido. Prima para continuar."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"Rosto reconhecido. Prima ícone de desbloqueio para continuar"</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"Desbloqueado com o rosto. Toque para continuar."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"Autenticado"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"Cancelar autenticação"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"Mais opções"</string> diff --git a/packages/SystemUI/res/values-pt/strings.xml b/packages/SystemUI/res/values-pt/strings.xml index 5b9833bfac01..b693067dec97 100644 --- a/packages/SystemUI/res/values-pt/strings.xml +++ b/packages/SystemUI/res/values-pt/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"Desbloqueado pelo rosto. Pressione para continuar."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"Rosto reconhecido. Pressione para continuar."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"Rosto reconhecido. Pressione o ícone para continuar."</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"Desbloqueado pelo rosto. Toque para continuar."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"Autenticado"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"Cancelar autenticação"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"Mais opções"</string> diff --git a/packages/SystemUI/res/values-ro/strings.xml b/packages/SystemUI/res/values-ro/strings.xml index 4dbb58884392..209261816bd7 100644 --- a/packages/SystemUI/res/values-ro/strings.xml +++ b/packages/SystemUI/res/values-ro/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"S-a deblocat cu ajutorul feței. Apasă pentru a continua."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"Chipul a fost recunoscut. Apasă pentru a continua."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"Chip recunoscut. Apasă pictograma Deblocare ca să continui."</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"S-a deblocat folosind fața. Atinge pentru a continua."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"Autentificat"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"Anulează autentificarea"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"Mai multe opțiuni"</string> diff --git a/packages/SystemUI/res/values-ru/strings.xml b/packages/SystemUI/res/values-ru/strings.xml index 936020965a4f..aaa7757b1c2e 100644 --- a/packages/SystemUI/res/values-ru/strings.xml +++ b/packages/SystemUI/res/values-ru/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"Разблокировано сканированием лица. Нажмите, чтобы продолжить."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"Лицо распознано. Нажмите, чтобы продолжить."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"Лицо распознано. Нажмите на значок разблокировки."</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"Сканирование лица выполнено. Нажмите, чтобы продолжить."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"Аутентификация выполнена"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"Отмена распознавания лица"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"Ещё"</string> diff --git a/packages/SystemUI/res/values-si/strings.xml b/packages/SystemUI/res/values-si/strings.xml index 0b50c2671987..8391437f1bc8 100644 --- a/packages/SystemUI/res/values-si/strings.xml +++ b/packages/SystemUI/res/values-si/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"මුහුණ මගින් අගුලු හරින ලදි. ඉදිරියට යාමට ඔබන්න."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"මුහුණ හඳුනා ගන්නා ලදි. ඉදිරියට යාමට ඔබන්න."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"මුහුණ හඳුනා ගන්නා ලදි. ඉදිරියට යාමට අගුලු හැරීමේ නිරූපකය ඔබන්න."</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"මුහුණ මගින් අගුළු හරින ලදි. ඉදිරියට යාමට තට්ටු කරන්න."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"සත්යාපනය විය"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"සත්යාපනය අවලංගු කරන්න"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"තවත් විකල්ප"</string> diff --git a/packages/SystemUI/res/values-sk/strings.xml b/packages/SystemUI/res/values-sk/strings.xml index 542f0e3dd2ec..5f5460f35cbc 100644 --- a/packages/SystemUI/res/values-sk/strings.xml +++ b/packages/SystemUI/res/values-sk/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"Odomknuté tvárou. Pokračujte stlačením."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"Tvár bola rozpoznaná. Pokračujte stlačením."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"Tvár bola rozpoznaná. Pokračujte stlačením ikony odomknutia"</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"Odomknuté tvárou. Pokračujte klepnutím."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"Overené"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"Zrušiť overenie"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"Ďalšie možnosti"</string> diff --git a/packages/SystemUI/res/values-sl/strings.xml b/packages/SystemUI/res/values-sl/strings.xml index b33326f16f18..0b3f828262ad 100644 --- a/packages/SystemUI/res/values-sl/strings.xml +++ b/packages/SystemUI/res/values-sl/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"Odklenjeno z obrazom. Pritisnite za nadaljevanje."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"Obraz je prepoznan. Pritisnite za nadaljevanje."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"Obraz je prepoznan. Za nadaljevanje pritisnite ikono za odklepanje."</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"Odklenjeno z obrazom. Dotaknite se, če želite nadaljevati."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"Preverjena pristnost"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"Prekliči preverjanje pristnosti"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"Več možnosti"</string> diff --git a/packages/SystemUI/res/values-sq/strings.xml b/packages/SystemUI/res/values-sq/strings.xml index f93f02b8d9bb..b21fbd07cf03 100644 --- a/packages/SystemUI/res/values-sq/strings.xml +++ b/packages/SystemUI/res/values-sq/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"U shkyç me fytyrë. Shtyp për të vazhduar."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"Fytyra u njoh. Shtyp për të vazhduar."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"Fytyra u njoh. Shtyp ikonën e shkyçjes për të vazhduar."</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"U shkyç me fytyrë. Trokit për të vazhduar."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"U vërtetua"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"Anulo vërtetimin"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"Opsione të tjera"</string> diff --git a/packages/SystemUI/res/values-sr/strings.xml b/packages/SystemUI/res/values-sr/strings.xml index e3e541f0d3a1..277651e0f706 100644 --- a/packages/SystemUI/res/values-sr/strings.xml +++ b/packages/SystemUI/res/values-sr/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"Откључано је лицем. Притисните да бисте наставили."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"Лице је препознато. Притисните да бисте наставили."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"Лице препознато. Притисните икону откључавања за наставак."</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"Откључано је лицем. Додирните да бисте наставили."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"Идентитет је потврђен"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"Откажите потврду идентитета"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"Још опција"</string> diff --git a/packages/SystemUI/res/values-sv/strings.xml b/packages/SystemUI/res/values-sv/strings.xml index 2a48d4fb85f9..aeef47b79bf2 100644 --- a/packages/SystemUI/res/values-sv/strings.xml +++ b/packages/SystemUI/res/values-sv/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"Upplåst med ansiktslås. Tryck för att fortsätta."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"Ansiktet har identifierats. Tryck för att fortsätta."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"Ansiktet har identifierats. Tryck på ikonen lås upp."</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"Upplåst med ansiktslås. Tryck för att fortsätta."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"Autentiserad"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"Avbryt autentiseringen"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"Fler alternativ"</string> diff --git a/packages/SystemUI/res/values-sw/strings.xml b/packages/SystemUI/res/values-sw/strings.xml index da88840d9dfe..96ca4453b10a 100644 --- a/packages/SystemUI/res/values-sw/strings.xml +++ b/packages/SystemUI/res/values-sw/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"Imefunguliwa kwa kutumia uso wako. Bonyeza ili uendelee."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"Uso umetambuliwa. Bonyeza ili uendelee."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"Uso umetambuliwa. Bonyeza aikoni ya kufungua ili uendelee."</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"Imefunguliwa kwa kutumia uso wako. Gusa ili uendelee."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"Umethibitishwa"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"Ghairi Uthibitishaji"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"Chaguo Zaidi"</string> diff --git a/packages/SystemUI/res/values-ta/strings.xml b/packages/SystemUI/res/values-ta/strings.xml index 102f1df8880a..59600892ed8c 100644 --- a/packages/SystemUI/res/values-ta/strings.xml +++ b/packages/SystemUI/res/values-ta/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"முகம் மூலம் அன்லாக் செய்யப்பட்டது. தொடர அழுத்தவும்."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"முகம் அங்கீகரிக்கப்பட்டது. தொடர அழுத்தவும்."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"முகம் அங்கீகரிக்கப்பட்டது. தொடர அன்லாக் ஐகானை அழுத்தவும்."</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"முகம் கொண்டு அன்லாக் செய்யப்பட்டது. தொடர தட்டவும்."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"அங்கீகரிக்கப்பட்டது"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"அங்கீகரிப்பை ரத்துசெய்"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"கூடுதல் விருப்பங்கள்"</string> diff --git a/packages/SystemUI/res/values-te/strings.xml b/packages/SystemUI/res/values-te/strings.xml index 0d54c146869b..70970883ae35 100644 --- a/packages/SystemUI/res/values-te/strings.xml +++ b/packages/SystemUI/res/values-te/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"ముఖం ద్వారా అన్లాక్ చేయబడింది. కొనసాగించడానికి నొక్కండి."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"ముఖం గుర్తించబడింది. కొనసాగించడానికి నొక్కండి."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"ముఖం గుర్తించబడింది. కొనసాగడానికి అన్లాక్ చిహ్నం నొక్కండి."</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"ముఖం ద్వారా అన్లాక్ అయింది. కొనసాగడానికి ట్యాప్ చేయండి."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"ప్రామాణీకరించబడింది"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"ప్రామాణీకరణను రద్దు చేయండి"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"మరిన్ని ఆప్షన్లు"</string> diff --git a/packages/SystemUI/res/values-th/strings.xml b/packages/SystemUI/res/values-th/strings.xml index 0e6cb90b07e7..1ce7ad96683b 100644 --- a/packages/SystemUI/res/values-th/strings.xml +++ b/packages/SystemUI/res/values-th/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"ปลดล็อกด้วยใบหน้าแล้ว กดเพื่อดำเนินการต่อ"</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"จดจำใบหน้าได้ กดเพื่อดำเนินการต่อ"</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"จดจำใบหน้าได้ กดไอคอนปลดล็อกเพื่อดำเนินการต่อ"</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"ปลดล็อกด้วยใบหน้าแล้ว แตะเพื่อดำเนินการต่อ"</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"ตรวจสอบสิทธิ์แล้ว"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"ยกเลิกการตรวจสอบสิทธิ์"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"ตัวเลือกเพิ่มเติม"</string> diff --git a/packages/SystemUI/res/values-tl/strings.xml b/packages/SystemUI/res/values-tl/strings.xml index ea5362635245..9ecdbc44ac59 100644 --- a/packages/SystemUI/res/values-tl/strings.xml +++ b/packages/SystemUI/res/values-tl/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"Na-unlock gamit ang mukha. Pindutin para magpatuloy."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"Nakilala ang mukha. Pindutin para magpatuloy."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"Nakilala ang mukha. Pindutin ang unlock para magpatuloy."</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"Na-unlock gamit ang mukha. I-tap para magpatuloy."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"Na-authenticate"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"Kanselahin ang Pag-authenticate"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"Higit Pang Opsyon"</string> diff --git a/packages/SystemUI/res/values-tr/strings.xml b/packages/SystemUI/res/values-tr/strings.xml index 3d645b3eb5e5..d35008376ca8 100644 --- a/packages/SystemUI/res/values-tr/strings.xml +++ b/packages/SystemUI/res/values-tr/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"Cihazın kilidini yüzünüzle açtınız. Devam etmek için basın."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"Yüzünüz tanındı. Devam etmek için basın."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"Yüzünüz tanındı. Kilit açma simgesine basın."</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"Kilidi yüzünüzle açtınız. Devam etmek için dokunun."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"Kimliği Doğrulandı"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"Kimlik doğrulamayı iptal et"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"Diğer Seçenekler"</string> diff --git a/packages/SystemUI/res/values-uk/strings.xml b/packages/SystemUI/res/values-uk/strings.xml index 3f8f4a9492b2..b8c4e80758d6 100644 --- a/packages/SystemUI/res/values-uk/strings.xml +++ b/packages/SystemUI/res/values-uk/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"Розблоковано (фейс-контроль). Натисніть, щоб продовжити."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"Обличчя розпізнано. Натисніть, щоб продовжити."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"Обличчя розпізнано. Натисніть значок розблокування."</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"Розблоковано (фейс-контроль). Натисніть, щоб продовжити."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"Автентифіковано"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"Скасувати автентифікацію"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"Інші опції"</string> diff --git a/packages/SystemUI/res/values-ur/strings.xml b/packages/SystemUI/res/values-ur/strings.xml index 1fc258030e16..e6c5106f8d48 100644 --- a/packages/SystemUI/res/values-ur/strings.xml +++ b/packages/SystemUI/res/values-ur/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"چہرے سے انلاک کیا گیا۔ جاری رکھنے کے لیے دبائیں۔"</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"چہرے کی شناخت ہو گئی۔ جاری رکھنے کے لیے دبائیں۔"</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"چہرے کی شناخت ہو گئی۔ جاری رکھنے کیلئے انلاک آئیکن دبائیں۔"</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"چہرے سے غیر مقفل کیا گیا۔ جاری رکھنے کیلئے تھپتھپائیں۔"</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"تصدیق کردہ"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"تصدیق کو منسوخ کریں"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"مزید اختیارات"</string> diff --git a/packages/SystemUI/res/values-uz/strings.xml b/packages/SystemUI/res/values-uz/strings.xml index 9077d7dd8233..cdd698f44eb2 100644 --- a/packages/SystemUI/res/values-uz/strings.xml +++ b/packages/SystemUI/res/values-uz/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"Yuz orqali ochildi. Davom etish uchun bosing."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"Yuz aniqlandi. Davom etish uchun bosing."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"Yuz aniqlandi. Davom etish uchun ochish belgisini bosing."</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"Yuz bilan ochildi. Davom etish uchun bosing."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"Tasdiqlandi"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"Autentifikatsiyani bekor qilish"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"Boshqa parametrlar"</string> diff --git a/packages/SystemUI/res/values-vi/strings.xml b/packages/SystemUI/res/values-vi/strings.xml index e756a254a87c..9014c885f457 100644 --- a/packages/SystemUI/res/values-vi/strings.xml +++ b/packages/SystemUI/res/values-vi/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"Đã mở khoá bằng khuôn mặt. Hãy nhấn để tiếp tục."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"Đã nhận diện khuôn mặt. Hãy nhấn để tiếp tục."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"Đã nhận diện khuôn mặt. Nhấn biểu tượng mở khoá để tiếp tục."</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"Đã mở khoá bằng khuôn mặt. Nhấn để tiếp tục."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"Đã xác thực"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"Huỷ quy trình xác thực"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"Tuỳ chọn khác"</string> diff --git a/packages/SystemUI/res/values-zh-rCN/strings.xml b/packages/SystemUI/res/values-zh-rCN/strings.xml index 7942620e9762..2122dc7544c8 100644 --- a/packages/SystemUI/res/values-zh-rCN/strings.xml +++ b/packages/SystemUI/res/values-zh-rCN/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"已通过面孔识别解锁。点按即可继续。"</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"识别出面孔。点按即可继续。"</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"识别出面孔。按下解锁图标即可继续。"</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"已通过面孔识别解锁。点按即可继续。"</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"已经过身份验证"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"取消身份验证"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"更多选项"</string> diff --git a/packages/SystemUI/res/values-zh-rHK/strings.xml b/packages/SystemUI/res/values-zh-rHK/strings.xml index f5e9b9cb350d..c06db50fde68 100644 --- a/packages/SystemUI/res/values-zh-rHK/strings.xml +++ b/packages/SystemUI/res/values-zh-rHK/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"已使用面孔解鎖。按下即可繼續操作。"</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"已識別面孔。按下即可繼續操作。"</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"已識別面孔。按解鎖圖示即可繼續。"</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"已使用面孔解鎖,輕按即可繼續。"</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"驗證咗"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"取消驗證"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"更多選項"</string> @@ -343,7 +342,7 @@ <string name="quick_settings_hotspot_secondary_label_transient" msgid="7585604088079160564">"正在開啟…"</string> <string name="quick_settings_hotspot_secondary_label_data_saver_enabled" msgid="1280433136266439372">"數據節省模式已開啟"</string> <string name="quick_settings_hotspot_secondary_label_num_devices" msgid="7536823087501239457">"{count,plural, =1{# 部裝置}other{# 部裝置}}"</string> - <string name="quick_settings_flashlight_label" msgid="4904634272006284185">"電筒"</string> + <string name="quick_settings_flashlight_label" msgid="4904634272006284185">"手電筒"</string> <string name="quick_settings_flashlight_camera_in_use" msgid="4820591564526512571">"相機使用中"</string> <string name="quick_settings_cellular_detail_title" msgid="792977203299358893">"流動數據"</string> <string name="quick_settings_cellular_detail_data_usage" msgid="6105969068871138427">"數據用量"</string> diff --git a/packages/SystemUI/res/values-zh-rTW/strings.xml b/packages/SystemUI/res/values-zh-rTW/strings.xml index 4801f7731b10..da850b8de6d5 100644 --- a/packages/SystemUI/res/values-zh-rTW/strings.xml +++ b/packages/SystemUI/res/values-zh-rTW/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"裝置已透過你的臉解鎖,按下即可繼續操作。"</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"臉孔辨識完成,按下即可繼續操作。"</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"臉孔辨識完成,按下「解鎖」圖示即可繼續操作。"</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"裝置已透過你的臉解鎖,輕觸這裡即可繼續。"</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"已通過驗證"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"取消驗證"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"更多選項"</string> diff --git a/packages/SystemUI/res/values-zu/strings.xml b/packages/SystemUI/res/values-zu/strings.xml index 1d4290214ee7..5f9e4529cc92 100644 --- a/packages/SystemUI/res/values-zu/strings.xml +++ b/packages/SystemUI/res/values-zu/strings.xml @@ -186,7 +186,6 @@ <string name="biometric_dialog_tap_confirm_with_face_alt_1" msgid="439152621640507113">"Vula ngobuso. Cindezela ukuze uqhubeke."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_2" msgid="8586608186457385108">"Ubuso buyaziwa. Cindezela ukuze uqhubeke."</string> <string name="biometric_dialog_tap_confirm_with_face_alt_3" msgid="2192670471930606539">"Ubuso buyaziwa. Cindezela isithonjana sokuvula ukuze uqhubeke."</string> - <string name="biometric_dialog_tap_confirm_with_face_sfps" msgid="2499213248903257928">"Kuvulwe ngobuso. Thepha ukuze uqhubeke."</string> <string name="biometric_dialog_authenticated" msgid="7337147327545272484">"Kugunyaziwe"</string> <string name="biometric_dialog_cancel_authentication" msgid="981316588773442637">"Khansela Ukuqinisekisa"</string> <string name="biometric_dialog_content_view_more_options_button" msgid="2663810393874865475">"Okukhethwayo Okwengeziwe"</string> diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/rotation/FloatingRotationButton.java b/packages/SystemUI/shared/src/com/android/systemui/shared/rotation/FloatingRotationButton.java index 317201d2c2d9..f358ba2d3ccd 100644 --- a/packages/SystemUI/shared/src/com/android/systemui/shared/rotation/FloatingRotationButton.java +++ b/packages/SystemUI/shared/src/com/android/systemui/shared/rotation/FloatingRotationButton.java @@ -125,6 +125,7 @@ public class FloatingRotationButton implements RotationButton { taskbarMarginLeft, taskbarMarginBottom, floatingRotationButtonPositionLeft); final int diameter = res.getDimensionPixelSize(mButtonDiameterResource); + mKeyButtonView.setDiameter(diameter); mContainerSize = diameter + Math.max(defaultMargin, Math.max(taskbarMarginLeft, taskbarMarginBottom)); } @@ -195,6 +196,7 @@ public class FloatingRotationButton implements RotationButton { public void updateIcon(int lightIconColor, int darkIconColor) { mAnimatedDrawable = (AnimatedVectorDrawable) mKeyButtonView.getContext() .getDrawable(mRotationButtonController.getIconResId()); + mAnimatedDrawable.setBounds(0, 0, mKeyButtonView.getWidth(), mKeyButtonView.getHeight()); mKeyButtonView.setImageDrawable(mAnimatedDrawable); mKeyButtonView.setColors(lightIconColor, darkIconColor); } @@ -248,8 +250,14 @@ public class FloatingRotationButton implements RotationButton { updateDimensionResources(); if (mIsShowing) { + updateIcon(mRotationButtonController.getLightIconColor(), + mRotationButtonController.getDarkIconColor()); final LayoutParams layoutParams = adjustViewPositionAndCreateLayoutParams(); mWindowManager.updateViewLayout(mKeyButtonContainer, layoutParams); + if (mAnimatedDrawable != null) { + mAnimatedDrawable.reset(); + mAnimatedDrawable.start(); + } } } diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/rotation/FloatingRotationButtonView.java b/packages/SystemUI/shared/src/com/android/systemui/shared/rotation/FloatingRotationButtonView.java index 2145166e9bc5..75412f94ccb1 100644 --- a/packages/SystemUI/shared/src/com/android/systemui/shared/rotation/FloatingRotationButtonView.java +++ b/packages/SystemUI/shared/src/com/android/systemui/shared/rotation/FloatingRotationButtonView.java @@ -37,6 +37,7 @@ public class FloatingRotationButtonView extends ImageView { private static final float BACKGROUND_ALPHA = 0.92f; private KeyButtonRipple mRipple; + private int mDiameter; private final Paint mOvalBgPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG); private final Configuration mLastConfiguration; @@ -93,10 +94,25 @@ public class FloatingRotationButtonView extends ImageView { mRipple.setDarkIntensity(darkIntensity); } + /** + * Sets the view's diameter. + * + * @param diameter the diameter value for the view + */ + void setDiameter(int diameter) { + mDiameter = diameter; + } + @Override public void draw(Canvas canvas) { int d = Math.min(getWidth(), getHeight()); canvas.drawOval(0, 0, d, d, mOvalBgPaint); super.draw(canvas); } + + @Override + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + super.onMeasure(widthMeasureSpec, heightMeasureSpec); + setMeasuredDimension(mDiameter, mDiameter); + } } diff --git a/packages/SystemUI/src/com/android/systemui/accessibility/MagnificationSettingsController.java b/packages/SystemUI/src/com/android/systemui/accessibility/MagnificationSettingsController.java index b4530ace68d6..ed7062b5a335 100644 --- a/packages/SystemUI/src/com/android/systemui/accessibility/MagnificationSettingsController.java +++ b/packages/SystemUI/src/com/android/systemui/accessibility/MagnificationSettingsController.java @@ -26,6 +26,7 @@ import android.content.res.Configuration; import android.util.Range; import android.view.WindowManager; +import com.android.internal.accessibility.common.MagnificationConstants; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.graphics.SfVsyncFrameCallbackProvider; import com.android.systemui.util.settings.SecureSettings; @@ -40,7 +41,8 @@ import com.android.systemui.util.settings.SecureSettings; public class MagnificationSettingsController implements ComponentCallbacks { // It should be consistent with the value defined in WindowMagnificationGestureHandler. - private static final Range<Float> A11Y_ACTION_SCALE_RANGE = new Range<>(1.0f, 8.0f); + private static final Range<Float> A11Y_ACTION_SCALE_RANGE = + new Range<>(1.0f, MagnificationConstants.SCALE_MAX_VALUE); private final Context mContext; diff --git a/packages/SystemUI/src/com/android/systemui/accessibility/SystemActions.java b/packages/SystemUI/src/com/android/systemui/accessibility/SystemActions.java index 68a69d34b75a..37e9dc1a9d48 100644 --- a/packages/SystemUI/src/com/android/systemui/accessibility/SystemActions.java +++ b/packages/SystemUI/src/com/android/systemui/accessibility/SystemActions.java @@ -42,6 +42,7 @@ import android.view.KeyCharacterMap; import android.view.KeyEvent; import android.view.WindowManagerGlobal; import android.view.accessibility.AccessibilityManager; +import android.view.accessibility.Flags; import com.android.internal.R; import com.android.internal.accessibility.dialog.AccessibilityButtonChooserActivity; @@ -178,6 +179,18 @@ public class SystemActions implements CoreStartable, ConfigurationController.Con private static final int SYSTEM_ACTION_ID_DPAD_CENTER = AccessibilityService.GLOBAL_ACTION_DPAD_CENTER; // 20 + /** + * Action ID to trigger menu key event. + */ + private static final int SYSTEM_ACTION_ID_MENU = + AccessibilityService.GLOBAL_ACTION_MENU; // 21 + + /** + * Action ID to trigger media play/pause key event. + */ + private static final int SYSTEM_ACTION_ID_MEDIA_PLAY_PAUSE = + AccessibilityService.GLOBAL_ACTION_MEDIA_PLAY_PAUSE; // 22 + private static final String PERMISSION_SELF = "com.android.systemui.permission.SELF"; private final SystemActionsBroadcastReceiver mReceiver; @@ -307,6 +320,14 @@ public class SystemActions implements CoreStartable, ConfigurationController.Con R.string.accessibility_system_action_dpad_center_label, SystemActionsBroadcastReceiver.INTENT_ACTION_DPAD_CENTER); + RemoteAction actionMenu = createRemoteAction( + R.string.accessibility_system_action_menu_label, + SystemActionsBroadcastReceiver.INTENT_ACTION_MENU); + + RemoteAction actionMediaPlayPause = createRemoteAction( + R.string.accessibility_system_action_media_play_pause_label, + SystemActionsBroadcastReceiver.INTENT_ACTION_MEDIA_PLAY_PAUSE); + mA11yManager.registerSystemAction(actionBack, SYSTEM_ACTION_ID_BACK); mA11yManager.registerSystemAction(actionHome, SYSTEM_ACTION_ID_HOME); mA11yManager.registerSystemAction(actionRecents, SYSTEM_ACTION_ID_RECENTS); @@ -326,6 +347,8 @@ public class SystemActions implements CoreStartable, ConfigurationController.Con mA11yManager.registerSystemAction(actionDpadLeft, SYSTEM_ACTION_ID_DPAD_LEFT); mA11yManager.registerSystemAction(actionDpadRight, SYSTEM_ACTION_ID_DPAD_RIGHT); mA11yManager.registerSystemAction(actionDpadCenter, SYSTEM_ACTION_ID_DPAD_CENTER); + mA11yManager.registerSystemAction(actionMenu, SYSTEM_ACTION_ID_MENU); + mA11yManager.registerSystemAction(actionMediaPlayPause, SYSTEM_ACTION_ID_MEDIA_PLAY_PAUSE); registerOrUnregisterDismissNotificationShadeAction(); } @@ -435,6 +458,14 @@ public class SystemActions implements CoreStartable, ConfigurationController.Con labelId = R.string.accessibility_system_action_dpad_center_label; intent = SystemActionsBroadcastReceiver.INTENT_ACTION_DPAD_CENTER; break; + case SYSTEM_ACTION_ID_MENU: + labelId = R.string.accessibility_system_action_menu_label; + intent = SystemActionsBroadcastReceiver.INTENT_ACTION_MENU; + break; + case SYSTEM_ACTION_ID_MEDIA_PLAY_PAUSE: + labelId = R.string.accessibility_system_action_media_play_pause_label; + intent = SystemActionsBroadcastReceiver.INTENT_ACTION_MEDIA_PLAY_PAUSE; + break; default: return; } @@ -570,6 +601,16 @@ public class SystemActions implements CoreStartable, ConfigurationController.Con sendDownAndUpKeyEvents(KeyEvent.KEYCODE_DPAD_CENTER); } + @VisibleForTesting + void handleMenu() { + sendDownAndUpKeyEvents(KeyEvent.KEYCODE_MENU); + } + + @VisibleForTesting + void handleMediaPlayPause() { + sendDownAndUpKeyEvents(KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE); + } + private class SystemActionsBroadcastReceiver extends BroadcastReceiver { private static final String INTENT_ACTION_BACK = "SYSTEM_ACTION_BACK"; private static final String INTENT_ACTION_HOME = "SYSTEM_ACTION_HOME"; @@ -593,6 +634,9 @@ public class SystemActions implements CoreStartable, ConfigurationController.Con private static final String INTENT_ACTION_DPAD_LEFT = "SYSTEM_ACTION_DPAD_LEFT"; private static final String INTENT_ACTION_DPAD_RIGHT = "SYSTEM_ACTION_DPAD_RIGHT"; private static final String INTENT_ACTION_DPAD_CENTER = "SYSTEM_ACTION_DPAD_CENTER"; + private static final String INTENT_ACTION_MENU = "SYSTEM_ACTION_MENU"; + private static final String INTENT_ACTION_MEDIA_PLAY_PAUSE = + "SYSTEM_ACTION_MEDIA_PLAY_PAUSE"; private PendingIntent createPendingIntent(Context context, String intentAction) { switch (intentAction) { @@ -613,7 +657,9 @@ public class SystemActions implements CoreStartable, ConfigurationController.Con case INTENT_ACTION_DPAD_DOWN: case INTENT_ACTION_DPAD_LEFT: case INTENT_ACTION_DPAD_RIGHT: - case INTENT_ACTION_DPAD_CENTER: { + case INTENT_ACTION_DPAD_CENTER: + case INTENT_ACTION_MENU: + case INTENT_ACTION_MEDIA_PLAY_PAUSE: { Intent intent = new Intent(intentAction); intent.setPackage(context.getPackageName()); intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND); @@ -646,6 +692,8 @@ public class SystemActions implements CoreStartable, ConfigurationController.Con intentFilter.addAction(INTENT_ACTION_DPAD_LEFT); intentFilter.addAction(INTENT_ACTION_DPAD_RIGHT); intentFilter.addAction(INTENT_ACTION_DPAD_CENTER); + intentFilter.addAction(INTENT_ACTION_MENU); + intentFilter.addAction(INTENT_ACTION_MEDIA_PLAY_PAUSE); return intentFilter; } @@ -725,6 +773,18 @@ public class SystemActions implements CoreStartable, ConfigurationController.Con handleDpadCenter(); break; } + case INTENT_ACTION_MENU: { + if (Flags.globalActionMenu()) { + handleMenu(); + } + break; + } + case INTENT_ACTION_MEDIA_PLAY_PAUSE: { + if (Flags.globalActionMediaPlayPause()) { + handleMediaPlayPause(); + } + break; + } default: break; } 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 000000000000..208a17c0a220 --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/keyguard/OWNERS @@ -0,0 +1,12 @@ +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 +yuandizhou@google.com diff --git a/packages/SystemUI/src/com/android/systemui/mediaprojection/permission/BaseMediaProjectionPermissionDialogDelegate.kt b/packages/SystemUI/src/com/android/systemui/mediaprojection/permission/BaseMediaProjectionPermissionDialogDelegate.kt index 6224170fd906..83f694bb1980 100644 --- a/packages/SystemUI/src/com/android/systemui/mediaprojection/permission/BaseMediaProjectionPermissionDialogDelegate.kt +++ b/packages/SystemUI/src/com/android/systemui/mediaprojection/permission/BaseMediaProjectionPermissionDialogDelegate.kt @@ -104,7 +104,7 @@ abstract class BaseMediaProjectionPermissionDialogDelegate<T : AlertDialog>( private fun initScreenShareSpinner() { val adapter = OptionsAdapter(dialog.context.applicationContext, screenShareOptions) - screenShareModeSpinner = dialog.requireViewById(R.id.screen_share_mode_spinner) + screenShareModeSpinner = dialog.requireViewById(R.id.screen_share_mode_options) screenShareModeSpinner.adapter = adapter screenShareModeSpinner.onItemSelectedListener = this diff --git a/packages/SystemUI/src/com/android/systemui/mediaprojection/permission/MediaProjectionPermissionDialogDelegate.kt b/packages/SystemUI/src/com/android/systemui/mediaprojection/permission/MediaProjectionPermissionDialogDelegate.kt index 8858041ae529..9ce8070131fa 100644 --- a/packages/SystemUI/src/com/android/systemui/mediaprojection/permission/MediaProjectionPermissionDialogDelegate.kt +++ b/packages/SystemUI/src/com/android/systemui/mediaprojection/permission/MediaProjectionPermissionDialogDelegate.kt @@ -30,7 +30,7 @@ class MediaProjectionPermissionDialogDelegate( private val onStartRecordingClicked: Consumer<MediaProjectionPermissionDialogDelegate>, private val onCancelClicked: Runnable, private val appName: String?, - private val forceShowPartialScreenshare: Boolean, + forceShowPartialScreenshare: Boolean, hostUid: Int, mediaProjectionMetricsLogger: MediaProjectionMetricsLogger, ) : diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/OWNERS b/packages/SystemUI/src/com/android/systemui/statusbar/OWNERS new file mode 100644 index 000000000000..c4f539a4acdf --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/statusbar/OWNERS @@ -0,0 +1,16 @@ +set noparent + +# Bug component: 78010 + +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 000000000000..4c349c4f86c3 --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/statusbar/lockscreen/OWNERS @@ -0,0 +1,3 @@ +set noparent + +file:../../keyguard/OWNERS diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/OWNERS b/packages/SystemUI/src/com/android/systemui/statusbar/phone/OWNERS index 4657e9b84550..92a333e9ec2a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/OWNERS +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/OWNERS @@ -1,6 +1,6 @@ per-file *Notification* = set noparent per-file *Notification* = file:../notification/OWNERS -per-file NotificationIcon* = ccassidy@google.com, evanlaird@google.com, pixel@google.com +per-file NotificationIcon* = file:../OWNERS per-file NotificationShadeWindowControllerImpl.java = dupin@google.com, cinek@google.com, beverlyt@google.com, pixel@google.com, juliacr@google.com diff --git a/packages/SystemUI/tests/src/com/android/systemui/accessibility/SystemActionsTest.java b/packages/SystemUI/tests/src/com/android/systemui/accessibility/SystemActionsTest.java index f46b2f905f5b..53b98d52e9d1 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/accessibility/SystemActionsTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/accessibility/SystemActionsTest.java @@ -26,10 +26,14 @@ import static org.mockito.Mockito.when; import android.hardware.input.InputManager; import android.os.RemoteException; +import android.platform.test.annotations.RequiresFlagsEnabled; +import android.platform.test.flag.junit.CheckFlagsRule; +import android.platform.test.flag.junit.DeviceFlagsValueProvider; import android.telecom.TelecomManager; import android.telephony.TelephonyManager; import android.testing.TestableLooper; import android.view.KeyEvent; +import android.view.accessibility.Flags; import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.filters.SmallTest; @@ -44,6 +48,7 @@ import com.android.systemui.statusbar.NotificationShadeWindowController; import com.android.systemui.statusbar.policy.KeyguardStateController; import org.junit.Before; +import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; @@ -77,6 +82,9 @@ public class SystemActionsTest extends SysuiTestCase { private SystemActions mSystemActions; + @Rule + public final CheckFlagsRule mCheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule(); + @Before public void setUp() throws RemoteException { MockitoAnnotations.initMocks(this); @@ -131,4 +139,40 @@ public class SystemActionsTest extends SysuiTestCase { verify(mTelecomManager).endCall(); } + + @Test + @RequiresFlagsEnabled(Flags.FLAG_GLOBAL_ACTION_MENU) + public void handleMenu_injectsKeyEvents() { + final List<KeyEvent> keyEvents = new ArrayList<>(); + doAnswer(invocation -> { + keyEvents.add(new KeyEvent(invocation.getArgument(0))); + return null; + }).when(mInputManager).injectInputEvent(any(), anyInt()); + + mSystemActions.handleMenu(); + + assertThat(keyEvents.size()).isEqualTo(2); + assertThat(keyEvents.get(0).getKeyCode()).isEqualTo(KeyEvent.KEYCODE_MENU); + assertThat(keyEvents.get(0).getAction()).isEqualTo(KeyEvent.ACTION_DOWN); + assertThat(keyEvents.get(1).getKeyCode()).isEqualTo(KeyEvent.KEYCODE_MENU); + assertThat(keyEvents.get(1).getAction()).isEqualTo(KeyEvent.ACTION_UP); + } + + @Test + @RequiresFlagsEnabled(Flags.FLAG_GLOBAL_ACTION_MEDIA_PLAY_PAUSE) + public void handleMediaPlayPause_injectsKeyEvents() { + final List<KeyEvent> keyEvents = new ArrayList<>(); + doAnswer(invocation -> { + keyEvents.add(new KeyEvent(invocation.getArgument(0))); + return null; + }).when(mInputManager).injectInputEvent(any(), anyInt()); + + mSystemActions.handleMediaPlayPause(); + + assertThat(keyEvents.size()).isEqualTo(2); + assertThat(keyEvents.get(0).getKeyCode()).isEqualTo(KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE); + assertThat(keyEvents.get(0).getAction()).isEqualTo(KeyEvent.ACTION_DOWN); + assertThat(keyEvents.get(1).getKeyCode()).isEqualTo(KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE); + assertThat(keyEvents.get(1).getAction()).isEqualTo(KeyEvent.ACTION_UP); + } } diff --git a/packages/SystemUI/tests/src/com/android/systemui/mediaprojection/permission/MediaProjectionPermissionDialogDelegateTest.kt b/packages/SystemUI/tests/src/com/android/systemui/mediaprojection/permission/MediaProjectionPermissionDialogDelegateTest.kt index 548366e3fc38..d183c7370713 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/mediaprojection/permission/MediaProjectionPermissionDialogDelegateTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/mediaprojection/permission/MediaProjectionPermissionDialogDelegateTest.kt @@ -79,7 +79,7 @@ class MediaProjectionPermissionDialogDelegateTest : SysuiTestCase() { val overrideDisableSingleAppOption = false setUpAndShowDialog(overrideDisableSingleAppOption) - val spinner = dialog.requireViewById<Spinner>(R.id.screen_share_mode_spinner) + val spinner = dialog.requireViewById<Spinner>(R.id.screen_share_mode_options) val secondOptionText = spinner.adapter .getDropDownView(1, null, spinner) @@ -100,7 +100,7 @@ class MediaProjectionPermissionDialogDelegateTest : SysuiTestCase() { val overrideDisableSingleAppOption = true setUpAndShowDialog(overrideDisableSingleAppOption) - val spinner = dialog.requireViewById<Spinner>(R.id.screen_share_mode_spinner) + val spinner = dialog.requireViewById<Spinner>(R.id.screen_share_mode_options) val secondOptionText = spinner.adapter .getDropDownView(1, null, spinner) diff --git a/packages/SystemUI/tests/src/com/android/systemui/screenrecord/ScreenRecordPermissionDialogDelegateTest.kt b/packages/SystemUI/tests/src/com/android/systemui/screenrecord/ScreenRecordPermissionDialogDelegateTest.kt index 943245150e64..c6406a9732b6 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/screenrecord/ScreenRecordPermissionDialogDelegateTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/screenrecord/ScreenRecordPermissionDialogDelegateTest.kt @@ -109,7 +109,7 @@ class ScreenRecordPermissionDialogDelegateTest : SysuiTestCase() { fun testShowDialog_partialScreenSharingEnabled_optionsSpinnerIsVisible() { showDialog() - val visibility = dialog.requireViewById<Spinner>(R.id.screen_share_mode_spinner).visibility + val visibility = dialog.requireViewById<Spinner>(R.id.screen_share_mode_options).visibility assertThat(visibility).isEqualTo(View.VISIBLE) } @@ -155,7 +155,7 @@ class ScreenRecordPermissionDialogDelegateTest : SysuiTestCase() { fun showDialog_singleAppIsDefault() { showDialog() - val spinner = dialog.requireViewById<Spinner>(R.id.screen_share_mode_spinner) + val spinner = dialog.requireViewById<Spinner>(R.id.screen_share_mode_options) val singleApp = context.getString(R.string.screen_share_permission_dialog_option_single_app) assertEquals(spinner.adapter.getItem(0), singleApp) } @@ -217,7 +217,7 @@ class ScreenRecordPermissionDialogDelegateTest : SysuiTestCase() { } private fun onSpinnerItemSelected(position: Int) { - val spinner = dialog.requireViewById<Spinner>(R.id.screen_share_mode_spinner) + val spinner = dialog.requireViewById<Spinner>(R.id.screen_share_mode_options) checkNotNull(spinner.onItemSelectedListener) .onItemSelected(spinner, mock(), position, /* id= */ 0) } diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/OWNERS b/packages/SystemUI/tests/src/com/android/systemui/statusbar/OWNERS new file mode 100644 index 000000000000..1c52b8d25347 --- /dev/null +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/OWNERS @@ -0,0 +1,3 @@ +set noparent + +include /packages/SystemUI/src/com/android/systemui/statusbar/OWNERS diff --git a/packages/VpnDialogs/res/values-ar/strings.xml b/packages/VpnDialogs/res/values-ar/strings.xml index 9307a744c37f..4a0929f72e71 100644 --- a/packages/VpnDialogs/res/values-ar/strings.xml +++ b/packages/VpnDialogs/res/values-ar/strings.xml @@ -17,8 +17,8 @@ <resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string name="prompt" msgid="3183836924226407828">"طلب الاتصال"</string> - <string name="warning" msgid="809658604548412033">"يريد <xliff:g id="APP">%s</xliff:g> إعداد الاتصال بالشبكة الافتراضية الخاصة التي تتيح له مراقبة حركة المرور على الشبكة. فلا توافق إلا إذا كنت تثق في المصدر. <br /> <br /> <img src=vpn_icon /> يظهر في الجزء العلوي من الشاشة عندما تكون الشبكة الافتراضية الخاصة نشطة."</string> - <string name="warning" product="tv" msgid="5188957997628124947">"يريد تطبيق <xliff:g id="APP">%s</xliff:g> إعداد اتصال شبكة افتراضية خاصة (VPN) يتيح له مراقبة حركة بيانات الشبكة. لا تقبل السماح بذلك إلا إذا كنت تثق في المصدر. <br /> <br /> <img src=vpn_icon /> يظهر على شاشتك عندما تكون الشبكة الافتراضية الخاصة نشطة."</string> + <string name="warning" msgid="809658604548412033">"يريد <xliff:g id="APP">%s</xliff:g> إعداد الاتصال بشبكة VPN التي تتيح له مراقبة حركة المرور على الشبكة. فلا توافق إلا إذا كنت تثق في المصدر. <br /> <br /> <img src=vpn_icon /> يظهر في الجزء العلوي من الشاشة عندما تكون شبكة VPN نشطة."</string> + <string name="warning" product="tv" msgid="5188957997628124947">"يريد تطبيق <xliff:g id="APP">%s</xliff:g> إعداد اتصال شبكة VPN يتيح له مراقبة حركة بيانات الشبكة. لا تقبل السماح بذلك إلا إذا كنت تثق في المصدر. <br /> <br /> <img src=vpn_icon /> يظهر على شاشتك عندما تكون شبكة VPN نشطة."</string> <string name="legacy_title" msgid="192936250066580964">"VPN متصلة"</string> <string name="session" msgid="6470628549473641030">"الجلسة"</string> <string name="duration" msgid="3584782459928719435">"المدة:"</string> @@ -27,9 +27,9 @@ <string name="data_value_format" msgid="2192466557826897580">"<xliff:g id="NUMBER_0">%1$s</xliff:g> بايت / <xliff:g id="NUMBER_1">%2$s</xliff:g> من الحزم"</string> <string name="always_on_disconnected_title" msgid="1906740176262776166">"يتعذّر الاتصال بشبكة VPN التي يتم تشغيلها دائمًا"</string> <string name="always_on_disconnected_message" msgid="555634519845992917">"تم إعداد شبكة <xliff:g id="VPN_APP_0">%1$s</xliff:g> بحيث تبقى متصلة بالإنترنت دائمًا، ومع ذلك يتعذّر اتصالها بالإنترنت الآن. سيستخدم هاتفك شبكة عامة إلى أن يتمكّن من إعادة الاتصال بشبكة <xliff:g id="VPN_APP_1">%1$s</xliff:g>."</string> - <string name="always_on_disconnected_message_lockdown" msgid="4232225539869452120">"تم إعداد شبكة <xliff:g id="VPN_APP">%1$s</xliff:g> بحيث تبقى متصلة بالإنترنت دائمًا، ومع ذلك يتعذّر اتصالها بالإنترنت الآن. لن تتوفر لديك إمكانية اتصال إلى أن تتمكّن الشبكة الافتراضية الخاصة (VPN) من إعادة الاتصال."</string> + <string name="always_on_disconnected_message_lockdown" msgid="4232225539869452120">"تم إعداد شبكة <xliff:g id="VPN_APP">%1$s</xliff:g> بحيث تبقى متصلة بالإنترنت دائمًا، ومع ذلك يتعذّر اتصالها بالإنترنت الآن. لن تتوفر لديك إمكانية اتصال إلى أن تتمكّن شبكة VPN من إعادة الاتصال."</string> <string name="always_on_disconnected_message_separator" msgid="3310614409322581371">" "</string> - <string name="always_on_disconnected_message_settings_link" msgid="6172280302829992412">"تغيير إعدادات الشبكة الافتراضية الخاصة (VPN)"</string> + <string name="always_on_disconnected_message_settings_link" msgid="6172280302829992412">"تغيير إعدادات شبكة VPN"</string> <string name="configure" msgid="4905518375574791375">"تهيئة"</string> <string name="disconnect" msgid="971412338304200056">"قطع الاتصال"</string> <string name="open_app" msgid="3717639178595958667">"فتح التطبيق"</string> diff --git a/packages/VpnDialogs/res/values-be/strings.xml b/packages/VpnDialogs/res/values-be/strings.xml index 54908f6d8ce7..58c6349db5ee 100644 --- a/packages/VpnDialogs/res/values-be/strings.xml +++ b/packages/VpnDialogs/res/values-be/strings.xml @@ -18,7 +18,7 @@ xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string name="prompt" msgid="3183836924226407828">"Запыт на падлучэнне"</string> <string name="warning" msgid="809658604548412033">"<xliff:g id="APP">%s</xliff:g> спрабуе наладзіць падлучэнне VPN, якое дазваляе сачыць за сеткавым трафікам. Прымайце толькі тады, калі вы давяраеце гэтай крыніцы. Калі VPN актыўны, у верхняй частцы экрана адлюстроўваецца <br /> <br /> <img src=vpn_icon />."</string> - <string name="warning" product="tv" msgid="5188957997628124947">"Праграма \"<xliff:g id="APP">%s</xliff:g>\" запытвае дазвол на падключэнне да сеткі VPN, каб адсочваць сеткавы трафік. Дайце дазвол, толькі калі вы давяраеце крыніцы. Калі адбудзецца падключэнне да VPN, на экране з\'явіцца значок <br /> <br /> <img src=vpn_icon />."</string> + <string name="warning" product="tv" msgid="5188957997628124947">"Праграма \"<xliff:g id="APP">%s</xliff:g>\" запытвае дазвол на падключэнне да сеткі VPN, каб адсочваць сеткавы трафік. Дайце дазвол, толькі калі вы давяраеце крыніцы. Калі адбудзецца падключэнне да VPN, на экране з’явіцца значок <br /> <br /> <img src=vpn_icon />."</string> <string name="legacy_title" msgid="192936250066580964">"VPN падключаны"</string> <string name="session" msgid="6470628549473641030">"Сессія"</string> <string name="duration" msgid="3584782459928719435">"Працягласць:"</string> diff --git a/packages/VpnDialogs/res/values-fr-rCA/strings.xml b/packages/VpnDialogs/res/values-fr-rCA/strings.xml index 9ae0cb24246e..3118ffe6299d 100644 --- a/packages/VpnDialogs/res/values-fr-rCA/strings.xml +++ b/packages/VpnDialogs/res/values-fr-rCA/strings.xml @@ -24,7 +24,7 @@ <string name="duration" msgid="3584782459928719435">"Durée :"</string> <string name="data_transmitted" msgid="7988167672982199061">"Date d\'envoi :"</string> <string name="data_received" msgid="4062776929376067820">"Reçu le :"</string> - <string name="data_value_format" msgid="2192466557826897580">"<xliff:g id="NUMBER_0">%1$s</xliff:g> octets / <xliff:g id="NUMBER_1">%2$s</xliff:g> paquets"</string> + <string name="data_value_format" msgid="2192466557826897580">"<xliff:g id="NUMBER_0">%1$s</xliff:g> octets/<xliff:g id="NUMBER_1">%2$s</xliff:g> paquets"</string> <string name="always_on_disconnected_title" msgid="1906740176262776166">"Impossible de se connecter au RPV permanent"</string> <string name="always_on_disconnected_message" msgid="555634519845992917">"<xliff:g id="VPN_APP_0">%1$s</xliff:g> est configuré pour rester connecté en permanence, mais n\'arrive pas à se connecter en ce moment. Votre téléphone utilisera un réseau public jusqu\'à ce qu\'il puisse se reconnecter à <xliff:g id="VPN_APP_1">%1$s</xliff:g>."</string> <string name="always_on_disconnected_message_lockdown" msgid="4232225539869452120">"<xliff:g id="VPN_APP">%1$s</xliff:g> est configuré pour rester connecté en permanence, mais n\'arrive pas à se connecter en ce moment. Vous n\'aurez pas de connexion jusqu\'à ce que le RPV arrive à se reconnecter."</string> diff --git a/ravenwood/Android.bp b/ravenwood/Android.bp index 48bc803f4a5c..4faf03c395f3 100644 --- a/ravenwood/Android.bp +++ b/ravenwood/Android.bp @@ -68,7 +68,10 @@ java_library { srcs: [ "runtime-common-ravenwood-src/**/*.java", ], - visibility: ["//frameworks/base"], + visibility: [ + // Some tests need to access the utilities. + ":__subpackages__", + ], } java_library { @@ -178,10 +181,13 @@ java_library { visibility: ["//visibility:public"], } -// Carefully compiles against only test_current to support tests that +// Carefully compiles against only module_current to support tests that // want to verify they're unbundled. The "impl" library above is what // ships inside the Ravenwood environment to actually drive any API // access to implementation details. +// We can't use test_current here because this library needs to be statically +// linked to mainline tests as well, which can't use test APIs because they +// need to be able to run on multiple API levels. java_library { name: "ravenwood-junit", srcs: [ @@ -189,7 +195,7 @@ java_library { "junit-stub-src/**/*.java", "junit-flag-src/**/*.java", ], - sdk_version: "test_current", + sdk_version: "module_current", static_libs: [ "ravenwood-runtime-common", "ravenwood-runtime-common-device", @@ -231,6 +237,12 @@ java_device_for_host { } filegroup { + name: "ravenwood-framework-jarjar-rules", + srcs: ["texts/ravenwood-framework-jarjar-rules.txt"], + visibility: ["//frameworks/base"], +} + +filegroup { name: "ravenwood-services-jarjar-rules", srcs: ["texts/ravenwood-services-jarjar-rules.txt"], visibility: ["//frameworks/base"], @@ -268,11 +280,95 @@ sh_test_host { src: "scripts/ravenwood-stats-checker.sh", test_suites: ["general-tests"], data: [ - ":framework-minus-apex.ravenwood.stats", - ":framework-minus-apex.ravenwood.apis", - ":framework-minus-apex.ravenwood.keep_all", - ":services.core.ravenwood.stats", - ":services.core.ravenwood.apis", - ":services.core.ravenwood.keep_all", + ":hoststubgen_framework-minus-apex_stats.csv", + ":hoststubgen_framework-minus-apex_apis.csv", + ":hoststubgen_framework-minus-apex_keep_all.txt", + ":hoststubgen_framework-minus-apex_dump.txt", + ":services.core.ravenwood-base{hoststubgen_services.core_stats.csv}", + ":services.core.ravenwood-base{hoststubgen_services.core_apis.csv}", + ":services.core.ravenwood-base{hoststubgen_services.core_keep_all.txt}", + ":services.core.ravenwood-base{hoststubgen_services.core_dump.txt}", + ], +} + +java_library { + name: "services.fakes.ravenwood-jarjar", + installable: false, + srcs: [":services.fakes-sources"], + libs: [ + "ravenwood-framework", + "services.core.ravenwood", + ], + jarjar_rules: ":ravenwood-services-jarjar-rules", + visibility: ["//visibility:private"], +} + +java_library { + name: "mockito-ravenwood-prebuilt", + installable: false, + static_libs: [ + "mockito-robolectric-prebuilt", + ], +} + +java_library { + name: "inline-mockito-ravenwood-prebuilt", + installable: false, + static_libs: [ + "inline-mockito-robolectric-prebuilt", + ], +} + +android_ravenwood_libgroup { + name: "ravenwood-runtime", + data: [ + "framework-res", + ], + libs: [ + "100-framework-minus-apex.ravenwood", + "200-kxml2-android", + + "ravenwood-runtime-common-ravenwood", + + "android.test.mock.ravenwood", + "ravenwood-helper-runtime", + "hoststubgen-helper-runtime.ravenwood", + "services.core.ravenwood-jarjar", + "services.fakes.ravenwood-jarjar", + + // ICU + "core-icu4j-for-host.ravenwood", + "icu4j-icudata-jarjar", + "icu4j-icutzdata-jarjar", + + // Provide runtime versions of utils linked in below + "junit", + "truth", + "flag-junit", + "ravenwood-framework", + "ravenwood-junit-impl", + "ravenwood-junit-impl-flag", + "mockito-ravenwood-prebuilt", + "inline-mockito-ravenwood-prebuilt", + + // It's a stub, so it should be towards the end. + "z00-all-updatable-modules-system-stubs", + ], + jni_libs: [ + "libandroid_runtime", + "libravenwood_runtime", + ], +} + +android_ravenwood_libgroup { + name: "ravenwood-utils", + libs: [ + "junit", + "truth", + "flag-junit", + "ravenwood-framework", + "ravenwood-junit", + "mockito-ravenwood-prebuilt", + "inline-mockito-ravenwood-prebuilt", ], } diff --git a/ravenwood/TEST_MAPPING b/ravenwood/TEST_MAPPING index f6885e1e74ba..fbf27fa5bf4b 100644 --- a/ravenwood/TEST_MAPPING +++ b/ravenwood/TEST_MAPPING @@ -12,6 +12,9 @@ { "name": "RavenwoodBivalentTest_device" }, + { + "name": "RavenwoodResApkTest" + }, // The sysui tests should match vendor/unbundled_google/packages/SystemUIGoogle/TEST_MAPPING { "name": "SystemUIGoogleTests", diff --git a/ravenwood/bivalenttest/Android.bp b/ravenwood/bivalenttest/Android.bp index 2d94894c54be..06cf08e6c3df 100644 --- a/ravenwood/bivalenttest/Android.bp +++ b/ravenwood/bivalenttest/Android.bp @@ -38,6 +38,9 @@ android_ravenwood_test { "androidx.annotation_annotation", "androidx.test.ext.junit", "androidx.test.rules", + + // To make sure it won't cause VerifyError (b/324063814) + "platformprotosnano", ], srcs: [ "test/**/*.java", diff --git a/ravenwood/coretest/test/com/android/ravenwoodtest/coretest/methodvalidation/RavenwoodTestMethodValidation_Fail01_Test.java b/ravenwood/coretest/test/com/android/ravenwoodtest/coretest/methodvalidation/RavenwoodTestMethodValidation_Fail01_Test.java new file mode 100644 index 000000000000..db95fad2a3ad --- /dev/null +++ b/ravenwood/coretest/test/com/android/ravenwoodtest/coretest/methodvalidation/RavenwoodTestMethodValidation_Fail01_Test.java @@ -0,0 +1,51 @@ +/* + * 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.ravenwoodtest.coretest.methodvalidation; + +import android.platform.test.ravenwood.RavenwoodRule; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.junit.rules.RuleChain; +import org.junit.runner.RunWith; + +/** + * RavenwoodRule has a validator to ensure "test-looking" methods have valid JUnit annotations. + * This class contains tests for this validator. + */ +@RunWith(AndroidJUnit4.class) +public class RavenwoodTestMethodValidation_Fail01_Test { + private ExpectedException mThrown = ExpectedException.none(); + private final RavenwoodRule mRavenwood = new RavenwoodRule(); + + @Rule + public final RuleChain chain = RuleChain.outerRule(mThrown).around(mRavenwood); + + public RavenwoodTestMethodValidation_Fail01_Test() { + mThrown.expectMessage("Method setUp() doesn't have @Before"); + } + + @SuppressWarnings("JUnit4SetUpNotRun") + public void setUp() { + } + + @Test + public void testEmpty() { + } +} diff --git a/ravenwood/coretest/test/com/android/ravenwoodtest/coretest/methodvalidation/RavenwoodTestMethodValidation_Fail02_Test.java b/ravenwood/coretest/test/com/android/ravenwoodtest/coretest/methodvalidation/RavenwoodTestMethodValidation_Fail02_Test.java new file mode 100644 index 000000000000..ddc66c73a7c0 --- /dev/null +++ b/ravenwood/coretest/test/com/android/ravenwoodtest/coretest/methodvalidation/RavenwoodTestMethodValidation_Fail02_Test.java @@ -0,0 +1,51 @@ +/* + * 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.ravenwoodtest.coretest.methodvalidation; + +import android.platform.test.ravenwood.RavenwoodRule; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.junit.rules.RuleChain; +import org.junit.runner.RunWith; + +/** + * RavenwoodRule has a validator to ensure "test-looking" methods have valid JUnit annotations. + * This class contains tests for this validator. + */ +@RunWith(AndroidJUnit4.class) +public class RavenwoodTestMethodValidation_Fail02_Test { + private ExpectedException mThrown = ExpectedException.none(); + private final RavenwoodRule mRavenwood = new RavenwoodRule(); + + @Rule + public final RuleChain chain = RuleChain.outerRule(mThrown).around(mRavenwood); + + public RavenwoodTestMethodValidation_Fail02_Test() { + mThrown.expectMessage("Method tearDown() doesn't have @After"); + } + + @SuppressWarnings("JUnit4TearDownNotRun") + public void tearDown() { + } + + @Test + public void testEmpty() { + } +} diff --git a/ravenwood/coretest/test/com/android/ravenwoodtest/coretest/methodvalidation/RavenwoodTestMethodValidation_Fail03_Test.java b/ravenwood/coretest/test/com/android/ravenwoodtest/coretest/methodvalidation/RavenwoodTestMethodValidation_Fail03_Test.java new file mode 100644 index 000000000000..ec8e907dcdb3 --- /dev/null +++ b/ravenwood/coretest/test/com/android/ravenwoodtest/coretest/methodvalidation/RavenwoodTestMethodValidation_Fail03_Test.java @@ -0,0 +1,51 @@ +/* + * 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.ravenwoodtest.coretest.methodvalidation; + +import android.platform.test.ravenwood.RavenwoodRule; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.junit.rules.RuleChain; +import org.junit.runner.RunWith; + +/** + * RavenwoodRule has a validator to ensure "test-looking" methods have valid JUnit annotations. + * This class contains tests for this validator. + */ +@RunWith(AndroidJUnit4.class) +public class RavenwoodTestMethodValidation_Fail03_Test { + private ExpectedException mThrown = ExpectedException.none(); + private final RavenwoodRule mRavenwood = new RavenwoodRule(); + + @Rule + public final RuleChain chain = RuleChain.outerRule(mThrown).around(mRavenwood); + + public RavenwoodTestMethodValidation_Fail03_Test() { + mThrown.expectMessage("Method testFoo() doesn't have @Test"); + } + + @SuppressWarnings("JUnit4TestNotRun") + public void testFoo() { + } + + @Test + public void testEmpty() { + } +} diff --git a/ravenwood/coretest/test/com/android/ravenwoodtest/coretest/methodvalidation/RavenwoodTestMethodValidation_OkTest.java b/ravenwood/coretest/test/com/android/ravenwoodtest/coretest/methodvalidation/RavenwoodTestMethodValidation_OkTest.java new file mode 100644 index 000000000000..d952d07b3817 --- /dev/null +++ b/ravenwood/coretest/test/com/android/ravenwoodtest/coretest/methodvalidation/RavenwoodTestMethodValidation_OkTest.java @@ -0,0 +1,56 @@ +/* + * 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.ravenwoodtest.coretest.methodvalidation; + +import android.platform.test.ravenwood.RavenwoodRule; + +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; + +/** + * RavenwoodRule has a validator to ensure "test-looking" methods have valid JUnit annotations. + * This class contains tests for this validator. + */ +@RunWith(AndroidJUnit4.class) +public class RavenwoodTestMethodValidation_OkTest { + @Rule + public final RavenwoodRule mRavenwood = new RavenwoodRule(); + + @Before + public void setUp() { + } + + @Before + public void testSetUp() { + } + + @After + public void tearDown() { + } + + @After + public void testTearDown() { + } + + @Test + public void testEmpty() { + } +} diff --git a/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodRuleImpl.java b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodRuleImpl.java index 49e793fcbddf..4357f2b8660a 100644 --- a/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodRuleImpl.java +++ b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodRuleImpl.java @@ -33,14 +33,17 @@ import com.android.internal.os.RuntimeInit; import com.android.server.LocalServices; import org.junit.After; +import org.junit.AfterClass; import org.junit.Assert; import org.junit.Before; +import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.Description; import org.junit.runner.RunWith; import org.junit.runners.model.Statement; import java.io.PrintStream; +import java.lang.annotation.Annotation; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.ArrayList; @@ -230,6 +233,18 @@ public class RavenwoodRuleImpl { } } + /** + * @return if a method has any of annotations. + */ + private static boolean hasAnyAnnotations(Method m, Class<? extends Annotation>... annotations) { + for (var anno : annotations) { + if (m.getAnnotation(anno) != null) { + return true; + } + } + return false; + } + private static void validateTestAnnotations(Statement base, Description description, boolean enableOptionalValidation) { final var testClass = description.getTestClass(); @@ -239,13 +254,14 @@ public class RavenwoodRuleImpl { boolean hasErrors = false; for (Method m : collectMethods(testClass)) { if (Modifier.isPublic(m.getModifiers()) && m.getName().startsWith("test")) { - if (m.getAnnotation(Test.class) == null) { + if (!hasAnyAnnotations(m, Test.class, Before.class, After.class, + BeforeClass.class, AfterClass.class)) { message.append("\nMethod " + m.getName() + "() doesn't have @Test"); hasErrors = true; } } if ("setUp".equals(m.getName())) { - if (m.getAnnotation(Before.class) == null) { + if (!hasAnyAnnotations(m, Before.class)) { message.append("\nMethod " + m.getName() + "() doesn't have @Before"); hasErrors = true; } @@ -255,7 +271,7 @@ public class RavenwoodRuleImpl { } } if ("tearDown".equals(m.getName())) { - if (m.getAnnotation(After.class) == null) { + if (!hasAnyAnnotations(m, After.class)) { message.append("\nMethod " + m.getName() + "() doesn't have @After"); hasErrors = true; } diff --git a/ravenwood/junit-src/android/platform/test/ravenwood/RavenwoodRule.java b/ravenwood/junit-src/android/platform/test/ravenwood/RavenwoodRule.java index 68b5aebe9c00..825c91a1b6dc 100644 --- a/ravenwood/junit-src/android/platform/test/ravenwood/RavenwoodRule.java +++ b/ravenwood/junit-src/android/platform/test/ravenwood/RavenwoodRule.java @@ -18,7 +18,7 @@ package android.platform.test.ravenwood; import static android.os.Process.FIRST_APPLICATION_UID; import static android.os.Process.SYSTEM_UID; -import static android.os.UserHandle.USER_SYSTEM; +import static android.os.UserHandle.SYSTEM; import static org.junit.Assert.fail; @@ -115,7 +115,7 @@ public class RavenwoodRule implements TestRule { private static final AtomicInteger sNextPid = new AtomicInteger(100); - int mCurrentUser = USER_SYSTEM; + int mCurrentUser = SYSTEM.getIdentifier(); /** * Unless the test author requests differently, run as "nobody", and give each collection of diff --git a/ravenwood/resapk_test/Android.bp b/ravenwood/resapk_test/Android.bp new file mode 100644 index 000000000000..c14576550f78 --- /dev/null +++ b/ravenwood/resapk_test/Android.bp @@ -0,0 +1,30 @@ +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"], +} + +android_ravenwood_test { + name: "RavenwoodResApkTest", + + resource_apk: "RavenwoodResApkTest-apk", + + libs: [ + // Normally, tests shouldn't directly access it, but we need to access RavenwoodCommonUtils + // in this test. + "ravenwood-runtime-common-ravenwood", + ], + static_libs: [ + "androidx.annotation_annotation", + "androidx.test.ext.junit", + "androidx.test.rules", + ], + srcs: [ + "test/**/*.java", + ], + sdk_version: "test_current", + auto_gen_config: true, +} diff --git a/ravenwood/resapk_test/apk/Android.bp b/ravenwood/resapk_test/apk/Android.bp new file mode 100644 index 000000000000..10ed5e2f8410 --- /dev/null +++ b/ravenwood/resapk_test/apk/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"], +} + +android_app { + name: "RavenwoodResApkTest-apk", + + sdk_version: "current", +} diff --git a/ravenwood/resapk_test/apk/AndroidManifest.xml b/ravenwood/resapk_test/apk/AndroidManifest.xml new file mode 100644 index 000000000000..f34d8b2f4e81 --- /dev/null +++ b/ravenwood/resapk_test/apk/AndroidManifest.xml @@ -0,0 +1,19 @@ +<?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. +--> + +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.android.ravenwood.restest_apk"> +</manifest> diff --git a/ravenwood/resapk_test/apk/res/values/strings.xml b/ravenwood/resapk_test/apk/res/values/strings.xml new file mode 100644 index 000000000000..23d4c0f21007 --- /dev/null +++ b/ravenwood/resapk_test/apk/res/values/strings.xml @@ -0,0 +1,19 @@ +<?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. +--> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <!-- Test string 1 --> + <string name="test_string_1" translatable="false" >Test String 1</string> +</resources> diff --git a/ravenwood/resapk_test/test/com/android/ravenwood/resapk_test/RavenwoodResApkTest.java b/ravenwood/resapk_test/test/com/android/ravenwood/resapk_test/RavenwoodResApkTest.java new file mode 100644 index 000000000000..1029ed2bee3b --- /dev/null +++ b/ravenwood/resapk_test/test/com/android/ravenwood/resapk_test/RavenwoodResApkTest.java @@ -0,0 +1,51 @@ +/* + * 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.ravenwood.resapk_test; + + +import static junit.framework.TestCase.assertTrue; + +import androidx.test.ext.junit.runners.AndroidJUnit4; + +import com.android.ravenwood.common.RavenwoodCommonUtils; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.io.File; + +@RunWith(AndroidJUnit4.class) +public class RavenwoodResApkTest { + /** + * Ensure the file "ravenwood-res.apk" exists. + * TODO Check the content of it, once Ravenwood supports resources. The file should + * be a copy of RavenwoodResApkTest-apk.apk + */ + @Test + public void testResApkExists() { + var file = "ravenwood-res-apks/ravenwood-res.apk"; + + assertTrue(new File(file).exists()); + } + + @Test + public void testFrameworkResExists() { + var file = "ravenwood-data/framework-res.apk"; + + assertTrue(new File( + RavenwoodCommonUtils.getRavenwoodRuntimePath() + "/" + file).exists()); + } +} diff --git a/ravenwood/runtime-common-src/com/android/ravenwood/common/JvmWorkaround.java b/ravenwood/runtime-common-src/com/android/ravenwood/common/JvmWorkaround.java index ee280991216a..0238baa2dcbf 100644 --- a/ravenwood/runtime-common-src/com/android/ravenwood/common/JvmWorkaround.java +++ b/ravenwood/runtime-common-src/com/android/ravenwood/common/JvmWorkaround.java @@ -16,6 +16,7 @@ package com.android.ravenwood.common; import java.io.FileDescriptor; +import java.io.IOException; /** * Collection of methods to workaround limitation in the hostside JVM. @@ -44,6 +45,11 @@ public abstract class JvmWorkaround { public abstract int getFdInt(FileDescriptor fd); /** + * Equivalent to Android's Os.close(fd). + */ + public abstract void closeFd(FileDescriptor fd) throws IOException; + + /** * Placeholder implementation for the host side. * * Even on the host side, we don't want to throw just because the class is loaded, @@ -64,5 +70,10 @@ public abstract class JvmWorkaround { public int getFdInt(FileDescriptor fd) { throw calledOnHostside(); } + + @Override + public void closeFd(FileDescriptor fd) { + throw calledOnHostside(); + } } } diff --git a/ravenwood/runtime-common-src/com/android/ravenwood/common/OpenJdkWorkaround.java b/ravenwood/runtime-common-src/com/android/ravenwood/common/OpenJdkWorkaround.java index 9aedaab5b911..a260147654cd 100644 --- a/ravenwood/runtime-common-src/com/android/ravenwood/common/OpenJdkWorkaround.java +++ b/ravenwood/runtime-common-src/com/android/ravenwood/common/OpenJdkWorkaround.java @@ -16,6 +16,8 @@ package com.android.ravenwood.common; import java.io.FileDescriptor; +import java.io.IOException; +import java.lang.reflect.InvocationTargetException; class OpenJdkWorkaround extends JvmWorkaround { @Override @@ -43,4 +45,19 @@ class OpenJdkWorkaround extends JvmWorkaround { + " perhaps JRE has changed?", e); } } + + @Override + public void closeFd(FileDescriptor fd) throws IOException { + try { + final Object obj = Class.forName("jdk.internal.access.SharedSecrets").getMethod( + "getJavaIOFileDescriptorAccess").invoke(null); + Class.forName("jdk.internal.access.JavaIOFileDescriptorAccess").getMethod( + "close", FileDescriptor.class).invoke(obj, fd); + } catch (InvocationTargetException e) { + SneakyThrow.sneakyThrow(e.getTargetException()); + } catch (ReflectiveOperationException e) { + throw new RuntimeException("Failed to interact with raw FileDescriptor internals;" + + " perhaps JRE has changed?", e); + } + } } diff --git a/ravenwood/runtime-common-src/com/android/ravenwood/common/SneakyThrow.java b/ravenwood/runtime-common-src/com/android/ravenwood/common/SneakyThrow.java new file mode 100644 index 000000000000..0dbf7df12bce --- /dev/null +++ b/ravenwood/runtime-common-src/com/android/ravenwood/common/SneakyThrow.java @@ -0,0 +1,33 @@ +/* + * 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.ravenwood.common; + +public class SneakyThrow { + + private SneakyThrow() { + } + + /** + * Throw checked exceptions without the need to declare in method signature + */ + public static void sneakyThrow(Throwable t) { + SneakyThrow.<RuntimeException>sneakyThrow_(t); + } + + private static <T extends Throwable> void sneakyThrow_(Throwable t) throws T { + throw (T) t; + } +} diff --git a/ravenwood/runtime-helper-src/framework/com/android/platform/test/ravenwood/nativesubstitution/ParcelFileDescriptor_host.java b/ravenwood/runtime-helper-src/framework/com/android/platform/test/ravenwood/nativesubstitution/ParcelFileDescriptor_host.java index 8fe6853abb45..5a3589dae43a 100644 --- a/ravenwood/runtime-helper-src/framework/com/android/platform/test/ravenwood/nativesubstitution/ParcelFileDescriptor_host.java +++ b/ravenwood/runtime-helper-src/framework/com/android/platform/test/ravenwood/nativesubstitution/ParcelFileDescriptor_host.java @@ -16,98 +16,16 @@ package com.android.platform.test.ravenwood.nativesubstitution; -import static android.os.ParcelFileDescriptor.MODE_APPEND; -import static android.os.ParcelFileDescriptor.MODE_CREATE; -import static android.os.ParcelFileDescriptor.MODE_READ_ONLY; -import static android.os.ParcelFileDescriptor.MODE_READ_WRITE; -import static android.os.ParcelFileDescriptor.MODE_TRUNCATE; -import static android.os.ParcelFileDescriptor.MODE_WORLD_READABLE; -import static android.os.ParcelFileDescriptor.MODE_WORLD_WRITEABLE; -import static android.os.ParcelFileDescriptor.MODE_WRITE_ONLY; - -import com.android.internal.annotations.GuardedBy; import com.android.ravenwood.common.JvmWorkaround; -import java.io.File; import java.io.FileDescriptor; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.RandomAccessFile; -import java.util.HashMap; -import java.util.Map; public class ParcelFileDescriptor_host { - /** - * Since we don't have a great way to keep an unmanaged {@code FileDescriptor} reference - * alive, we keep a strong reference to the {@code RandomAccessFile} we used to open it. This - * gives us a way to look up the original parent object when closing later. - */ - @GuardedBy("sActive") - private static final Map<FileDescriptor, RandomAccessFile> sActive = new HashMap<>(); - - public static void native_setFdInt$ravenwood(FileDescriptor fd, int fdInt) { + public static void setFdInt(FileDescriptor fd, int fdInt) { JvmWorkaround.getInstance().setFdInt(fd, fdInt); } - public static int native_getFdInt$ravenwood(FileDescriptor fd) { + public static int getFdInt(FileDescriptor fd) { return JvmWorkaround.getInstance().getFdInt(fd); } - - public static FileDescriptor native_open$ravenwood(File file, int pfdMode) throws IOException { - if ((pfdMode & MODE_CREATE) != 0 && !file.exists()) { - throw new FileNotFoundException(); - } - - final String modeString; - if ((pfdMode & MODE_READ_WRITE) == MODE_READ_WRITE) { - modeString = "rw"; - } else if ((pfdMode & MODE_WRITE_ONLY) == MODE_WRITE_ONLY) { - modeString = "rw"; - } else if ((pfdMode & MODE_READ_ONLY) == MODE_READ_ONLY) { - modeString = "r"; - } else { - throw new IllegalArgumentException(); - } - - final RandomAccessFile raf = new RandomAccessFile(file, modeString); - - // Now that we have a real file on disk, match requested flags - if ((pfdMode & MODE_TRUNCATE) != 0) { - raf.setLength(0); - } - if ((pfdMode & MODE_APPEND) != 0) { - raf.seek(raf.length()); - } - if ((pfdMode & MODE_WORLD_READABLE) != 0) { - file.setReadable(true, false); - } - if ((pfdMode & MODE_WORLD_WRITEABLE) != 0) { - file.setWritable(true, false); - } - - final FileDescriptor fd = raf.getFD(); - synchronized (sActive) { - sActive.put(fd, raf); - } - return fd; - } - - public static void native_close$ravenwood(FileDescriptor fd) { - final RandomAccessFile raf; - synchronized (sActive) { - raf = sActive.remove(fd); - } - try { - if (raf != null) { - raf.close(); - } else { - // Odd, we don't remember opening this ourselves, but let's release the - // underlying resource as requested - System.err.println("Closing unknown FileDescriptor: " + fd); - new FileOutputStream(fd).close(); - } - } catch (IOException ignored) { - } - } } diff --git a/ravenwood/runtime-helper-src/framework/com/android/platform/test/ravenwood/nativesubstitution/Parcel_host.java b/ravenwood/runtime-helper-src/framework/com/android/platform/test/ravenwood/nativesubstitution/Parcel_host.java index 22e11e18ae31..2df93cd93935 100644 --- a/ravenwood/runtime-helper-src/framework/com/android/platform/test/ravenwood/nativesubstitution/Parcel_host.java +++ b/ravenwood/runtime-helper-src/framework/com/android/platform/test/ravenwood/nativesubstitution/Parcel_host.java @@ -15,6 +15,11 @@ */ package com.android.platform.test.ravenwood.nativesubstitution; +import android.system.ErrnoException; +import android.system.Os; +import android.util.Log; + +import java.io.FileDescriptor; import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.util.Arrays; @@ -31,6 +36,8 @@ import java.util.concurrent.atomic.AtomicLong; * {@link ByteBuffer} wouldn't allow...) */ public class Parcel_host { + private static final String TAG = "Parcel"; + private Parcel_host() { } @@ -50,6 +57,11 @@ public class Parcel_host { // TODO Use the actual value from Parcel.java. private static final int OK = 0; + private final Map<Integer, FileDescriptor> mFdMap = new ConcurrentHashMap<>(); + + private static final int FD_PLACEHOLDER = 0xDEADBEEF; + private static final int FD_PAYLOAD_SIZE = 8; + private void validate() { if (mDeleted) { // TODO: Put more info @@ -67,6 +79,7 @@ public class Parcel_host { return p; } + /** Native method substitution */ public static long nativeCreate() { final long id = sNextId.getAndIncrement(); final Parcel_host p = new Parcel_host(); @@ -80,7 +93,8 @@ public class Parcel_host { mSize = 0; mPos = 0; mSensitive = false; - mAllowFds = false; + mAllowFds = true; + mFdMap.clear(); } private void updateSize() { @@ -89,16 +103,19 @@ public class Parcel_host { } } + /** Native method substitution */ public static void nativeDestroy(long nativePtr) { getInstance(nativePtr).mDeleted = true; sInstances.remove(nativePtr); } + /** Native method substitution */ public static void nativeFreeBuffer(long nativePtr) { getInstance(nativePtr).freeBuffer(); } - public void freeBuffer() { + /** Native method substitution */ + private void freeBuffer() { init(); } @@ -137,32 +154,47 @@ public class Parcel_host { } } + /** Native method substitution */ public static void nativeMarkSensitive(long nativePtr) { getInstance(nativePtr).mSensitive = true; } + + /** Native method substitution */ public static int nativeDataSize(long nativePtr) { return getInstance(nativePtr).mSize; } + + /** Native method substitution */ public static int nativeDataAvail(long nativePtr) { var p = getInstance(nativePtr); return p.mSize - p.mPos; } + + /** Native method substitution */ public static int nativeDataPosition(long nativePtr) { return getInstance(nativePtr).mPos; } + + /** Native method substitution */ public static int nativeDataCapacity(long nativePtr) { return getInstance(nativePtr).mBuffer.length; } + + /** Native method substitution */ public static void nativeSetDataSize(long nativePtr, int size) { var p = getInstance(nativePtr); p.ensureCapacity(size); getInstance(nativePtr).mSize = size; } + + /** Native method substitution */ public static void nativeSetDataPosition(long nativePtr, int pos) { var p = getInstance(nativePtr); // TODO: Should this change the size or the capacity?? p.mPos = pos; } + + /** Native method substitution */ public static void nativeSetDataCapacity(long nativePtr, int size) { if (size < 0) { throw new IllegalArgumentException("size < 0: size=" + size); @@ -173,20 +205,25 @@ public class Parcel_host { } } + /** Native method substitution */ public static boolean nativePushAllowFds(long nativePtr, boolean allowFds) { var p = getInstance(nativePtr); var prev = p.mAllowFds; p.mAllowFds = allowFds; return prev; } + + /** Native method substitution */ public static void nativeRestoreAllowFds(long nativePtr, boolean lastValue) { getInstance(nativePtr).mAllowFds = lastValue; } + /** Native method substitution */ public static void nativeWriteByteArray(long nativePtr, byte[] b, int offset, int len) { nativeWriteBlob(nativePtr, b, offset, len); } + /** Native method substitution */ public static void nativeWriteBlob(long nativePtr, byte[] b, int offset, int len) { var p = getInstance(nativePtr); @@ -205,6 +242,7 @@ public class Parcel_host { } } + /** Native method substitution */ public static int nativeWriteInt(long nativePtr, int value) { var p = getInstance(nativePtr); p.ensureMoreCapacity(Integer.BYTES); @@ -219,14 +257,19 @@ public class Parcel_host { return OK; } + /** Native method substitution */ public static int nativeWriteLong(long nativePtr, long value) { nativeWriteInt(nativePtr, (int) (value >>> 32)); nativeWriteInt(nativePtr, (int) (value)); return OK; } + + /** Native method substitution */ public static int nativeWriteFloat(long nativePtr, float val) { return nativeWriteInt(nativePtr, Float.floatToIntBits(val)); } + + /** Native method substitution */ public static int nativeWriteDouble(long nativePtr, double val) { return nativeWriteLong(nativePtr, Double.doubleToLongBits(val)); } @@ -235,6 +278,7 @@ public class Parcel_host { return ((val + 3) / 4) * 4; } + /** Native method substitution */ public static void nativeWriteString8(long nativePtr, String val) { if (val == null) { nativeWriteBlob(nativePtr, null, 0, 0); @@ -243,15 +287,19 @@ public class Parcel_host { nativeWriteBlob(nativePtr, bytes, 0, bytes.length); } } + + /** Native method substitution */ public static void nativeWriteString16(long nativePtr, String val) { // Just reuse String8 nativeWriteString8(nativePtr, val); } + /** Native method substitution */ public static byte[] nativeCreateByteArray(long nativePtr) { return nativeReadBlob(nativePtr); } + /** Native method substitution */ public static boolean nativeReadByteArray(long nativePtr, byte[] dest, int destLen) { if (dest == null) { return false; @@ -271,6 +319,7 @@ public class Parcel_host { return true; } + /** Native method substitution */ public static byte[] nativeReadBlob(long nativePtr) { var p = getInstance(nativePtr); if (p.mSize - p.mPos < 4) { @@ -295,6 +344,8 @@ public class Parcel_host { return bytes; } + + /** Native method substitution */ public static int nativeReadInt(long nativePtr) { var p = getInstance(nativePtr); @@ -310,19 +361,24 @@ public class Parcel_host { return ret; } + + /** Native method substitution */ public static long nativeReadLong(long nativePtr) { return (((long) nativeReadInt(nativePtr)) << 32) | (((long) nativeReadInt(nativePtr)) & 0xffff_ffffL); } + /** Native method substitution */ public static float nativeReadFloat(long nativePtr) { return Float.intBitsToFloat(nativeReadInt(nativePtr)); } + /** Native method substitution */ public static double nativeReadDouble(long nativePtr) { return Double.longBitsToDouble(nativeReadLong(nativePtr)); } + /** Native method substitution */ public static String nativeReadString8(long nativePtr) { final var bytes = nativeReadBlob(nativePtr); if (bytes == null) { @@ -334,10 +390,13 @@ public class Parcel_host { return nativeReadString8(nativePtr); } + /** Native method substitution */ public static byte[] nativeMarshall(long nativePtr) { var p = getInstance(nativePtr); return Arrays.copyOf(p.mBuffer, p.mSize); } + + /** Native method substitution */ public static void nativeUnmarshall( long nativePtr, byte[] data, int offset, int length) { var p = getInstance(nativePtr); @@ -346,6 +405,8 @@ public class Parcel_host { p.mPos += length; p.updateSize(); } + + /** Native method substitution */ public static int nativeCompareData(long thisNativePtr, long otherNativePtr) { var a = getInstance(thisNativePtr); var b = getInstance(otherNativePtr); @@ -355,6 +416,8 @@ public class Parcel_host { return -1; } } + + /** Native method substitution */ public static boolean nativeCompareDataInRange( long ptrA, int offsetA, long ptrB, int offsetB, int length) { var a = getInstance(ptrA); @@ -368,6 +431,8 @@ public class Parcel_host { return Arrays.equals(Arrays.copyOfRange(a.mBuffer, offsetA, offsetA + length), Arrays.copyOfRange(b.mBuffer, offsetB, offsetB + length)); } + + /** Native method substitution */ public static void nativeAppendFrom( long thisNativePtr, long otherNativePtr, int srcOffset, int length) { var dst = getInstance(thisNativePtr); @@ -382,25 +447,83 @@ public class Parcel_host { // TODO: Update the other's position? } - public static boolean nativeHasFileDescriptors(long nativePtr) { - // Assume false for now, because we don't support writing FDs yet. + /** Native method substitution */ + public static boolean nativeHasBinders(long nativePtr) { + // Assume false for now, because we don't support adding binders. return false; } - public static boolean nativeHasFileDescriptorsInRange( + /** Native method substitution */ + public static boolean nativeHasBindersInRange( long nativePtr, int offset, int length) { // Assume false for now, because we don't support writing FDs yet. return false; } - public static boolean nativeHasBinders(long nativePtr) { - // Assume false for now, because we don't support adding binders. - return false; + /** Native method substitution */ + public static void nativeWriteFileDescriptor(long nativePtr, java.io.FileDescriptor val) { + var p = getInstance(nativePtr); + + if (!p.mAllowFds) { + // Simulate the FDS_NOT_ALLOWED case in frameworks/base/core/jni/android_util_Binder.cpp + throw new RuntimeException("Not allowed to write file descriptors here"); + } + + FileDescriptor dup = null; + try { + dup = Os.dup(val); + } catch (ErrnoException e) { + throw new RuntimeException(e); + } + p.mFdMap.put(p.mPos, dup); + + // Parcel.cpp writes two int32s for a FD. + // Make sure FD_PAYLOAD_SIZE is in sync with this code. + nativeWriteInt(nativePtr, FD_PLACEHOLDER); + nativeWriteInt(nativePtr, FD_PLACEHOLDER); } - public static boolean nativeHasBindersInRange( - long nativePtr, int offset, int length) { - // Assume false for now, because we don't support writing FDs yet. + /** Native method substitution */ + public static java.io.FileDescriptor nativeReadFileDescriptor(long nativePtr) { + var p = getInstance(nativePtr); + + var pos = p.mPos; + var fd = p.mFdMap.get(pos); + + if (fd == null) { + Log.w(TAG, "nativeReadFileDescriptor: Not a FD at pos #" + pos); + return null; + } + nativeReadInt(nativePtr); + return fd; + } + + /** Native method substitution */ + public static boolean nativeHasFileDescriptors(long nativePtr) { + var p = getInstance(nativePtr); + return p.mFdMap.size() > 0; + } + + /** Native method substitution */ + public static boolean nativeHasFileDescriptorsInRange(long nativePtr, int offset, int length) { + var p = getInstance(nativePtr); + + // Original code: hasFileDescriptorsInRange() in frameworks/native/libs/binder/Parcel.cpp + if (offset < 0 || length < 0) { + throw new IllegalArgumentException("Negative value not allowed: offset=" + offset + + " length=" + length); + } + long limit = (long) offset + (long) length; + if (limit > p.mSize) { + throw new IllegalArgumentException("Out of range: offset=" + offset + + " length=" + length + " dataSize=" + p.mSize); + } + + for (var pos : p.mFdMap.keySet()) { + if (offset <= pos && (pos + FD_PAYLOAD_SIZE - 1) < (offset + length)) { + return true; + } + } return false; } -} +}
\ No newline at end of file diff --git a/ravenwood/runtime-helper-src/libcore-fake/android/system/Os.java b/ravenwood/runtime-helper-src/libcore-fake/android/system/Os.java index e031eb27513b..ecaa8161ee46 100644 --- a/ravenwood/runtime-helper-src/libcore-fake/android/system/Os.java +++ b/ravenwood/runtime-helper-src/libcore-fake/android/system/Os.java @@ -15,9 +15,11 @@ */ package android.system; +import com.android.ravenwood.common.JvmWorkaround; import com.android.ravenwood.common.RavenwoodRuntimeNative; import java.io.FileDescriptor; +import java.io.IOException; /** * OS class replacement used on Ravenwood. For now, we just implement APIs as we need them... @@ -30,7 +32,6 @@ public final class Os { return RavenwoodRuntimeNative.lseek(fd, offset, whence); } - public static FileDescriptor[] pipe2(int flags) throws ErrnoException { return RavenwoodRuntimeNative.pipe2(flags); } @@ -42,4 +43,30 @@ public final class Os { public static int fcntlInt(FileDescriptor fd, int cmd, int arg) throws ErrnoException { return RavenwoodRuntimeNative.fcntlInt(fd, cmd, arg); } + + public static StructStat fstat(FileDescriptor fd) throws ErrnoException { + return RavenwoodRuntimeNative.fstat(fd); + } + + public static StructStat lstat(String path) throws ErrnoException { + return RavenwoodRuntimeNative.lstat(path); + } + + public static StructStat stat(String path) throws ErrnoException { + return RavenwoodRuntimeNative.stat(path); + } + + /** Ravenwood version of the OS API. */ + public static void close(FileDescriptor fd) throws ErrnoException { + try { + JvmWorkaround.getInstance().closeFd(fd); + } catch (IOException e) { + // The only valid error on Linux that can happen is EIO + throw new ErrnoException("close", OsConstants.EIO); + } + } + + public static FileDescriptor open(String path, int flags, int mode) throws ErrnoException { + return RavenwoodRuntimeNative.open(path, flags, mode); + } } diff --git a/ravenwood/runtime-helper-src/libcore-fake/android/system/StructStat.java b/ravenwood/runtime-helper-src/libcore-fake/android/system/StructStat.java new file mode 100644 index 000000000000..a8b1fca464dd --- /dev/null +++ b/ravenwood/runtime-helper-src/libcore-fake/android/system/StructStat.java @@ -0,0 +1,121 @@ +/* + * Copyright (C) 2011 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.system; + +import libcore.util.Objects; + +/** + * File information returned by {@link Os#fstat}, {@link Os#lstat}, and {@link Os#stat}. + * Corresponds to C's {@code struct stat} from {@code <stat.h>}. + */ +public final class StructStat { + /** Device ID of device containing file. */ + public final long st_dev; /*dev_t*/ + + /** File serial number (inode). */ + public final long st_ino; /*ino_t*/ + + /** Mode (permissions) of file. */ + public final int st_mode; /*mode_t*/ + + /** Number of hard links to the file. */ + public final long st_nlink; /*nlink_t*/ + + /** User ID of file. */ + public final int st_uid; /*uid_t*/ + + /** Group ID of file. */ + public final int st_gid; /*gid_t*/ + + /** Device ID (if file is character or block special). */ + public final long st_rdev; /*dev_t*/ + + /** + * For regular files, the file size in bytes. + * For symbolic links, the length in bytes of the pathname contained in the symbolic link. + * For a shared memory object, the length in bytes. + * For a typed memory object, the length in bytes. + * For other file types, the use of this field is unspecified. + */ + public final long st_size; /*off_t*/ + + /** Seconds part of time of last access. */ + public final long st_atime; /*time_t*/ + + /** StructTimespec with time of last access. */ + public final StructTimespec st_atim; + + /** Seconds part of time of last data modification. */ + public final long st_mtime; /*time_t*/ + + /** StructTimespec with time of last modification. */ + public final StructTimespec st_mtim; + + /** Seconds part of time of last status change */ + public final long st_ctime; /*time_t*/ + + /** StructTimespec with time of last status change. */ + public final StructTimespec st_ctim; + + /** + * A file system-specific preferred I/O block size for this object. + * For some file system types, this may vary from file to file. + */ + public final long st_blksize; /*blksize_t*/ + + /** Number of blocks allocated for this object. */ + public final long st_blocks; /*blkcnt_t*/ + + /** + * Constructs an instance with the given field values. + */ + public StructStat(long st_dev, long st_ino, int st_mode, long st_nlink, int st_uid, int st_gid, + long st_rdev, long st_size, long st_atime, long st_mtime, long st_ctime, + long st_blksize, long st_blocks) { + this(st_dev, st_ino, st_mode, st_nlink, st_uid, st_gid, + st_rdev, st_size, new StructTimespec(st_atime, 0L), new StructTimespec(st_mtime, 0L), + new StructTimespec(st_ctime, 0L), st_blksize, st_blocks); + } + + /** + * Constructs an instance with the given field values. + */ + public StructStat(long st_dev, long st_ino, int st_mode, long st_nlink, int st_uid, int st_gid, + long st_rdev, long st_size, StructTimespec st_atim, StructTimespec st_mtim, + StructTimespec st_ctim, long st_blksize, long st_blocks) { + this.st_dev = st_dev; + this.st_ino = st_ino; + this.st_mode = st_mode; + this.st_nlink = st_nlink; + this.st_uid = st_uid; + this.st_gid = st_gid; + this.st_rdev = st_rdev; + this.st_size = st_size; + this.st_atime = st_atim.tv_sec; + this.st_mtime = st_mtim.tv_sec; + this.st_ctime = st_ctim.tv_sec; + this.st_atim = st_atim; + this.st_mtim = st_mtim; + this.st_ctim = st_ctim; + this.st_blksize = st_blksize; + this.st_blocks = st_blocks; + } + + @Override public String toString() { + return Objects.toString(this); + } +} diff --git a/ravenwood/runtime-helper-src/libcore-fake/android/system/StructTimespec.java b/ravenwood/runtime-helper-src/libcore-fake/android/system/StructTimespec.java new file mode 100644 index 000000000000..c10678057eeb --- /dev/null +++ b/ravenwood/runtime-helper-src/libcore-fake/android/system/StructTimespec.java @@ -0,0 +1,79 @@ +/* + * Copyright (C) 2017 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.system; + +import libcore.util.Objects;; + +/** + * Corresponds to C's {@code struct timespec} from {@code <time.h>}. + */ +public final class StructTimespec implements Comparable<StructTimespec> { + /** Seconds part of time of last data modification. */ + public final long tv_sec; /*time_t*/ + + /** Nanoseconds (values are [0, 999999999]). */ + public final long tv_nsec; + + public StructTimespec(long tv_sec, long tv_nsec) { + this.tv_sec = tv_sec; + this.tv_nsec = tv_nsec; + if (tv_nsec < 0 || tv_nsec > 999_999_999) { + throw new IllegalArgumentException( + "tv_nsec value " + tv_nsec + " is not in [0, 999999999]"); + } + } + + @Override + public int compareTo(StructTimespec other) { + if (tv_sec > other.tv_sec) { + return 1; + } + if (tv_sec < other.tv_sec) { + return -1; + } + if (tv_nsec > other.tv_nsec) { + return 1; + } + if (tv_nsec < other.tv_nsec) { + return -1; + } + return 0; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + StructTimespec that = (StructTimespec) o; + + if (tv_sec != that.tv_sec) return false; + return tv_nsec == that.tv_nsec; + } + + @Override + public int hashCode() { + int result = (int) (tv_sec ^ (tv_sec >>> 32)); + result = 31 * result + (int) (tv_nsec ^ (tv_nsec >>> 32)); + return result; + } + + @Override + public String toString() { + return Objects.toString(this); + } +} diff --git a/ravenwood/runtime-common-src/com/android/ravenwood/common/RavenwoodRuntimeNative.java b/ravenwood/runtime-helper-src/libcore-fake/com/android/ravenwood/common/RavenwoodRuntimeNative.java index 65402219ebee..beba83391652 100644 --- a/ravenwood/runtime-common-src/com/android/ravenwood/common/RavenwoodRuntimeNative.java +++ b/ravenwood/runtime-helper-src/libcore-fake/com/android/ravenwood/common/RavenwoodRuntimeNative.java @@ -15,6 +15,9 @@ */ package com.android.ravenwood.common; +import android.system.ErrnoException; +import android.system.StructStat; + import java.io.FileDescriptor; /** @@ -31,19 +34,27 @@ public class RavenwoodRuntimeNative { public static native void applyFreeFunction(long freeFunction, long nativePtr); - public static native long nLseek(int fd, long offset, int whence); + private static native long nLseek(int fd, long offset, int whence) throws ErrnoException; + + private static native int[] nPipe2(int flags) throws ErrnoException; + + private static native int nDup(int oldfd) throws ErrnoException; - public static native int[] nPipe2(int flags); + private static native int nFcntlInt(int fd, int cmd, int arg) throws ErrnoException; - public static native int nDup(int oldfd); + private static native StructStat nFstat(int fd) throws ErrnoException; - public static native int nFcntlInt(int fd, int cmd, int arg); + public static native StructStat lstat(String path) throws ErrnoException; - public static long lseek(FileDescriptor fd, long offset, int whence) { + public static native StructStat stat(String path) throws ErrnoException; + + private static native int nOpen(String path, int flags, int mode) throws ErrnoException; + + public static long lseek(FileDescriptor fd, long offset, int whence) throws ErrnoException { return nLseek(JvmWorkaround.getInstance().getFdInt(fd), offset, whence); } - public static FileDescriptor[] pipe2(int flags) { + public static FileDescriptor[] pipe2(int flags) throws ErrnoException { var fds = nPipe2(flags); var ret = new FileDescriptor[] { new FileDescriptor(), @@ -55,17 +66,31 @@ public class RavenwoodRuntimeNative { return ret; } - public static FileDescriptor dup(FileDescriptor fd) { + public static FileDescriptor dup(FileDescriptor fd) throws ErrnoException { var fdInt = nDup(JvmWorkaround.getInstance().getFdInt(fd)); - var retFd = new java.io.FileDescriptor(); + var retFd = new FileDescriptor(); JvmWorkaround.getInstance().setFdInt(retFd, fdInt); return retFd; } - public static int fcntlInt(FileDescriptor fd, int cmd, int arg) { + public static int fcntlInt(FileDescriptor fd, int cmd, int arg) throws ErrnoException { var fdInt = JvmWorkaround.getInstance().getFdInt(fd); return nFcntlInt(fdInt, cmd, arg); } + + public static StructStat fstat(FileDescriptor fd) throws ErrnoException { + var fdInt = JvmWorkaround.getInstance().getFdInt(fd); + + return nFstat(fdInt); + } + + public static FileDescriptor open(String path, int flags, int mode) throws ErrnoException { + int fd = nOpen(path, flags, mode); + if (fd < 0) return null; + var retFd = new FileDescriptor(); + JvmWorkaround.getInstance().setFdInt(retFd, fd); + return retFd; + } } diff --git a/ravenwood/runtime-helper-src/libcore-fake/libcore/util/Objects.java b/ravenwood/runtime-helper-src/libcore-fake/libcore/util/Objects.java new file mode 100644 index 000000000000..3781fcf4e891 --- /dev/null +++ b/ravenwood/runtime-helper-src/libcore-fake/libcore/util/Objects.java @@ -0,0 +1,85 @@ +/* + * Copyright (C) 2010 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 libcore.util; + +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; +import java.util.Arrays; + +public final class Objects { + private Objects() {} + + /** + * Returns a string reporting the value of each declared field, via reflection. + * Static and transient fields are automatically skipped. Produces output like + * "SimpleClassName[integer=1234,string="hello",character='c',intArray=[1,2,3]]". + */ + public static String toString(Object o) { + Class<?> c = o.getClass(); + StringBuilder sb = new StringBuilder(); + sb.append(c.getSimpleName()).append('['); + int i = 0; + for (Field f : c.getDeclaredFields()) { + if ((f.getModifiers() & (Modifier.STATIC | Modifier.TRANSIENT)) != 0) { + continue; + } + f.setAccessible(true); + try { + Object value = f.get(o); + + if (i++ > 0) { + sb.append(','); + } + + sb.append(f.getName()); + sb.append('='); + + if (value.getClass().isArray()) { + if (value.getClass() == boolean[].class) { + sb.append(Arrays.toString((boolean[]) value)); + } else if (value.getClass() == byte[].class) { + sb.append(Arrays.toString((byte[]) value)); + } else if (value.getClass() == char[].class) { + sb.append(Arrays.toString((char[]) value)); + } else if (value.getClass() == double[].class) { + sb.append(Arrays.toString((double[]) value)); + } else if (value.getClass() == float[].class) { + sb.append(Arrays.toString((float[]) value)); + } else if (value.getClass() == int[].class) { + sb.append(Arrays.toString((int[]) value)); + } else if (value.getClass() == long[].class) { + sb.append(Arrays.toString((long[]) value)); + } else if (value.getClass() == short[].class) { + sb.append(Arrays.toString((short[]) value)); + } else { + sb.append(Arrays.toString((Object[]) value)); + } + } else if (value.getClass() == Character.class) { + sb.append('\'').append(value).append('\''); + } else if (value.getClass() == String.class) { + sb.append('"').append(value).append('"'); + } else { + sb.append(value); + } + } catch (IllegalAccessException unexpected) { + throw new AssertionError(unexpected); + } + } + sb.append("]"); + return sb.toString(); + } +} diff --git a/ravenwood/runtime-jni/ravenwood_runtime.cpp b/ravenwood/runtime-jni/ravenwood_runtime.cpp index 34cf9f915677..c8049281bc53 100644 --- a/ravenwood/runtime-jni/ravenwood_runtime.cpp +++ b/ravenwood/runtime-jni/ravenwood_runtime.cpp @@ -18,7 +18,12 @@ #include <sys/stat.h> #include <string.h> #include <unistd.h> +#include <string> #include <nativehelper/JNIHelp.h> +#include <nativehelper/ScopedLocalRef.h> +#include <nativehelper/ScopedUtfChars.h> +#include <nativehelper/ScopedPrimitiveArray.h> + #include "jni.h" #include "utils/Log.h" #include "utils/misc.h" @@ -41,6 +46,112 @@ static rc_t throwIfMinusOne(JNIEnv* env, const char* name, rc_t rc) { return rc; } +// ---- Helper functions --- + +static jclass g_StructStat; +static jclass g_StructTimespecClass; + +// We have to explicitly decode the string to real UTF-8, because when using GetStringUTFChars +// we only get modified UTF-8, which is not the platform string type used in host JVM. +struct ScopedRealUtf8Chars { + ScopedRealUtf8Chars(JNIEnv* env, jstring s) : valid_(false) { + if (s == nullptr) { + jniThrowNullPointerException(env); + return; + } + jclass clazz = env->GetObjectClass(s); + jmethodID getBytes = env->GetMethodID(clazz, "getBytes", "(Ljava/lang/String;)[B"); + + ScopedLocalRef<jstring> utf8(env, env->NewStringUTF("UTF-8")); + ScopedLocalRef<jbyteArray> jbytes(env, + (jbyteArray) env->CallObjectMethod(s, getBytes, utf8.get())); + + ScopedByteArrayRO bytes(env, jbytes.get()); + string_.append((const char *) bytes.get(), bytes.size()); + valid_ = true; + } + + const char* c_str() const { + return valid_ ? string_.c_str() : nullptr; + } + + size_t size() const { + return string_.size(); + } + + const char& operator[](size_t n) const { + return string_[n]; + } + +private: + std::string string_; + bool valid_; +}; + +static jclass findClass(JNIEnv* env, const char* name) { + ScopedLocalRef<jclass> localClass(env, env->FindClass(name)); + jclass result = reinterpret_cast<jclass>(env->NewGlobalRef(localClass.get())); + if (result == NULL) { + ALOGE("failed to find class '%s'", name); + abort(); + } + return result; +} + +static jobject makeStructTimespec(JNIEnv* env, const struct timespec& ts) { + static jmethodID ctor = env->GetMethodID(g_StructTimespecClass, "<init>", + "(JJ)V"); + if (ctor == NULL) { + return NULL; + } + return env->NewObject(g_StructTimespecClass, ctor, + static_cast<jlong>(ts.tv_sec), static_cast<jlong>(ts.tv_nsec)); +} + +static jobject makeStructStat(JNIEnv* env, const struct stat64& sb) { + static jmethodID ctor = env->GetMethodID(g_StructStat, "<init>", + "(JJIJIIJJLandroid/system/StructTimespec;Landroid/system/StructTimespec;Landroid/system/StructTimespec;JJ)V"); + if (ctor == NULL) { + return NULL; + } + + jobject atim_timespec = makeStructTimespec(env, sb.st_atim); + if (atim_timespec == NULL) { + return NULL; + } + jobject mtim_timespec = makeStructTimespec(env, sb.st_mtim); + if (mtim_timespec == NULL) { + return NULL; + } + jobject ctim_timespec = makeStructTimespec(env, sb.st_ctim); + if (ctim_timespec == NULL) { + return NULL; + } + + return env->NewObject(g_StructStat, ctor, + static_cast<jlong>(sb.st_dev), static_cast<jlong>(sb.st_ino), + static_cast<jint>(sb.st_mode), static_cast<jlong>(sb.st_nlink), + static_cast<jint>(sb.st_uid), static_cast<jint>(sb.st_gid), + static_cast<jlong>(sb.st_rdev), static_cast<jlong>(sb.st_size), + atim_timespec, mtim_timespec, ctim_timespec, + static_cast<jlong>(sb.st_blksize), static_cast<jlong>(sb.st_blocks)); +} + +static jobject doStat(JNIEnv* env, jstring javaPath, bool isLstat) { + ScopedRealUtf8Chars path(env, javaPath); + if (path.c_str() == NULL) { + return NULL; + } + struct stat64 sb; + int rc = isLstat ? TEMP_FAILURE_RETRY(lstat64(path.c_str(), &sb)) + : TEMP_FAILURE_RETRY(stat64(path.c_str(), &sb)); + if (rc == -1) { + throwErrnoException(env, isLstat ? "lstat" : "stat"); + return NULL; + } + return makeStructStat(env, sb); +} + // ---- JNI methods ---- typedef void (*FreeFunction)(void*); @@ -77,6 +188,32 @@ static jlong nDup(JNIEnv* env, jclass, jint fd) { return throwIfMinusOne(env, "fcntl", TEMP_FAILURE_RETRY(fcntl(fd, F_DUPFD_CLOEXEC, 0))); } +static jobject nFstat(JNIEnv* env, jobject, jint fd) { + struct stat64 sb; + int rc = TEMP_FAILURE_RETRY(fstat64(fd, &sb)); + if (rc == -1) { + throwErrnoException(env, "fstat"); + return NULL; + } + return makeStructStat(env, sb); +} + +static jobject Linux_lstat(JNIEnv* env, jobject, jstring javaPath) { + return doStat(env, javaPath, true); +} + +static jobject Linux_stat(JNIEnv* env, jobject, jstring javaPath) { + return doStat(env, javaPath, false); +} + +static jint Linux_open(JNIEnv* env, jobject, jstring javaPath, jint flags, jint mode) { + ScopedRealUtf8Chars path(env, javaPath); + if (path.c_str() == NULL) { + return -1; + } + return throwIfMinusOne(env, "open", TEMP_FAILURE_RETRY(open(path.c_str(), flags, mode))); +} + // ---- Registration ---- static const JNINativeMethod sMethods[] = @@ -86,6 +223,10 @@ static const JNINativeMethod sMethods[] = { "nLseek", "(IJI)J", (void*)nLseek }, { "nPipe2", "(I)[I", (void*)nPipe2 }, { "nDup", "(I)I", (void*)nDup }, + { "nFstat", "(I)Landroid/system/StructStat;", (void*)nFstat }, + { "lstat", "(Ljava/lang/String;)Landroid/system/StructStat;", (void*)Linux_lstat }, + { "stat", "(Ljava/lang/String;)Landroid/system/StructStat;", (void*)Linux_stat }, + { "nOpen", "(Ljava/lang/String;II)I", (void*)Linux_open }, }; extern "C" jint JNI_OnLoad(JavaVM* vm, void* /* reserved */) @@ -101,6 +242,9 @@ extern "C" jint JNI_OnLoad(JavaVM* vm, void* /* reserved */) ALOGI("%s: JNI_OnLoad", __FILE__); + g_StructStat = findClass(env, "android/system/StructStat"); + g_StructTimespecClass = findClass(env, "android/system/StructTimespec"); + jint res = jniRegisterNativeMethods(env, "com/android/ravenwood/common/RavenwoodRuntimeNative", sMethods, NELEM(sMethods)); if (res < 0) { diff --git a/ravenwood/runtime-test/test/com/android/ravenwood/runtimetest/OsTest.java b/ravenwood/runtime-test/test/com/android/ravenwood/runtimetest/OsTest.java index b5038e68516d..05275b29e48b 100644 --- a/ravenwood/runtime-test/test/com/android/ravenwood/runtimetest/OsTest.java +++ b/ravenwood/runtime-test/test/com/android/ravenwood/runtimetest/OsTest.java @@ -15,15 +15,26 @@ */ package com.android.ravenwood.runtimetest; +import static android.system.OsConstants.S_ISBLK; +import static android.system.OsConstants.S_ISCHR; +import static android.system.OsConstants.S_ISDIR; +import static android.system.OsConstants.S_ISFIFO; +import static android.system.OsConstants.S_ISLNK; +import static android.system.OsConstants.S_ISREG; +import static android.system.OsConstants.S_ISSOCK; + import static org.junit.Assert.assertEquals; +import static java.nio.file.LinkOption.NOFOLLOW_LINKS; + import android.system.Os; import android.system.OsConstants; +import android.system.StructStat; +import android.system.StructTimespec; import androidx.test.ext.junit.runners.AndroidJUnit4; import com.android.ravenwood.common.JvmWorkaround; -import com.android.ravenwood.common.RavenwoodRuntimeNative; import org.junit.Test; import org.junit.runner.RunWith; @@ -32,8 +43,15 @@ import java.io.File; import java.io.FileDescriptor; import java.io.FileInputStream; import java.io.FileOutputStream; -import java.io.IOException; import java.io.RandomAccessFile; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.attribute.FileTime; +import java.nio.file.attribute.PosixFileAttributes; +import java.nio.file.attribute.PosixFilePermission; +import java.util.HashSet; +import java.util.Set; +import java.util.concurrent.TimeUnit; @RunWith(AndroidJUnit4.class) public class OsTest { @@ -41,7 +59,7 @@ public class OsTest { void accept(T var1) throws Exception; } - private void withTestFile(ConsumerWithThrow<FileDescriptor> consumer) throws Exception { + private void withTestFileFD(ConsumerWithThrow<FileDescriptor> consumer) throws Exception { File file = File.createTempFile("osTest", "bin"); try (var raf = new RandomAccessFile(file, "rw")) { var fd = raf.getFD(); @@ -57,9 +75,20 @@ public class OsTest { } } + private void withTestFile(ConsumerWithThrow<Path> consumer) throws Exception { + var path = Files.createTempFile("osTest", "bin"); + try (var os = Files.newOutputStream(path)) { + os.write(1); + os.write(2); + os.write(3); + os.write(4); + } + consumer.accept(path); + } + @Test public void testLseek() throws Exception { - withTestFile((fd) -> { + withTestFileFD((fd) -> { assertEquals(4, Os.lseek(fd, 4, OsConstants.SEEK_SET)); assertEquals(4, Os.lseek(fd, 0, OsConstants.SEEK_CUR)); assertEquals(6, Os.lseek(fd, 2, OsConstants.SEEK_CUR)); @@ -68,7 +97,7 @@ public class OsTest { @Test public void testDup() throws Exception { - withTestFile((fd) -> { + withTestFileFD((fd) -> { var dup = Os.dup(fd); checkAreDup(fd, dup); @@ -85,7 +114,7 @@ public class OsTest { @Test public void testFcntlInt() throws Exception { - withTestFile((fd) -> { + withTestFileFD((fd) -> { var dupInt = Os.fcntlInt(fd, 0, 0); var dup = new FileDescriptor(); @@ -95,16 +124,90 @@ public class OsTest { }); } - private static void write(FileDescriptor fd, int oneByte) throws IOException { + @Test + public void testStat() throws Exception { + withTestFile(path -> { + var attr = Files.readAttributes(path, PosixFileAttributes.class); + var stat = Os.stat(path.toAbsolutePath().toString()); + assertAttributesEqual(attr, stat); + }); + } + + @Test + public void testLstat() throws Exception { + withTestFile(path -> { + // Create a symbolic link + var lnk = Files.createTempFile("osTest", "lnk"); + Files.delete(lnk); + Files.createSymbolicLink(lnk, path); + + // Test lstat + var attr = Files.readAttributes(lnk, PosixFileAttributes.class, NOFOLLOW_LINKS); + var stat = Os.lstat(lnk.toAbsolutePath().toString()); + assertAttributesEqual(attr, stat); + + // Test stat + var followAttr = Files.readAttributes(lnk, PosixFileAttributes.class); + var followStat = Os.stat(lnk.toAbsolutePath().toString()); + assertAttributesEqual(followAttr, followStat); + }); + } + + @Test + public void testFstat() throws Exception { + withTestFile(path -> { + var attr = Files.readAttributes(path, PosixFileAttributes.class); + try (var raf = new RandomAccessFile(path.toFile(), "r")) { + var fd = raf.getFD(); + var stat = Os.fstat(fd); + assertAttributesEqual(attr, stat); + } + }); + } + + // Verify StructStat values from libcore against native JVM PosixFileAttributes + private static void assertAttributesEqual(PosixFileAttributes attr, StructStat stat) { + assertEquals(attr.lastModifiedTime(), convertTimespecToFileTime(stat.st_mtim)); + assertEquals(attr.size(), stat.st_size); + assertEquals(attr.isDirectory(), S_ISDIR(stat.st_mode)); + assertEquals(attr.isRegularFile(), S_ISREG(stat.st_mode)); + assertEquals(attr.isSymbolicLink(), S_ISLNK(stat.st_mode)); + assertEquals(attr.isOther(), S_ISCHR(stat.st_mode) + || S_ISBLK(stat.st_mode) || S_ISFIFO(stat.st_mode) || S_ISSOCK(stat.st_mode)); + assertEquals(attr.permissions(), convertModeToPosixPerms(stat.st_mode)); + + } + + private static FileTime convertTimespecToFileTime(StructTimespec ts) { + var nanos = TimeUnit.SECONDS.toNanos(ts.tv_sec); + nanos += ts.tv_nsec; + return FileTime.from(nanos, TimeUnit.NANOSECONDS); + } + + private static Set<PosixFilePermission> convertModeToPosixPerms(int mode) { + var set = new HashSet<PosixFilePermission>(); + if ((mode & OsConstants.S_IRUSR) != 0) set.add(PosixFilePermission.OWNER_READ); + if ((mode & OsConstants.S_IWUSR) != 0) set.add(PosixFilePermission.OWNER_WRITE); + if ((mode & OsConstants.S_IXUSR) != 0) set.add(PosixFilePermission.OWNER_EXECUTE); + if ((mode & OsConstants.S_IRGRP) != 0) set.add(PosixFilePermission.GROUP_READ); + if ((mode & OsConstants.S_IWGRP) != 0) set.add(PosixFilePermission.GROUP_WRITE); + if ((mode & OsConstants.S_IXGRP) != 0) set.add(PosixFilePermission.GROUP_EXECUTE); + if ((mode & OsConstants.S_IROTH) != 0) set.add(PosixFilePermission.OTHERS_READ); + if ((mode & OsConstants.S_IWOTH) != 0) set.add(PosixFilePermission.OTHERS_WRITE); + if ((mode & OsConstants.S_IXOTH) != 0) set.add(PosixFilePermission.OTHERS_EXECUTE); + return set; + } + + private static void write(FileDescriptor fd, int oneByte) throws Exception { // Create a dup to avoid closing the FD. - try (var dup = new FileOutputStream(RavenwoodRuntimeNative.dup(fd))) { + try (var dup = new FileOutputStream(Os.dup(fd))) { dup.write(oneByte); } } - private static int read(FileDescriptor fd) throws IOException { + private static int read(FileDescriptor fd) throws Exception { // Create a dup to avoid closing the FD. - try (var dup = new FileInputStream(RavenwoodRuntimeNative.dup(fd))) { + try (var dup = new FileInputStream(Os.dup(fd))) { return dup.read(); } } diff --git a/ravenwood/scripts/ravenwood-stats-collector.sh b/ravenwood/scripts/ravenwood-stats-collector.sh index 43b61a46b747..36601bde87cd 100755 --- a/ravenwood/scripts/ravenwood-stats-collector.sh +++ b/ravenwood/scripts/ravenwood-stats-collector.sh @@ -22,10 +22,12 @@ out_dir=/tmp/ravenwood stats=$out_dir/ravenwood-stats-all.csv apis=$out_dir/ravenwood-apis-all.csv keep_all_dir=$out_dir/ravenwood-keep-all/ +dump_dir=$out_dir/ravenwood-dump/ rm -fr $out_dir mkdir -p $out_dir mkdir -p $keep_all_dir +mkdir -p $dump_dir # Where the input files are. path=$ANDROID_BUILD_TOP/out/host/linux-x86/testcases/ravenwood-stats-checker/x86_64/ @@ -85,4 +87,8 @@ collect_apis $apis cp *keep_all.txt $keep_all_dir echo "Keep all files created at:" -find $keep_all_dir -type f
\ No newline at end of file +find $keep_all_dir -type f + +cp *dump.txt $dump_dir +echo "Dump files created at:" +find $dump_dir -type f
\ No newline at end of file diff --git a/ravenwood/texts/ravenwood-framework-jarjar-rules.txt b/ravenwood/texts/ravenwood-framework-jarjar-rules.txt new file mode 100644 index 000000000000..afef56433d5b --- /dev/null +++ b/ravenwood/texts/ravenwood-framework-jarjar-rules.txt @@ -0,0 +1 @@ +# Applying jarjar on framework-minux-apex is too slow, so we don't use jarjar for now. b/313930116
\ No newline at end of file diff --git a/ravenwood/texts/ravenwood-framework-policies.txt b/ravenwood/texts/ravenwood-framework-policies.txt index 9d29a051d092..4012bdc5be62 100644 --- a/ravenwood/texts/ravenwood-framework-policies.txt +++ b/ravenwood/texts/ravenwood-framework-policies.txt @@ -9,6 +9,11 @@ class :feature_flags keepclass # Keep all sysprops generated code implementations class :sysprops keepclass +# To avoid VerifyError on nano proto files (b/324063814), we rename nano proto classes. +# Note: The "rename" directive must use shashes (/) as a package name separator. +rename com/.*/nano/ devicenano/ +rename android/.*/nano/ devicenano/ + # Exported to Mainline modules; cannot use annotations class com.android.internal.util.FastXmlSerializer keepclass class com.android.internal.util.FileRotator keepclass diff --git a/ravenwood/tools/ravenizer-fake/Android.bp b/ravenwood/tools/ravenizer-fake/Android.bp new file mode 100644 index 000000000000..7e2c407f2116 --- /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 000000000000..84b3c8ee365e --- /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/Android.bp b/services/Android.bp index cd974c5f562d..a679341f0de5 100644 --- a/services/Android.bp +++ b/services/Android.bp @@ -108,6 +108,8 @@ filegroup { filegroup { name: "services-non-updatable-sources", srcs: [ + ":incremental_aidl", + ":services.core-aidl-sources", ":services.core-sources", ":services.core-sources-am-wm", "core/java/com/android/server/am/package.html", @@ -359,4 +361,8 @@ non_updatable_exportable_droidstubs { }, }, api_surface: "system-server", + sdk_version: "module_current", + libs: [ + "framework-annotations-lib", + ], } diff --git a/services/OWNERS b/services/OWNERS index 3ce5ae170329..69e4e24f8fa3 100644 --- a/services/OWNERS +++ b/services/OWNERS @@ -1,7 +1,7 @@ per-file Android.bp = file:platform/build/soong:/OWNERS #{LAST_RESORT_SUGGESTION} # art-team@ manages the system server profile -per-file art-profile* = calin@google.com, ngeoffray@google.com, vmarko@google.com +per-file art-profile* = file:platform/art:main:/OWNERS_boot_profile per-file java/com/android/server/HsumBootUserInitializer.java = file:/MULTIUSER_OWNERS diff --git a/services/accessibility/TEST_MAPPING b/services/accessibility/TEST_MAPPING index 299d33fbbe6d..3f85a9005582 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/accessibility/java/com/android/server/accessibility/FlashNotificationsController.java b/services/accessibility/java/com/android/server/accessibility/FlashNotificationsController.java index e6055148867d..2009cd3d4527 100644 --- a/services/accessibility/java/com/android/server/accessibility/FlashNotificationsController.java +++ b/services/accessibility/java/com/android/server/accessibility/FlashNotificationsController.java @@ -659,6 +659,8 @@ class FlashNotificationsController { mIsTorchTouched = on; } catch (CameraAccessException e) { Log.e(LOG_TAG, "Failed to setTorchMode: " + e); + } catch (IllegalArgumentException e) { + Log.e(LOG_TAG, "Failed to setTorchMode: " + e); } } else { Log.e(LOG_TAG, "Can not use camera flash notification, please check CameraManager!"); diff --git a/services/accessibility/java/com/android/server/accessibility/SystemActionPerformer.java b/services/accessibility/java/com/android/server/accessibility/SystemActionPerformer.java index 9747579fa231..2945af507d51 100644 --- a/services/accessibility/java/com/android/server/accessibility/SystemActionPerformer.java +++ b/services/accessibility/java/com/android/server/accessibility/SystemActionPerformer.java @@ -34,6 +34,7 @@ import android.view.KeyCharacterMap; import android.view.KeyEvent; import android.view.WindowManager; import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction; +import android.view.accessibility.Flags; import com.android.internal.R; import com.android.internal.accessibility.util.AccessibilityUtils; @@ -328,6 +329,18 @@ public class SystemActionPerformer { sendDownAndUpKeyEvents(KeyEvent.KEYCODE_DPAD_CENTER, InputDevice.SOURCE_KEYBOARD | InputDevice.SOURCE_DPAD); return true; + case AccessibilityService.GLOBAL_ACTION_MENU: + if (Flags.globalActionMenu()) { + sendDownAndUpKeyEvents(KeyEvent.KEYCODE_MENU, + InputDevice.SOURCE_KEYBOARD); + } + return true; + case AccessibilityService.GLOBAL_ACTION_MEDIA_PLAY_PAUSE: + if (Flags.globalActionMediaPlayPause()) { + sendDownAndUpKeyEvents(KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE, + InputDevice.SOURCE_KEYBOARD); + } + return true; default: Slog.e(TAG, "Invalid action id: " + actionId); return false; diff --git a/services/appfunctions/OWNERS b/services/appfunctions/OWNERS new file mode 100644 index 000000000000..b3108944a3ce --- /dev/null +++ b/services/appfunctions/OWNERS @@ -0,0 +1 @@ +include /core/java/android/app/appfunctions/OWNERS 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 000000000000..3d09da303b0f --- /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/Android.bp b/services/core/Android.bp index 53730e317ac6..89bac5123084 100644 --- a/services/core/Android.bp +++ b/services/core/Android.bp @@ -30,6 +30,18 @@ filegroup { ], } +filegroup { + name: "services.core-aidl-sources", + srcs: [ + ":dumpstate_aidl", + ":framework_native_aidl", + ":gsiservice_aidl", + ":installd_aidl", + ":storaged_aidl", + ":vold_aidl", + ], +} + java_library_static { name: "services-config-update", srcs: [ @@ -120,14 +132,9 @@ java_library_static { ":android.hardware.tv.hdmi.earc-V1-java-source", ":statslog-art-java-gen", ":statslog-contexthub-java-gen", + ":services.core-aidl-sources", ":services.core-sources", ":services.core.protologsrc", - ":dumpstate_aidl", - ":framework_native_aidl", - ":gsiservice_aidl", - ":installd_aidl", - ":storaged_aidl", - ":vold_aidl", ":platform-compat-config", ":platform-compat-overrides", ":display-device-config", @@ -239,6 +246,9 @@ java_library_static { ], lint: { baseline_filename: "lint-baseline.xml", + warning_checks: [ + "FlaggedApi", + ], }, } diff --git a/services/core/java/com/android/server/BatteryService.java b/services/core/java/com/android/server/BatteryService.java index 1ccc48d44f99..2de44820ec05 100644 --- a/services/core/java/com/android/server/BatteryService.java +++ b/services/core/java/com/android/server/BatteryService.java @@ -157,7 +157,7 @@ public final class BatteryService extends SystemService { private int mLastMaxChargingVoltage; private int mLastChargeCounter; private int mLastBatteryCycleCount; - private int mLastCharingState; + private int mLastChargingState; /** * The last seen charging policy. This requires the * {@link android.Manifest.permission#BATTERY_STATS} permission and should therefore not be @@ -555,7 +555,7 @@ public final class BatteryService extends SystemService { || mHealthInfo.batteryChargeCounterUah != mLastChargeCounter || mInvalidCharger != mLastInvalidCharger || mHealthInfo.batteryCycleCount != mLastBatteryCycleCount - || mHealthInfo.chargingState != mLastCharingState)) { + || mHealthInfo.chargingState != mLastChargingState)) { if (mPlugType != mLastPlugType) { if (mLastPlugType == BATTERY_PLUGGED_NONE) { @@ -738,7 +738,7 @@ public final class BatteryService extends SystemService { mLastBatteryLevelCritical = mBatteryLevelCritical; mLastInvalidCharger = mInvalidCharger; mLastBatteryCycleCount = mHealthInfo.batteryCycleCount; - mLastCharingState = mHealthInfo.chargingState; + mLastChargingState = mHealthInfo.chargingState; } } diff --git a/services/core/java/com/android/server/CertBlacklister.java b/services/core/java/com/android/server/CertBlocklister.java index e726c6abfac3..9e23f884f4ba 100644 --- a/services/core/java/com/android/server/CertBlacklister.java +++ b/services/core/java/com/android/server/CertBlocklister.java @@ -16,37 +16,39 @@ package com.android.server; -import android.content.Context; import android.content.ContentResolver; +import android.content.Context; import android.database.ContentObserver; import android.os.Binder; import android.os.FileUtils; import android.provider.Settings; import android.util.Slog; +import libcore.io.IoUtils; + import java.io.File; import java.io.FileOutputStream; import java.io.IOException; -import libcore.io.IoUtils; - /** - * <p>CertBlacklister provides a simple mechanism for updating the platform denylists for SSL + * <p>CertBlocklister provides a simple mechanism for updating the platform denylists for SSL * certificate public keys and serial numbers. */ -public class CertBlacklister extends Binder { +public class CertBlocklister extends Binder { - private static final String TAG = "CertBlacklister"; + private static final String TAG = "CertBlocklister"; private static final String DENYLIST_ROOT = System.getenv("ANDROID_DATA") + "/misc/keychain/"; + /* For compatibility reasons, the name of these paths cannot be changed */ public static final String PUBKEY_PATH = DENYLIST_ROOT + "pubkey_blacklist.txt"; public static final String SERIAL_PATH = DENYLIST_ROOT + "serial_blacklist.txt"; - public static final String PUBKEY_BLACKLIST_KEY = "pubkey_blacklist"; - public static final String SERIAL_BLACKLIST_KEY = "serial_blacklist"; + /* For compatibility reasons, the name of these keys cannot be changed */ + public static final String PUBKEY_BLOCKLIST_KEY = "pubkey_blacklist"; + public static final String SERIAL_BLOCKLIST_KEY = "serial_blacklist"; - private static class BlacklistObserver extends ContentObserver { + private static class BlocklistObserver extends ContentObserver { private final String mKey; private final String mName; @@ -54,7 +56,7 @@ public class CertBlacklister extends Binder { private final File mTmpDir; private final ContentResolver mContentResolver; - public BlacklistObserver(String key, String name, String path, ContentResolver cr) { + BlocklistObserver(String key, String name, String path, ContentResolver cr) { super(null); mKey = key; mName = name; @@ -66,59 +68,61 @@ public class CertBlacklister extends Binder { @Override public void onChange(boolean selfChange) { super.onChange(selfChange); - writeDenylist(); + new Thread("BlocklistUpdater") { + public void run() { + writeDenylist(); + } + }.start(); } public String getValue() { - return Settings.Secure.getString(mContentResolver, mKey); + return Settings.Secure.getStringForUser( + mContentResolver, mKey, mContentResolver.getUserId()); } private void writeDenylist() { - new Thread("BlacklistUpdater") { - public void run() { - synchronized(mTmpDir) { - String blacklist = getValue(); - if (blacklist != null) { - Slog.i(TAG, "Certificate blacklist changed, updating..."); - FileOutputStream out = null; - try { - // create a temporary file - File tmp = File.createTempFile("journal", "", mTmpDir); - // mark it -rw-r--r-- - tmp.setReadable(true, false); - // write to it - out = new FileOutputStream(tmp); - out.write(blacklist.getBytes()); - // sync to disk - FileUtils.sync(out); - // atomic rename - tmp.renameTo(new File(mPath)); - Slog.i(TAG, "Certificate blacklist updated"); - } catch (IOException e) { - Slog.e(TAG, "Failed to write blacklist", e); - } finally { - IoUtils.closeQuietly(out); - } - } - } + synchronized (mTmpDir) { + String blocklist = getValue(); + if (blocklist == null) { + return; } - }.start(); + if (mPath.equals(SERIAL_PATH)) { + Slog.w(TAG, "The certificate blocklist based on serials is deprecated. " + + "Please use the pubkey blocklist instead."); + } + Slog.i(TAG, "Certificate blocklist changed, updating..."); + FileOutputStream out = null; + try { + // Create a temporary file and rename it atomically. + File tmp = File.createTempFile("journal", "", mTmpDir); + tmp.setReadable(true /* readable */, false /* ownerOnly */); + out = new FileOutputStream(tmp); + out.write(blocklist.getBytes()); + FileUtils.sync(out); + tmp.renameTo(new File(mPath)); + Slog.i(TAG, "Certificate blocklist updated"); + } catch (IOException e) { + Slog.e(TAG, "Failed to write blocklist", e); + } finally { + IoUtils.closeQuietly(out); + } + } } } - public CertBlacklister(Context context) { + public CertBlocklister(Context context) { registerObservers(context.getContentResolver()); } - private BlacklistObserver buildPubkeyObserver(ContentResolver cr) { - return new BlacklistObserver(PUBKEY_BLACKLIST_KEY, + private BlocklistObserver buildPubkeyObserver(ContentResolver cr) { + return new BlocklistObserver(PUBKEY_BLOCKLIST_KEY, "pubkey", PUBKEY_PATH, cr); } - private BlacklistObserver buildSerialObserver(ContentResolver cr) { - return new BlacklistObserver(SERIAL_BLACKLIST_KEY, + private BlocklistObserver buildSerialObserver(ContentResolver cr) { + return new BlocklistObserver(SERIAL_BLOCKLIST_KEY, "serial", SERIAL_PATH, cr); @@ -127,16 +131,16 @@ public class CertBlacklister extends Binder { private void registerObservers(ContentResolver cr) { // set up the public key denylist observer cr.registerContentObserver( - Settings.Secure.getUriFor(PUBKEY_BLACKLIST_KEY), - true, - buildPubkeyObserver(cr) + Settings.Secure.getUriFor(PUBKEY_BLOCKLIST_KEY), + true, + buildPubkeyObserver(cr) ); // set up the serial number denylist observer cr.registerContentObserver( - Settings.Secure.getUriFor(SERIAL_BLACKLIST_KEY), - true, - buildSerialObserver(cr) + Settings.Secure.getUriFor(SERIAL_BLOCKLIST_KEY), + true, + buildSerialObserver(cr) ); } } diff --git a/services/core/java/com/android/server/OWNERS b/services/core/java/com/android/server/OWNERS index c4d38e46da3c..37dddc61a976 100644 --- a/services/core/java/com/android/server/OWNERS +++ b/services/core/java/com/android/server/OWNERS @@ -10,9 +10,6 @@ per-file DisplayThread.java = michaelwr@google.com, ogunwale@google.com # 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 @@ -48,3 +45,6 @@ per-file VcnManagementService.java = file:/services/core/java/com/android/server # SystemConfig per-file SystemConfig.java = file:/PACKAGE_MANAGER_OWNERS + +# CertBlocklister +per-file Cert*.java = tweek@google.com, brambonne@google.com, prb@google.com, miguelaranda@google.com diff --git a/services/core/java/com/android/server/PackageWatchdog.java b/services/core/java/com/android/server/PackageWatchdog.java index eb037095c6c9..d9926a4a0f0d 100644 --- a/services/core/java/com/android/server/PackageWatchdog.java +++ b/services/core/java/com/android/server/PackageWatchdog.java @@ -150,6 +150,15 @@ public class PackageWatchdog { private static final int DEFAULT_MAJOR_USER_IMPACT_LEVEL_THRESHOLD = PackageHealthObserverImpact.USER_IMPACT_LEVEL_71; + // Comma separated list of all packages exempt from user impact level threshold. If a package + // in the list is crash looping, all the mitigations including factory reset will be performed. + private static final String PACKAGES_EXEMPT_FROM_IMPACT_LEVEL_THRESHOLD = + "persist.device_config.configuration.packages_exempt_from_impact_level_threshold"; + + // Comma separated list of default packages exempt from user impact level threshold. + private static final String DEFAULT_PACKAGES_EXEMPT_FROM_IMPACT_LEVEL_THRESHOLD = + "com.android.systemui"; + private long mNumberOfNativeCrashPollsRemaining; private static final int DB_VERSION = 1; @@ -196,6 +205,8 @@ public class PackageWatchdog { private final DeviceConfig.OnPropertiesChangedListener mOnPropertyChangedListener = this::onPropertyChanged; + private final Set<String> mPackagesExemptFromImpactLevelThreshold = new ArraySet<>(); + // The set of packages that have been synced with the ExplicitHealthCheckController @GuardedBy("mLock") private Set<String> mRequestedHealthCheckPackages = new ArraySet<>(); @@ -518,7 +529,7 @@ public class PackageWatchdog { @FailureReasons int failureReason, int currentObserverImpact, int mitigationCount) { - if (currentObserverImpact < getUserImpactLevelLimit()) { + if (allowMitigations(currentObserverImpact, versionedPackage)) { synchronized (mLock) { mLastMitigation = mSystemClock.uptimeMillis(); } @@ -526,6 +537,13 @@ public class PackageWatchdog { } } + private boolean allowMitigations(int currentObserverImpact, + VersionedPackage versionedPackage) { + return currentObserverImpact < getUserImpactLevelLimit() + || getPackagesExemptFromImpactLevelThreshold().contains( + versionedPackage.getPackageName()); + } + private long getMitigationWindowMs() { return SystemProperties.getLong(MITIGATION_WINDOW_MS, DEFAULT_MITIGATION_WINDOW_MS); } @@ -657,6 +675,15 @@ public class PackageWatchdog { DEFAULT_MAJOR_USER_IMPACT_LEVEL_THRESHOLD); } + private Set<String> getPackagesExemptFromImpactLevelThreshold() { + if (mPackagesExemptFromImpactLevelThreshold.isEmpty()) { + String packageNames = SystemProperties.get(PACKAGES_EXEMPT_FROM_IMPACT_LEVEL_THRESHOLD, + DEFAULT_PACKAGES_EXEMPT_FROM_IMPACT_LEVEL_THRESHOLD); + return Set.of(packageNames.split("\\s*,\\s*")); + } + return mPackagesExemptFromImpactLevelThreshold; + } + /** Possible severity values of the user impact of a {@link PackageHealthObserver#execute}. */ @Retention(SOURCE) @IntDef(value = {PackageHealthObserverImpact.USER_IMPACT_LEVEL_0, diff --git a/services/core/java/com/android/server/RescueParty.java b/services/core/java/com/android/server/RescueParty.java index 189b2495c1b1..c2cb5e90ca58 100644 --- a/services/core/java/com/android/server/RescueParty.java +++ b/services/core/java/com/android/server/RescueParty.java @@ -58,7 +58,6 @@ import java.io.File; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.ArrayList; -import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; @@ -242,12 +241,14 @@ public class RescueParty { * opportunity to reset any settings depending on our rescue level. */ public static void onSettingsProviderPublished(Context context) { - handleNativeRescuePartyResets(); - ContentResolver contentResolver = context.getContentResolver(); - DeviceConfig.setMonitorCallback( - contentResolver, - Executors.newSingleThreadExecutor(), - new RescuePartyMonitorCallback(context)); + if (!Flags.deprecateFlagsAndSettingsResets()) { + handleNativeRescuePartyResets(); + ContentResolver contentResolver = context.getContentResolver(); + DeviceConfig.setMonitorCallback( + contentResolver, + Executors.newSingleThreadExecutor(), + new RescuePartyMonitorCallback(context)); + } } @@ -257,75 +258,81 @@ public class RescueParty { * on modules of newer versions. */ public static void resetDeviceConfigForPackages(List<String> packageNames) { - if (packageNames == null) { - return; - } - Set<String> namespacesToReset = new ArraySet<String>(); - Iterator<String> it = packageNames.iterator(); - RescuePartyObserver rescuePartyObserver = RescuePartyObserver.getInstanceIfCreated(); - // Get runtime package to namespace mapping if created. - if (rescuePartyObserver != null) { - while (it.hasNext()) { - String packageName = it.next(); - Set<String> runtimeAffectedNamespaces = - rescuePartyObserver.getAffectedNamespaceSet(packageName); - if (runtimeAffectedNamespaces != null) { - namespacesToReset.addAll(runtimeAffectedNamespaces); + if (!Flags.deprecateFlagsAndSettingsResets()) { + if (packageNames == null) { + return; + } + Set<String> namespacesToReset = new ArraySet<String>(); + Iterator<String> it = packageNames.iterator(); + RescuePartyObserver rescuePartyObserver = RescuePartyObserver.getInstanceIfCreated(); + // Get runtime package to namespace mapping if created. + if (rescuePartyObserver != null) { + while (it.hasNext()) { + String packageName = it.next(); + Set<String> runtimeAffectedNamespaces = + rescuePartyObserver.getAffectedNamespaceSet(packageName); + if (runtimeAffectedNamespaces != null) { + namespacesToReset.addAll(runtimeAffectedNamespaces); + } } } - } - // Get preset package to namespace mapping if created. - Set<String> presetAffectedNamespaces = getPresetNamespacesForPackages( - packageNames); - if (presetAffectedNamespaces != null) { - namespacesToReset.addAll(presetAffectedNamespaces); - } + // Get preset package to namespace mapping if created. + Set<String> presetAffectedNamespaces = getPresetNamespacesForPackages( + packageNames); + if (presetAffectedNamespaces != null) { + namespacesToReset.addAll(presetAffectedNamespaces); + } - // Clear flags under the namespaces mapped to these packages. - // Using setProperties since DeviceConfig.resetToDefaults bans the current flag set. - Iterator<String> namespaceIt = namespacesToReset.iterator(); - while (namespaceIt.hasNext()) { - String namespaceToReset = namespaceIt.next(); - Properties properties = new Properties.Builder(namespaceToReset).build(); - try { - if (!DeviceConfig.setProperties(properties)) { - logCriticalInfo(Log.ERROR, "Failed to clear properties under " + // Clear flags under the namespaces mapped to these packages. + // Using setProperties since DeviceConfig.resetToDefaults bans the current flag set. + Iterator<String> namespaceIt = namespacesToReset.iterator(); + while (namespaceIt.hasNext()) { + String namespaceToReset = namespaceIt.next(); + Properties properties = new Properties.Builder(namespaceToReset).build(); + try { + if (!DeviceConfig.setProperties(properties)) { + logCriticalInfo(Log.ERROR, "Failed to clear properties under " + namespaceToReset + ". Running `device_config get_sync_disabled_for_tests` will confirm" + " if config-bulk-update is enabled."); + } + } catch (DeviceConfig.BadConfigException exception) { + logCriticalInfo(Log.WARN, "namespace " + namespaceToReset + + " is already banned, skip reset."); } - } catch (DeviceConfig.BadConfigException exception) { - logCriticalInfo(Log.WARN, "namespace " + namespaceToReset - + " is already banned, skip reset."); } } } private static Set<String> getPresetNamespacesForPackages(List<String> packageNames) { Set<String> resultSet = new ArraySet<String>(); - try { - String flagVal = DeviceConfig.getString(NAMESPACE_CONFIGURATION, - NAMESPACE_TO_PACKAGE_MAPPING_FLAG, ""); - String[] mappingEntries = flagVal.split(","); - for (int i = 0; i < mappingEntries.length; i++) { - if (TextUtils.isEmpty(mappingEntries[i])) { - continue; - } - String[] splittedEntry = mappingEntries[i].split(":"); - if (splittedEntry.length != 2) { - throw new RuntimeException("Invalid mapping entry: " + mappingEntries[i]); - } - String namespace = splittedEntry[0]; - String packageName = splittedEntry[1]; + if (!Flags.deprecateFlagsAndSettingsResets()) { + try { + String flagVal = DeviceConfig.getString(NAMESPACE_CONFIGURATION, + NAMESPACE_TO_PACKAGE_MAPPING_FLAG, ""); + String[] mappingEntries = flagVal.split(","); + for (int i = 0; i < mappingEntries.length; i++) { + if (TextUtils.isEmpty(mappingEntries[i])) { + continue; + } + String[] splitEntry = mappingEntries[i].split(":"); + if (splitEntry.length != 2) { + throw new RuntimeException("Invalid mapping entry: " + mappingEntries[i]); + } + String namespace = splitEntry[0]; + String packageName = splitEntry[1]; - if (packageNames.contains(packageName)) { - resultSet.add(namespace); + if (packageNames.contains(packageName)) { + resultSet.add(namespace); + } } + } catch (Exception e) { + resultSet.clear(); + Slog.e(TAG, "Failed to read preset package to namespaces mapping.", e); + } finally { + return resultSet; } - } catch (Exception e) { - resultSet.clear(); - Slog.e(TAG, "Failed to read preset package to namespaces mapping.", e); - } finally { + } else { return resultSet; } } @@ -343,43 +350,54 @@ public class RescueParty { } public void onNamespaceUpdate(@NonNull String updatedNamespace) { - startObservingPackages(mContext, updatedNamespace); + if (!Flags.deprecateFlagsAndSettingsResets()) { + startObservingPackages(mContext, updatedNamespace); + } } public void onDeviceConfigAccess(@NonNull String callingPackage, @NonNull String namespace) { - RescuePartyObserver.getInstance(mContext).recordDeviceConfigAccess( - callingPackage, - namespace); + + if (!Flags.deprecateFlagsAndSettingsResets()) { + RescuePartyObserver.getInstance(mContext).recordDeviceConfigAccess( + callingPackage, + namespace); + } } } private static void startObservingPackages(Context context, @NonNull String updatedNamespace) { - RescuePartyObserver rescuePartyObserver = RescuePartyObserver.getInstance(context); - Set<String> callingPackages = rescuePartyObserver.getCallingPackagesSet(updatedNamespace); - if (callingPackages == null) { - return; + if (!Flags.deprecateFlagsAndSettingsResets()) { + RescuePartyObserver rescuePartyObserver = RescuePartyObserver.getInstance(context); + Set<String> callingPackages = rescuePartyObserver.getCallingPackagesSet( + updatedNamespace); + if (callingPackages == null) { + return; + } + List<String> callingPackageList = new ArrayList<>(); + callingPackageList.addAll(callingPackages); + Slog.i(TAG, "Starting to observe: " + callingPackageList + ", updated namespace: " + + updatedNamespace); + PackageWatchdog.getInstance(context).startObservingHealth( + rescuePartyObserver, + callingPackageList, + DEFAULT_OBSERVING_DURATION_MS); } - List<String> callingPackageList = new ArrayList<>(); - callingPackageList.addAll(callingPackages); - Slog.i(TAG, "Starting to observe: " + callingPackageList + ", updated namespace: " - + updatedNamespace); - PackageWatchdog.getInstance(context).startObservingHealth( - rescuePartyObserver, - callingPackageList, - DEFAULT_OBSERVING_DURATION_MS); } private static void handleNativeRescuePartyResets() { - if (SettingsToPropertiesMapper.isNativeFlagsResetPerformed()) { - String[] resetNativeCategories = SettingsToPropertiesMapper.getResetNativeCategories(); - for (int i = 0; i < resetNativeCategories.length; i++) { - // Don't let RescueParty reset the namespace for RescueParty switches. - if (NAMESPACE_CONFIGURATION.equals(resetNativeCategories[i])) { - continue; + if (!Flags.deprecateFlagsAndSettingsResets()) { + if (SettingsToPropertiesMapper.isNativeFlagsResetPerformed()) { + String[] resetNativeCategories = + SettingsToPropertiesMapper.getResetNativeCategories(); + for (int i = 0; i < resetNativeCategories.length; i++) { + // Don't let RescueParty reset the namespace for RescueParty switches. + if (NAMESPACE_CONFIGURATION.equals(resetNativeCategories[i])) { + continue; + } + DeviceConfig.resetToDefaults(DEVICE_CONFIG_RESET_MODE, + resetNativeCategories[i]); } - DeviceConfig.resetToDefaults(DEVICE_CONFIG_RESET_MODE, - resetNativeCategories[i]); } } } @@ -401,6 +419,13 @@ public class RescueParty { } } + private static int getMaxRescueLevel() { + if (!SystemProperties.getBoolean(PROP_DISABLE_FACTORY_RESET_FLAG, false)) { + return Level.factoryReset(); + } + return Level.reboot(); + } + /** * Get the rescue level to perform if this is the n-th attempt at mitigating failure. * @@ -410,19 +435,30 @@ public class RescueParty { * @return the rescue level for the n-th mitigation attempt. */ private static int getRescueLevel(int mitigationCount, boolean mayPerformReboot) { - if (mitigationCount == 1) { - return LEVEL_RESET_SETTINGS_UNTRUSTED_DEFAULTS; - } else if (mitigationCount == 2) { - return LEVEL_RESET_SETTINGS_UNTRUSTED_CHANGES; - } else if (mitigationCount == 3) { - return LEVEL_RESET_SETTINGS_TRUSTED_DEFAULTS; - } else if (mitigationCount == 4) { - return Math.min(getMaxRescueLevel(mayPerformReboot), LEVEL_WARM_REBOOT); - } else if (mitigationCount >= 5) { - return Math.min(getMaxRescueLevel(mayPerformReboot), LEVEL_FACTORY_RESET); + if (!Flags.deprecateFlagsAndSettingsResets()) { + if (mitigationCount == 1) { + return LEVEL_RESET_SETTINGS_UNTRUSTED_DEFAULTS; + } else if (mitigationCount == 2) { + return LEVEL_RESET_SETTINGS_UNTRUSTED_CHANGES; + } else if (mitigationCount == 3) { + return LEVEL_RESET_SETTINGS_TRUSTED_DEFAULTS; + } else if (mitigationCount == 4) { + return Math.min(getMaxRescueLevel(mayPerformReboot), LEVEL_WARM_REBOOT); + } else if (mitigationCount >= 5) { + return Math.min(getMaxRescueLevel(mayPerformReboot), LEVEL_FACTORY_RESET); + } else { + Slog.w(TAG, "Expected positive mitigation count, was " + mitigationCount); + return LEVEL_NONE; + } } else { - Slog.w(TAG, "Expected positive mitigation count, was " + mitigationCount); - return LEVEL_NONE; + if (mitigationCount == 1) { + return Level.reboot(); + } else if (mitigationCount >= 2) { + return Math.min(getMaxRescueLevel(), Level.factoryReset()); + } else { + Slog.w(TAG, "Expected positive mitigation count, was " + mitigationCount); + return LEVEL_NONE; + } } } @@ -452,13 +488,13 @@ public class RescueParty { return Math.min(getMaxRescueLevel(mayPerformReboot), RESCUE_LEVEL_WARM_REBOOT); } else if (mitigationCount == 4) { return Math.min(getMaxRescueLevel(mayPerformReboot), - RESCUE_LEVEL_RESET_SETTINGS_UNTRUSTED_DEFAULTS); + RESCUE_LEVEL_RESET_SETTINGS_UNTRUSTED_DEFAULTS); } else if (mitigationCount == 5) { return Math.min(getMaxRescueLevel(mayPerformReboot), - RESCUE_LEVEL_RESET_SETTINGS_UNTRUSTED_CHANGES); + RESCUE_LEVEL_RESET_SETTINGS_UNTRUSTED_CHANGES); } else if (mitigationCount == 6) { return Math.min(getMaxRescueLevel(mayPerformReboot), - RESCUE_LEVEL_RESET_SETTINGS_TRUSTED_DEFAULTS); + RESCUE_LEVEL_RESET_SETTINGS_TRUSTED_DEFAULTS); } else if (mitigationCount >= 7) { return Math.min(getMaxRescueLevel(mayPerformReboot), RESCUE_LEVEL_FACTORY_RESET); } else { @@ -466,6 +502,22 @@ public class RescueParty { } } + /** + * Get the rescue level to perform if this is the n-th attempt at mitigating failure. + * + * @param mitigationCount the mitigation attempt number (1 = first attempt etc.). + * @return the rescue level for the n-th mitigation attempt. + */ + private static @RescueLevels int getRescueLevel(int mitigationCount) { + if (mitigationCount == 1) { + return Level.reboot(); + } else if (mitigationCount >= 2) { + return Math.min(getMaxRescueLevel(), Level.factoryReset()); + } else { + return Level.none(); + } + } + private static void executeRescueLevel(Context context, @Nullable String failedPackage, int level) { Slog.w(TAG, "Attempting rescue level " + levelToString(level)); @@ -493,14 +545,6 @@ public class RescueParty { private static void executeRescueLevelInternalOld(Context context, int level, @Nullable String failedPackage) throws Exception { - - // Note: DeviceConfig reset is disabled currently and would be enabled using the flag, - // after we have figured out a way to reset flags without interfering with trunk - // development. TODO: b/287618292 For enabling flag resets. - if (!Flags.allowRescuePartyFlagResets() && level <= LEVEL_RESET_SETTINGS_TRUSTED_DEFAULTS) { - return; - } - CrashRecoveryStatsLog.write(CrashRecoveryStatsLog.RESCUE_PARTY_RESET_REPORTED, level, levelToString(level)); // Try our best to reset all settings possible, and once finished @@ -508,43 +552,10 @@ public class RescueParty { Exception res = null; switch (level) { case LEVEL_RESET_SETTINGS_UNTRUSTED_DEFAULTS: - try { - resetAllSettingsIfNecessary(context, Settings.RESET_MODE_UNTRUSTED_DEFAULTS, - level); - } catch (Exception e) { - res = e; - } - try { - resetDeviceConfig(context, /*isScoped=*/true, failedPackage); - } catch (Exception e) { - res = e; - } break; case LEVEL_RESET_SETTINGS_UNTRUSTED_CHANGES: - try { - resetAllSettingsIfNecessary(context, Settings.RESET_MODE_UNTRUSTED_CHANGES, - level); - } catch (Exception e) { - res = e; - } - try { - resetDeviceConfig(context, /*isScoped=*/true, failedPackage); - } catch (Exception e) { - res = e; - } break; case LEVEL_RESET_SETTINGS_TRUSTED_DEFAULTS: - try { - resetAllSettingsIfNecessary(context, Settings.RESET_MODE_TRUSTED_DEFAULTS, - level); - } catch (Exception e) { - res = e; - } - try { - resetDeviceConfig(context, /*isScoped=*/false, failedPackage); - } catch (Exception e) { - res = e; - } break; case LEVEL_WARM_REBOOT: executeWarmReboot(context, level, failedPackage); @@ -572,28 +583,29 @@ public class RescueParty { level, levelToString(level)); switch (level) { case RESCUE_LEVEL_SCOPED_DEVICE_CONFIG_RESET: - // Enable deviceConfig reset behind flag - if (Flags.allowRescuePartyFlagResets()) { - resetDeviceConfig(context, /*isScoped=*/true, failedPackage); - } break; case RESCUE_LEVEL_ALL_DEVICE_CONFIG_RESET: - // Enable deviceConfig reset behind flag - if (Flags.allowRescuePartyFlagResets()) { - resetDeviceConfig(context, /*isScoped=*/false, failedPackage); - } break; case RESCUE_LEVEL_WARM_REBOOT: executeWarmReboot(context, level, failedPackage); break; case RESCUE_LEVEL_RESET_SETTINGS_UNTRUSTED_DEFAULTS: - resetAllSettingsIfNecessary(context, Settings.RESET_MODE_UNTRUSTED_DEFAULTS, level); + if (!Flags.deprecateFlagsAndSettingsResets()) { + resetAllSettingsIfNecessary(context, Settings.RESET_MODE_UNTRUSTED_DEFAULTS, + level); + } break; case RESCUE_LEVEL_RESET_SETTINGS_UNTRUSTED_CHANGES: - resetAllSettingsIfNecessary(context, Settings.RESET_MODE_UNTRUSTED_CHANGES, level); + if (!Flags.deprecateFlagsAndSettingsResets()) { + resetAllSettingsIfNecessary(context, Settings.RESET_MODE_UNTRUSTED_CHANGES, + level); + } break; case RESCUE_LEVEL_RESET_SETTINGS_TRUSTED_DEFAULTS: - resetAllSettingsIfNecessary(context, Settings.RESET_MODE_TRUSTED_DEFAULTS, level); + if (!Flags.deprecateFlagsAndSettingsResets()) { + resetAllSettingsIfNecessary(context, Settings.RESET_MODE_TRUSTED_DEFAULTS, + level); + } break; case RESCUE_LEVEL_FACTORY_RESET: // Before the completion of Reboot, if any crash happens then PackageWatchdog @@ -610,6 +622,12 @@ public class RescueParty { private static void executeWarmReboot(Context context, int level, @Nullable String failedPackage) { + if (Flags.deprecateFlagsAndSettingsResets()) { + if (shouldThrottleReboot()) { + return; + } + } + // Request the reboot from a separate thread to avoid deadlock on PackageWatchdog // when device shutting down. setRebootProperty(true); @@ -629,6 +647,11 @@ public class RescueParty { private static void executeFactoryReset(Context context, int level, @Nullable String failedPackage) { + if (Flags.deprecateFlagsAndSettingsResets()) { + if (shouldThrottleReboot()) { + return; + } + } setFactoryResetProperty(true); long now = System.currentTimeMillis(); setLastFactoryResetTimeMs(now); @@ -705,84 +728,31 @@ public class RescueParty { private static void resetAllSettingsIfNecessary(Context context, int mode, int level) throws Exception { - // No need to reset Settings again if they are already reset in the current level once. - if (getMaxRescueLevelAttempted() >= level) { - return; - } - setMaxRescueLevelAttempted(level); - // Try our best to reset all settings possible, and once finished - // rethrow any exception that we encountered - Exception res = null; - final ContentResolver resolver = context.getContentResolver(); - try { - Settings.Global.resetToDefaultsAsUser(resolver, null, mode, - UserHandle.SYSTEM.getIdentifier()); - } catch (Exception e) { - res = new RuntimeException("Failed to reset global settings", e); - } - for (int userId : getAllUserIds()) { + if (!Flags.deprecateFlagsAndSettingsResets()) { + // No need to reset Settings again if they are already reset in the current level once. + if (getMaxRescueLevelAttempted() >= level) { + return; + } + setMaxRescueLevelAttempted(level); + // Try our best to reset all settings possible, and once finished + // rethrow any exception that we encountered + Exception res = null; + final ContentResolver resolver = context.getContentResolver(); try { - Settings.Secure.resetToDefaultsAsUser(resolver, null, mode, userId); + Settings.Global.resetToDefaultsAsUser(resolver, null, mode, + UserHandle.SYSTEM.getIdentifier()); } catch (Exception e) { - res = new RuntimeException("Failed to reset secure settings for " + userId, e); + res = new RuntimeException("Failed to reset global settings", e); } - } - if (res != null) { - throw res; - } - } - - private static void resetDeviceConfig(Context context, boolean isScoped, - @Nullable String failedPackage) throws Exception { - final ContentResolver resolver = context.getContentResolver(); - try { - if (!isScoped || failedPackage == null) { - resetAllAffectedNamespaces(context); - } else { - performScopedReset(context, failedPackage); - } - } catch (Exception e) { - throw new RuntimeException("Failed to reset config settings", e); - } - } - - private static void resetAllAffectedNamespaces(Context context) { - RescuePartyObserver rescuePartyObserver = RescuePartyObserver.getInstance(context); - Set<String> allAffectedNamespaces = rescuePartyObserver.getAllAffectedNamespaceSet(); - - Slog.w(TAG, - "Performing reset for all affected namespaces: " - + Arrays.toString(allAffectedNamespaces.toArray())); - Iterator<String> it = allAffectedNamespaces.iterator(); - while (it.hasNext()) { - String namespace = it.next(); - // Don't let RescueParty reset the namespace for RescueParty switches. - if (NAMESPACE_CONFIGURATION.equals(namespace)) { - continue; - } - DeviceConfig.resetToDefaults(DEVICE_CONFIG_RESET_MODE, namespace); - } - } - - private static void performScopedReset(Context context, @NonNull String failedPackage) { - RescuePartyObserver rescuePartyObserver = RescuePartyObserver.getInstance(context); - Set<String> affectedNamespaces = rescuePartyObserver.getAffectedNamespaceSet( - failedPackage); - // If we can't find namespaces affected for current package, - // skip this round of reset. - if (affectedNamespaces != null) { - Slog.w(TAG, - "Performing scoped reset for package: " + failedPackage - + ", affected namespaces: " - + Arrays.toString(affectedNamespaces.toArray())); - Iterator<String> it = affectedNamespaces.iterator(); - while (it.hasNext()) { - String namespace = it.next(); - // Don't let RescueParty reset the namespace for RescueParty switches. - if (NAMESPACE_CONFIGURATION.equals(namespace)) { - continue; + for (int userId : getAllUserIds()) { + try { + Settings.Secure.resetToDefaultsAsUser(resolver, null, mode, userId); + } catch (Exception e) { + res = new RuntimeException("Failed to reset secure settings for " + userId, e); } - DeviceConfig.resetToDefaults(DEVICE_CONFIG_RESET_MODE, namespace); + } + if (res != null) { + throw res; } } } @@ -833,18 +803,28 @@ public class RescueParty { @Override public int onHealthCheckFailed(@Nullable VersionedPackage failedPackage, @FailureReasons int failureReason, int mitigationCount) { + int impact = PackageHealthObserverImpact.USER_IMPACT_LEVEL_0; if (!isDisabled() && (failureReason == PackageWatchdog.FAILURE_REASON_APP_CRASH || failureReason == PackageWatchdog.FAILURE_REASON_APP_NOT_RESPONDING)) { if (Flags.recoverabilityDetection()) { - return mapRescueLevelToUserImpact(getRescueLevel(mitigationCount, - mayPerformReboot(failedPackage), failedPackage)); + if (!Flags.deprecateFlagsAndSettingsResets()) { + impact = mapRescueLevelToUserImpact(getRescueLevel(mitigationCount, + mayPerformReboot(failedPackage), failedPackage)); + } else { + impact = mapRescueLevelToUserImpact(getRescueLevel(mitigationCount)); + } } else { - return mapRescueLevelToUserImpact(getRescueLevel(mitigationCount, - mayPerformReboot(failedPackage))); + impact = mapRescueLevelToUserImpact(getRescueLevel(mitigationCount, + mayPerformReboot(failedPackage))); } - } else { - return PackageHealthObserverImpact.USER_IMPACT_LEVEL_0; } + + Slog.i(TAG, "Checking available remediations for health check failure." + + " failedPackage: " + + (failedPackage == null ? null : failedPackage.getPackageName()) + + " failureReason: " + failureReason + + " available impact: " + impact); + return impact; } @Override @@ -853,12 +833,24 @@ public class RescueParty { if (isDisabled()) { return false; } + Slog.i(TAG, "Executing remediation." + + " failedPackage: " + + (failedPackage == null ? null : failedPackage.getPackageName()) + + " failureReason: " + failureReason + + " mitigationCount: " + mitigationCount); if (failureReason == PackageWatchdog.FAILURE_REASON_APP_CRASH || failureReason == PackageWatchdog.FAILURE_REASON_APP_NOT_RESPONDING) { - final int level = Flags.recoverabilityDetection() ? getRescueLevel(mitigationCount, - mayPerformReboot(failedPackage), failedPackage) - : getRescueLevel(mitigationCount, - mayPerformReboot(failedPackage)); + final int level; + if (Flags.recoverabilityDetection()) { + if (!Flags.deprecateFlagsAndSettingsResets()) { + level = getRescueLevel(mitigationCount, mayPerformReboot(failedPackage), + failedPackage); + } else { + level = getRescueLevel(mitigationCount); + } + } else { + level = getRescueLevel(mitigationCount, mayPerformReboot(failedPackage)); + } executeRescueLevel(mContext, failedPackage == null ? null : failedPackage.getPackageName(), level); return true; @@ -892,8 +884,12 @@ public class RescueParty { return PackageHealthObserverImpact.USER_IMPACT_LEVEL_0; } if (Flags.recoverabilityDetection()) { - return mapRescueLevelToUserImpact(getRescueLevel(mitigationCount, - true, /*failedPackage=*/ null)); + if (!Flags.deprecateFlagsAndSettingsResets()) { + return mapRescueLevelToUserImpact(getRescueLevel(mitigationCount, + true, /*failedPackage=*/ null)); + } else { + return mapRescueLevelToUserImpact(getRescueLevel(mitigationCount)); + } } else { return mapRescueLevelToUserImpact(getRescueLevel(mitigationCount, true)); } @@ -905,9 +901,17 @@ public class RescueParty { return false; } boolean mayPerformReboot = !shouldThrottleReboot(); - final int level = Flags.recoverabilityDetection() ? getRescueLevel(mitigationCount, - mayPerformReboot, /*failedPackage=*/ null) - : getRescueLevel(mitigationCount, mayPerformReboot); + final int level; + if (Flags.recoverabilityDetection()) { + if (!Flags.deprecateFlagsAndSettingsResets()) { + level = getRescueLevel(mitigationCount, mayPerformReboot, + /*failedPackage=*/ null); + } else { + level = getRescueLevel(mitigationCount); + } + } else { + level = getRescueLevel(mitigationCount, mayPerformReboot); + } executeRescueLevel(mContext, /*failedPackage=*/ null, level); return true; } @@ -933,18 +937,6 @@ public class RescueParty { return isPersistentSystemApp(failingPackage.getPackageName()); } - /** - * Returns {@code true} if Rescue Party is allowed to attempt a reboot or factory reset. - * Will return {@code false} if a factory reset was already offered recently. - */ - private boolean shouldThrottleReboot() { - Long lastResetTime = getLastFactoryResetTimeMs(); - long now = System.currentTimeMillis(); - long throttleDurationMin = SystemProperties.getLong(PROP_THROTTLE_DURATION_MIN_FLAG, - DEFAULT_FACTORY_RESET_THROTTLE_DURATION_MIN); - return now < lastResetTime + TimeUnit.MINUTES.toMillis(throttleDurationMin); - } - private boolean isPersistentSystemApp(@NonNull String packageName) { PackageManager pm = mContext.getPackageManager(); try { @@ -957,20 +949,22 @@ public class RescueParty { private synchronized void recordDeviceConfigAccess(@NonNull String callingPackage, @NonNull String namespace) { - // Record it in calling packages to namespace map - Set<String> namespaceSet = mCallingPackageNamespaceSetMap.get(callingPackage); - if (namespaceSet == null) { - namespaceSet = new ArraySet<>(); - mCallingPackageNamespaceSetMap.put(callingPackage, namespaceSet); - } - namespaceSet.add(namespace); - // Record it in namespace to calling packages map - Set<String> callingPackageSet = mNamespaceCallingPackageSetMap.get(namespace); - if (callingPackageSet == null) { - callingPackageSet = new ArraySet<>(); + if (!Flags.deprecateFlagsAndSettingsResets()) { + // Record it in calling packages to namespace map + Set<String> namespaceSet = mCallingPackageNamespaceSetMap.get(callingPackage); + if (namespaceSet == null) { + namespaceSet = new ArraySet<>(); + mCallingPackageNamespaceSetMap.put(callingPackage, namespaceSet); + } + namespaceSet.add(namespace); + // Record it in namespace to calling packages map + Set<String> callingPackageSet = mNamespaceCallingPackageSetMap.get(namespace); + if (callingPackageSet == null) { + callingPackageSet = new ArraySet<>(); + } + callingPackageSet.add(callingPackage); + mNamespaceCallingPackageSetMap.put(namespace, callingPackageSet); } - callingPackageSet.add(callingPackage); - mNamespaceCallingPackageSetMap.put(namespace, callingPackageSet); } private synchronized Set<String> getAffectedNamespaceSet(String failedPackage) { @@ -986,6 +980,18 @@ public class RescueParty { } } + /** + * Returns {@code true} if Rescue Party is allowed to attempt a reboot or factory reset. + * Will return {@code false} if a factory reset was already offered recently. + */ + private static boolean shouldThrottleReboot() { + Long lastResetTime = getLastFactoryResetTimeMs(); + long now = System.currentTimeMillis(); + long throttleDurationMin = SystemProperties.getLong(PROP_THROTTLE_DURATION_MIN_FLAG, + DEFAULT_FACTORY_RESET_THROTTLE_DURATION_MIN); + return now < lastResetTime + TimeUnit.MINUTES.toMillis(throttleDurationMin); + } + private static int[] getAllUserIds() { int systemUserId = UserHandle.SYSTEM.getIdentifier(); int[] userIds = { systemUserId }; @@ -1024,6 +1030,22 @@ public class RescueParty { } } + private static class Level { + static int none() { + return Flags.recoverabilityDetection() ? RESCUE_LEVEL_NONE : LEVEL_NONE; + } + + static int reboot() { + return Flags.recoverabilityDetection() ? RESCUE_LEVEL_WARM_REBOOT : LEVEL_WARM_REBOOT; + } + + static int factoryReset() { + return Flags.recoverabilityDetection() + ? RESCUE_LEVEL_FACTORY_RESET + : LEVEL_FACTORY_RESET; + } + } + private static String levelToString(int level) { if (Flags.recoverabilityDetection()) { switch (level) { diff --git a/services/core/java/com/android/server/SystemConfig.java b/services/core/java/com/android/server/SystemConfig.java index e2ab0d9f2683..d80e40c5898a 100644 --- a/services/core/java/com/android/server/SystemConfig.java +++ b/services/core/java/com/android/server/SystemConfig.java @@ -371,6 +371,10 @@ public class SystemConfig { // 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 @@ public class SystemConfig { 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. @@ -1628,6 +1636,26 @@ public class SystemConfig { } } } 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 a3b6d806c6ce..dd4239cdd37e 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 89327b50883c..000000000000 --- 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/Watchdog.java b/services/core/java/com/android/server/Watchdog.java index 72a55dbea481..918f13096cdc 100644 --- a/services/core/java/com/android/server/Watchdog.java +++ b/services/core/java/com/android/server/Watchdog.java @@ -1011,6 +1011,7 @@ public class Watchdog implements Dumpable { // Trigger the kernel to dump all blocked threads, and backtraces on all CPUs to the // kernel log doSysRq('w'); + doSysRq('m'); doSysRq('l'); } diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index d41de38ce2a8..995c17635a0a 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -371,7 +371,6 @@ import android.os.storage.StorageManager; 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; @@ -450,7 +449,6 @@ import com.android.server.SystemConfig; 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; @@ -2350,20 +2348,6 @@ public class ActivityManagerService extends IActivityManager.Stub } } - 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. @@ -5291,12 +5275,6 @@ public class ActivityManagerService extends IActivityManager.Stub // 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"); @@ -5320,7 +5298,6 @@ public class ActivityManagerService extends IActivityManager.Stub }, mConstants.FULL_PSS_MIN_INTERVAL); } }); - maybeLogUserspaceRebootEvent(); mUserController.scheduleStartProfiles(); } // UART is on if init's console service is running, send a warning notification. @@ -12531,7 +12508,7 @@ public class ActivityManagerService extends IActivityManager.Stub opts.dumpProto = true; } else if ("--logstats".equals(opt)) { opts.mDumpAllocatorStats = true; - } else if ("-h".equals(opt)) { + } else if ("-h".equals(opt) || "--help".equals(opt)) { pw.println("meminfo dump options: [-a] [-d] [-c] [-s] [--oom] [process]"); pw.println(" -a: include all available information for each process."); pw.println(" -d: include dalvik details."); @@ -12541,10 +12518,13 @@ public class ActivityManagerService extends IActivityManager.Stub pw.println(" -p: dump also private dirty memory usage."); pw.println(" --oom: only show processes organized by oom adj."); pw.println(" --local: only collect details locally, don't call process."); + pw.println(" --logstats: dump native allocator stats to log"); pw.println(" --package: interpret process arg as package, dumping all"); pw.println(" processes that have loaded that package."); pw.println(" --checkin: dump data for a checkin"); pw.println(" --proto: dump data to proto"); + pw.println(" --logstats: log native allocator statistics."); + pw.println(" --unreachable: dump unreachable native memory with libmemunreachable."); pw.println("If [process] is specified it can be the name or "); pw.println("pid of a specific process to dump."); return; @@ -16307,6 +16287,7 @@ public class ActivityManagerService extends IActivityManager.Stub String[] excludedPackages, int appOp, Bundle bOptions, boolean serialized, boolean sticky, int userId) { enforceNotIsolatedCaller("broadcastIntent"); + synchronized(this) { intent = verifyBroadcastLocked(intent); @@ -16320,6 +16301,12 @@ public class ActivityManagerService extends IActivityManager.Stub // Permission regimes around sender-supplied broadcast options. enforceBroadcastOptionPermissionsInternal(bOptions, callingUid); + final ComponentName cn = intent.getComponent(); + + Trace.traceBegin( + Trace.TRACE_TAG_ACTIVITY_MANAGER, + "broadcastIntent:" + (cn != null ? cn.toString() : intent.getAction())); + final long origId = Binder.clearCallingIdentity(); try { return broadcastIntentLocked(callerApp, @@ -16330,6 +16317,7 @@ public class ActivityManagerService extends IActivityManager.Stub callingPid, userId, BackgroundStartPrivileges.NONE, null, null); } finally { Binder.restoreCallingIdentity(origId); + Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER); } } } diff --git a/services/core/java/com/android/server/am/AppExitInfoTracker.java b/services/core/java/com/android/server/am/AppExitInfoTracker.java index 666e5600a8b6..1f88657e5dbc 100644 --- a/services/core/java/com/android/server/am/AppExitInfoTracker.java +++ b/services/core/java/com/android/server/am/AppExitInfoTracker.java @@ -88,6 +88,7 @@ import java.util.concurrent.atomic.AtomicBoolean; import java.util.function.BiConsumer; import java.util.function.BiFunction; import java.util.function.Consumer; +import java.util.function.Function; import java.util.function.Predicate; import java.util.function.Supplier; import java.util.zip.GZIPOutputStream; @@ -104,9 +105,9 @@ public final class AppExitInfoTracker { private static final long APP_EXIT_INFO_PERSIST_INTERVAL = TimeUnit.MINUTES.toMillis(30); /** These are actions that the forEach* should take after each iteration */ - private static final int FOREACH_ACTION_NONE = 0; - private static final int FOREACH_ACTION_REMOVE_ITEM = 1; - private static final int FOREACH_ACTION_STOP_ITERATION = 2; + @VisibleForTesting static final int FOREACH_ACTION_NONE = 0; + @VisibleForTesting static final int FOREACH_ACTION_REMOVE_ITEM = 1; + @VisibleForTesting static final int FOREACH_ACTION_STOP_ITERATION = 2; private static final int APP_EXIT_RAW_INFO_POOL_SIZE = 8; @@ -125,7 +126,7 @@ public final class AppExitInfoTracker { private static final String APP_TRACE_FILE_SUFFIX = ".gz"; - private final Object mLock = new Object(); + @VisibleForTesting final Object mLock = new Object(); /** * Initialized in {@link #init} and read-only after that. @@ -352,8 +353,8 @@ public final class AppExitInfoTracker { } /** Called when there is a low memory kill */ - void scheduleNoteLmkdProcKilled(final int pid, final int uid) { - mKillHandler.obtainMessage(KillHandler.MSG_LMKD_PROC_KILLED, pid, uid) + void scheduleNoteLmkdProcKilled(final int pid, final int uid, final int rssKb) { + mKillHandler.obtainMessage(KillHandler.MSG_LMKD_PROC_KILLED, pid, uid, Long.valueOf(rssKb)) .sendToTarget(); } @@ -400,9 +401,9 @@ public final class AppExitInfoTracker { if (lmkd != null) { updateExistingExitInfoRecordLocked(info, null, - ApplicationExitInfo.REASON_LOW_MEMORY); + ApplicationExitInfo.REASON_LOW_MEMORY, (Long) lmkd.second); } else if (zygote != null) { - updateExistingExitInfoRecordLocked(info, (Integer) zygote.second, null); + updateExistingExitInfoRecordLocked(info, (Integer) zygote.second, null, null); } else { scheduleLogToStatsdLocked(info, false); } @@ -410,6 +411,23 @@ public final class AppExitInfoTracker { } /** + * Certain types of crashes should not be updated. This could end up deleting valuable + * information, for example, if a test application crashes and then the `am instrument` + * finishes, then the crash whould be replaced with a `reason == USER_REQUESTED` + * ApplicationExitInfo from ActivityManager, and the original crash would be lost. + */ + private boolean preventExitInfoUpdate(final ApplicationExitInfo exitInfo) { + switch (exitInfo.getReason()) { + case ApplicationExitInfo.REASON_ANR: + case ApplicationExitInfo.REASON_CRASH: + case ApplicationExitInfo.REASON_CRASH_NATIVE: + return true; + default: + return false; + } + } + + /** * Make note when ActivityManagerService decides to kill an application process. */ @VisibleForTesting @@ -418,10 +436,10 @@ public final class AppExitInfoTracker { ApplicationExitInfo info = getExitInfoLocked( raw.getPackageName(), raw.getPackageUid(), raw.getPid()); - if (info == null) { + if (info == null || preventExitInfoUpdate(info)) { info = addExitInfoLocked(raw); } else { - // always override the existing info since we are now more informational. + // Override the existing info since we have more information. info.setReason(raw.getReason()); info.setSubReason(raw.getSubReason()); info.setStatus(0); @@ -431,24 +449,8 @@ public final class AppExitInfoTracker { scheduleLogToStatsdLocked(info, true); } - /** - * Make note when ActivityManagerService gets a recoverable native crash, as the process isn't - * being killed but the crash should still be added to AppExitInfo. Also, because we're not - * crashing, don't log out to statsd. - */ - @VisibleForTesting - @GuardedBy("mLock") - void handleNoteAppRecoverableCrashLocked(final ApplicationExitInfo raw) { - addExitInfoLocked(raw, /* recoverable */ true); - } - @GuardedBy("mLock") private ApplicationExitInfo addExitInfoLocked(ApplicationExitInfo raw) { - return addExitInfoLocked(raw, /* recoverable */ false); - } - - @GuardedBy("mLock") - private ApplicationExitInfo addExitInfoLocked(ApplicationExitInfo raw, boolean recoverable) { if (!mAppExitInfoLoaded.get()) { Slog.w(TAG, "Skipping saving the exit info due to ongoing loading from storage"); return null; @@ -464,13 +466,13 @@ public final class AppExitInfoTracker { } } for (int i = 0; i < packages.length; i++) { - addExitInfoInnerLocked(packages[i], uid, info, recoverable); + addExitInfoInnerLocked(packages[i], uid, info); } // SDK sandbox exits are stored under both real and package UID if (Process.isSdkSandboxUid(uid)) { for (int i = 0; i < packages.length; i++) { - addExitInfoInnerLocked(packages[i], raw.getPackageUid(), info, recoverable); + addExitInfoInnerLocked(packages[i], raw.getPackageUid(), info); } } @@ -484,7 +486,7 @@ public final class AppExitInfoTracker { */ @GuardedBy("mLock") private void updateExistingExitInfoRecordLocked(ApplicationExitInfo info, - Integer status, Integer reason) { + Integer status, Integer reason, Long rssKb) { if (info == null || !isFresh(info.getTimestamp())) { // if the record is way outdated, don't update it then (because of potential pid reuse) return; @@ -511,6 +513,9 @@ public final class AppExitInfoTracker { immediateLog = true; } } + if (rssKb != null) { + info.setRss(rssKb.longValue()); + } scheduleLogToStatsdLocked(info, immediateLog); } @@ -521,77 +526,82 @@ public final class AppExitInfoTracker { */ @GuardedBy("mLock") private boolean updateExitInfoIfNecessaryLocked( - int pid, int uid, Integer status, Integer reason) { + int pid, int uid, Integer status, Integer reason, Long rssKb) { Integer k = mIsolatedUidRecords.getUidByIsolatedUid(uid); if (k != null) { uid = k; } - ArrayList<ApplicationExitInfo> tlist = mTmpInfoList; - tlist.clear(); final int targetUid = uid; + // Launder the modification bit through a `final` array, as Java doesn't allow you to mutate + // a captured boolean inside of a lambda. + final boolean[] isModified = {false}; forEachPackageLocked((packageName, records) -> { AppExitInfoContainer container = records.get(targetUid); if (container == null) { return FOREACH_ACTION_NONE; } - tlist.clear(); - container.getExitInfoLocked(pid, 1, tlist); - if (tlist.size() == 0) { + mTmpInfoList.clear(); + container.getExitInfosLocked(pid, /* maxNum */ 0, mTmpInfoList); + if (mTmpInfoList.size() == 0) { return FOREACH_ACTION_NONE; } - ApplicationExitInfo info = tlist.get(0); - if (info.getRealUid() != targetUid) { - tlist.clear(); - return FOREACH_ACTION_NONE; - } - // Okay found it, update its reason. - updateExistingExitInfoRecordLocked(info, status, reason); - return FOREACH_ACTION_STOP_ITERATION; + for (int i = 0, size = mTmpInfoList.size(); i < size; i++) { + ApplicationExitInfo info = mTmpInfoList.get(i); + if (info.getRealUid() != targetUid) { + continue; + } + // We only update the most recent `ApplicationExitInfo` for this pid, which will + // always be the first one we se as `getExitInfosLocked()` returns them sorted + // by most-recent-first. + isModified[0] = true; + updateExistingExitInfoRecordLocked(info, status, reason, rssKb); + return FOREACH_ACTION_STOP_ITERATION; + } + return FOREACH_ACTION_NONE; }); - return tlist.size() > 0; + mTmpInfoList.clear(); + return isModified[0]; } /** * Get the exit info with matching package name, filterUid and filterPid (if > 0) */ @VisibleForTesting - void getExitInfo(final String packageName, final int filterUid, - final int filterPid, final int maxNum, final ArrayList<ApplicationExitInfo> results) { + void getExitInfo(final String packageName, final int filterUid, final int filterPid, + final int maxNum, final List<ApplicationExitInfo> results) { final long identity = Binder.clearCallingIdentity(); try { synchronized (mLock) { - boolean emptyPackageName = TextUtils.isEmpty(packageName); - if (!emptyPackageName) { - // fast path + if (!TextUtils.isEmpty(packageName)) { + // Fast path - just a single package. AppExitInfoContainer container = mData.get(packageName, filterUid); if (container != null) { - container.getExitInfoLocked(filterPid, maxNum, results); + container.getExitInfosLocked(filterPid, maxNum, results); } - } else { - // slow path - final ArrayList<ApplicationExitInfo> list = mTmpInfoList2; - list.clear(); - // get all packages - forEachPackageLocked((name, records) -> { - AppExitInfoContainer container = records.get(filterUid); - if (container != null) { - mTmpInfoList.clear(); - list.addAll(container.toListLocked(mTmpInfoList, filterPid)); - } - return AppExitInfoTracker.FOREACH_ACTION_NONE; - }); - - Collections.sort(list, - (a, b) -> Long.compare(b.getTimestamp(), a.getTimestamp())); - int size = list.size(); - if (maxNum > 0) { - size = Math.min(size, maxNum); - } - for (int i = 0; i < size; i++) { - results.add(list.get(i)); + return; + } + + // Slow path - get all the packages. + forEachPackageLocked((name, records) -> { + AppExitInfoContainer container = records.get(filterUid); + if (container != null) { + container.getExitInfosLocked(filterPid, /* maxNum */ 0, results); } - list.clear(); + return AppExitInfoTracker.FOREACH_ACTION_NONE; + }); + + // And while the results for each package are sorted, we should + // sort over and trim the quantity of global results as well. + Collections.sort( + results, (a, b) -> Long.compare(b.getTimestamp(), a.getTimestamp())); + if (maxNum <= 0) { + return; + } + + int elementsToRemove = results.size() - maxNum; + for (int i = 0; i < elementsToRemove; i++) { + results.removeLast(); } } } finally { @@ -606,12 +616,10 @@ public final class AppExitInfoTracker { @GuardedBy("mLock") private ApplicationExitInfo getExitInfoLocked(final String packageName, final int filterUid, final int filterPid) { - ArrayList<ApplicationExitInfo> list = mTmpInfoList; - list.clear(); - getExitInfo(packageName, filterUid, filterPid, 1, list); - - ApplicationExitInfo info = list.size() > 0 ? list.get(0) : null; - list.clear(); + mTmpInfoList.clear(); + getExitInfo(packageName, filterUid, filterPid, 1, mTmpInfoList); + ApplicationExitInfo info = mTmpInfoList.size() > 0 ? mTmpInfoList.getFirst() : null; + mTmpInfoList.clear(); return info; } @@ -878,8 +886,7 @@ public final class AppExitInfoTracker { } @GuardedBy("mLock") - private void addExitInfoInnerLocked(String packageName, int uid, ApplicationExitInfo info, - boolean recoverable) { + private void addExitInfoInnerLocked(String packageName, int uid, ApplicationExitInfo info) { AppExitInfoContainer container = mData.get(packageName, uid); if (container == null) { container = new AppExitInfoContainer(mAppExitInfoHistoryListSize); @@ -893,11 +900,7 @@ public final class AppExitInfoTracker { } mData.put(packageName, uid, container); } - if (recoverable) { - container.addRecoverableCrashLocked(info); - } else { - container.addExitInfoLocked(info); - } + container.addExitInfoLocked(info); } @GuardedBy("mLock") @@ -1205,7 +1208,7 @@ public final class AppExitInfoTracker { forEachPackageLocked((name, records) -> { for (int i = records.size() - 1; i >= 0; i--) { final AppExitInfoContainer container = records.valueAt(i); - container.forEachRecordLocked((pid, info) -> { + container.forEachRecordLocked((info) -> { final File traceFile = info.getTraceFile(); if (traceFile != null) { allFiles.remove(traceFile.getName()); @@ -1322,90 +1325,72 @@ public final class AppExitInfoTracker { * A container class of {@link android.app.ApplicationExitInfo} */ final class AppExitInfoContainer { - private SparseArray<ApplicationExitInfo> mInfos; // index is a pid - private SparseArray<ApplicationExitInfo> mRecoverableCrashes; // index is a pid + private ArrayList<ApplicationExitInfo> mExitInfos; private int mMaxCapacity; private int mUid; // Application uid, not isolated uid. AppExitInfoContainer(final int maxCapacity) { - mInfos = new SparseArray<ApplicationExitInfo>(); - mRecoverableCrashes = new SparseArray<ApplicationExitInfo>(); + mExitInfos = new ArrayList<ApplicationExitInfo>(); mMaxCapacity = maxCapacity; } + @VisibleForTesting @GuardedBy("mLock") - void getInfosLocked(SparseArray<ApplicationExitInfo> map, final int filterPid, - final int maxNum, ArrayList<ApplicationExitInfo> results) { - if (filterPid > 0) { - ApplicationExitInfo r = map.get(filterPid); - if (r != null) { - results.add(r); + void getExitInfosLocked( + final int filterPid, final int maxNum, List<ApplicationExitInfo> results) { + if (mExitInfos.size() == 0) { + return; + } + + // Most of the callers might only be interested with the most recent + // ApplicationExitInfo, and so we can special case an O(n) walk. + if (maxNum == 1) { + ApplicationExitInfo result = null; + for (int i = 0, size = mExitInfos.size(); i < size; i++) { + ApplicationExitInfo info = mExitInfos.get(i); + if (filterPid > 0 && info.getPid() != filterPid) { + continue; + } + + if (result == null || result.getTimestamp() < info.getTimestamp()) { + result = info; + } + } + if (result != null) { + results.add(result); } + return; + } + + mTmpInfoList2.clear(); + if (filterPid <= 0) { + mTmpInfoList2.addAll(mExitInfos); } else { - final int numRep = map.size(); - if (maxNum <= 0 || numRep <= maxNum) { - // Return all records. - for (int i = 0; i < numRep; i++) { - results.add(map.valueAt(i)); - } - Collections.sort(results, - (a, b) -> Long.compare(b.getTimestamp(), a.getTimestamp())); - } else { - if (maxNum == 1) { - // Most of the caller might be only interested with the most recent one - ApplicationExitInfo r = map.valueAt(0); - for (int i = 1; i < numRep; i++) { - ApplicationExitInfo t = map.valueAt(i); - if (r.getTimestamp() < t.getTimestamp()) { - r = t; - } - } - results.add(r); - } else { - // Huh, need to sort it out then. - ArrayList<ApplicationExitInfo> list = mTmpInfoList2; - list.clear(); - for (int i = 0; i < numRep; i++) { - list.add(map.valueAt(i)); - } - Collections.sort(list, - (a, b) -> Long.compare(b.getTimestamp(), a.getTimestamp())); - for (int i = 0; i < maxNum; i++) { - results.add(list.get(i)); - } - list.clear(); + for (int i = 0, size = mExitInfos.size(); i < size; i++) { + ApplicationExitInfo info = mExitInfos.get(i); + if (info.getPid() == filterPid) { + mTmpInfoList2.add(info); } } } - } - @GuardedBy("mLock") - void getExitInfoLocked(final int filterPid, final int maxNum, - ArrayList<ApplicationExitInfo> results) { - getInfosLocked(mInfos, filterPid, maxNum, results); + Collections.sort( + mTmpInfoList2, (a, b) -> Long.compare(b.getTimestamp(), a.getTimestamp())); + if (maxNum <= 0) { + results.addAll(mTmpInfoList2); + return; + } + + int elementsToRemove = mTmpInfoList2.size() - maxNum; + for (int i = 0; i < elementsToRemove; i++) { + mTmpInfoList2.removeLast(); + } + results.addAll(mTmpInfoList2); } + @VisibleForTesting @GuardedBy("mLock") - void addInfoLocked(SparseArray<ApplicationExitInfo> map, ApplicationExitInfo info) { - int size; - if ((size = map.size()) >= mMaxCapacity) { - int oldestIndex = -1; - long oldestTimeStamp = Long.MAX_VALUE; - for (int i = 0; i < size; i++) { - ApplicationExitInfo r = map.valueAt(i); - if (r.getTimestamp() < oldestTimeStamp) { - oldestTimeStamp = r.getTimestamp(); - oldestIndex = i; - } - } - if (oldestIndex >= 0) { - final File traceFile = map.valueAt(oldestIndex).getTraceFile(); - if (traceFile != null) { - traceFile.delete(); - } - map.removeAt(oldestIndex); - } - } + void addExitInfoLocked(ApplicationExitInfo info) { // Claim the state information if there is any int uid = info.getPackageUid(); // SDK sandbox app states and app traces are stored under real UID @@ -1420,24 +1405,39 @@ public final class AppExitInfoTracker { if (info.getTraceFile() == null) { info.setTraceFile(findAndRemoveFromSparse2dArray(mActiveAppTraces, uid, pid)); } - info.setAppTraceRetriever(mAppTraceRetriever); - map.append(pid, info); - } - @GuardedBy("mLock") - void addExitInfoLocked(ApplicationExitInfo info) { - addInfoLocked(mInfos, info); + mExitInfos.add(info); + if (mExitInfos.size() <= mMaxCapacity) { + return; + } + + ApplicationExitInfo oldest = null; + for (int i = 0, size = mExitInfos.size(); i < size; i++) { + ApplicationExitInfo info2 = mExitInfos.get(i); + if (oldest == null || info2.getTimestamp() < oldest.getTimestamp()) { + oldest = info2; + } + } + File traceFile = oldest.getTraceFile(); + if (traceFile != null) { + traceFile.delete(); + } + mExitInfos.remove(oldest); } @GuardedBy("mLock") - void addRecoverableCrashLocked(ApplicationExitInfo info) { - addInfoLocked(mRecoverableCrashes, info); + ApplicationExitInfo getLastExitInfoForPid(final int pid) { + mTmpInfoList.clear(); + getExitInfosLocked(pid, /* maxNum */ 1, mTmpInfoList); + ApplicationExitInfo info = mTmpInfoList.size() == 0 ? null : mTmpInfoList.getFirst(); + mTmpInfoList.clear(); + return info; } @GuardedBy("mLock") boolean appendTraceIfNecessaryLocked(final int pid, final File traceFile) { - final ApplicationExitInfo r = mInfos.get(pid); + final ApplicationExitInfo r = getLastExitInfoForPid(pid); if (r != null) { r.setTraceFile(traceFile); r.setAppTraceRetriever(mAppTraceRetriever); @@ -1447,49 +1447,36 @@ public final class AppExitInfoTracker { } @GuardedBy("mLock") - void destroyLocked(SparseArray<ApplicationExitInfo> map) { - for (int i = map.size() - 1; i >= 0; i--) { - ApplicationExitInfo ai = map.valueAt(i); - final File traceFile = ai.getTraceFile(); + void destroyLocked() { + for (int i = 0, size = mExitInfos.size(); i < size; i++) { + ApplicationExitInfo info = mExitInfos.get(i); + final File traceFile = info.getTraceFile(); if (traceFile != null) { traceFile.delete(); } - ai.setTraceFile(null); - ai.setAppTraceRetriever(null); + info.setTraceFile(null); + info.setAppTraceRetriever(null); } } + /** + * Go through each record in an *unspecified* order, execute `callback()` on each element, + * and potentially do some action (stopping iteration, removing the element, etc.) based on + * the return value of the callback. + */ @GuardedBy("mLock") - void destroyLocked() { - destroyLocked(mInfos); - destroyLocked(mRecoverableCrashes); - } - - @GuardedBy("mLock") - void forEachRecordLocked(final BiFunction<Integer, ApplicationExitInfo, Integer> callback) { + void forEachRecordLocked(final Function<ApplicationExitInfo, Integer> callback) { if (callback == null) return; - for (int i = mInfos.size() - 1; i >= 0; i--) { - switch (callback.apply(mInfos.keyAt(i), mInfos.valueAt(i))) { - case FOREACH_ACTION_STOP_ITERATION: return; - case FOREACH_ACTION_REMOVE_ITEM: - final File traceFile = mInfos.valueAt(i).getTraceFile(); - if (traceFile != null) { - traceFile.delete(); - } - mInfos.removeAt(i); - break; - } - } - for (int i = mRecoverableCrashes.size() - 1; i >= 0; i--) { - switch (callback.apply( - mRecoverableCrashes.keyAt(i), mRecoverableCrashes.valueAt(i))) { + for (int i = mExitInfos.size() - 1; i >= 0; i--) { + ApplicationExitInfo info = mExitInfos.get(i); + switch (callback.apply(info)) { case FOREACH_ACTION_STOP_ITERATION: return; case FOREACH_ACTION_REMOVE_ITEM: - final File traceFile = mRecoverableCrashes.valueAt(i).getTraceFile(); - if (traceFile != null) { + File traceFile; + if ((traceFile = info.getTraceFile()) != null) { traceFile.delete(); } - mRecoverableCrashes.removeAt(i); + mExitInfos.remove(info); break; } } @@ -1497,30 +1484,20 @@ public final class AppExitInfoTracker { @GuardedBy("mLock") void dumpLocked(PrintWriter pw, String prefix, SimpleDateFormat sdf) { - ArrayList<ApplicationExitInfo> list = new ArrayList<ApplicationExitInfo>(); - for (int i = mInfos.size() - 1; i >= 0; i--) { - list.add(mInfos.valueAt(i)); - } - for (int i = mRecoverableCrashes.size() - 1; i >= 0; i--) { - list.add(mRecoverableCrashes.valueAt(i)); - } - Collections.sort(list, (a, b) -> Long.compare(b.getTimestamp(), a.getTimestamp())); - int size = list.size(); - for (int i = 0; i < size; i++) { - list.get(i).dump(pw, prefix + " ", "#" + i, sdf); + mTmpInfoList.clear(); + getExitInfosLocked(/* filterPid */ 0, /* maxNum */ 0, mTmpInfoList); + for (int i = 0, size = mTmpInfoList.size(); i < size; i++) { + mTmpInfoList.get(i).dump(pw, prefix + " ", "#" + i, sdf); } + mTmpInfoList.clear(); } @GuardedBy("mLock") void writeToProto(ProtoOutputStream proto, long fieldId) { long token = proto.start(fieldId); proto.write(AppsExitInfoProto.Package.User.UID, mUid); - for (int i = 0; i < mInfos.size(); i++) { - mInfos.valueAt(i).writeToProto(proto, AppsExitInfoProto.Package.User.APP_EXIT_INFO); - } - for (int i = 0; i < mRecoverableCrashes.size(); i++) { - mRecoverableCrashes.valueAt(i).writeToProto( - proto, AppsExitInfoProto.Package.User.APP_RECOVERABLE_CRASH); + for (int i = 0, size = mExitInfos.size(); i < size; i++) { + mExitInfos.get(i).writeToProto(proto, AppsExitInfoProto.Package.User.APP_EXIT_INFO); } proto.end(token); } @@ -1539,14 +1516,7 @@ public final class AppExitInfoTracker { case (int) AppsExitInfoProto.Package.User.APP_EXIT_INFO: { ApplicationExitInfo info = new ApplicationExitInfo(); info.readFromProto(proto, AppsExitInfoProto.Package.User.APP_EXIT_INFO); - mInfos.put(info.getPid(), info); - break; - } - case (int) AppsExitInfoProto.Package.User.APP_RECOVERABLE_CRASH: { - ApplicationExitInfo info = new ApplicationExitInfo(); - info.readFromProto( - proto, AppsExitInfoProto.Package.User.APP_RECOVERABLE_CRASH); - mRecoverableCrashes.put(info.getPid(), info); + mExitInfos.add(info); break; } } @@ -1554,24 +1524,6 @@ public final class AppExitInfoTracker { proto.end(token); return mUid; } - - @GuardedBy("mLock") - List<ApplicationExitInfo> toListLocked(List<ApplicationExitInfo> list, int filterPid) { - if (list == null) { - list = new ArrayList<ApplicationExitInfo>(); - } - for (int i = mInfos.size() - 1; i >= 0; i--) { - if (filterPid == 0 || filterPid == mInfos.keyAt(i)) { - list.add(mInfos.valueAt(i)); - } - } - for (int i = mRecoverableCrashes.size() - 1; i >= 0; i--) { - if (filterPid == 0 || filterPid == mRecoverableCrashes.keyAt(i)) { - list.add(mRecoverableCrashes.valueAt(i)); - } - } - return list; - } } /** @@ -1719,11 +1671,11 @@ public final class AppExitInfoTracker { switch (msg.what) { case MSG_LMKD_PROC_KILLED: mAppExitInfoSourceLmkd.onProcDied(msg.arg1 /* pid */, msg.arg2 /* uid */, - null /* status */); + null /* status */, (Long) msg.obj /* rss_kb */); break; case MSG_CHILD_PROC_DIED: mAppExitInfoSourceZygote.onProcDied(msg.arg1 /* pid */, msg.arg2 /* uid */, - (Integer) msg.obj /* status */); + (Integer) msg.obj /* status */, null /* rss_kb */); break; case MSG_PROC_DIED: { ApplicationExitInfo raw = (ApplicationExitInfo) msg.obj; @@ -1750,7 +1702,11 @@ public final class AppExitInfoTracker { case MSG_APP_RECOVERABLE_CRASH: { ApplicationExitInfo raw = (ApplicationExitInfo) msg.obj; synchronized (mLock) { - handleNoteAppRecoverableCrashLocked(raw); + // Unlike MSG_APP_KILL, this is a recoverable crash, and + // so we want to bypass the statsd app-kill logging. + // Hence, call `addExitInfoLocked()` directly instead of + // `handleNoteAppKillLocked()`. + addExitInfoLocked(raw); } recycleRawRecord(raw); } @@ -1880,7 +1836,7 @@ public final class AppExitInfoTracker { } } - void onProcDied(final int pid, final int uid, final Integer status) { + void onProcDied(final int pid, final int uid, final Integer status, final Long rssKb) { if (DEBUG_PROCESSES) { Slog.i(TAG, mTag + ": proc died: pid=" + pid + " uid=" + uid + ", status=" + status); @@ -1893,8 +1849,12 @@ public final class AppExitInfoTracker { // Unlikely but possible: the record has been created // Let's update it if we could find a ApplicationExitInfo record synchronized (mLock) { - if (!updateExitInfoIfNecessaryLocked(pid, uid, status, mPresetReason)) { - addLocked(pid, uid, status); + if (!updateExitInfoIfNecessaryLocked(pid, uid, status, mPresetReason, rssKb)) { + if (rssKb != null) { + addLocked(pid, uid, rssKb); // lmkd + } else { + addLocked(pid, uid, status); // zygote + } } // Notify any interesed party regarding the lmkd kills diff --git a/services/core/java/com/android/server/am/AppRestrictionController.java b/services/core/java/com/android/server/am/AppRestrictionController.java index 4a31fd1f46e4..4c87e1ce357c 100644 --- a/services/core/java/com/android/server/am/AppRestrictionController.java +++ b/services/core/java/com/android/server/am/AppRestrictionController.java @@ -308,7 +308,7 @@ public final class AppRestrictionController { /** * 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<>(); /** @@ -1603,7 +1603,7 @@ public final class AppRestrictionController { if (moduleInfos == null) { return; } - synchronized (mLock) { + synchronized (mSystemModulesCache) { for (ModuleInfo info : moduleInfos) { mSystemModulesCache.put(info.getPackageName(), Boolean.TRUE); } @@ -1611,7 +1611,7 @@ public final class AppRestrictionController { } private boolean isSystemModule(String packageName) { - synchronized (mLock) { + synchronized (mSystemModulesCache) { final Boolean val = mSystemModulesCache.get(packageName); if (val != null) { return val.booleanValue(); @@ -1639,7 +1639,7 @@ public final class AppRestrictionController { } } // Update the cache. - synchronized (mLock) { + synchronized (mSystemModulesCache) { mSystemModulesCache.put(packageName, isSystemModule); } return isSystemModule; diff --git a/services/core/java/com/android/server/am/BroadcastQueueModernImpl.java b/services/core/java/com/android/server/am/BroadcastQueueModernImpl.java index 178171d49388..aeebae43d1ef 100644 --- a/services/core/java/com/android/server/am/BroadcastQueueModernImpl.java +++ b/services/core/java/com/android/server/am/BroadcastQueueModernImpl.java @@ -2482,7 +2482,8 @@ class BroadcastQueueModernImpl extends BroadcastQueue { ipw.println(); if (dumpConstants) { - mConstants.dump(ipw); + mFgConstants.dump(ipw); + mBgConstants.dump(ipw); } if (dumpHistory) { diff --git a/services/core/java/com/android/server/am/LmkdConnection.java b/services/core/java/com/android/server/am/LmkdConnection.java index 598f086db94d..4faadcbe0cca 100644 --- a/services/core/java/com/android/server/am/LmkdConnection.java +++ b/services/core/java/com/android/server/am/LmkdConnection.java @@ -91,10 +91,18 @@ public class LmkdConnection { @GuardedBy("mLmkdSocketLock") private LocalSocket mLmkdSocket = null; - // socket I/O streams - @GuardedBy("mLmkdSocketLock") + // mutex to synchronize socket output stream with socket creation/destruction + private final Object mLmkdOutputStreamLock = new Object(); + + // socket output stream + @GuardedBy("mLmkdOutputStreamLock") private OutputStream mLmkdOutputStream = null; - @GuardedBy("mLmkdSocketLock") + + // mutex to synchronize socket input stream with socket creation/destruction + private final Object mLmkdInputStreamLock = new Object(); + + // socket input stream + @GuardedBy("mLmkdInputStreamLock") private InputStream mLmkdInputStream = null; // buffer to store incoming data @@ -148,9 +156,13 @@ public class LmkdConnection { return false; } // connection established - mLmkdSocket = socket; - mLmkdOutputStream = ostream; - mLmkdInputStream = istream; + synchronized(mLmkdOutputStreamLock) { + synchronized(mLmkdInputStreamLock) { + mLmkdSocket = socket; + mLmkdOutputStream = ostream; + mLmkdInputStream = istream; + } + } mMsgQueue.addOnFileDescriptorEventListener(mLmkdSocket.getFileDescriptor(), EVENT_INPUT | EVENT_ERROR, new MessageQueue.OnFileDescriptorEventListener() { @@ -177,7 +189,13 @@ public class LmkdConnection { mMsgQueue.removeOnFileDescriptorEventListener( mLmkdSocket.getFileDescriptor()); IoUtils.closeQuietly(mLmkdSocket); - mLmkdSocket = null; + synchronized(mLmkdOutputStreamLock) { + synchronized(mLmkdInputStreamLock) { + mLmkdOutputStream = null; + mLmkdInputStream = null; + mLmkdSocket = null; + } + } } // wake up reply waiters if any synchronized (mReplyBufLock) { @@ -262,24 +280,33 @@ public class LmkdConnection { } private boolean write(ByteBuffer buf) { - synchronized (mLmkdSocketLock) { - try { - mLmkdOutputStream.write(buf.array(), 0, buf.position()); - } catch (IOException ex) { - return false; + boolean result = false; + + synchronized(mLmkdOutputStreamLock) { + if (mLmkdOutputStream != null) { + try { + mLmkdOutputStream.write(buf.array(), 0, buf.position()); + result = true; + } catch (IOException ex) { + } } - return true; } + + return result; } private int read(ByteBuffer buf) { - synchronized (mLmkdSocketLock) { - try { - return mLmkdInputStream.read(buf.array(), 0, buf.array().length); - } catch (IOException ex) { + int result = -1; + + synchronized(mLmkdInputStreamLock) { + if (mLmkdInputStream != null) { + try { + result = mLmkdInputStream.read(buf.array(), 0, buf.array().length); + } catch (IOException ex) { + } } - return -1; } + return result; } /** diff --git a/services/core/java/com/android/server/am/OWNERS b/services/core/java/com/android/server/am/OWNERS index b517631f35c0..d6f04db5af55 100644 --- a/services/core/java/com/android/server/am/OWNERS +++ b/services/core/java/com/android/server/am/OWNERS @@ -39,6 +39,7 @@ per-file CarUserSwitchingDialog.java = file:platform/packages/services/Car:/OWNE per-file ContentProviderHelper.java = varunshah@google.com, omakoto@google.com, jsharkey@google.com, yamasani@google.com per-file CachedAppOptimizer.java = file:/PERFORMANCE_OWNERS +per-file Freezer.java = file:/PERFORMANCE_OWNERS # Multiuser per-file User* = file:/MULTIUSER_OWNERS diff --git a/services/core/java/com/android/server/am/ProcessList.java b/services/core/java/com/android/server/am/ProcessList.java index c0947247de4b..728ad5fb1099 100644 --- a/services/core/java/com/android/server/am/ProcessList.java +++ b/services/core/java/com/android/server/am/ProcessList.java @@ -951,12 +951,14 @@ public final class ProcessList { try { switch (inputData.readInt()) { case LMK_PROCKILL: - if (receivedLen != 12) { + if (receivedLen != 16) { return false; } final int pid = inputData.readInt(); final int uid = inputData.readInt(); - mAppExitInfoTracker.scheduleNoteLmkdProcKilled(pid, uid); + final int rssKb = inputData.readInt(); + mAppExitInfoTracker.scheduleNoteLmkdProcKilled(pid, uid, + rssKb); return true; case LMK_KILL_OCCURRED: if (receivedLen @@ -5559,8 +5561,9 @@ public final class ProcessList { void noteAppKill(final ProcessRecord app, final @Reason int reason, final @SubReason int subReason, final String msg) { if (DEBUG_PROCESSES) { - Slog.i(TAG, "note: " + app + " is being killed, reason: " + reason - + ", sub-reason: " + subReason + ", message: " + msg); + Slog.i(TAG, "note: " + app + " is being killed, reason: " + + ApplicationExitInfo.reasonCodeToString(reason) + ", sub-reason: " + + ApplicationExitInfo.subreasonToString(subReason) + ", message: " + msg); } if (app.getPid() > 0 && !app.isolated && app.getDeathRecipient() != null) { // We are killing it, put it into the dying process list. diff --git a/services/core/java/com/android/server/am/TEST_MAPPING b/services/core/java/com/android/server/am/TEST_MAPPING index bac513221c78..6e8eb7d76108 100644 --- a/services/core/java/com/android/server/am/TEST_MAPPING +++ b/services/core/java/com/android/server/am/TEST_MAPPING @@ -50,47 +50,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"], @@ -98,12 +69,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 82840ee5fcbb..b718ce62c118 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 65f6af7d0309..2a9dfa273e87 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/AudioDeviceBroker.java b/services/core/java/com/android/server/audio/AudioDeviceBroker.java index 903fc3a94c03..550d87899b7e 100644 --- a/services/core/java/com/android/server/audio/AudioDeviceBroker.java +++ b/services/core/java/com/android/server/audio/AudioDeviceBroker.java @@ -783,6 +783,14 @@ public class AudioDeviceBroker { return isDeviceActiveForCommunication(AudioDeviceInfo.TYPE_BLUETOOTH_SCO); } + /*package*/ boolean isBluetoothBleHeadsetActive() { + return isDeviceActiveForCommunication(AudioDeviceInfo.TYPE_BLE_HEADSET); + } + + /*package*/ boolean isBluetoothBleSpeakerActive() { + return isDeviceActiveForCommunication(AudioDeviceInfo.TYPE_BLE_SPEAKER); + } + /*package*/ boolean isDeviceConnected(@NonNull AudioDeviceAttributes device) { synchronized (mDeviceStateLock) { return mDeviceInventory.isDeviceConnected(device); @@ -1649,6 +1657,10 @@ public class AudioDeviceBroker { sendIILMsg(MSG_IIL_BTLEAUDIO_TIMEOUT, SENDMSG_QUEUE, device, codec, address, delayMs); } + /*package*/ void setHearingAidTimeout(String address, int delayMs) { + sendLMsg(MSG_IL_BT_HEARING_AID_TIMEOUT, SENDMSG_QUEUE, address, delayMs); + } + /*package*/ void setAvrcpAbsoluteVolumeSupported(boolean supported) { synchronized (mDeviceStateLock) { mBtHelper.setAvrcpAbsoluteVolumeSupported(supported); @@ -1891,6 +1903,13 @@ public class AudioDeviceBroker { (String) msg.obj, msg.arg1, msg.arg2); } break; + case MSG_IL_BT_HEARING_AID_TIMEOUT: + // msg.obj == address of Hearing Aid device + synchronized (mDeviceStateLock) { + mDeviceInventory.onMakeHearingAidDeviceUnavailableNow( + (String) msg.obj); + } + break; case MSG_L_BLUETOOTH_DEVICE_CONFIG_CHANGE: { final BtDeviceInfo btInfo = (BtDeviceInfo) msg.obj; final Pair<Integer, Boolean> codecAndChanged = mBtHelper.getCodecWithFallback( @@ -2166,6 +2185,7 @@ public class AudioDeviceBroker { private static final int MSG_L_SYNCHRONIZE_ADI_DEVICES_IN_INVENTORY = 58; private static final int MSG_IL_UPDATED_ADI_DEVICE_STATE = 59; private static final int MSG_L_SET_FORCE_BT_A2DP_USE_NO_MUTE = 60; + private static final int MSG_IL_BT_HEARING_AID_TIMEOUT = 61; private static boolean isMessageHandledUnderWakelock(int msgId) { switch(msgId) { @@ -2178,6 +2198,7 @@ public class AudioDeviceBroker { case MSG_L_A2DP_DEVICE_CONNECTION_CHANGE_EXT: case MSG_L_HEARING_AID_DEVICE_CONNECTION_CHANGE_EXT: case MSG_CHECK_MUTE_MUSIC: + case MSG_IL_BT_HEARING_AID_TIMEOUT: return true; default: return false; @@ -2262,6 +2283,7 @@ public class AudioDeviceBroker { case MSG_IL_BTA2DP_TIMEOUT: case MSG_IIL_BTLEAUDIO_TIMEOUT: case MSG_L_BLUETOOTH_DEVICE_CONFIG_CHANGE: + case MSG_IL_BT_HEARING_AID_TIMEOUT: if (sLastDeviceConnectMsgTime >= time) { // add a little delay to make sure messages are ordered as expected time = sLastDeviceConnectMsgTime + 30; diff --git a/services/core/java/com/android/server/audio/AudioDeviceInventory.java b/services/core/java/com/android/server/audio/AudioDeviceInventory.java index 6ff4a617cec4..ea3d82134489 100644 --- a/services/core/java/com/android/server/audio/AudioDeviceInventory.java +++ b/services/core/java/com/android/server/audio/AudioDeviceInventory.java @@ -1023,6 +1023,11 @@ public class AudioDeviceInventory { } } + /*package*/ void onMakeHearingAidDeviceUnavailableNow(String address) { + synchronized (mDevicesLock) { + makeHearingAidDeviceUnavailable(address); + } + } /** * Goes over all connected LE Audio devices in the provided group ID and @@ -1866,12 +1871,10 @@ public class AudioDeviceInventory { .set(MediaMetrics.Property.EVENT, "disconnectHearingAid") .record(); if (toRemove.size() > 0) { - /*final int delay = */ - checkSendBecomingNoisyIntentInt(DEVICE_OUT_HEARING_AID, + final int delay = checkSendBecomingNoisyIntentInt(DEVICE_OUT_HEARING_AID, AudioService.CONNECTION_STATE_DISCONNECTED, AudioSystem.DEVICE_NONE); toRemove.stream().forEach(deviceAddress -> - // TODO delay not used? - makeHearingAidDeviceUnavailable(deviceAddress /*, delay*/) + makeHearingAidDeviceUnavailableLater(deviceAddress, delay) ); } } @@ -2450,6 +2453,15 @@ public class AudioDeviceInventory { mDeviceBroker.postCheckCommunicationDeviceRemoval(ada); } + @GuardedBy("mDevicesLock") + private void makeHearingAidDeviceUnavailableLater( + String address, int delayMs) { + // the device will be made unavailable later, so consider it disconnected right away + mConnectedDevices.remove(DeviceInfo.makeDeviceListKey(DEVICE_OUT_HEARING_AID, address)); + // send the delayed message to make the device unavailable later + mDeviceBroker.setHearingAidTimeout(address, delayMs); + } + /** * Returns whether a device of type DEVICE_OUT_HEARING_AID is connected. * Visibility by APM plays no role diff --git a/services/core/java/com/android/server/audio/AudioService.java b/services/core/java/com/android/server/audio/AudioService.java index ca0e585d85e8..b0590fe70232 100644 --- a/services/core/java/com/android/server/audio/AudioService.java +++ b/services/core/java/com/android/server/audio/AudioService.java @@ -5750,16 +5750,25 @@ public class AudioService extends IAudioService.Stub || ringerMode == AudioManager.RINGER_MODE_SILENT; final boolean shouldRingSco = ringerMode == AudioManager.RINGER_MODE_VIBRATE && mDeviceBroker.isBluetoothScoActive(); - // Ask audio policy engine to force use Bluetooth SCO channel if needed + final boolean shouldRingBle = ringerMode == AudioManager.RINGER_MODE_VIBRATE + && (mDeviceBroker.isBluetoothBleHeadsetActive() + || mDeviceBroker.isBluetoothBleSpeakerActive()); + // Ask audio policy engine to force use Bluetooth SCO/BLE channel if needed final String eventSource = "muteRingerModeStreams() from u/pid:" + Binder.getCallingUid() + "/" + Binder.getCallingPid(); + int forceUse = AudioSystem.FORCE_NONE; + if (shouldRingSco) { + forceUse = AudioSystem.FORCE_BT_SCO; + } else if (shouldRingBle) { + forceUse = AudioSystem.FORCE_BT_BLE; + } sendMsg(mAudioHandler, MSG_SET_FORCE_USE, SENDMSG_QUEUE, AudioSystem.FOR_VIBRATE_RINGING, - shouldRingSco ? AudioSystem.FORCE_BT_SCO : AudioSystem.FORCE_NONE, eventSource, 0); + forceUse, eventSource, 0); for (int streamType = numStreamTypes - 1; streamType >= 0; streamType--) { final boolean isMuted = isStreamMutedByRingerOrZenMode(streamType); final boolean muteAllowedBySco = - !(shouldRingSco && streamType == AudioSystem.STREAM_RING); + !((shouldRingSco || shouldRingBle) && streamType == AudioSystem.STREAM_RING); final boolean shouldZenMute = isStreamAffectedByCurrentZen(streamType); final boolean shouldMute = shouldZenMute || (ringerModeMute && isStreamAffectedByRingerMode(streamType) && muteAllowedBySco); diff --git a/services/core/java/com/android/server/audio/BtHelper.java b/services/core/java/com/android/server/audio/BtHelper.java index 991f94ba6f73..a346a9b3ef73 100644 --- a/services/core/java/com/android/server/audio/BtHelper.java +++ b/services/core/java/com/android/server/audio/BtHelper.java @@ -484,8 +484,13 @@ public class BtHelper { if (mBluetoothHeadset == null || mBluetoothHeadsetDevice == null) { return false; } - return mBluetoothHeadset.getAudioState(mBluetoothHeadsetDevice) - == BluetoothHeadset.STATE_AUDIO_CONNECTED; + try { + return mBluetoothHeadset.getAudioState(mBluetoothHeadsetDevice) + == BluetoothHeadset.STATE_AUDIO_CONNECTED; + } catch (Exception e) { + Log.e(TAG, "Exception while getting audio state of " + mBluetoothHeadsetDevice, e); + } + return false; } // @GuardedBy("mDeviceBroker.mSetModeLock") @@ -1163,12 +1168,16 @@ public class BtHelper { } private void checkScoAudioState() { - if (mBluetoothHeadset != null - && mBluetoothHeadsetDevice != null - && mScoAudioState == SCO_STATE_INACTIVE - && mBluetoothHeadset.getAudioState(mBluetoothHeadsetDevice) - != BluetoothHeadset.STATE_AUDIO_DISCONNECTED) { - mScoAudioState = SCO_STATE_ACTIVE_EXTERNAL; + try { + if (mBluetoothHeadset != null + && mBluetoothHeadsetDevice != null + && mScoAudioState == SCO_STATE_INACTIVE + && mBluetoothHeadset.getAudioState(mBluetoothHeadsetDevice) + != BluetoothHeadset.STATE_AUDIO_DISCONNECTED) { + mScoAudioState = SCO_STATE_ACTIVE_EXTERNAL; + } + } catch (Exception e) { + Log.e(TAG, "Exception while getting audio state of " + mBluetoothHeadsetDevice, e); } } diff --git a/services/core/java/com/android/server/audio/TEST_MAPPING b/services/core/java/com/android/server/audio/TEST_MAPPING index 2cea32af2396..ca462ce0ed8f 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/BiometricServiceRegistry.java b/services/core/java/com/android/server/biometrics/sensors/BiometricServiceRegistry.java index 6a2731d3982e..5a493e4dded8 100644 --- a/services/core/java/com/android/server/biometrics/sensors/BiometricServiceRegistry.java +++ b/services/core/java/com/android/server/biometrics/sensors/BiometricServiceRegistry.java @@ -120,11 +120,13 @@ public abstract class BiometricServiceRegistry<T extends BiometricServiceProvide // Register each sensor individually with BiometricService final List<P> allProps = new ArrayList<>(); for (T provider : providers) { - final List<P> props = provider.getSensorProperties(); - for (P prop : props) { - registerService(biometricService, prop); + if(provider != null) { + final List<P> props = provider.getSensorProperties(); + for (P prop : props) { + registerService(biometricService, prop); + } + allProps.addAll(props); } - allProps.addAll(props); } finishRegistration(providers, allProps); 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 59e64cd06667..87bd80754269 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 @@ public class FingerprintUpdateActiveUserClient extends StartUserClient<ISession, 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 b469752d49cf..671bd875d194 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 @@ public class HidlToAidlSessionAdapter implements ISession { 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 bc1c7287d04a..3997bcff8b37 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 4b8f08ec9164..16497538344a 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 5905b7de5b6e..e1bb8a1a0f21 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 @@ public class Vpn { 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 @@ public class Vpn { createUserAndRestrictedProfilesRanges(mUserId, mConfig.allowedApplications, mConfig.disallowedApplications)); - mCarrierConfigManager.registerCarrierConfigChangeListener(mExecutor, - mCarrierConfigChangeListener); + if (mCarrierConfigManager != null) { + mCarrierConfigManager.registerCarrierConfigChangeListener(mExecutor, + mCarrierConfigChangeListener); + } } @Override @@ -3343,6 +3349,10 @@ public class Vpn { */ @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 @@ public class Vpn { resetIkeState(); - mCarrierConfigManager.unregisterCarrierConfigChangeListener( - mCarrierConfigChangeListener); + if (mCarrierConfigManager != null) { + mCarrierConfigManager.unregisterCarrierConfigChangeListener( + mCarrierConfigChangeListener); + } mConnectivityManager.unregisterNetworkCallback(mNetworkCallback); mExecutor.shutdown(); diff --git a/services/core/java/com/android/server/crashrecovery/TEST_MAPPING b/services/core/java/com/android/server/crashrecovery/TEST_MAPPING new file mode 100644 index 000000000000..4a66bac2e4ec --- /dev/null +++ b/services/core/java/com/android/server/crashrecovery/TEST_MAPPING @@ -0,0 +1,12 @@ +{ + "postsubmit": [ + { + "name": "FrameworksMockingServicesTests", + "options": [ + { + "include-filter": "com.android.server.RescuePartyTest" + } + ] + } + ] +}
\ No newline at end of file diff --git a/services/core/java/com/android/server/display/DisplayManagerShellCommand.java b/services/core/java/com/android/server/display/DisplayManagerShellCommand.java index d973b71366b1..2fea5dc7234d 100644 --- a/services/core/java/com/android/server/display/DisplayManagerShellCommand.java +++ b/services/core/java/com/android/server/display/DisplayManagerShellCommand.java @@ -62,6 +62,8 @@ class DisplayManagerShellCommand extends ShellCommand { return showNotification(); case "cancel-notifications": return cancelNotifications(); + case "get-brightness": + return getBrightness(); case "set-brightness": return setBrightness(); case "reset-brightness-configuration": @@ -309,6 +311,25 @@ class DisplayManagerShellCommand extends ShellCommand { return 0; } + private int getBrightness() { + String displayIdString = getNextArg(); + if (displayIdString == null) { + getErrPrintWriter().println("Error: no display id specified"); + return 1; + } + int displayId; + try { + displayId = Integer.parseInt(displayIdString); + } catch (NumberFormatException e) { + getErrPrintWriter().println("Error: invalid displayId=" + displayIdString + " not int"); + return 1; + } + final Context context = mService.getContext(); + final DisplayManager dm = context.getSystemService(DisplayManager.class); + getOutPrintWriter().println(dm.getBrightness(displayId)); + return 0; + } + private int setBrightness() { String brightnessText = getNextArg(); if (brightnessText == null) { diff --git a/services/core/java/com/android/server/display/LocalDisplayAdapter.java b/services/core/java/com/android/server/display/LocalDisplayAdapter.java index 44846f310348..6e0b9cf2f234 100644 --- a/services/core/java/com/android/server/display/LocalDisplayAdapter.java +++ b/services/core/java/com/android/server/display/LocalDisplayAdapter.java @@ -49,6 +49,7 @@ import android.view.RoundedCorners; import android.view.SurfaceControl; import com.android.internal.R; +import com.android.internal.annotations.KeepForWeakReference; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.display.BrightnessSynchronizer; import com.android.internal.util.function.pooled.PooledLambda; @@ -1442,8 +1443,9 @@ final class LocalDisplayAdapter extends DisplayAdapter { } public static class Injector { - // Native callback. + // Ensure the callback is kept to preserve native weak reference lifecycle semantics. @SuppressWarnings("unused") + @KeepForWeakReference private ProxyDisplayEventReceiver mReceiver; public void setDisplayEventListenerLocked(Looper looper, DisplayEventListener listener) { mReceiver = new ProxyDisplayEventReceiver(looper, listener); diff --git a/services/core/java/com/android/server/hdmi/DelayedMessageBuffer.java b/services/core/java/com/android/server/hdmi/DelayedMessageBuffer.java index 46b4f48165f9..44907457f649 100644 --- a/services/core/java/com/android/server/hdmi/DelayedMessageBuffer.java +++ b/services/core/java/com/android/server/hdmi/DelayedMessageBuffer.java @@ -17,8 +17,10 @@ package com.android.server.hdmi; import android.hardware.hdmi.HdmiDeviceInfo; + import java.util.ArrayList; import java.util.Iterator; +import java.util.List; /** * Buffer storage to keep incoming messages for later processing. Used to @@ -83,6 +85,16 @@ final class DelayedMessageBuffer { return false; } + List<HdmiCecMessage> getBufferedMessagesWithOpcode(int opcode) { + List<HdmiCecMessage> messages = new ArrayList<>(); + for (HdmiCecMessage message : mBuffer) { + if (message.getOpcode() == opcode) { + messages.add(message); + } + } + return messages; + } + void processAllMessages() { // Use the copied buffer. ArrayList<HdmiCecMessage> copiedBuffer = new ArrayList<>(mBuffer); diff --git a/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java b/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java index 275c9309ffc9..978a8c0e1a45 100644 --- a/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java +++ b/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java @@ -205,7 +205,9 @@ public final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice { resetSelectRequestBuffer(); launchDeviceDiscovery(); startQueuedActions(); - if (!mDelayedMessageBuffer.isBuffered(Constants.MESSAGE_ACTIVE_SOURCE)) { + List<HdmiCecMessage> bufferedActiveSource = mDelayedMessageBuffer + .getBufferedMessagesWithOpcode(Constants.MESSAGE_ACTIVE_SOURCE); + if (bufferedActiveSource.isEmpty()) { if (hasAction(RequestActiveSourceAction.class)) { Slog.i(TAG, "RequestActiveSourceAction is in progress. Restarting."); removeAction(RequestActiveSourceAction.class); @@ -224,9 +226,33 @@ public final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice { } } })); + } else { + addCecDeviceForBufferedActiveSource(bufferedActiveSource.get(0)); } } + // Add a new CEC device with known information from the buffered <Active Source> message. This + // helps TvInputCallback#onInputAdded to be called such that the message can be processed and + // the TV to switch to the new active input. + @ServiceThreadOnly + private void addCecDeviceForBufferedActiveSource(HdmiCecMessage bufferedActiveSource) { + assertRunOnServiceThread(); + if (bufferedActiveSource == null) { + return; + } + int source = bufferedActiveSource.getSource(); + int physicalAddress = HdmiUtils.twoBytesToInt(bufferedActiveSource.getParams()); + List<Integer> deviceTypes = HdmiUtils.getTypeFromAddress(source); + HdmiDeviceInfo newDevice = HdmiDeviceInfo.cecDeviceBuilder() + .setLogicalAddress(source) + .setPhysicalAddress(physicalAddress) + .setDisplayName(HdmiUtils.getDefaultDeviceName(source)) + .setDeviceType(deviceTypes.get(0)) + .setVendorId(Constants.VENDOR_ID_UNKNOWN) + .build(); + mService.getHdmiCecNetwork().addCecDevice(newDevice); + } + @ServiceThreadOnly public void setSelectRequestBuffer(SelectRequestBuffer requestBuffer) { assertRunOnServiceThread(); @@ -581,6 +607,12 @@ public final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice { @Constants.HandleMessageResult protected int handleReportPhysicalAddress(HdmiCecMessage message) { super.handleReportPhysicalAddress(message); + // Ignore <Report Physical Address> while DeviceDiscoveryAction is in progress to avoid + // starting a NewDeviceAction which might interfere in creating the list of known devices. + if (hasAction(DeviceDiscoveryAction.class)) { + return Constants.HANDLED; + } + int path = HdmiUtils.twoBytesToInt(message.getParams()); int address = message.getSource(); int type = message.getParams()[2]; diff --git a/services/core/java/com/android/server/hdmi/HdmiCecMessageValidator.java b/services/core/java/com/android/server/hdmi/HdmiCecMessageValidator.java index 3c3bdd5b69f6..310f592ddf5c 100644 --- a/services/core/java/com/android/server/hdmi/HdmiCecMessageValidator.java +++ b/services/core/java/com/android/server/hdmi/HdmiCecMessageValidator.java @@ -485,6 +485,7 @@ public class HdmiCecMessageValidator { * @return true if the hour is valid */ private static boolean isValidHour(int value) { + value = bcdToDecimal(value); return isWithinRange(value, 0, 23); } @@ -496,6 +497,7 @@ public class HdmiCecMessageValidator { * @return true if the minute is valid */ private static boolean isValidMinute(int value) { + value = bcdToDecimal(value); return isWithinRange(value, 0, 59); } @@ -507,10 +509,24 @@ public class HdmiCecMessageValidator { * @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) * @@ -523,8 +539,7 @@ public class HdmiCecMessageValidator { if ((value & 0x80) != 0x00) { return false; } - // Validate than not more than one bit is set - return (Integer.bitCount(value) <= 1); + return true; } /** @@ -769,6 +784,7 @@ public class HdmiCecMessageValidator { * @return true if the UI Broadcast type is valid */ private static boolean isValidUiBroadcastType(int value) { + value = value & 0xFF; return ((value == 0x00) || (value == 0x01) || (value == 0x10) diff --git a/services/core/java/com/android/server/hdmi/HdmiCecNetwork.java b/services/core/java/com/android/server/hdmi/HdmiCecNetwork.java index 88da6fb94754..550f68fbc94c 100644 --- a/services/core/java/com/android/server/hdmi/HdmiCecNetwork.java +++ b/services/core/java/com/android/server/hdmi/HdmiCecNetwork.java @@ -660,7 +660,11 @@ public class HdmiCecNetwork { .setPortId(physicalAddressToPortId(physicalAddress)) .setDeviceType(type) .build(); - updateCecDevice(updatedDeviceInfo); + if (deviceInfo.getPhysicalAddress() != physicalAddress) { + addCecDevice(updatedDeviceInfo); + } else { + updateCecDevice(updatedDeviceInfo); + } } } diff --git a/services/core/java/com/android/server/hdmi/HdmiControlService.java b/services/core/java/com/android/server/hdmi/HdmiControlService.java index 6e027c6d44c4..bbe7b2b038c9 100644 --- a/services/core/java/com/android/server/hdmi/HdmiControlService.java +++ b/services/core/java/com/android/server/hdmi/HdmiControlService.java @@ -144,6 +144,10 @@ public class HdmiControlService extends SystemService { private static final String TAG = "HdmiControlService"; private static final Locale HONG_KONG = new Locale("zh", "HK"); private static final Locale MACAU = new Locale("zh", "MO"); + private static final String TAIWAN_HantLanguageTag = "zh-Hant-TW"; + private static final String HONG_KONG_HantLanguageTag = "zh-Hant-HK"; + private static final String HONG_KONG_YUE_HantLanguageTag = "yue-Hant-HK"; + private static final String MACAU_HantLanguageTag = "zh-Hant-MO"; private static final Map<String, String> sTerminologyToBibliographicMap = createsTerminologyToBibliographicMap(); @@ -174,7 +178,11 @@ public class HdmiControlService extends SystemService { } @VisibleForTesting static String localeToMenuLanguage(Locale locale) { - if (locale.equals(Locale.TAIWAN) || locale.equals(HONG_KONG) || locale.equals(MACAU)) { + if (locale.equals(Locale.TAIWAN) || locale.equals(HONG_KONG) || locale.equals(MACAU) || + locale.toLanguageTag().equals(TAIWAN_HantLanguageTag) || + locale.toLanguageTag().equals(HONG_KONG_HantLanguageTag) || + locale.toLanguageTag().equals(HONG_KONG_YUE_HantLanguageTag) || + locale.toLanguageTag().equals(MACAU_HantLanguageTag)) { // Android always returns "zho" for all Chinese variants. // Use "bibliographic" code defined in CEC639-2 for traditional // Chinese used in Taiwan/Hong Kong/Macau. diff --git a/services/core/java/com/android/server/hdmi/TEST_MAPPING b/services/core/java/com/android/server/hdmi/TEST_MAPPING index c0fa12131e8e..1c85c7f1233c 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 4c20c4dc9d35..e2834ec246b6 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/inputmethod/InputMethodManagerService.java b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java index 0e76c3f1e833..0f8060bba1ab 100644 --- a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java +++ b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java @@ -2646,6 +2646,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. hideStatusBarIconLocked(); mInFullscreenMode = false; mWindowManagerInternal.setDismissImeOnBackKeyPressed(false); + scheduleResetStylusHandwriting(); } @BinderThread diff --git a/services/core/java/com/android/server/integrity/TEST_MAPPING b/services/core/java/com/android/server/integrity/TEST_MAPPING index be8d2e15a203..5c05fceed92e 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 17b98ce8e2d5..1d2cd3c6e217 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 fd8cddc08fff..26e4685ad684 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 f5deb2ba3e07..64b1ed20656e 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/altitude/AltitudeService.java b/services/core/java/com/android/server/location/altitude/AltitudeService.java index 289d4a25f208..96540c225e23 100644 --- a/services/core/java/com/android/server/location/altitude/AltitudeService.java +++ b/services/core/java/com/android/server/location/altitude/AltitudeService.java @@ -25,6 +25,7 @@ import android.frameworks.location.altitude.IAltitudeService; import android.location.Location; import android.location.altitude.AltitudeConverter; import android.os.RemoteException; +import android.util.Log; import com.android.server.SystemService; @@ -38,6 +39,8 @@ import java.io.IOException; */ public class AltitudeService extends IAltitudeService.Stub { + private static final String TAG = "AltitudeService"; + private final AltitudeConverter mAltitudeConverter = new AltitudeConverter(); private final Context mContext; @@ -59,6 +62,7 @@ public class AltitudeService extends IAltitudeService.Stub { try { mAltitudeConverter.addMslAltitudeToLocation(mContext, location); } catch (IOException e) { + Log.e(TAG, "", e); response.success = false; return response; } @@ -74,6 +78,7 @@ public class AltitudeService extends IAltitudeService.Stub { try { return mAltitudeConverter.getGeoidHeight(mContext, request); } catch (IOException e) { + Log.e(TAG, "", e); GetGeoidHeightResponse response = new GetGeoidHeightResponse(); response.success = false; return response; 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 2f6aa5308086..85ea5a474a90 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/LockSettingsService.java b/services/core/java/com/android/server/locksettings/LockSettingsService.java index 22b33ddcfa2b..db4d68b52a95 100644 --- a/services/core/java/com/android/server/locksettings/LockSettingsService.java +++ b/services/core/java/com/android/server/locksettings/LockSettingsService.java @@ -254,9 +254,6 @@ public class LockSettingsService extends ILockSettings.Stub { private static final String MIGRATED_SP_CE_ONLY = "migrated_all_users_to_sp_and_bound_ce"; private static final String MIGRATED_SP_FULL = "migrated_all_users_to_sp_and_bound_keys"; - private static final boolean FIX_UNLOCKED_DEVICE_REQUIRED_KEYS = - android.security.Flags.fixUnlockedDeviceRequiredKeysV2(); - // Duration that LockSettingsService will store the gatekeeper password for. This allows // multiple biometric enrollments without prompting the user to enter their password via // ConfirmLockPassword/ConfirmLockPattern multiple times. This needs to be at least the duration @@ -670,7 +667,6 @@ public class LockSettingsService extends ILockSettings.Stub { mActivityManager = injector.getActivityManager(); IntentFilter filter = new IntentFilter(); - filter.addAction(Intent.ACTION_USER_ADDED); filter.addAction(Intent.ACTION_USER_STARTING); filter.addAction(Intent.ACTION_LOCALE_CHANGED); injector.getContext().registerReceiverAsUser(mBroadcastReceiver, UserHandle.ALL, filter, @@ -909,13 +905,7 @@ public class LockSettingsService extends ILockSettings.Stub { private final BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { - if (Intent.ACTION_USER_ADDED.equals(intent.getAction())) { - if (!FIX_UNLOCKED_DEVICE_REQUIRED_KEYS) { - // Notify keystore that a new user was added. - final int userHandle = intent.getIntExtra(Intent.EXTRA_USER_HANDLE, 0); - AndroidKeyStoreMaintenance.onUserAdded(userHandle); - } - } else if (Intent.ACTION_USER_STARTING.equals(intent.getAction())) { + if (Intent.ACTION_USER_STARTING.equals(intent.getAction())) { final int userHandle = intent.getIntExtra(Intent.EXTRA_USER_HANDLE, 0); mStorage.prefetchUser(userHandle); } else if (Intent.ACTION_LOCALE_CHANGED.equals(intent.getAction())) { @@ -1130,32 +1120,14 @@ public class LockSettingsService extends ILockSettings.Stub { // Note: if this migration gets interrupted (e.g. by the device powering off), there // shouldn't be a problem since this will run again on the next boot, and // setCeStorageProtection() and initKeystoreSuperKeys(..., true) are idempotent. - if (FIX_UNLOCKED_DEVICE_REQUIRED_KEYS) { - if (!getBoolean(MIGRATED_SP_FULL, false, 0)) { - for (UserInfo user : mUserManager.getAliveUsers()) { - removeStateForReusedUserIdIfNecessary(user.id, user.serialNumber); - synchronized (mSpManager) { - migrateUserToSpWithBoundKeysLocked(user.id); - } - } - setBoolean(MIGRATED_SP_FULL, true, 0); - } - } else { - if (getString(MIGRATED_SP_CE_ONLY, null, 0) == null) { - for (UserInfo user : mUserManager.getAliveUsers()) { - removeStateForReusedUserIdIfNecessary(user.id, user.serialNumber); - synchronized (mSpManager) { - migrateUserToSpWithBoundCeKeyLocked(user.id); - } + if (!getBoolean(MIGRATED_SP_FULL, false, 0)) { + for (UserInfo user : mUserManager.getAliveUsers()) { + removeStateForReusedUserIdIfNecessary(user.id, user.serialNumber); + synchronized (mSpManager) { + migrateUserToSpWithBoundKeysLocked(user.id); } - setString(MIGRATED_SP_CE_ONLY, "true", 0); - } - - if (getBoolean(MIGRATED_SP_FULL, false, 0)) { - // The FIX_UNLOCKED_DEVICE_REQUIRED_KEYS flag was enabled but then got disabled. - // Ensure the full migration runs again the next time the flag is enabled... - setBoolean(MIGRATED_SP_FULL, false, 0); } + setBoolean(MIGRATED_SP_FULL, true, 0); } mThirdPartyAppsStarted = true; @@ -1163,30 +1135,6 @@ public class LockSettingsService extends ILockSettings.Stub { } @GuardedBy("mSpManager") - private void migrateUserToSpWithBoundCeKeyLocked(@UserIdInt int userId) { - if (isUserSecure(userId)) { - Slogf.d(TAG, "User %d is secured; no migration needed", userId); - return; - } - long protectorId = getCurrentLskfBasedProtectorId(userId); - if (protectorId == SyntheticPasswordManager.NULL_PROTECTOR_ID) { - Slogf.i(TAG, "Migrating unsecured user %d to SP-based credential", userId); - initializeSyntheticPassword(userId); - } else { - Slogf.i(TAG, "Existing unsecured user %d has a synthetic password; re-encrypting CE " + - "key with it", userId); - AuthenticationResult result = mSpManager.unlockLskfBasedProtector( - getGateKeeperService(), protectorId, LockscreenCredential.createNone(), userId, - null); - if (result.syntheticPassword == null) { - Slogf.wtf(TAG, "Failed to unwrap synthetic password for unsecured user %d", userId); - return; - } - setCeStorageProtection(userId, result.syntheticPassword); - } - } - - @GuardedBy("mSpManager") private void migrateUserToSpWithBoundKeysLocked(@UserIdInt int userId) { if (isUserSecure(userId)) { Slogf.d(TAG, "User %d is secured; no migration needed", userId); @@ -1496,11 +1444,6 @@ public class LockSettingsService extends ILockSettings.Stub { } @VisibleForTesting /** Note: this method is overridden in unit tests */ - void setKeystorePassword(byte[] password, int userHandle) { - AndroidKeyStoreMaintenance.onUserPasswordChanged(userHandle, password); - } - - @VisibleForTesting /** Note: this method is overridden in unit tests */ void initKeystoreSuperKeys(@UserIdInt int userId, SyntheticPassword sp, boolean allowExisting) { final byte[] password = sp.deriveKeyStorePassword(); try { @@ -1872,6 +1815,20 @@ public class LockSettingsService extends ILockSettings.Stub { } } + @Override + public boolean writeRepairModeCredential(int userId) { + checkWritePermission(); + final long identity = Binder.clearCallingIdentity(); + try { + synchronized (mSpManager) { + long protectorId = getCurrentLskfBasedProtectorId(userId); + return mSpManager.writeRepairModeCredentialLocked(protectorId, userId); + } + } finally { + Binder.restoreCallingIdentity(identity); + } + } + /** * @param savedCredential if the user is a profile with * {@link UserManager#isCredentialSharableWithParent()} with unified challenge and @@ -2237,9 +2194,7 @@ public class LockSettingsService extends ILockSettings.Stub { return; } onSyntheticPasswordUnlocked(userId, result.syntheticPassword); - if (FIX_UNLOCKED_DEVICE_REQUIRED_KEYS) { - unlockKeystore(userId, result.syntheticPassword); - } + unlockKeystore(userId, result.syntheticPassword); unlockCeStorage(userId, result.syntheticPassword); } } @@ -2545,9 +2500,7 @@ public class LockSettingsService extends ILockSettings.Stub { // long time, so for now we keep doing it just in case it's ever important. Don't wait // until initKeystoreSuperKeys() to do this; that can be delayed if the user is being // created during early boot, and maybe something will use Keystore before then. - if (FIX_UNLOCKED_DEVICE_REQUIRED_KEYS) { - AndroidKeyStoreMaintenance.onUserAdded(userId); - } + AndroidKeyStoreMaintenance.onUserAdded(userId); synchronized (mUserCreationAndRemovalLock) { // During early boot, don't actually create the synthetic password yet, but rather @@ -2973,9 +2926,7 @@ public class LockSettingsService extends ILockSettings.Stub { LockscreenCredential.createNone(), sp, userId); setCurrentLskfBasedProtectorId(protectorId, userId); setCeStorageProtection(userId, sp); - if (FIX_UNLOCKED_DEVICE_REQUIRED_KEYS) { - initKeystoreSuperKeys(userId, sp, /* allowExisting= */ false); - } + initKeystoreSuperKeys(userId, sp, /* allowExisting= */ false); onSyntheticPasswordCreated(userId, sp); Slogf.i(TAG, "Successfully initialized synthetic password for user %d", userId); return sp; @@ -3090,9 +3041,6 @@ public class LockSettingsService extends ILockSettings.Stub { if (!mSpManager.hasSidForUser(userId)) { mSpManager.newSidForUser(getGateKeeperService(), sp, userId); mSpManager.verifyChallenge(getGateKeeperService(), sp, 0L, userId); - if (!FIX_UNLOCKED_DEVICE_REQUIRED_KEYS) { - setKeystorePassword(sp.deriveKeyStorePassword(), userId); - } } } else { // Cache all profile password if they use unified challenge. This will later be used to @@ -3103,11 +3051,7 @@ public class LockSettingsService extends ILockSettings.Stub { gateKeeperClearSecureUserId(userId); unlockCeStorage(userId, sp); unlockKeystore(userId, sp); - if (FIX_UNLOCKED_DEVICE_REQUIRED_KEYS) { - AndroidKeyStoreMaintenance.onUserLskfRemoved(userId); - } else { - setKeystorePassword(null, userId); - } + AndroidKeyStoreMaintenance.onUserLskfRemoved(userId); removeBiometricsForUser(userId); } setCurrentLskfBasedProtectorId(newProtectorId, userId); diff --git a/services/core/java/com/android/server/locksettings/LockSettingsShellCommand.java b/services/core/java/com/android/server/locksettings/LockSettingsShellCommand.java index 17f2fcc5b9d8..bb35b378866b 100644 --- a/services/core/java/com/android/server/locksettings/LockSettingsShellCommand.java +++ b/services/core/java/com/android/server/locksettings/LockSettingsShellCommand.java @@ -340,6 +340,11 @@ class LockSettingsShellCommand extends ShellCommand { getOutPrintWriter().println("Profile uses unified challenge"); return false; } + if (mOld.isEmpty()) { + getOutPrintWriter().println( + "User has a lock credential, but old credential was not provided"); + return false; + } try { final boolean result = mLockPatternUtils.checkCredential(getOldCredential(), diff --git a/services/core/java/com/android/server/locksettings/TEST_MAPPING b/services/core/java/com/android/server/locksettings/TEST_MAPPING index 256d9ba86a6f..ffbdf7f2bf8b 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 904155226d7f..5b07cd960fbe 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/net/Android.bp b/services/core/java/com/android/server/net/Android.bp index 3ac2d232dfc8..68dc7816c5a4 100644 --- a/services/core/java/com/android/server/net/Android.bp +++ b/services/core/java/com/android/server/net/Android.bp @@ -9,3 +9,10 @@ java_aconfig_library { name: "net_flags_lib", aconfig_declarations: "net_flags", } + +java_aconfig_library { + name: "net_flags_host_lib", + aconfig_declarations: "net_flags", + host_supported: true, + mode: "test", +} diff --git a/services/core/java/com/android/server/net/NetworkManagementService.java b/services/core/java/com/android/server/net/NetworkManagementService.java index 5ea3e70f7957..74f0d9cf3e39 100644 --- a/services/core/java/com/android/server/net/NetworkManagementService.java +++ b/services/core/java/com/android/server/net/NetworkManagementService.java @@ -81,8 +81,6 @@ import com.android.internal.annotations.GuardedBy; import com.android.internal.app.IBatteryStats; import com.android.internal.util.DumpUtils; import com.android.internal.util.HexDump; -import com.android.modules.utils.build.SdkLevel; -import com.android.net.module.util.NetdUtils; import com.android.net.module.util.PermissionUtils; import com.android.server.FgThread; import com.android.server.LocalServices; @@ -833,144 +831,6 @@ public class NetworkManagementService extends INetworkManagementService.Stub { } @Override - public boolean getIpForwardingEnabled() throws IllegalStateException{ - PermissionUtils.enforceNetworkStackPermission(mContext); - if (SdkLevel.isAtLeastV()) { - throw new UnsupportedOperationException( - "NMS#getIpForwardingEnabled not supported in V+"); - } - try { - return mNetdService.ipfwdEnabled(); - } catch (RemoteException | ServiceSpecificException e) { - throw new IllegalStateException(e); - } - } - - @Override - public void setIpForwardingEnabled(boolean enable) { - PermissionUtils.enforceNetworkStackPermission(mContext); - if (SdkLevel.isAtLeastV()) { - throw new UnsupportedOperationException( - "NMS#setIpForwardingEnabled not supported in V+"); - } try { - if (enable) { - mNetdService.ipfwdEnableForwarding("tethering"); - } else { - mNetdService.ipfwdDisableForwarding("tethering"); - } - } catch (RemoteException | ServiceSpecificException e) { - throw new IllegalStateException(e); - } - } - - @Override - public void startTethering(String[] dhcpRange) { - PermissionUtils.enforceNetworkStackPermission(mContext); - if (SdkLevel.isAtLeastV()) { - throw new UnsupportedOperationException("NMS#startTethering not supported in V+"); - } - try { - NetdUtils.tetherStart(mNetdService, true /* usingLegacyDnsProxy */, dhcpRange); - } catch (RemoteException | ServiceSpecificException e) { - throw new IllegalStateException(e); - } - } - - @Override - public void stopTethering() { - PermissionUtils.enforceNetworkStackPermission(mContext); - if (SdkLevel.isAtLeastV()) { - throw new UnsupportedOperationException("NMS#stopTethering not supported in V+"); - } - try { - mNetdService.tetherStop(); - } catch (RemoteException | ServiceSpecificException e) { - throw new IllegalStateException(e); - } - } - - @Override - public boolean isTetheringStarted() { - PermissionUtils.enforceNetworkStackPermission(mContext); - if (SdkLevel.isAtLeastV()) { - throw new UnsupportedOperationException("NMS#isTetheringStarted not supported in V+"); - } - try { - return mNetdService.tetherIsEnabled(); - } catch (RemoteException | ServiceSpecificException e) { - throw new IllegalStateException(e); - } - } - - @Override - public void tetherInterface(String iface) { - PermissionUtils.enforceNetworkStackPermission(mContext); - if (SdkLevel.isAtLeastV()) { - throw new UnsupportedOperationException("NMS#tetherInterface not supported in V+"); - } - try { - final LinkAddress addr = getInterfaceConfig(iface).getLinkAddress(); - final IpPrefix dest = new IpPrefix(addr.getAddress(), addr.getPrefixLength()); - NetdUtils.tetherInterface(mNetdService, iface, dest); - } catch (RemoteException | ServiceSpecificException e) { - throw new IllegalStateException(e); - } - } - - @Override - public void untetherInterface(String iface) { - PermissionUtils.enforceNetworkStackPermission(mContext); - if (SdkLevel.isAtLeastV()) { - throw new UnsupportedOperationException("NMS#untetherInterface not supported in V+"); - } - try { - NetdUtils.untetherInterface(mNetdService, iface); - } catch (RemoteException | ServiceSpecificException e) { - throw new IllegalStateException(e); - } - } - - @Override - public String[] listTetheredInterfaces() { - PermissionUtils.enforceNetworkStackPermission(mContext); - if (SdkLevel.isAtLeastV()) { - throw new UnsupportedOperationException( - "NMS#listTetheredInterfaces not supported in V+"); - } - try { - return mNetdService.tetherInterfaceList(); - } catch (RemoteException | ServiceSpecificException e) { - throw new IllegalStateException(e); - } - } - - @Override - public void enableNat(String internalInterface, String externalInterface) { - PermissionUtils.enforceNetworkStackPermission(mContext); - if (SdkLevel.isAtLeastV()) { - throw new UnsupportedOperationException("NMS#enableNat not supported in V+"); - } - try { - mNetdService.tetherAddForward(internalInterface, externalInterface); - } catch (RemoteException | ServiceSpecificException e) { - throw new IllegalStateException(e); - } - } - - @Override - public void disableNat(String internalInterface, String externalInterface) { - PermissionUtils.enforceNetworkStackPermission(mContext); - if (SdkLevel.isAtLeastV()) { - throw new UnsupportedOperationException("NMS#disableNat not supported in V+"); - } - try { - mNetdService.tetherRemoveForward(internalInterface, externalInterface); - } catch (RemoteException | ServiceSpecificException e) { - throw new IllegalStateException(e); - } - } - - @Override public void setInterfaceQuota(String iface, long quotaBytes) { PermissionUtils.enforceNetworkStackPermission(mContext); @@ -1126,30 +986,19 @@ public class NetworkManagementService extends INetworkManagementService.Stub { } Trace.traceBegin(Trace.TRACE_TAG_NETWORK, "setDataSaverModeEnabled"); try { - if (SdkLevel.isAtLeastV()) { - // setDataSaverEnabled throws if it fails to set data saver. - mContext.getSystemService(ConnectivityManager.class) - .setDataSaverEnabled(enable); - mDataSaverMode = enable; - if (mUseMeteredFirewallChains) { - // Copy mDataSaverMode state to FIREWALL_CHAIN_METERED_ALLOW - // until ConnectivityService allows manipulation of the data saver mode via - // FIREWALL_CHAIN_METERED_ALLOW. - synchronized (mRulesLock) { - mFirewallChainStates.put(FIREWALL_CHAIN_METERED_ALLOW, enable); - } - } - return true; - } else { - final boolean changed = mNetdService.bandwidthEnableDataSaver(enable); - if (changed) { - mDataSaverMode = enable; - } else { - Log.e(TAG, "setDataSaverMode(" + enable + "): failed to set iptables"); + // setDataSaverEnabled throws if it fails to set data saver. + mContext.getSystemService(ConnectivityManager.class).setDataSaverEnabled(enable); + mDataSaverMode = enable; + if (mUseMeteredFirewallChains) { + // Copy mDataSaverMode state to FIREWALL_CHAIN_METERED_ALLOW + // until ConnectivityService allows manipulation of the data saver mode via + // FIREWALL_CHAIN_METERED_ALLOW. + synchronized (mRulesLock) { + mFirewallChainStates.put(FIREWALL_CHAIN_METERED_ALLOW, enable); } - return changed; } - } catch (RemoteException | IllegalStateException e) { + return true; + } catch (IllegalStateException e) { Log.e(TAG, "setDataSaverMode(" + enable + "): failed with exception", e); return false; } finally { diff --git a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java index d9e22c5a270f..a6f4c0e597d1 100644 --- a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java +++ b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java @@ -530,6 +530,12 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { */ private boolean mUseDifferentDelaysForBackgroundChain; + /** + * Core uids and apps without the internet permission will not have any firewall rules applied + * to them. + */ + private boolean mNeverApplyRulesToCoreUids; + // See main javadoc for instructions on how to use these locks. final Object mUidRulesFirstLock = new Object(); final Object mNetworkPoliciesSecondLock = new Object(); @@ -622,16 +628,6 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { @GuardedBy("mUidRulesFirstLock") final SparseIntArray mUidFirewallStandbyRules = new SparseIntArray(); - @GuardedBy("mUidRulesFirstLock") - final SparseIntArray mUidFirewallDozableRules = new SparseIntArray(); - @GuardedBy("mUidRulesFirstLock") - final SparseIntArray mUidFirewallPowerSaveRules = new SparseIntArray(); - @GuardedBy("mUidRulesFirstLock") - final SparseIntArray mUidFirewallBackgroundRules = new SparseIntArray(); - @GuardedBy("mUidRulesFirstLock") - final SparseIntArray mUidFirewallRestrictedModeRules = new SparseIntArray(); - @GuardedBy("mUidRulesFirstLock") - final SparseIntArray mUidFirewallLowPowerStandbyModeRules = new SparseIntArray(); /** Set of states for the child firewall chains. True if the chain is active. */ @GuardedBy("mUidRulesFirstLock") @@ -770,7 +766,8 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { /** List of apps indexed by uid and whether they have the internet permission */ @GuardedBy("mUidRulesFirstLock") - private final SparseBooleanArray mInternetPermissionMap = new SparseBooleanArray(); + @VisibleForTesting + final SparseBooleanArray mInternetPermissionMap = new SparseBooleanArray(); /** * Map of uid -> UidStateCallbackInfo objects holding the data received from @@ -1048,6 +1045,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { mUseMeteredFirewallChains = Flags.useMeteredFirewallChains(); mUseDifferentDelaysForBackgroundChain = Flags.useDifferentDelaysForBackgroundChain(); + mNeverApplyRulesToCoreUids = Flags.neverApplyRulesToCoreUids(); synchronized (mUidRulesFirstLock) { synchronized (mNetworkPoliciesSecondLock) { @@ -4098,6 +4096,8 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { + mUseMeteredFirewallChains); fout.println(Flags.FLAG_USE_DIFFERENT_DELAYS_FOR_BACKGROUND_CHAIN + ": " + mUseDifferentDelaysForBackgroundChain); + fout.println(Flags.FLAG_NEVER_APPLY_RULES_TO_CORE_UIDS + ": " + + mNeverApplyRulesToCoreUids); fout.println(); fout.println("mRestrictBackgroundLowPowerMode: " + mRestrictBackgroundLowPowerMode); @@ -4118,7 +4118,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { fout.increaseIndent(); for (int i = 0; i < mSubscriptionPlans.size(); i++) { final int subId = mSubscriptionPlans.keyAt(i); - fout.println("Subscriber ID " + subId + ":"); + fout.println("Subscription ID " + subId + ":"); fout.increaseIndent(); final SubscriptionPlan[] plans = mSubscriptionPlans.valueAt(i); if (!ArrayUtils.isEmpty(plans)) { @@ -4589,7 +4589,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { @VisibleForTesting @GuardedBy("mUidRulesFirstLock") void updateRestrictedModeAllowlistUL() { - mUidFirewallRestrictedModeRules.clear(); + final SparseIntArray uidRules = new SparseIntArray(); forEachUid("updateRestrictedModeAllowlist", uid -> { synchronized (mUidRulesFirstLock) { final int effectiveBlockedReasons = updateBlockedReasonsForRestrictedModeUL( @@ -4599,13 +4599,13 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { // setUidFirewallRulesUL will allowlist all uids that are passed to it, so only add // non-default rules. if (newFirewallRule != FIREWALL_RULE_DEFAULT) { - mUidFirewallRestrictedModeRules.append(uid, newFirewallRule); + uidRules.append(uid, newFirewallRule); } } }); if (mRestrictedNetworkingMode) { // firewall rules only need to be set when this mode is being enabled. - setUidFirewallRulesUL(FIREWALL_CHAIN_RESTRICTED, mUidFirewallRestrictedModeRules); + setUidFirewallRulesUL(FIREWALL_CHAIN_RESTRICTED, uidRules); } enableFirewallChainUL(FIREWALL_CHAIN_RESTRICTED, mRestrictedNetworkingMode); } @@ -4689,8 +4689,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { void updateRulesForPowerSaveUL() { Trace.traceBegin(Trace.TRACE_TAG_NETWORK, "updateRulesForPowerSaveUL"); try { - updateRulesForAllowlistedPowerSaveUL(mRestrictPower, FIREWALL_CHAIN_POWERSAVE, - mUidFirewallPowerSaveRules); + updateRulesForAllowlistedPowerSaveUL(mRestrictPower, FIREWALL_CHAIN_POWERSAVE); } finally { Trace.traceEnd(Trace.TRACE_TAG_NETWORK); } @@ -4705,8 +4704,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { void updateRulesForDeviceIdleUL() { Trace.traceBegin(Trace.TRACE_TAG_NETWORK, "updateRulesForDeviceIdleUL"); try { - updateRulesForAllowlistedPowerSaveUL(mDeviceIdleMode, FIREWALL_CHAIN_DOZABLE, - mUidFirewallDozableRules); + updateRulesForAllowlistedPowerSaveUL(mDeviceIdleMode, FIREWALL_CHAIN_DOZABLE); } finally { Trace.traceEnd(Trace.TRACE_TAG_NETWORK); } @@ -4720,13 +4718,11 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { // NOTE: since both fw_dozable and fw_powersave uses the same map // (mPowerSaveTempWhitelistAppIds) for allowlisting, we can reuse their logic in this method. @GuardedBy("mUidRulesFirstLock") - private void updateRulesForAllowlistedPowerSaveUL(boolean enabled, int chain, - SparseIntArray rules) { + private void updateRulesForAllowlistedPowerSaveUL(boolean enabled, int chain) { if (enabled) { // Sync the allowlists before enabling the chain. We don't care about the rules if // we are disabling the chain. - final SparseIntArray uidRules = rules; - uidRules.clear(); + final SparseIntArray uidRules = new SparseIntArray(); final List<UserInfo> users = mUserManager.getUsers(); for (int ui = users.size() - 1; ui >= 0; ui--) { UserInfo user = users.get(ui); @@ -4755,9 +4751,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { private void updateRulesForBackgroundChainUL() { Trace.traceBegin(Trace.TRACE_TAG_NETWORK, "updateRulesForBackgroundChainUL"); try { - final SparseIntArray uidRules = mUidFirewallBackgroundRules; - uidRules.clear(); - + final SparseIntArray uidRules = new SparseIntArray(); final List<UserInfo> users = mUserManager.getUsers(); for (int ui = users.size() - 1; ui >= 0; ui--) { final UserInfo user = users.get(ui); @@ -4794,17 +4788,17 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { Trace.traceBegin(Trace.TRACE_TAG_NETWORK, "updateRulesForLowPowerStandbyUL"); try { if (mLowPowerStandbyActive) { - mUidFirewallLowPowerStandbyModeRules.clear(); + final SparseIntArray uidRules = new SparseIntArray(); for (int i = mUidState.size() - 1; i >= 0; i--) { final int uid = mUidState.keyAt(i); final int effectiveBlockedReasons = getEffectiveBlockedReasons(uid); if (hasInternetPermissionUL(uid) && (effectiveBlockedReasons & BLOCKED_REASON_LOW_POWER_STANDBY) == 0) { - mUidFirewallLowPowerStandbyModeRules.put(uid, FIREWALL_RULE_ALLOW); + uidRules.put(uid, FIREWALL_RULE_ALLOW); } } setUidFirewallRulesUL(FIREWALL_CHAIN_LOW_POWER_STANDBY, - mUidFirewallLowPowerStandbyModeRules, CHAIN_TOGGLE_ENABLE); + uidRules, CHAIN_TOGGLE_ENABLE); } else { setUidFirewallRulesUL(FIREWALL_CHAIN_LOW_POWER_STANDBY, null, CHAIN_TOGGLE_DISABLE); } @@ -4822,10 +4816,8 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { final int effectiveBlockedReasons = getEffectiveBlockedReasons(uid); if (mUidState.contains(uid) && (effectiveBlockedReasons & BLOCKED_REASON_LOW_POWER_STANDBY) == 0) { - mUidFirewallLowPowerStandbyModeRules.put(uid, FIREWALL_RULE_ALLOW); setUidFirewallRuleUL(FIREWALL_CHAIN_LOW_POWER_STANDBY, uid, FIREWALL_RULE_ALLOW); } else { - mUidFirewallLowPowerStandbyModeRules.delete(uid); setUidFirewallRuleUL(FIREWALL_CHAIN_LOW_POWER_STANDBY, uid, FIREWALL_RULE_DEFAULT); } } @@ -4896,6 +4888,12 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { int[] idleUids = mUsageStats.getIdleUidsForUser(user.id); for (int uid : idleUids) { if (!mPowerSaveTempWhitelistAppIds.get(UserHandle.getAppId(uid), false)) { + if (mNeverApplyRulesToCoreUids && !isUidValidForRulesUL(uid)) { + // This check is needed to keep mUidFirewallStandbyRules free of any + // such uids. Doing this keeps it in sync with the actual rules applied + // in the underlying connectivity stack. + continue; + } // quick check: if this uid doesn't have INTERNET permission, it // doesn't have network access anyway, so it is a waste to mess // with it here. @@ -5198,6 +5196,11 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { @GuardedBy("mUidRulesFirstLock") private boolean isUidValidForAllowlistRulesUL(int uid) { + return isUidValidForRulesUL(uid); + } + + @GuardedBy("mUidRulesFirstLock") + private boolean isUidValidForRulesUL(int uid) { return UserHandle.isApp(uid) && hasInternetPermissionUL(uid); } @@ -5313,16 +5316,11 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { mActivityManagerInternal.onUidBlockedReasonsChanged(uid, BLOCKED_REASON_NONE); mUidPolicy.delete(uid); mUidFirewallStandbyRules.delete(uid); - mUidFirewallDozableRules.delete(uid); - mUidFirewallPowerSaveRules.delete(uid); - mUidFirewallBackgroundRules.delete(uid); mBackgroundTransitioningUids.delete(uid); mPowerSaveWhitelistExceptIdleAppIds.delete(uid); mPowerSaveWhitelistAppIds.delete(uid); mPowerSaveTempWhitelistAppIds.delete(uid); mAppIdleTempWhitelistAppIds.delete(uid); - mUidFirewallRestrictedModeRules.delete(uid); - mUidFirewallLowPowerStandbyModeRules.delete(uid); synchronized (mUidStateCallbackInfos) { mUidStateCallbackInfos.remove(uid); } @@ -6217,41 +6215,33 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { } } - private void addSdkSandboxUidsIfNeeded(SparseIntArray uidRules) { - final int size = uidRules.size(); - final SparseIntArray sdkSandboxUids = new SparseIntArray(); - for (int index = 0; index < size; index++) { - final int uid = uidRules.keyAt(index); - final int rule = uidRules.valueAt(index); - if (Process.isApplicationUid(uid)) { - sdkSandboxUids.put(Process.toSdkSandboxUid(uid), rule); - } - } - - for (int index = 0; index < sdkSandboxUids.size(); index++) { - final int uid = sdkSandboxUids.keyAt(index); - final int rule = sdkSandboxUids.valueAt(index); - uidRules.put(uid, rule); - } - } - /** * Set uid rules on a particular firewall chain. This is going to synchronize the rules given * here to netd. It will clean up dead rules and make sure the target chain only contains rules * specified here. */ + @GuardedBy("mUidRulesFirstLock") private void setUidFirewallRulesUL(int chain, SparseIntArray uidRules) { - addSdkSandboxUidsIfNeeded(uidRules); try { int size = uidRules.size(); - int[] uids = new int[size]; - int[] rules = new int[size]; + final IntArray uids = new IntArray(size); + final IntArray rules = new IntArray(size); for(int index = size - 1; index >= 0; --index) { - uids[index] = uidRules.keyAt(index); - rules[index] = uidRules.valueAt(index); + final int uid = uidRules.keyAt(index); + if (mNeverApplyRulesToCoreUids && !isUidValidForRulesUL(uid)) { + continue; + } + uids.add(uid); + rules.add(uidRules.valueAt(index)); + if (Process.isApplicationUid(uid)) { + uids.add(Process.toSdkSandboxUid(uid)); + rules.add(uidRules.valueAt(index)); + } } - mNetworkManager.setFirewallUidRules(chain, uids, rules); - mLogger.firewallRulesChanged(chain, uids, rules); + final int[] uidArray = uids.toArray(); + final int[] ruleArray = rules.toArray(); + mNetworkManager.setFirewallUidRules(chain, uidArray, ruleArray); + mLogger.firewallRulesChanged(chain, uidArray, ruleArray); } catch (IllegalStateException e) { Log.wtf(TAG, "problem setting firewall uid rules", e); } catch (RemoteException e) { @@ -6264,26 +6254,17 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { */ @GuardedBy("mUidRulesFirstLock") private void setUidFirewallRuleUL(int chain, int uid, int rule) { + if (mNeverApplyRulesToCoreUids && !isUidValidForRulesUL(uid)) { + return; + } if (Trace.isTagEnabled(Trace.TRACE_TAG_NETWORK)) { Trace.traceBegin(Trace.TRACE_TAG_NETWORK, "setUidFirewallRuleUL: " + chain + "/" + uid + "/" + rule); } try { - if (chain == FIREWALL_CHAIN_DOZABLE) { - mUidFirewallDozableRules.put(uid, rule); - } else if (chain == FIREWALL_CHAIN_STANDBY) { + if (chain == FIREWALL_CHAIN_STANDBY) { mUidFirewallStandbyRules.put(uid, rule); - } else if (chain == FIREWALL_CHAIN_POWERSAVE) { - mUidFirewallPowerSaveRules.put(uid, rule); - } else if (chain == FIREWALL_CHAIN_RESTRICTED) { - mUidFirewallRestrictedModeRules.put(uid, rule); - } else if (chain == FIREWALL_CHAIN_LOW_POWER_STANDBY) { - mUidFirewallLowPowerStandbyModeRules.put(uid, rule); - } else if (chain == FIREWALL_CHAIN_BACKGROUND) { - mUidFirewallBackgroundRules.put(uid, rule); - } - // Note that we do not need keep a separate cache of uid rules for chains that we do - // not call #setUidFirewallRulesUL for. + } try { mNetworkManager.setFirewallUidRule(chain, uid, rule); @@ -6328,6 +6309,8 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { * Resets all firewall rules associated with an UID. */ private void resetUidFirewallRules(int uid) { + // Resetting rules for uids with isUidValidForRulesUL = false should be OK as no rules + // should be previously set and the downstream code will skip no-op changes. try { mNetworkManager.setFirewallUidRule(FIREWALL_CHAIN_DOZABLE, uid, FIREWALL_RULE_DEFAULT); diff --git a/services/core/java/com/android/server/net/flags.aconfig b/services/core/java/com/android/server/net/flags.aconfig index 586baf022897..7f04e665567e 100644 --- a/services/core/java/com/android/server/net/flags.aconfig +++ b/services/core/java/com/android/server/net/flags.aconfig @@ -27,3 +27,13 @@ flag { purpose: PURPOSE_BUGFIX } } + +flag { + name: "never_apply_rules_to_core_uids" + namespace: "backstage_power" + description: "Removes all rule bookkeeping and evaluation logic for core uids and uids without the internet permission" + bug: "356956588" + metadata { + purpose: PURPOSE_BUGFIX + } +} diff --git a/services/core/java/com/android/server/net/watchlist/OWNERS b/services/core/java/com/android/server/net/watchlist/OWNERS index d0c4e553ad8c..eef1e46b2ba6 100644 --- a/services/core/java/com/android/server/net/watchlist/OWNERS +++ b/services/core/java/com/android/server/net/watchlist/OWNERS @@ -1,2 +1 @@ -alanstokes@google.com simonjw@google.com diff --git a/services/core/java/com/android/server/om/TEST_MAPPING b/services/core/java/com/android/server/om/TEST_MAPPING index 82e7817720af..ce047bb203b3 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 9e9802354a4d..ed6dfd8e948f 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/InstallPackageHelper.java b/services/core/java/com/android/server/pm/InstallPackageHelper.java index b079fed65d5d..26c1edb79787 100644 --- a/services/core/java/com/android/server/pm/InstallPackageHelper.java +++ b/services/core/java/com/android/server/pm/InstallPackageHelper.java @@ -4568,7 +4568,7 @@ final class InstallPackageHelper { PackageManagerException.INTERNAL_ERROR_SYSTEM_OVERLAY_STATIC); } } else { - if ((scanFlags & SCAN_AS_VENDOR) != 0) { + if ((scanFlags & (SCAN_AS_VENDOR | SCAN_AS_ODM)) != 0) { if (pkg.getTargetSdkVersion() < ScanPackageUtils.getVendorPartitionVersion()) { Slog.w(TAG, "System overlay " + pkg.getPackageName() + " targets an SDK below the required SDK level of vendor" diff --git a/services/core/java/com/android/server/pm/OWNERS b/services/core/java/com/android/server/pm/OWNERS index c10dfcb5e9bf..e8fc577d9f0f 100644 --- a/services/core/java/com/android/server/pm/OWNERS +++ b/services/core/java/com/android/server/pm/OWNERS @@ -27,6 +27,7 @@ per-file CrossProfile* = file:MULTIUSER_AND_ENTERPRISE_OWNERS per-file RestrictionsSet.java = file:MULTIUSER_AND_ENTERPRISE_OWNERS per-file UserRestriction* = file:MULTIUSER_AND_ENTERPRISE_OWNERS per-file User* = file:/MULTIUSER_OWNERS +per-file BackgroundUser* = file:/MULTIUSER_OWNERS # security per-file KeySetHandle.java = cbrubaker@google.com, nnk@google.com diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java index c0b8034b9a56..69c78eb155eb 100644 --- a/services/core/java/com/android/server/pm/PackageManagerService.java +++ b/services/core/java/com/android/server/pm/PackageManagerService.java @@ -371,6 +371,7 @@ public class PackageManagerService implements PackageSender, TestUtilityService private static final int SE_UID = Process.SE_UID; private static final int NETWORKSTACK_UID = Process.NETWORK_STACK_UID; private static final int UWB_UID = Process.UWB_UID; + private static final int VENDOR_DATA_UID = Process.VENDOR_DATA_UID; static final int SCAN_NO_DEX = 1 << 0; static final int SCAN_UPDATE_SIGNATURE = 1 << 1; @@ -2033,6 +2034,10 @@ public class PackageManagerService implements PackageSender, TestUtilityService // 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); @@ -2052,6 +2057,13 @@ public class PackageManagerService implements PackageSender, TestUtilityService 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"); @@ -2083,10 +2095,7 @@ public class PackageManagerService implements PackageSender, TestUtilityService 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 39565526f33e..2eb9a384a016 100644 --- a/services/core/java/com/android/server/pm/Settings.java +++ b/services/core/java/com/android/server/pm/Settings.java @@ -976,6 +976,21 @@ public final class Settings implements Watchable, Snappable, ResilientAtomicFile 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 e12b70f033c3..372bbc445b79 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 1c86c4f72ff9..64bcc22586fc 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/OWNERS b/services/core/java/com/android/server/power/OWNERS index 94340ec26cba..c1fad33fef0f 100644 --- a/services/core/java/com/android/server/power/OWNERS +++ b/services/core/java/com/android/server/power/OWNERS @@ -1,6 +1,7 @@ michaelwr@google.com santoscordon@google.com -philipjunker@google.com +petsjonkin@google.com +brup@google.com per-file ThermalManagerService.java=file:/THERMAL_OWNERS per-file LowPowerStandbyController.java=qingxun@google.com diff --git a/services/core/java/com/android/server/power/PowerManagerService.java b/services/core/java/com/android/server/power/PowerManagerService.java index ce0120c245d6..9a9c1fdac7ba 100644 --- a/services/core/java/com/android/server/power/PowerManagerService.java +++ b/services/core/java/com/android/server/power/PowerManagerService.java @@ -97,7 +97,6 @@ import android.provider.DeviceConfigInterface; 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; @@ -128,7 +127,6 @@ import com.android.server.RescueParty; 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; @@ -1274,8 +1272,7 @@ public final class PowerManagerService extends SystemService 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); @@ -4023,7 +4020,6 @@ public final class PowerManagerService extends SystemService 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 e64704a84cdf..4ce01d21903f 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 eb91a72c127a..d29dbfe4aa87 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 79224a580cd8..0ba1da9a9540 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/Rollback.java b/services/core/java/com/android/server/rollback/Rollback.java index 8f39ffb3f53c..685ab3a9424f 100644 --- a/services/core/java/com/android/server/rollback/Rollback.java +++ b/services/core/java/com/android/server/rollback/Rollback.java @@ -16,6 +16,8 @@ package com.android.server.rollback; +import static android.crashrecovery.flags.Flags.deprecateFlagsAndSettingsResets; + import static com.android.server.rollback.RollbackManagerServiceImpl.sendFailure; import android.Manifest; @@ -623,8 +625,10 @@ class Rollback { parentSession.addChildSessionId(sessionId); } - // Clear flags. - RescueParty.resetDeviceConfigForPackages(packageNames); + if (!deprecateFlagsAndSettingsResets()) { + // Clear flags. + RescueParty.resetDeviceConfigForPackages(packageNames); + } Consumer<Intent> onResult = result -> { mHandler.post(() -> { diff --git a/services/core/java/com/android/server/rollback/RollbackPackageHealthObserver.java b/services/core/java/com/android/server/rollback/RollbackPackageHealthObserver.java index c85ceac9ea55..4f28e023da92 100644 --- a/services/core/java/com/android/server/rollback/RollbackPackageHealthObserver.java +++ b/services/core/java/com/android/server/rollback/RollbackPackageHealthObserver.java @@ -154,12 +154,22 @@ public final class RollbackPackageHealthObserver implements PackageHealthObserve } } + Slog.i(TAG, "Checking available remediations for health check failure." + + " failedPackage: " + + (failedPackage == null ? null : failedPackage.getPackageName()) + + " failureReason: " + failureReason + + " available impact: " + impact); return impact; } @Override public boolean execute(@Nullable VersionedPackage failedPackage, @FailureReasons int rollbackReason, int mitigationCount) { + Slog.i(TAG, "Executing remediation." + + " failedPackage: " + + (failedPackage == null ? null : failedPackage.getPackageName()) + + " rollbackReason: " + rollbackReason + + " mitigationCount: " + mitigationCount); if (Flags.recoverabilityDetection()) { List<RollbackInfo> availableRollbacks = getAvailableRollbacks(); if (rollbackReason == PackageWatchdog.FAILURE_REASON_NATIVE_CRASH) { @@ -503,6 +513,10 @@ public final class RollbackPackageHealthObserver implements PackageHealthObserve @FailureReasons int rollbackReason) { assertInWorkerThread(); + Slog.i(TAG, "Rolling back package. RollbackId: " + rollback.getRollbackId() + + " failedPackage: " + + (failedPackage == null ? null : failedPackage.getPackageName()) + + " rollbackReason: " + rollbackReason); final RollbackManager rollbackManager = mContext.getSystemService(RollbackManager.class); int reasonToLog = WatchdogRollbackLogger.mapFailureReasonToMetric(rollbackReason); final String failedPackageToLog; diff --git a/services/core/java/com/android/server/rollback/TEST_MAPPING b/services/core/java/com/android/server/rollback/TEST_MAPPING index 2cc931bfac5b..291b8dbfbf13 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/sensorprivacy/SensorPrivacyService.java b/services/core/java/com/android/server/sensorprivacy/SensorPrivacyService.java index 52ef87cf949f..06a2565da75a 100644 --- a/services/core/java/com/android/server/sensorprivacy/SensorPrivacyService.java +++ b/services/core/java/com/android/server/sensorprivacy/SensorPrivacyService.java @@ -130,6 +130,7 @@ import android.util.proto.ProtoOutputStream; import com.android.internal.R; import com.android.internal.annotations.GuardedBy; +import com.android.internal.annotations.KeepForWeakReference; import com.android.internal.camera.flags.Flags; import com.android.internal.messages.nano.SystemMessageProto.SystemMessage; import com.android.internal.os.BackgroundThread; @@ -1944,8 +1945,12 @@ public final class SensorPrivacyService extends SystemService { } private class CallStateHelper { - private OutgoingEmergencyStateCallback mEmergencyStateCallback; - private CallStateCallback mCallStateCallback; + // TelephonyCallback instances are only weakly referenced when registered, so we need + // to ensure these fields are kept during optimization to preserve lifecycle semantics. + @KeepForWeakReference + private final OutgoingEmergencyStateCallback mEmergencyStateCallback; + @KeepForWeakReference + private final CallStateCallback mCallStateCallback; private boolean mIsInEmergencyCall; private boolean mMicUnmutedForEmergencyCall; 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 c1b825b3f8d1..8dbaa7e26c20 100644 --- a/services/core/java/com/android/server/stats/pull/StatsPullAtomService.java +++ b/services/core/java/com/android/server/stats/pull/StatsPullAtomService.java @@ -69,6 +69,8 @@ import static com.android.server.stats.pull.IonMemoryUtil.readSystemIonHeapSizeF 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 com.android.server.stats.pull.netstats.NetworkStatsUtils.isAddEntriesSupported; import static libcore.io.IoUtils.closeQuietly; @@ -207,7 +209,6 @@ import com.android.internal.os.SelectedProcessCpuThreadReader; 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; @@ -1366,14 +1367,22 @@ public class StatsPullAtomService extends SystemService { @NonNull private static NetworkStats removeEmptyEntries(NetworkStats stats) { - NetworkStats ret = new NetworkStats(0, 1); + final ArrayList<NetworkStats.Entry> entries = new ArrayList<>(); for (NetworkStats.Entry e : stats) { if (e.getRxBytes() != 0 || e.getRxPackets() != 0 || e.getTxBytes() != 0 || e.getTxPackets() != 0 || e.getOperations() != 0) { - ret = ret.addEntry(e); + entries.add(e); } } - return ret; + if (isAddEntriesSupported()) { + return new NetworkStats(0, entries.size()).addEntries(entries); + } else { + NetworkStats outputStats = new NetworkStats(0L, 1); + for (NetworkStats.Entry e : entries) { + outputStats = outputStats.addEntry(e); + } + return outputStats; + } } private void addNetworkStats(int atomTag, @NonNull List<StatsEvent> ret, @@ -1552,7 +1561,7 @@ public class StatsPullAtomService extends SystemService { currentTimeInMillis); final NetworkStats nonTaggedStats = - NetworkStatsUtils.fromPublicNetworkStats(queryNonTaggedStats); + fromPublicNetworkStats(queryNonTaggedStats); queryNonTaggedStats.close(); if (!includeTags) return nonTaggedStats; @@ -1561,7 +1570,7 @@ public class StatsPullAtomService extends SystemService { currentTimeInMillis - elapsedMillisSinceBoot - bucketDuration, currentTimeInMillis); final NetworkStats taggedStats = - NetworkStatsUtils.fromPublicNetworkStats(queryTaggedStats); + fromPublicNetworkStats(queryTaggedStats); queryTaggedStats.close(); return nonTaggedStats.add(taggedStats); } @@ -1686,11 +1695,19 @@ public class StatsPullAtomService extends SystemService { @NonNull private NetworkStats sliceNetworkStats(@NonNull NetworkStats stats, @NonNull Function<NetworkStats.Entry, NetworkStats.Entry> slicer) { - NetworkStats ret = new NetworkStats(0, 1); + final ArrayList<NetworkStats.Entry> entries = new ArrayList(); for (NetworkStats.Entry e : stats) { - ret = ret.addEntry(slicer.apply(e)); + entries.add(slicer.apply(e)); + } + if (isAddEntriesSupported()) { + return new NetworkStats(0, entries.size()).addEntries(entries); + } else { + NetworkStats outputStats = new NetworkStats(0L, 1); + for (NetworkStats.Entry e : entries) { + outputStats = outputStats.addEntry(e); + } + return outputStats; } - return ret; } private void registerWifiBytesTransferBackground() { 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 000000000000..0318bdd61473 --- /dev/null +++ b/services/core/java/com/android/server/stats/pull/netstats/NetworkStatsUtils.java @@ -0,0 +1,125 @@ +/* + * 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; +import com.android.server.stats.Flags; + +import java.util.ArrayList; + +/** + * 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) { + final ArrayList<android.net.NetworkStats.Entry> entries = new ArrayList<>(); + while (publiceNetworkStats.hasNextBucket()) { + NetworkStats.Bucket bucket = new NetworkStats.Bucket(); + publiceNetworkStats.getNextBucket(bucket); + entries.add(fromBucket(bucket)); + } + android.net.NetworkStats stats = new android.net.NetworkStats(0L, 1); + // The new API is only supported on devices running the mainline version of `NetworkStats`. + // It should always be used when available for memory efficiency. + if (isAddEntriesSupported()) { + stats = stats.addEntries(entries); + } else { + for (android.net.NetworkStats.Entry entry : entries) { + 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; + } + + public static boolean isAddEntriesSupported() { + return Flags.netstatsUseAddEntries(); + } +} diff --git a/services/core/java/com/android/server/stats/stats_flags.aconfig b/services/core/java/com/android/server/stats/stats_flags.aconfig index 6faa2737ac30..fd1088328bda 100644 --- a/services/core/java/com/android/server/stats/stats_flags.aconfig +++ b/services/core/java/com/android/server/stats/stats_flags.aconfig @@ -1,6 +1,20 @@ package: "com.android.server.stats" container: "system" +# Note: To ensure compatibility across all release configurations, initiate the ramp-up process +# only after the 'com.android.net.flags.netstats_add_entries' flag has been fully deployed. +# This flag provides the necessary API from the Connectivity module. +# The flag was added because the flag 'com.android.net.flags.netstats_add_entries' for API +# is already being rolled out, and modifying behavior during an active rollout might +# lead to unwanted issues. +flag { + name: "netstats_use_add_entries" + namespace: "statsd" + description: "Use NetworkStats#addEntries to reduce memory footprint" + bug: "335680025" + is_fixed_read_only: true +} + flag { name: "add_mobile_bytes_transfer_by_proc_state_puller" namespace: "statsd" diff --git a/services/core/java/com/android/server/timezonedetector/OWNERS b/services/core/java/com/android/server/timezonedetector/OWNERS index 485a0ddb06d8..4220d145754f 100644 --- a/services/core/java/com/android/server/timezonedetector/OWNERS +++ b/services/core/java/com/android/server/timezonedetector/OWNERS @@ -1,8 +1,7 @@ # Bug component: 847766 # This is the main list for platform time / time zone detection maintainers, for this dir and # ultimately referenced by other OWNERS files for components maintained by the same team. -nfuller@google.com +boullanger@google.com jmorace@google.com kanyinsola@google.com -mingaleev@google.com -narayan@google.com +mingaleev@google.com
\ No newline at end of file diff --git a/services/core/java/com/android/server/timezonedetector/location/ZoneInfoDbTimeZoneProviderEventPreProcessor.java b/services/core/java/com/android/server/timezonedetector/location/ZoneInfoDbTimeZoneProviderEventPreProcessor.java index aa2b74edaff2..58c3ba5013fa 100644 --- a/services/core/java/com/android/server/timezonedetector/location/ZoneInfoDbTimeZoneProviderEventPreProcessor.java +++ b/services/core/java/com/android/server/timezonedetector/location/ZoneInfoDbTimeZoneProviderEventPreProcessor.java @@ -56,12 +56,17 @@ public class ZoneInfoDbTimeZoneProviderEventPreProcessor // enables immediate failover to a secondary provider, one that might provide valid IDs for // the same location, which should provide better behavior than just ignoring the event. if (hasInvalidZones(event)) { - TimeZoneProviderStatus providerStatus = new TimeZoneProviderStatus.Builder( - event.getTimeZoneProviderStatus()) - .setTimeZoneResolutionOperationStatus(OPERATION_STATUS_FAILED) - .build(); - return TimeZoneProviderEvent.createUncertainEvent( - event.getCreationElapsedMillis(), providerStatus); + TimeZoneProviderStatus providerStatus = event.getTimeZoneProviderStatus(); + TimeZoneProviderStatus.Builder providerStatusBuilder; + if (providerStatus != null) { + providerStatusBuilder = new TimeZoneProviderStatus.Builder(providerStatus); + } else { + providerStatusBuilder = new TimeZoneProviderStatus.Builder(); + } + return TimeZoneProviderEvent.createUncertainEvent(event.getCreationElapsedMillis(), + providerStatusBuilder + .setTimeZoneResolutionOperationStatus(OPERATION_STATUS_FAILED) + .build()); } return event; diff --git a/services/core/java/com/android/server/tracing/TracingServiceProxy.java b/services/core/java/com/android/server/tracing/TracingServiceProxy.java index 68eb8eb1deaf..480db25ec606 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 @@ public class TracingServiceProxy extends SystemService { // 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 @@ public class TracingServiceProxy extends SystemService { 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 @@ public class TracingServiceProxy extends SystemService { } } - private void notifyTraceur(boolean sessionStolen) { + private void notifyTraceur() { final Intent intent = new Intent(); try { @@ -141,11 +138,7 @@ public class TracingServiceProxy extends SystemService { 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/trust/TrustManagerService.java b/services/core/java/com/android/server/trust/TrustManagerService.java index 3138a9ea9426..953aae9588dd 100644 --- a/services/core/java/com/android/server/trust/TrustManagerService.java +++ b/services/core/java/com/android/server/trust/TrustManagerService.java @@ -16,6 +16,7 @@ package com.android.server.trust; +import static android.security.Flags.shouldTrustManagerListenForPrimaryAuth; import static android.service.trust.GrantTrustResult.STATUS_UNLOCKED_BY_GRANT; import static android.service.trust.TrustAgentService.FLAG_GRANT_TRUST_TEMPORARY_AND_RENEWABLE; @@ -84,6 +85,9 @@ import com.android.internal.content.PackageMonitor; import com.android.internal.infra.AndroidFuture; import com.android.internal.util.DumpUtils; import com.android.internal.widget.LockPatternUtils; +import com.android.internal.widget.LockSettingsInternal; +import com.android.internal.widget.LockSettingsStateListener; +import com.android.server.LocalServices; import com.android.server.SystemService; import com.android.server.servicewatcher.CurrentUserServiceSupplier; import com.android.server.servicewatcher.ServiceWatcher; @@ -159,6 +163,7 @@ public class TrustManagerService extends SystemService { /* package */ final TrustArchive mArchive = new TrustArchive(); private final Context mContext; + private final LockSettingsInternal mLockSettings; private final LockPatternUtils mLockPatternUtils; private final KeyStoreAuthorization mKeyStoreAuthorization; private final UserManager mUserManager; @@ -250,6 +255,20 @@ public class TrustManagerService extends SystemService { private final StrongAuthTracker mStrongAuthTracker; + // Used to subscribe to device credential auth attempts. + private final LockSettingsStateListener mLockSettingsStateListener = + new LockSettingsStateListener() { + @Override + public void onAuthenticationSucceeded(int userId) { + mHandler.obtainMessage(MSG_DISPATCH_UNLOCK_ATTEMPT, 1, userId).sendToTarget(); + } + + @Override + public void onAuthenticationFailed(int userId) { + mHandler.obtainMessage(MSG_DISPATCH_UNLOCK_ATTEMPT, 0, userId).sendToTarget(); + } + }; + private boolean mTrustAgentsCanRun = false; private int mCurrentUser = UserHandle.USER_SYSTEM; @@ -294,6 +313,7 @@ public class TrustManagerService extends SystemService { mHandler = createHandler(injector.getLooper()); mUserManager = (UserManager) mContext.getSystemService(Context.USER_SERVICE); mActivityManager = (ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE); + mLockSettings = LocalServices.getService(LockSettingsInternal.class); mLockPatternUtils = injector.getLockPatternUtils(); mKeyStoreAuthorization = injector.getKeyStoreAuthorization(); mStrongAuthTracker = new StrongAuthTracker(context, injector.getLooper()); @@ -315,6 +335,9 @@ public class TrustManagerService extends SystemService { checkNewAgents(); mPackageMonitor.register(mContext, mHandler.getLooper(), UserHandle.ALL, true); mReceiver.register(mContext); + if (shouldTrustManagerListenForPrimaryAuth()) { + mLockSettings.registerLockSettingsStateListener(mLockSettingsStateListener); + } mLockPatternUtils.registerStrongAuthTracker(mStrongAuthTracker); mFingerprintManager = mContext.getSystemService(FingerprintManager.class); mFaceManager = mContext.getSystemService(FaceManager.class); @@ -1026,12 +1049,7 @@ public class TrustManagerService extends SystemService { continue; } - final boolean trusted; - if (android.security.Flags.fixUnlockedDeviceRequiredKeysV2()) { - trusted = getUserTrustStateInner(id) == TrustState.TRUSTED; - } else { - trusted = aggregateIsTrusted(id); - } + final boolean trusted = getUserTrustStateInner(id) == TrustState.TRUSTED; boolean showingKeyguard = true; boolean biometricAuthenticated = false; boolean currentUserIsUnlocked = false; @@ -1092,19 +1110,15 @@ public class TrustManagerService extends SystemService { private void notifyKeystoreOfDeviceLockState(int userId, boolean isLocked) { if (isLocked) { - if (android.security.Flags.fixUnlockedDeviceRequiredKeysV2()) { - // A profile with unified challenge is unlockable not by its own biometrics and - // trust agents, but rather by those of the parent user. Therefore, when protecting - // the profile's UnlockedDeviceRequired keys, we must use the parent's list of - // biometric SIDs and weak unlock methods, not the profile's. - int authUserId = mLockPatternUtils.isProfileWithUnifiedChallenge(userId) - ? resolveProfileParent(userId) : userId; - - mKeyStoreAuthorization.onDeviceLocked(userId, getBiometricSids(authUserId), - isWeakUnlockMethodEnabled(authUserId)); - } else { - mKeyStoreAuthorization.onDeviceLocked(userId, getBiometricSids(userId), false); - } + // A profile with unified challenge is unlockable not by its own biometrics and + // trust agents, but rather by those of the parent user. Therefore, when protecting + // the profile's UnlockedDeviceRequired keys, we must use the parent's list of + // biometric SIDs and weak unlock methods, not the profile's. + int authUserId = mLockPatternUtils.isProfileWithUnifiedChallenge(userId) + ? resolveProfileParent(userId) : userId; + + mKeyStoreAuthorization.onDeviceLocked(userId, getBiometricSids(authUserId), + isWeakUnlockMethodEnabled(authUserId)); } else { // Notify Keystore that the device is now unlocked for the user. Note that for unlocks // with LSKF, this is redundant with the call from LockSettingsService which provides diff --git a/services/core/java/com/android/server/uri/TEST_MAPPING b/services/core/java/com/android/server/uri/TEST_MAPPING index b42d154e04a7..0d756bb984d1 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 bb7cea98eda0..dcf0049001cd 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/wallpaper/WallpaperManagerService.java b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java index 9a3a2743b66d..72c7be34597e 100644 --- a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java +++ b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java @@ -651,9 +651,12 @@ public class WallpaperManagerService extends IWallpaperManager.Stub synchronized (mLock) { if (mLastWallpaper != null) { WallpaperData targetWallpaper = null; - if (mLastWallpaper.connection.containsDisplay(displayId)) { + if (mLastWallpaper.connection != null && + mLastWallpaper.connection.containsDisplay(displayId)) { targetWallpaper = mLastWallpaper; - } else if (mFallbackWallpaper.connection.containsDisplay(displayId)) { + } else if (mFallbackWallpaper != null && + mFallbackWallpaper.connection != null && + mFallbackWallpaper.connection.containsDisplay(displayId)) { targetWallpaper = mFallbackWallpaper; } if (targetWallpaper == null) return; diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java index de16683f2d77..a076cf6bf6ab 100644 --- a/services/core/java/com/android/server/wm/ActivityRecord.java +++ b/services/core/java/com/android/server/wm/ActivityRecord.java @@ -377,6 +377,7 @@ import android.window.WindowOnBackInvokedDispatcher; import com.android.internal.R; import com.android.internal.annotations.GuardedBy; +import com.android.internal.annotations.KeepForWeakReference; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.app.ResolverActivity; import com.android.internal.content.ReferrerIntent; @@ -968,6 +969,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A private RemoteCallbackList<IScreenCaptureObserver> mCaptureCallbacks; + // Ensure the field is kept during optimization to preserve downstream weak refs. + @KeepForWeakReference private final ColorDisplayService.ColorTransformController mColorTransformController = (matrix, translation) -> mWmService.mH.post(() -> { synchronized (mWmService.mGlobalLock) { diff --git a/services/core/java/com/android/server/wm/AppWarnings.java b/services/core/java/com/android/server/wm/AppWarnings.java index 9fd543fca30e..fcaab2c0f8c7 100644 --- a/services/core/java/com/android/server/wm/AppWarnings.java +++ b/services/core/java/com/android/server/wm/AppWarnings.java @@ -152,10 +152,12 @@ class AppWarnings { * @param r activity record for which the warning may be displayed */ public void showUnsupportedDisplaySizeDialogIfNeeded(ActivityRecord r) { - final Configuration globalConfig = mAtm.getGlobalConfiguration(); - if (globalConfig.densityDpi != DisplayMetrics.DENSITY_DEVICE_STABLE + final DisplayContent dc = r.getDisplayContent(); + final Configuration config = dc == null + ? mAtm.getGlobalConfiguration() : dc.getConfiguration(); + if (config.densityDpi != DisplayMetrics.DENSITY_DEVICE_STABLE && r.info.applicationInfo.requiresSmallestWidthDp - > globalConfig.smallestScreenWidthDp) { + > config.smallestScreenWidthDp) { mUiHandler.showUnsupportedDisplaySizeDialog(r); } } diff --git a/services/core/java/com/android/server/wm/RootWindowContainer.java b/services/core/java/com/android/server/wm/RootWindowContainer.java index 4a564157c46f..94e3c1f48a50 100644 --- a/services/core/java/com/android/server/wm/RootWindowContainer.java +++ b/services/core/java/com/android/server/wm/RootWindowContainer.java @@ -1003,6 +1003,7 @@ class RootWindowContainer extends WindowContainer<DisplayContent> // complete configuration. continue; } + win.updateSurfacePositionIfNeeded(); win.reportResized(); mWmService.mResizingWindows.remove(i); } diff --git a/services/core/java/com/android/server/wm/SafeActivityOptions.java b/services/core/java/com/android/server/wm/SafeActivityOptions.java index f2dc55f38bc3..b452131188c6 100644 --- a/services/core/java/com/android/server/wm/SafeActivityOptions.java +++ b/services/core/java/com/android/server/wm/SafeActivityOptions.java @@ -140,7 +140,9 @@ public class SafeActivityOptions { } private ActivityOptions cloneLaunchingOptions(ActivityOptions options) { - return options == null ? null : ActivityOptions.makeBasic() + if (options == null) return null; + + final ActivityOptions cloneOptions = ActivityOptions.makeBasic() .setLaunchTaskDisplayArea(options.getLaunchTaskDisplayArea()) .setLaunchDisplayId(options.getLaunchDisplayId()) .setCallerDisplayId(options.getCallerDisplayId()) @@ -150,6 +152,8 @@ public class SafeActivityOptions { .setPendingIntentCreatorBackgroundActivityStartMode( options.getPendingIntentCreatorBackgroundActivityStartMode()) .setRemoteTransition(options.getRemoteTransition()); + cloneOptions.setLaunchWindowingMode(options.getLaunchWindowingMode()); + return cloneOptions; } /** diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java index 787c5d6f7699..728f739f9f8d 100644 --- a/services/core/java/com/android/server/wm/Task.java +++ b/services/core/java/com/android/server/wm/Task.java @@ -2290,7 +2290,7 @@ class Task extends TaskFragment { // Apply crop to root tasks only and clear the crops of the descendant tasks. int width = 0; int height = 0; - if (isRootTask()) { + if (isRootTask() && !mTransitionController.mIsWaitingForDisplayEnabled) { final Rect taskBounds = getBounds(); width = taskBounds.width(); height = taskBounds.height(); @@ -4771,6 +4771,9 @@ class Task extends TaskFragment { 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 dcfe350b1c42..84df11a2746b 100644 --- a/services/core/java/com/android/server/wm/Transition.java +++ b/services/core/java/com/android/server/wm/Transition.java @@ -1809,8 +1809,9 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener { // 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 86440ac3782d..a67e856f93cd 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 @@ class WallpaperController { 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/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index b814ccd2babe..aaa7f12690fb 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -3843,7 +3843,7 @@ public class WindowManagerService extends IWindowManager.Stub hideBootMessagesLocked(); // If the screen still doesn't come up after 30 seconds, give // up and turn it on. - mH.sendEmptyMessageDelayed(H.BOOT_TIMEOUT, 30 * 1000); + mH.sendEmptyMessageDelayed(H.BOOT_TIMEOUT, 30 * 1000 * Build.HW_TIMEOUT_MULTIPLIER); } mPolicy.systemBooted(); diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java index dcd4bd68c3fc..fc7d3dca1c29 100644 --- a/services/core/java/com/android/server/wm/WindowState.java +++ b/services/core/java/com/android/server/wm/WindowState.java @@ -2374,6 +2374,8 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP mWmService.mDisplayManagerInternal.onPresentation(dc.getDisplay().getDisplayId(), /*isShown=*/ false); } + // Check if window provides non decor insets before clearing its provided insets. + final boolean windowProvidesDisplayDecorInsets = providesDisplayDecorInsets(); dc.getDisplayPolicy().removeWindowLw(this); @@ -2384,6 +2386,18 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP 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 @@ -2436,16 +2450,10 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP 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 @@ -2455,7 +2463,9 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP // 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. @@ -2504,21 +2514,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP } } - // 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, @@ -5283,6 +5279,14 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP 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/core/jni/OWNERS b/services/core/jni/OWNERS index 1667e273e19a..b622751fc3e8 100644 --- a/services/core/jni/OWNERS +++ b/services/core/jni/OWNERS @@ -27,7 +27,8 @@ per-file com_android_server_power_stats_* = file:/BATTERY_STATS_OWNERS per-file com_android_server_security_* = file:/core/java/android/security/OWNERS per-file com_android_server_tv_* = file:/media/java/android/media/tv/OWNERS per-file com_android_server_vibrator_* = file:/services/core/java/com/android/server/vibrator/OWNERS -per-file com_android_server_am_CachedAppOptimizer.cpp = timmurray@google.com, edgararriaga@google.com, dualli@google.com, carmenjackson@google.com, philipcuadra@google.com +per-file com_android_server_am_CachedAppOptimizer.cpp = file:/PERFORMANCE_OWNERS +per-file com_android_server_am_Freezer.cpp = file:/PERFORMANCE_OWNERS per-file com_android_server_companion_virtual_InputController.cpp = file:/services/companion/java/com/android/server/companion/virtual/OWNERS # Memory diff --git a/services/core/jni/com_android_server_input_InputManagerService.cpp b/services/core/jni/com_android_server_input_InputManagerService.cpp index 1f0c827083ac..9f0e8681702b 100644 --- a/services/core/jni/com_android_server_input_InputManagerService.cpp +++ b/services/core/jni/com_android_server_input_InputManagerService.cpp @@ -1847,10 +1847,6 @@ static void handleInputChannelDisposed(JNIEnv* env, jobject /* inputChannelObj * const std::shared_ptr<InputChannel>& inputChannel, void* data) { NativeInputManager* im = static_cast<NativeInputManager*>(data); - - ALOGW("Input channel object '%s' was disposed without first being removed with " - "the input manager!", - inputChannel->getName().c_str()); im->removeInputChannel(inputChannel->getConnectionToken()); } diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java index e8204e0434c3..f1d858fa1f6c 100644 --- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java @@ -1114,9 +1114,9 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { } @Override - public void onUserUnlocked(@NonNull TargetUser user) { - if (user.isPreCreated()) return; - mService.handleOnUserUnlocked(user.getUserIdentifier()); + public void onUserSwitching(@NonNull TargetUser from, @NonNull TargetUser to) { + if (to.isPreCreated()) return; + mService.handleOnUserSwitching(from.getUserIdentifier(), to.getUserIdentifier()); } } @@ -3696,8 +3696,8 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { mDevicePolicyEngine.handleUnlockUser(userId); } - void handleOnUserUnlocked(int userId) { - showNewUserDisclaimerIfNecessary(userId); + void handleOnUserSwitching(int fromUserId, int toUserId) { + showNewUserDisclaimerIfNecessary(toUserId); } void handleStopUser(int userId) { diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/EnterpriseSpecificIdCalculator.java b/services/devicepolicy/java/com/android/server/devicepolicy/EnterpriseSpecificIdCalculator.java index cbd28475bc26..6e038f9b67a0 100644 --- a/services/devicepolicy/java/com/android/server/devicepolicy/EnterpriseSpecificIdCalculator.java +++ b/services/devicepolicy/java/com/android/server/devicepolicy/EnterpriseSpecificIdCalculator.java @@ -17,6 +17,7 @@ package com.android.server.devicepolicy; import android.content.Context; +import android.content.pm.PackageManager; import android.content.pm.VerifierDeviceIdentity; import android.net.wifi.WifiManager; import android.os.Build; @@ -77,13 +78,14 @@ class EnterpriseSpecificIdCalculator { mMeid = meid; mSerialNumber = Build.getSerial(); WifiManager wifiManager = context.getSystemService(WifiManager.class); - Preconditions.checkState(wifiManager != null, "Unable to access WiFi service"); - final String[] macAddresses = wifiManager.getFactoryMacAddresses(); - if (macAddresses == null || macAddresses.length == 0) { - mMacAddress = ""; - } else { - mMacAddress = macAddresses[0]; + String macAddress = ""; + if (context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_WIFI)) { + final String[] macAddresses = wifiManager.getFactoryMacAddresses(); + if (macAddresses != null && macAddresses.length > 0) { + macAddress = macAddresses[0]; + } } + mMacAddress = macAddress; } private static String getPaddedTruncatedString(String input, int maxLength) { diff --git a/services/fakes/Android.bp b/services/fakes/Android.bp index 148054b31e89..d44bb5ae302c 100644 --- a/services/fakes/Android.bp +++ b/services/fakes/Android.bp @@ -16,5 +16,5 @@ filegroup { "java/**/*.java", ], path: "java", - visibility: ["//frameworks/base"], + visibility: ["//frameworks/base/ravenwood:__subpackages__"], } 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 6393e11b7432..1db9e8d545e4 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 21e33dd1b99a..f827b5508015 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/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java index 107c2947c550..cdca948f91ac 100644 --- a/services/java/com/android/server/SystemServer.java +++ b/services/java/com/android/server/SystemServer.java @@ -2435,11 +2435,11 @@ public final class SystemServer implements Dumpable { t.traceEnd(); } - t.traceBegin("CertBlacklister"); + t.traceBegin("CertBlocklister"); try { - CertBlacklister blacklister = new CertBlacklister(context); + CertBlocklister blocklister = new CertBlocklister(context); } catch (Throwable e) { - reportWtf("starting CertBlacklister", e); + reportWtf("starting CertBlocklister", e); } t.traceEnd(); diff --git a/services/net/Android.bp b/services/net/Android.bp index 3d40f6445834..927146db0a24 100644 --- a/services/net/Android.bp +++ b/services/net/Android.bp @@ -21,6 +21,7 @@ java_library_static { ":services.net-sources", ], static_libs: [ + "modules-utils-build_system", "netd-client", "networkstack-client", "net-utils-services-common", diff --git a/services/profcollect/src/com/android/server/profcollect/ProfcollectForwardingService.java b/services/profcollect/src/com/android/server/profcollect/ProfcollectForwardingService.java index cd70ed23a824..105147fe212d 100644 --- a/services/profcollect/src/com/android/server/profcollect/ProfcollectForwardingService.java +++ b/services/profcollect/src/com/android/server/profcollect/ProfcollectForwardingService.java @@ -46,11 +46,12 @@ import com.android.server.LocalManagerRegistry; 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.concurrent.ThreadLocalRandom; +import java.util.Arrays; import java.util.concurrent.TimeUnit; /** @@ -274,30 +275,15 @@ public final class ProfcollectForwardingService extends SystemService { 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_once("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"); + } } } @@ -317,20 +303,9 @@ public final class ProfcollectForwardingService extends SystemService { 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_once("dex2oat"); - } catch (RemoteException e) { - Log.e(LOG_TAG, "Failed to initiate trace: " + e.getMessage()); - } - }, 1000); + Utils.traceSystem(mIProfcollect, "dex2oat", /* delayMs */ 1000); } } @@ -353,6 +328,9 @@ public final class ProfcollectForwardingService extends SystemService { private static void createAndUploadReport(ProfcollectForwardingService pfs) { BackgroundThread.get().getThreadHandler().post(() -> { + if (pfs.mIProfcollect == null) { + return; + } String reportName; try { reportName = pfs.mIProfcollect.report(pfs.mUsageSetting) + ".zip"; @@ -378,28 +356,23 @@ public final class ProfcollectForwardingService extends SystemService { @Override public void onCameraOpened(String cameraId, String packageId) { Log.d(LOG_TAG, "Received camera open event from: " + packageId); - // Skip face auth and Android System Intelligence, since they trigger way too - // often. - if (packageId.startsWith("client.pid") - || packageId.equals("com.google.android.as")) { + // Skip face auth since it triggers way too often. + if (packageId.startsWith("client.pid")) { 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) { + // Additional vendor specific list of apps to skip. + String[] cameraSkipPackages = + getContext().getResources().getStringArray( + R.array.config_profcollectOnCameraOpenedSkipPackages); + if (Arrays.asList(cameraSkipPackages).contains(packageId)) { return; } - // Wait for 1s before starting tracing. - BackgroundThread.get().getThreadHandler().postDelayed(() -> { - try { - mIProfcollect.trace_once("camera"); - } catch (RemoteException e) { - Log.e(LOG_TAG, "Failed to initiate trace: " + e.getMessage()); - } - }, 1000); + if (Utils.withFrequency("camera_trace_freq", 10)) { + Utils.traceProcess(mIProfcollect, + "camera", + "android.hardware.camera.provider", + /* durationMs */ 5000); + } } }, 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 000000000000..850880256cfa --- /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 bf30781b434e..cdd41abf6c7c 100644 --- a/services/proguard.flags +++ b/services/proguard.flags @@ -52,9 +52,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 @@ -107,8 +104,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 4149e44a2ee9..9808d54202e5 100644 --- a/services/tests/mockingservicestests/Android.bp +++ b/services/tests/mockingservicestests/Android.bp @@ -53,6 +53,7 @@ android_test { "mockingservicestests-utils-mockito", "mockito-target-extended-minus-junit4", "platform-compat-test-rules", + "platform-parametric-runner-lib", "platform-test-annotations", "PlatformProperties", "service-blobstore", @@ -136,3 +137,199 @@ android_ravenwood_test { ], 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/RescuePartyTest.java b/services/tests/mockingservicestests/src/com/android/server/RescuePartyTest.java index 42814e7c775e..f2acbc31b008 100644 --- a/services/tests/mockingservicestests/src/com/android/server/RescuePartyTest.java +++ b/services/tests/mockingservicestests/src/com/android/server/RescuePartyTest.java @@ -27,7 +27,6 @@ import static com.android.dx.mockito.inline.extended.ExtendedMockito.verify; import static com.android.dx.mockito.inline.extended.ExtendedMockito.when; import static com.android.server.RescueParty.DEFAULT_FACTORY_RESET_THROTTLE_DURATION_MIN; import static com.android.server.RescueParty.LEVEL_FACTORY_RESET; -import static com.android.server.RescueParty.RESCUE_LEVEL_FACTORY_RESET; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -36,7 +35,6 @@ import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.isNull; import static org.mockito.Mockito.never; import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.times; import android.content.ContentResolver; import android.content.Context; @@ -47,6 +45,9 @@ import android.crashrecovery.flags.Flags; import android.os.RecoverySystem; import android.os.SystemProperties; import android.os.UserHandle; +import android.platform.test.annotations.DisableFlags; +import android.platform.test.annotations.EnableFlags; +import android.platform.test.flag.junit.FlagsParameterization; import android.platform.test.flag.junit.SetFlagsRule; import android.provider.DeviceConfig; import android.provider.Settings; @@ -61,6 +62,9 @@ import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; import org.mockito.Answers; import org.mockito.ArgumentCaptor; import org.mockito.Captor; @@ -74,14 +78,17 @@ import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.List; -import java.util.Map; import java.util.concurrent.Executor; import java.util.concurrent.TimeUnit; + /** * Test RescueParty. */ +@RunWith(Parameterized.class) public class RescuePartyTest { + @Rule + public SetFlagsRule mSetFlagsRule; private static final long CURRENT_NETWORK_TIME_MILLIS = 0L; private static final String FAKE_NATIVE_NAMESPACE1 = "native1"; private static final String FAKE_NATIVE_NAMESPACE2 = "native2"; @@ -104,9 +111,6 @@ public class RescuePartyTest { private static final String PROP_DISABLE_FACTORY_RESET_FLAG = "persist.device_config.configuration.disable_rescue_party_factory_reset"; - @Rule - public final SetFlagsRule mSetFlagsRule = new SetFlagsRule(); - private MockitoSession mSession; private HashMap<String, String> mSystemSettingsMap; private HashMap<String, String> mCrashRecoveryPropertiesMap; @@ -130,6 +134,17 @@ public class RescuePartyTest { @Captor private ArgumentCaptor<List<String>> mPackageListCaptor; + @Parameters(name = "{0}") + public static List<FlagsParameterization> getFlags() { + return FlagsParameterization.allCombinationsOf( + Flags.FLAG_RECOVERABILITY_DETECTION, + Flags.FLAG_DEPRECATE_FLAGS_AND_SETTINGS_RESETS); + } + + public RescuePartyTest(FlagsParameterization flags) { + mSetFlagsRule = new SetFlagsRule(flags); + } + @Before public void setUp() throws Exception { mSession = @@ -227,9 +242,6 @@ public class RescuePartyTest { setCrashRecoveryPropRescueBootCount(0); SystemProperties.set(RescueParty.PROP_ENABLE_RESCUE, Boolean.toString(true)); SystemProperties.set(PROP_DEVICE_CONFIG_DISABLE_FLAG, Boolean.toString(false)); - - // enable flag resets for tests - mSetFlagsRule.enableFlags(Flags.FLAG_ALLOW_RESCUE_PARTY_FLAG_RESETS); } @After @@ -238,10 +250,10 @@ public class RescuePartyTest { } @Test - public void testBootLoopDetectionWithExecutionForAllRescueLevels() { + @DisableFlags({Flags.FLAG_RECOVERABILITY_DETECTION, + Flags.FLAG_DEPRECATE_FLAGS_AND_SETTINGS_RESETS}) + public void testBootLoop() { // this is old test where the flag needs to be disabled - mSetFlagsRule.disableFlags(Flags.FLAG_RECOVERABILITY_DETECTION); - RescueParty.onSettingsProviderPublished(mMockContext); verify(() -> DeviceConfig.setMonitorCallback(eq(mMockContentResolver), any(Executor.class), @@ -250,9 +262,6 @@ public class RescuePartyTest { noteBoot(1); - verifySettingsResets(Settings.RESET_MODE_UNTRUSTED_DEFAULTS, /*resetNamespaces=*/ null, - verifiedTimesMap); - // Record DeviceConfig accesses RescuePartyObserver observer = RescuePartyObserver.getInstance(mMockContext); DeviceConfig.MonitorCallback monitorCallback = mMonitorCallbackCaptor.getValue(); @@ -262,15 +271,8 @@ public class RescuePartyTest { final String[] expectedAllResetNamespaces = new String[]{NAMESPACE1, NAMESPACE2}; noteBoot(2); - - verifySettingsResets(Settings.RESET_MODE_UNTRUSTED_CHANGES, expectedAllResetNamespaces, - verifiedTimesMap); - noteBoot(3); - verifySettingsResets(Settings.RESET_MODE_TRUSTED_DEFAULTS, expectedAllResetNamespaces, - verifiedTimesMap); - noteBoot(4); assertTrue(RescueParty.isRebootPropertySet()); @@ -278,10 +280,22 @@ public class RescuePartyTest { noteBoot(5); assertTrue(RescueParty.isFactoryResetPropertySet()); } + @Test + @EnableFlags(Flags.FLAG_DEPRECATE_FLAGS_AND_SETTINGS_RESETS) + public void testBootLoopNoFlags() { + // this is old test where the flag needs to be disabled + noteBoot(1); + assertTrue(RescueParty.isRebootPropertySet()); + + setCrashRecoveryPropAttemptingReboot(false); + noteBoot(2); + assertTrue(RescueParty.isFactoryResetPropertySet()); + } @Test - public void testBootLoopDetectionWithExecutionForAllRescueLevelsRecoverabilityDetection() { - mSetFlagsRule.enableFlags(Flags.FLAG_RECOVERABILITY_DETECTION); + @EnableFlags(Flags.FLAG_RECOVERABILITY_DETECTION) + @DisableFlags(Flags.FLAG_DEPRECATE_FLAGS_AND_SETTINGS_RESETS) + public void testBootLoopRecoverability() { RescueParty.onSettingsProviderPublished(mMockContext); verify(() -> DeviceConfig.setMonitorCallback(eq(mMockContentResolver), any(Executor.class), @@ -295,13 +309,14 @@ public class RescuePartyTest { final String[] expectedAllResetNamespaces = new String[]{NAMESPACE1, NAMESPACE2}; + noteBoot(1); - verifyDeviceConfigReset(expectedAllResetNamespaces, verifiedTimesMap); noteBoot(2); assertTrue(RescueParty.isRebootPropertySet()); noteBoot(3); + verifyOnlySettingsReset(Settings.RESET_MODE_UNTRUSTED_DEFAULTS); noteBoot(4); @@ -316,25 +331,14 @@ public class RescuePartyTest { } @Test - public void testPersistentAppCrashDetectionWithExecutionForAllRescueLevels() { + @DisableFlags({Flags.FLAG_RECOVERABILITY_DETECTION, + Flags.FLAG_DEPRECATE_FLAGS_AND_SETTINGS_RESETS}) + public void testPersistentAppCrash() { // this is old test where the flag needs to be disabled - mSetFlagsRule.disableFlags(Flags.FLAG_RECOVERABILITY_DETECTION); - noteAppCrash(1, true); - - verifySettingsResets(Settings.RESET_MODE_UNTRUSTED_DEFAULTS, /*resetNamespaces=*/ null, - /*configResetVerifiedTimesMap=*/ null); - noteAppCrash(2, true); - - verifySettingsResets(Settings.RESET_MODE_UNTRUSTED_CHANGES, /*resetNamespaces=*/ null, - /*configResetVerifiedTimesMap=*/ null); - noteAppCrash(3, true); - verifySettingsResets(Settings.RESET_MODE_TRUSTED_DEFAULTS, /*resetNamespaces=*/ null, - /*configResetVerifiedTimesMap=*/ null); - noteAppCrash(4, true); assertTrue(RescueParty.isRebootPropertySet()); @@ -344,8 +348,21 @@ public class RescuePartyTest { } @Test - public void testPersistentAppCrashDetectionWithExecutionForAllRescueLevelsRecoverability() { - mSetFlagsRule.enableFlags(Flags.FLAG_RECOVERABILITY_DETECTION); + @EnableFlags(Flags.FLAG_DEPRECATE_FLAGS_AND_SETTINGS_RESETS) + public void testPersistentAppCrashNoFlags() { + // this is old test where the flag needs to be disabled + noteAppCrash(1, true); + assertTrue(RescueParty.isRebootPropertySet()); + + setCrashRecoveryPropAttemptingReboot(false); + noteAppCrash(2, true); + assertTrue(RescueParty.isFactoryResetPropertySet()); + } + + @Test + @EnableFlags(Flags.FLAG_RECOVERABILITY_DETECTION) + @DisableFlags(Flags.FLAG_DEPRECATE_FLAGS_AND_SETTINGS_RESETS) + public void testPersistentAppCrashRecoverability() { RescueParty.onSettingsProviderPublished(mMockContext); verify(() -> DeviceConfig.setMonitorCallback(eq(mMockContentResolver), any(Executor.class), @@ -362,10 +379,8 @@ public class RescuePartyTest { final String[] expectedAllResetNamespaces = new String[]{NAMESPACE1, NAMESPACE2}; noteAppCrash(1, true); - verifyDeviceConfigReset(expectedResetNamespaces, verifiedTimesMap); noteAppCrash(2, true); - verifyDeviceConfigReset(expectedAllResetNamespaces, verifiedTimesMap); noteAppCrash(3, true); assertTrue(RescueParty.isRebootPropertySet()); @@ -385,26 +400,13 @@ public class RescuePartyTest { } @Test - public void testNonPersistentAppOnlyPerformsFlagResets() { + @DisableFlags({Flags.FLAG_RECOVERABILITY_DETECTION, + Flags.FLAG_DEPRECATE_FLAGS_AND_SETTINGS_RESETS}) + public void testNonPersistentApp() { // this is old test where the flag needs to be disabled - mSetFlagsRule.disableFlags(Flags.FLAG_RECOVERABILITY_DETECTION); - noteAppCrash(1, false); - - verifySettingsResets(Settings.RESET_MODE_UNTRUSTED_DEFAULTS, /*resetNamespaces=*/ null, - /*configResetVerifiedTimesMap=*/ null); - noteAppCrash(2, false); - - verifySettingsResets(Settings.RESET_MODE_UNTRUSTED_CHANGES, /*resetNamespaces=*/ null, - /*configResetVerifiedTimesMap=*/ null); - noteAppCrash(3, false); - - verifySettingsResets(Settings.RESET_MODE_TRUSTED_DEFAULTS, /*resetNamespaces=*/ null, - /*configResetVerifiedTimesMap=*/ null); - - noteAppCrash(4, false); assertFalse(RescueParty.isRebootPropertySet()); noteAppCrash(5, false); @@ -412,8 +414,9 @@ public class RescuePartyTest { } @Test + @EnableFlags(Flags.FLAG_RECOVERABILITY_DETECTION) + @DisableFlags(Flags.FLAG_DEPRECATE_FLAGS_AND_SETTINGS_RESETS) public void testNonPersistentAppOnlyPerformsFlagResetsRecoverabilityDetection() { - mSetFlagsRule.enableFlags(Flags.FLAG_RECOVERABILITY_DETECTION); RescueParty.onSettingsProviderPublished(mMockContext); verify(() -> DeviceConfig.setMonitorCallback(eq(mMockContentResolver), any(Executor.class), @@ -430,10 +433,8 @@ public class RescuePartyTest { final String[] expectedAllResetNamespaces = new String[]{NAMESPACE1, NAMESPACE2}; noteAppCrash(1, false); - verifyDeviceConfigReset(expectedResetNamespaces, verifiedTimesMap); noteAppCrash(2, false); - verifyDeviceConfigReset(expectedAllResetNamespaces, verifiedTimesMap); noteAppCrash(3, false); assertFalse(RescueParty.isRebootPropertySet()); @@ -451,135 +452,6 @@ public class RescuePartyTest { } @Test - public void testNonPersistentAppCrashDetectionWithScopedResets() { - // this is old test where the flag needs to be disabled - mSetFlagsRule.disableFlags(Flags.FLAG_RECOVERABILITY_DETECTION); - - RescueParty.onSettingsProviderPublished(mMockContext); - verify(() -> DeviceConfig.setMonitorCallback(eq(mMockContentResolver), - any(Executor.class), - mMonitorCallbackCaptor.capture())); - - // Record DeviceConfig accesses - RescuePartyObserver observer = RescuePartyObserver.getInstance(mMockContext); - DeviceConfig.MonitorCallback monitorCallback = mMonitorCallbackCaptor.getValue(); - monitorCallback.onDeviceConfigAccess(CALLING_PACKAGE1, NAMESPACE1); - monitorCallback.onDeviceConfigAccess(CALLING_PACKAGE1, NAMESPACE2); - monitorCallback.onDeviceConfigAccess(CALLING_PACKAGE2, NAMESPACE2); - monitorCallback.onDeviceConfigAccess(CALLING_PACKAGE2, NAMESPACE3); - - // Fake DeviceConfig value changes - monitorCallback.onNamespaceUpdate(NAMESPACE1); - verify(mMockPackageWatchdog).startObservingHealth(observer, - Arrays.asList(CALLING_PACKAGE1), RescueParty.DEFAULT_OBSERVING_DURATION_MS); - monitorCallback.onNamespaceUpdate(NAMESPACE2); - verify(mMockPackageWatchdog, times(2)).startObservingHealth(eq(observer), - mPackageListCaptor.capture(), - eq(RescueParty.DEFAULT_OBSERVING_DURATION_MS)); - monitorCallback.onNamespaceUpdate(NAMESPACE3); - verify(mMockPackageWatchdog).startObservingHealth(observer, - Arrays.asList(CALLING_PACKAGE2), RescueParty.DEFAULT_OBSERVING_DURATION_MS); - assertTrue(mPackageListCaptor.getValue().containsAll( - Arrays.asList(CALLING_PACKAGE1, CALLING_PACKAGE2))); - // Perform and verify scoped resets - final String[] expectedResetNamespaces = new String[]{NAMESPACE1, NAMESPACE2}; - final String[] expectedAllResetNamespaces = - new String[]{NAMESPACE1, NAMESPACE2, NAMESPACE3}; - HashMap<String, Integer> verifiedTimesMap = new HashMap<String, Integer>(); - observer.execute(new VersionedPackage( - CALLING_PACKAGE1, 1), PackageWatchdog.FAILURE_REASON_APP_CRASH, 1); - verifySettingsResets(Settings.RESET_MODE_UNTRUSTED_DEFAULTS, expectedResetNamespaces, - verifiedTimesMap); - - observer.execute(new VersionedPackage( - CALLING_PACKAGE1, 1), PackageWatchdog.FAILURE_REASON_APP_NOT_RESPONDING, 2); - verifySettingsResets(Settings.RESET_MODE_UNTRUSTED_CHANGES, expectedResetNamespaces, - verifiedTimesMap); - - observer.execute(new VersionedPackage( - CALLING_PACKAGE1, 1), PackageWatchdog.FAILURE_REASON_APP_NOT_RESPONDING, 3); - verifySettingsResets(Settings.RESET_MODE_TRUSTED_DEFAULTS, expectedAllResetNamespaces, - verifiedTimesMap); - - observer.execute(new VersionedPackage( - CALLING_PACKAGE1, 1), PackageWatchdog.FAILURE_REASON_APP_NOT_RESPONDING, 4); - assertFalse(RescueParty.isRebootPropertySet()); - - observer.execute(new VersionedPackage( - CALLING_PACKAGE1, 1), PackageWatchdog.FAILURE_REASON_APP_NOT_RESPONDING, 5); - assertFalse(RescueParty.isFactoryResetPropertySet()); - } - - @Test - public void testNonDeviceConfigSettingsOnlyResetOncePerLevel() { - // this is old test where the flag needs to be disabled - mSetFlagsRule.disableFlags(Flags.FLAG_RECOVERABILITY_DETECTION); - - RescueParty.onSettingsProviderPublished(mMockContext); - verify(() -> DeviceConfig.setMonitorCallback(eq(mMockContentResolver), - any(Executor.class), - mMonitorCallbackCaptor.capture())); - - // Record DeviceConfig accesses - RescuePartyObserver observer = RescuePartyObserver.getInstance(mMockContext); - DeviceConfig.MonitorCallback monitorCallback = mMonitorCallbackCaptor.getValue(); - monitorCallback.onDeviceConfigAccess(CALLING_PACKAGE1, NAMESPACE1); - monitorCallback.onDeviceConfigAccess(CALLING_PACKAGE1, NAMESPACE2); - monitorCallback.onDeviceConfigAccess(CALLING_PACKAGE2, NAMESPACE2); - monitorCallback.onDeviceConfigAccess(CALLING_PACKAGE2, NAMESPACE3); - // Fake DeviceConfig value changes - monitorCallback.onNamespaceUpdate(NAMESPACE1); - monitorCallback.onNamespaceUpdate(NAMESPACE2); - monitorCallback.onNamespaceUpdate(NAMESPACE3); - // Perform and verify scoped resets - final String[] expectedPackage1ResetNamespaces = new String[]{NAMESPACE1, NAMESPACE2}; - final String[] expectedPackage2ResetNamespaces = new String[]{NAMESPACE2, NAMESPACE3}; - final String[] expectedAllResetNamespaces = - new String[]{NAMESPACE1, NAMESPACE2, NAMESPACE3}; - HashMap<String, Integer> verifiedTimesMap = new HashMap<String, Integer>(); - observer.execute(new VersionedPackage( - CALLING_PACKAGE1, 1), PackageWatchdog.FAILURE_REASON_APP_CRASH, 1); - verifySettingsResets(Settings.RESET_MODE_UNTRUSTED_DEFAULTS, - expectedPackage1ResetNamespaces, verifiedTimesMap); - - // Settings.Global & Settings.Secure should still remain the same execution times. - observer.execute(new VersionedPackage( - CALLING_PACKAGE2, 1), PackageWatchdog.FAILURE_REASON_APP_CRASH, 1); - verifySettingsResets(Settings.RESET_MODE_UNTRUSTED_DEFAULTS, - expectedPackage2ResetNamespaces, verifiedTimesMap); - - observer.execute(new VersionedPackage( - CALLING_PACKAGE1, 1), PackageWatchdog.FAILURE_REASON_APP_NOT_RESPONDING, 2); - verifySettingsResets(Settings.RESET_MODE_UNTRUSTED_CHANGES, - expectedPackage1ResetNamespaces, verifiedTimesMap); - - // Settings.Global & Settings.Secure should still remain the same execution times. - observer.execute(new VersionedPackage( - CALLING_PACKAGE2, 1), PackageWatchdog.FAILURE_REASON_APP_NOT_RESPONDING, 2); - verifySettingsResets(Settings.RESET_MODE_UNTRUSTED_CHANGES, - expectedPackage2ResetNamespaces, verifiedTimesMap); - - observer.execute(new VersionedPackage( - CALLING_PACKAGE1, 1), PackageWatchdog.FAILURE_REASON_APP_NOT_RESPONDING, 3); - verifySettingsResets(Settings.RESET_MODE_TRUSTED_DEFAULTS, expectedAllResetNamespaces, - verifiedTimesMap); - - // Settings.Global & Settings.Secure should still remain the same execution times. - observer.execute(new VersionedPackage( - CALLING_PACKAGE2, 1), PackageWatchdog.FAILURE_REASON_APP_NOT_RESPONDING, 3); - verifySettingsResets(Settings.RESET_MODE_TRUSTED_DEFAULTS, expectedAllResetNamespaces, - verifiedTimesMap); - - observer.execute(new VersionedPackage( - CALLING_PACKAGE1, 1), PackageWatchdog.FAILURE_REASON_APP_NOT_RESPONDING, 4); - assertFalse(RescueParty.isRebootPropertySet()); - - observer.execute(new VersionedPackage( - CALLING_PACKAGE1, 1), PackageWatchdog.FAILURE_REASON_APP_NOT_RESPONDING, 5); - assertFalse(RescueParty.isFactoryResetPropertySet()); - } - - @Test public void testIsRecoveryTriggeredReboot() { for (int i = 0; i < LEVEL_FACTORY_RESET; i++) { noteBoot(i + 1); @@ -592,19 +464,6 @@ public class RescuePartyTest { } @Test - public void testIsRecoveryTriggeredRebootRecoverabilityDetection() { - mSetFlagsRule.enableFlags(Flags.FLAG_RECOVERABILITY_DETECTION); - for (int i = 0; i < RESCUE_LEVEL_FACTORY_RESET; i++) { - noteBoot(i + 1); - } - assertFalse(RescueParty.isFactoryResetPropertySet()); - setCrashRecoveryPropAttemptingReboot(false); - noteBoot(RESCUE_LEVEL_FACTORY_RESET + 1); - assertTrue(RescueParty.isRecoveryTriggeredReboot()); - assertTrue(RescueParty.isFactoryResetPropertySet()); - } - - @Test public void testIsRecoveryTriggeredRebootOnlyAfterRebootCompleted() { for (int i = 0; i < LEVEL_FACTORY_RESET; i++) { noteBoot(i + 1); @@ -623,25 +482,6 @@ public class RescuePartyTest { } @Test - public void testIsRecoveryTriggeredRebootOnlyAfterRebootCompletedRecoverabilityDetection() { - mSetFlagsRule.enableFlags(Flags.FLAG_RECOVERABILITY_DETECTION); - for (int i = 0; i < RESCUE_LEVEL_FACTORY_RESET; i++) { - noteBoot(i + 1); - } - int mitigationCount = RESCUE_LEVEL_FACTORY_RESET + 1; - assertFalse(RescueParty.isFactoryResetPropertySet()); - noteBoot(mitigationCount++); - assertFalse(RescueParty.isFactoryResetPropertySet()); - noteBoot(mitigationCount++); - assertFalse(RescueParty.isFactoryResetPropertySet()); - noteBoot(mitigationCount++); - setCrashRecoveryPropAttemptingReboot(false); - noteBoot(mitigationCount + 1); - assertTrue(RescueParty.isRecoveryTriggeredReboot()); - assertTrue(RescueParty.isFactoryResetPropertySet()); - } - - @Test public void testThrottlingOnBootFailures() { setCrashRecoveryPropAttemptingReboot(false); long now = System.currentTimeMillis(); @@ -655,20 +495,6 @@ public class RescuePartyTest { } @Test - public void testThrottlingOnBootFailuresRecoverabilityDetection() { - mSetFlagsRule.enableFlags(Flags.FLAG_RECOVERABILITY_DETECTION); - setCrashRecoveryPropAttemptingReboot(false); - long now = System.currentTimeMillis(); - long beforeTimeout = now - TimeUnit.MINUTES.toMillis( - DEFAULT_FACTORY_RESET_THROTTLE_DURATION_MIN - 1); - setCrashRecoveryPropLastFactoryReset(beforeTimeout); - for (int i = 1; i <= RESCUE_LEVEL_FACTORY_RESET; i++) { - noteBoot(i); - } - assertFalse(RescueParty.isRecoveryTriggeredReboot()); - } - - @Test public void testThrottlingOnAppCrash() { setCrashRecoveryPropAttemptingReboot(false); long now = System.currentTimeMillis(); @@ -682,20 +508,6 @@ public class RescuePartyTest { } @Test - public void testThrottlingOnAppCrashRecoverabilityDetection() { - mSetFlagsRule.enableFlags(Flags.FLAG_RECOVERABILITY_DETECTION); - setCrashRecoveryPropAttemptingReboot(false); - long now = System.currentTimeMillis(); - long beforeTimeout = now - TimeUnit.MINUTES.toMillis( - DEFAULT_FACTORY_RESET_THROTTLE_DURATION_MIN - 1); - setCrashRecoveryPropLastFactoryReset(beforeTimeout); - for (int i = 0; i <= RESCUE_LEVEL_FACTORY_RESET; i++) { - noteAppCrash(i + 1, true); - } - assertFalse(RescueParty.isRecoveryTriggeredReboot()); - } - - @Test public void testNotThrottlingAfterTimeoutOnBootFailures() { setCrashRecoveryPropAttemptingReboot(false); long now = System.currentTimeMillis(); @@ -709,20 +521,6 @@ public class RescuePartyTest { } @Test - public void testNotThrottlingAfterTimeoutOnBootFailuresRecoverabilityDetection() { - mSetFlagsRule.enableFlags(Flags.FLAG_RECOVERABILITY_DETECTION); - setCrashRecoveryPropAttemptingReboot(false); - long now = System.currentTimeMillis(); - long afterTimeout = now - TimeUnit.MINUTES.toMillis( - DEFAULT_FACTORY_RESET_THROTTLE_DURATION_MIN + 1); - setCrashRecoveryPropLastFactoryReset(afterTimeout); - for (int i = 1; i <= RESCUE_LEVEL_FACTORY_RESET; i++) { - noteBoot(i); - } - assertTrue(RescueParty.isRecoveryTriggeredReboot()); - } - - @Test public void testNotThrottlingAfterTimeoutOnAppCrash() { setCrashRecoveryPropAttemptingReboot(false); long now = System.currentTimeMillis(); @@ -736,20 +534,7 @@ public class RescuePartyTest { } @Test - public void testNotThrottlingAfterTimeoutOnAppCrashRecoverabilityDetection() { - mSetFlagsRule.enableFlags(Flags.FLAG_RECOVERABILITY_DETECTION); - setCrashRecoveryPropAttemptingReboot(false); - long now = System.currentTimeMillis(); - long afterTimeout = now - TimeUnit.MINUTES.toMillis( - DEFAULT_FACTORY_RESET_THROTTLE_DURATION_MIN + 1); - setCrashRecoveryPropLastFactoryReset(afterTimeout); - for (int i = 0; i <= RESCUE_LEVEL_FACTORY_RESET; i++) { - noteAppCrash(i + 1, true); - } - assertTrue(RescueParty.isRecoveryTriggeredReboot()); - } - - @Test + @DisableFlags(Flags.FLAG_DEPRECATE_FLAGS_AND_SETTINGS_RESETS) public void testNativeRescuePartyResets() { doReturn(true).when(() -> SettingsToPropertiesMapper.isNativeFlagsResetPerformed()); doReturn(FAKE_RESET_NATIVE_NAMESPACES).when( @@ -765,7 +550,6 @@ public class RescuePartyTest { @Test public void testExplicitlyEnablingAndDisablingRescue() { - mSetFlagsRule.enableFlags(Flags.FLAG_RECOVERABILITY_DETECTION); SystemProperties.set(RescueParty.PROP_ENABLE_RESCUE, Boolean.toString(false)); SystemProperties.set(PROP_DISABLE_RESCUE, Boolean.toString(true)); assertEquals(RescuePartyObserver.getInstance(mMockContext).execute(sFailingPackage, @@ -778,7 +562,6 @@ public class RescuePartyTest { @Test public void testDisablingRescueByDeviceConfigFlag() { - mSetFlagsRule.enableFlags(Flags.FLAG_RECOVERABILITY_DETECTION); SystemProperties.set(RescueParty.PROP_ENABLE_RESCUE, Boolean.toString(false)); SystemProperties.set(PROP_DEVICE_CONFIG_DISABLE_FLAG, Boolean.toString(true)); @@ -804,24 +587,10 @@ public class RescuePartyTest { } @Test - public void testDisablingFactoryResetByDeviceConfigFlagRecoverabilityDetection() { - mSetFlagsRule.enableFlags(Flags.FLAG_RECOVERABILITY_DETECTION); - SystemProperties.set(PROP_DISABLE_FACTORY_RESET_FLAG, Boolean.toString(true)); - - for (int i = 0; i < RESCUE_LEVEL_FACTORY_RESET; i++) { - noteBoot(i + 1); - } - assertFalse(RescueParty.isFactoryResetPropertySet()); - - // Restore the property value initialized in SetUp() - SystemProperties.set(PROP_DISABLE_FACTORY_RESET_FLAG, ""); - } - - @Test + @DisableFlags({Flags.FLAG_RECOVERABILITY_DETECTION, + Flags.FLAG_DEPRECATE_FLAGS_AND_SETTINGS_RESETS}) public void testHealthCheckLevels() { // this is old test where the flag needs to be disabled - mSetFlagsRule.disableFlags(Flags.FLAG_RECOVERABILITY_DETECTION); - RescuePartyObserver observer = RescuePartyObserver.getInstance(mMockContext); // Ensure that no action is taken for cases where the failure reason is unknown @@ -847,8 +616,9 @@ public class RescuePartyTest { } @Test + @DisableFlags(Flags.FLAG_DEPRECATE_FLAGS_AND_SETTINGS_RESETS) + @EnableFlags(Flags.FLAG_RECOVERABILITY_DETECTION) public void testHealthCheckLevelsRecoverabilityDetection() { - mSetFlagsRule.enableFlags(Flags.FLAG_RECOVERABILITY_DETECTION); RescuePartyObserver observer = RescuePartyObserver.getInstance(mMockContext); // Ensure that no action is taken for cases where the failure reason is unknown @@ -863,33 +633,53 @@ public class RescuePartyTest { assertEquals(observer.onHealthCheckFailed(sFailingPackage, PackageWatchdog.FAILURE_REASON_APP_NOT_RESPONDING, 2), - PackageHealthObserverImpact.USER_IMPACT_LEVEL_20); + PackageHealthObserverImpact.USER_IMPACT_LEVEL_40); assertEquals(observer.onHealthCheckFailed(sFailingPackage, PackageWatchdog.FAILURE_REASON_APP_NOT_RESPONDING, 3), - PackageHealthObserverImpact.USER_IMPACT_LEVEL_20); + PackageHealthObserverImpact.USER_IMPACT_LEVEL_40); assertEquals(observer.onHealthCheckFailed(sFailingPackage, PackageWatchdog.FAILURE_REASON_APP_NOT_RESPONDING, 4), - PackageHealthObserverImpact.USER_IMPACT_LEVEL_20); + PackageHealthObserverImpact.USER_IMPACT_LEVEL_40); assertEquals(observer.onHealthCheckFailed(sFailingPackage, PackageWatchdog.FAILURE_REASON_APP_NOT_RESPONDING, 5), - PackageHealthObserverImpact.USER_IMPACT_LEVEL_20); + PackageHealthObserverImpact.USER_IMPACT_LEVEL_40); assertEquals(observer.onHealthCheckFailed(sFailingPackage, PackageWatchdog.FAILURE_REASON_APP_NOT_RESPONDING, 6), - PackageHealthObserverImpact.USER_IMPACT_LEVEL_20); + PackageHealthObserverImpact.USER_IMPACT_LEVEL_40); assertEquals(observer.onHealthCheckFailed(sFailingPackage, PackageWatchdog.FAILURE_REASON_APP_NOT_RESPONDING, 7), - PackageHealthObserverImpact.USER_IMPACT_LEVEL_20); + PackageHealthObserverImpact.USER_IMPACT_LEVEL_40); } + @Test + @EnableFlags(Flags.FLAG_DEPRECATE_FLAGS_AND_SETTINGS_RESETS) + public void testHealthCheckLevelsNoFlags() { + // this is old test where the flag needs to be disabled + RescuePartyObserver observer = RescuePartyObserver.getInstance(mMockContext); + // Ensure that no action is taken for cases where the failure reason is unknown + assertEquals(observer.onHealthCheckFailed(null, PackageWatchdog.FAILURE_REASON_UNKNOWN, 1), + PackageHealthObserverImpact.USER_IMPACT_LEVEL_0); + + // Ensure the correct user impact is returned for each mitigation count. + assertEquals(observer.onHealthCheckFailed(null, + PackageWatchdog.FAILURE_REASON_APP_NOT_RESPONDING, 1), + PackageHealthObserverImpact.USER_IMPACT_LEVEL_50); + + assertEquals(observer.onHealthCheckFailed(null, + PackageWatchdog.FAILURE_REASON_APP_NOT_RESPONDING, 2), + PackageHealthObserverImpact.USER_IMPACT_LEVEL_100); + } @Test + @DisableFlags({Flags.FLAG_RECOVERABILITY_DETECTION, + Flags.FLAG_DEPRECATE_FLAGS_AND_SETTINGS_RESETS}) public void testBootLoopLevels() { // this is old test where the flag needs to be disabled - mSetFlagsRule.disableFlags(Flags.FLAG_RECOVERABILITY_DETECTION); + RescuePartyObserver observer = RescuePartyObserver.getInstance(mMockContext); @@ -902,11 +692,12 @@ public class RescuePartyTest { } @Test + @DisableFlags(Flags.FLAG_DEPRECATE_FLAGS_AND_SETTINGS_RESETS) + @EnableFlags(Flags.FLAG_RECOVERABILITY_DETECTION) public void testBootLoopLevelsRecoverabilityDetection() { - mSetFlagsRule.enableFlags(Flags.FLAG_RECOVERABILITY_DETECTION); RescuePartyObserver observer = RescuePartyObserver.getInstance(mMockContext); - assertEquals(observer.onBootLoop(1), PackageHealthObserverImpact.USER_IMPACT_LEVEL_20); + assertEquals(observer.onBootLoop(1), PackageHealthObserverImpact.USER_IMPACT_LEVEL_40); assertEquals(observer.onBootLoop(2), PackageHealthObserverImpact.USER_IMPACT_LEVEL_50); assertEquals(observer.onBootLoop(3), PackageHealthObserverImpact.USER_IMPACT_LEVEL_71); assertEquals(observer.onBootLoop(4), PackageHealthObserverImpact.USER_IMPACT_LEVEL_75); @@ -915,6 +706,16 @@ public class RescuePartyTest { } @Test + @EnableFlags(Flags.FLAG_DEPRECATE_FLAGS_AND_SETTINGS_RESETS) + public void testBootLoopLevelsNoFlags() { + RescuePartyObserver observer = RescuePartyObserver.getInstance(mMockContext); + + assertEquals(observer.onBootLoop(1), PackageHealthObserverImpact.USER_IMPACT_LEVEL_50); + assertEquals(observer.onBootLoop(2), PackageHealthObserverImpact.USER_IMPACT_LEVEL_100); + } + + @Test + @DisableFlags(Flags.FLAG_DEPRECATE_FLAGS_AND_SETTINGS_RESETS) public void testResetDeviceConfigForPackagesOnlyRuntimeMap() { RescueParty.onSettingsProviderPublished(mMockContext); verify(() -> DeviceConfig.setMonitorCallback(eq(mMockContentResolver), @@ -945,6 +746,7 @@ public class RescuePartyTest { } @Test + @DisableFlags(Flags.FLAG_DEPRECATE_FLAGS_AND_SETTINGS_RESETS) public void testResetDeviceConfigForPackagesOnlyPresetMap() { RescueParty.onSettingsProviderPublished(mMockContext); verify(() -> DeviceConfig.setMonitorCallback(eq(mMockContentResolver), @@ -953,7 +755,7 @@ public class RescuePartyTest { String presetMapping = NAMESPACE1 + ":" + CALLING_PACKAGE1 + "," + NAMESPACE2 + ":" + CALLING_PACKAGE2 + "," - + NAMESPACE3 + ":" + CALLING_PACKAGE1; + + NAMESPACE3 + ":" + CALLING_PACKAGE1; doReturn(presetMapping).when(() -> DeviceConfig.getString( eq(RescueParty.NAMESPACE_CONFIGURATION), eq(RescueParty.NAMESPACE_TO_PACKAGE_MAPPING_FLAG), @@ -966,6 +768,7 @@ public class RescuePartyTest { } @Test + @DisableFlags(Flags.FLAG_DEPRECATE_FLAGS_AND_SETTINGS_RESETS) public void testResetDeviceConfigForPackagesBothMaps() { RescueParty.onSettingsProviderPublished(mMockContext); verify(() -> DeviceConfig.setMonitorCallback(eq(mMockContentResolver), @@ -1002,6 +805,7 @@ public class RescuePartyTest { } @Test + @DisableFlags(Flags.FLAG_DEPRECATE_FLAGS_AND_SETTINGS_RESETS) public void testResetDeviceConfigNoExceptionWhenFlagMalformed() { RescueParty.onSettingsProviderPublished(mMockContext); verify(() -> DeviceConfig.setMonitorCallback(eq(mMockContentResolver), @@ -1037,7 +841,6 @@ public class RescuePartyTest { private void verifySettingsResets(int resetMode, String[] resetNamespaces, HashMap<String, Integer> configResetVerifiedTimesMap) { verifyOnlySettingsReset(resetMode); - verifyDeviceConfigReset(resetNamespaces, configResetVerifiedTimesMap); } private void verifyOnlySettingsReset(int resetMode) { @@ -1054,26 +857,6 @@ public class RescuePartyTest { eq(resetMode), anyInt()), never()); } - private void verifyDeviceConfigReset(String[] resetNamespaces, - Map<String, Integer> configResetVerifiedTimesMap) { - if (resetNamespaces == null) { - verify(() -> DeviceConfig.resetToDefaults(anyInt(), anyString()), never()); - } else { - for (String namespace : resetNamespaces) { - int verifiedTimes = 0; - if (configResetVerifiedTimesMap != null - && configResetVerifiedTimesMap.get(namespace) != null) { - verifiedTimes = configResetVerifiedTimesMap.get(namespace); - } - verify(() -> DeviceConfig.resetToDefaults(RescueParty.DEVICE_CONFIG_RESET_MODE, - namespace), times(verifiedTimes + 1)); - if (configResetVerifiedTimesMap != null) { - configResetVerifiedTimesMap.put(namespace, verifiedTimes + 1); - } - } - } - } - private void noteBoot(int mitigationCount) { RescuePartyObserver.getInstance(mMockContext).executeBootLoopMitigation(mitigationCount); } diff --git a/services/tests/mockingservicestests/src/com/android/server/am/ApplicationExitInfoTest.java b/services/tests/mockingservicestests/src/com/android/server/am/ApplicationExitInfoTest.java index e15942bb8f9a..194bf4ba73f3 100644 --- a/services/tests/mockingservicestests/src/com/android/server/am/ApplicationExitInfoTest.java +++ b/services/tests/mockingservicestests/src/com/android/server/am/ApplicationExitInfoTest.java @@ -84,7 +84,11 @@ import java.io.IOException; import java.lang.reflect.Field; import java.lang.reflect.Modifier; import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; import java.util.Random; +import java.util.function.Function; import java.util.zip.GZIPInputStream; /** @@ -438,20 +442,24 @@ public class ApplicationExitInfoTest { IMPORTANCE_FOREGROUND_SERVICE, // importance null); // description - // Case 4: Create a process from another package with kill from lmkd + /* + * Case 4: Create a process from another package with kill from lmkd + * We expect LMKD's reported RSS to be the process' last seen RSS. + */ final int app2UidUser2 = 1010234; final int app2PidUser2 = 12348; final long app2Pss1 = 54321; final long app2Rss1 = 65432; + final long lmkd_reported_rss = 43215; final String app2ProcessName = "com.android.test.stub2:process"; final String app2PackageName = "com.android.test.stub2"; sleep(1); final long now4 = System.currentTimeMillis(); - doReturn(new Pair<Long, Object>(now4, Integer.valueOf(0))) + doReturn(null) .when(mAppExitInfoTracker.mAppExitInfoSourceZygote) .remove(anyInt(), anyInt()); - doReturn(new Pair<Long, Object>(now4, null)) + doReturn(new Pair<Long, Object>(now4, Long.valueOf(lmkd_reported_rss))) .when(mAppExitInfoTracker.mAppExitInfoSourceLmkd) .remove(anyInt(), anyInt()); @@ -486,7 +494,7 @@ public class ApplicationExitInfoTest { null, // subReason 0, // status app2Pss1, // pss - app2Rss1, // rss + lmkd_reported_rss, // rss IMPORTANCE_CACHED, // importance null); // description @@ -495,6 +503,11 @@ public class ApplicationExitInfoTest { mAppExitInfoTracker.getExitInfo(null, app2UidUser2, 0, 0, list); assertEquals(1, list.size()); + info = list.get(0); + + // Verify the AppExitInfo has the LMKD reported RSS + assertEquals(lmkd_reported_rss, info.getRss()); + // Case 5: App native crash final int app3UidUser2 = 1010345; final int app3PidUser2 = 12349; @@ -595,7 +608,7 @@ public class ApplicationExitInfoTest { null, // subReason 0, // status app2Pss1, // pss - app2Rss1, // rss + lmkd_reported_rss, // rss IMPORTANCE_CACHED, // importance null); // description @@ -940,6 +953,228 @@ public class ApplicationExitInfoTest { } } + private ApplicationExitInfo createExitInfo(int i) { + ApplicationExitInfo info = new ApplicationExitInfo(); + info.setPid(i); + info.setTimestamp(1000 + i); + info.setPackageUid(2000); + return info; + } + + @SuppressWarnings("GuardedBy") + private ArrayList<ApplicationExitInfo> getExitInfosHelper( + AppExitInfoTracker.AppExitInfoContainer container, int filterPid, int maxNum) { + ArrayList<ApplicationExitInfo> infos = new ArrayList<ApplicationExitInfo>(); + container.getExitInfosLocked(filterPid, maxNum, infos); + return infos; + } + + @SuppressWarnings("GuardedBy") + private void checkAreHelper(AppExitInfoTracker.AppExitInfoContainer container, int filterPid, + int maxNum, List<Integer> expected, Function<ApplicationExitInfo, Integer> func) { + ArrayList<Integer> values = new ArrayList<Integer>(); + getExitInfosHelper(container, filterPid, maxNum) + .forEach((exitInfo) -> values.add(func.apply(exitInfo))); + assertEquals(values, expected); + + HashMap<Integer, Integer> expectedMultiset = new HashMap<Integer, Integer>(); + expected.forEach( + (elem) -> expectedMultiset.put(elem, expectedMultiset.getOrDefault(elem, 0) + 1)); + // `maxNum` isn't a parameter supported by `forEachRecordLocked()s`, but we can emulate it + // by stopping iteration when we've seen enough elements. + int[] numElementsToObserveWrapped = {maxNum}; + container.forEachRecordLocked((exitInfo) -> { + // Same thing as above, `filterPid` isn't a parameter supported out of the box for + // `forEachRecordLocked()`, but we emulate it here. + if (filterPid > 0 && filterPid != exitInfo.getPid()) { + return AppExitInfoTracker.FOREACH_ACTION_NONE; + } + + Integer key = func.apply(exitInfo); + assertTrue(expectedMultiset.toString(), expectedMultiset.containsKey(key)); + Integer references = expectedMultiset.get(key); + if (references == 1) { + expectedMultiset.remove(key); + } else { + expectedMultiset.put(key, references - 1); + } + if (--numElementsToObserveWrapped[0] == 0) { + return AppExitInfoTracker.FOREACH_ACTION_STOP_ITERATION; + } + return AppExitInfoTracker.FOREACH_ACTION_NONE; + }); + assertEquals(expectedMultiset.size(), 0); + } + + private void checkPidsAre(AppExitInfoTracker.AppExitInfoContainer container, int filterPid, + int maxNum, List<Integer> expectedPids) { + checkAreHelper(container, filterPid, maxNum, expectedPids, (exitInfo) -> exitInfo.getPid()); + } + + private void checkPidsAre( + AppExitInfoTracker.AppExitInfoContainer container, List<Integer> expectedPids) { + checkPidsAre(container, 0, 0, expectedPids); + } + + private void checkTimestampsAre(AppExitInfoTracker.AppExitInfoContainer container, + int filterPid, int maxNum, List<Integer> expectedTimestamps) { + checkAreHelper(container, filterPid, maxNum, expectedTimestamps, + (exitInfo) -> (int) exitInfo.getTimestamp()); + } + + private void checkTimestampsAre( + AppExitInfoTracker.AppExitInfoContainer container, List<Integer> expectedTimestamps) { + checkTimestampsAre(container, 0, 0, expectedTimestamps); + } + + @SuppressWarnings("GuardedBy") + private AppExitInfoTracker.AppExitInfoContainer createBasicContainer() { + AppExitInfoTracker.AppExitInfoContainer container = + mAppExitInfoTracker.new AppExitInfoContainer(3); + container.addExitInfoLocked(createExitInfo(10)); + container.addExitInfoLocked(createExitInfo(30)); + container.addExitInfoLocked(createExitInfo(20)); + return container; + } + + @Test + @SuppressWarnings("GuardedBy") + public void testContainerGetExitInfosIsSortedNewestFirst() throws Exception { + AppExitInfoTracker.AppExitInfoContainer container = createBasicContainer(); + checkPidsAre(container, Arrays.asList(30, 20, 10)); + } + + @Test + @SuppressWarnings("GuardedBy") + public void testContainerRemovesOldestReports() throws Exception { + AppExitInfoTracker.AppExitInfoContainer container = createBasicContainer(); + container.addExitInfoLocked(createExitInfo(40)); + checkPidsAre(container, Arrays.asList(40, 30, 20)); + + container.addExitInfoLocked(createExitInfo(50)); + checkPidsAre(container, Arrays.asList(50, 40, 30)); + + container.addExitInfoLocked(createExitInfo(45)); + checkPidsAre(container, Arrays.asList(50, 45, 40)); + + // Adding an older report shouldn't remove the newer ones. + container.addExitInfoLocked(createExitInfo(15)); + checkPidsAre(container, Arrays.asList(50, 45, 40)); + } + + @Test + @SuppressWarnings("GuardedBy") + public void testContainerFilterByPid() throws Exception { + AppExitInfoTracker.AppExitInfoContainer container = createBasicContainer(); + assertEquals(1, getExitInfosHelper(container, 30, 0).size()); + assertEquals(30, getExitInfosHelper(container, 0, 0).get(0).getPid()); + + assertEquals(1, getExitInfosHelper(container, 30, 0).size()); + assertEquals(20, getExitInfosHelper(container, 20, 0).get(0).getPid()); + + assertEquals(1, getExitInfosHelper(container, 10, 0).size()); + assertEquals(10, getExitInfosHelper(container, 10, 0).get(0).getPid()); + + assertEquals(0, getExitInfosHelper(container, 1337, 0).size()); + } + + @Test + @SuppressWarnings("GuardedBy") + public void testContainerLimitQuantityOfResults() throws Exception { + AppExitInfoTracker.AppExitInfoContainer container = createBasicContainer(); + checkPidsAre(container, /* filterPid */ 30, /* maxNum */ 1, Arrays.asList(30)); + checkPidsAre(container, /* filterPid */ 30, /* maxNum */ 1000, Arrays.asList(30)); + + checkPidsAre(container, /* filterPid */ 20, /* maxNum */ 1, Arrays.asList(20)); + checkPidsAre(container, /* filterPid */ 20, /* maxNum */ 1000, Arrays.asList(20)); + + checkPidsAre(container, /* filterPid */ 10, /* maxNum */ 1, Arrays.asList(10)); + checkPidsAre(container, /* filterPid */ 10, /* maxNum */ 1000, Arrays.asList(10)); + + checkPidsAre(container, /* filterPid */ 1337, /* maxNum */ 1, Arrays.asList()); + checkPidsAre(container, /* filterPid */ 1337, /* maxNum */ 1000, Arrays.asList()); + } + + @Test + @SuppressWarnings("GuardedBy") + public void testContainerLastExitInfoForPid() throws Exception { + AppExitInfoTracker.AppExitInfoContainer container = createBasicContainer(); + assertEquals(30, container.getLastExitInfoForPid(30).getPid()); + assertEquals(20, container.getLastExitInfoForPid(20).getPid()); + assertEquals(10, container.getLastExitInfoForPid(10).getPid()); + assertEquals(null, container.getLastExitInfoForPid(1337)); + } + + @Test + @SuppressWarnings("GuardedBy") + public void testContainerCanHoldMultipleFromSamePid() throws Exception { + AppExitInfoTracker.AppExitInfoContainer container = createBasicContainer(); + ApplicationExitInfo info = createExitInfo(100); + ApplicationExitInfo info2 = createExitInfo(100); + ApplicationExitInfo info3 = createExitInfo(100); + info2.setTimestamp(1337); + info3.setTimestamp(31337); + + container.addExitInfoLocked(info); + assertEquals(1100, container.getLastExitInfoForPid(100).getTimestamp()); + container.addExitInfoLocked(info2); + assertEquals(1337, container.getLastExitInfoForPid(100).getTimestamp()); + container.addExitInfoLocked(info3); + assertEquals(31337, container.getLastExitInfoForPid(100).getTimestamp()); + + checkPidsAre(container, Arrays.asList(100, 100, 100)); + checkTimestampsAre(container, Arrays.asList(31337, 1337, 1100)); + + checkPidsAre(container, /* filterPid */ 100, /* maxNum */ 0, Arrays.asList(100, 100, 100)); + checkTimestampsAre( + container, /* filterPid */ 100, /* maxNum */ 0, Arrays.asList(31337, 1337, 1100)); + + checkPidsAre(container, /* filterPid */ 100, /* maxNum */ 2, Arrays.asList(100, 100)); + checkTimestampsAre( + container, /* filterPid */ 100, /* maxNum */ 2, Arrays.asList(31337, 1337)); + } + + @Test + @SuppressWarnings("GuardedBy") + public void testContainerIteration() throws Exception { + AppExitInfoTracker.AppExitInfoContainer container = createBasicContainer(); + checkPidsAre(container, Arrays.asList(30, 20, 10)); + + // Unfortunately relying on order for this test, which is implemented as "last inserted" -> + // "first inserted". Note that this is insertion order, not timestamp. Thus, it's 20 -> 30 + // -> 10, as defined by `createBasicContainer()`. + List<Integer> elements = Arrays.asList(20, 30, 10); + for (int i = 0, size = elements.size(); i < size; i++) { + ArrayList<Integer> processedEntries = new ArrayList<Integer>(); + final int finalIndex = i; + container.forEachRecordLocked((exitInfo) -> { + processedEntries.add(new Integer(exitInfo.getPid())); + if (exitInfo.getPid() == elements.get(finalIndex)) { + return AppExitInfoTracker.FOREACH_ACTION_STOP_ITERATION; + } + return AppExitInfoTracker.FOREACH_ACTION_NONE; + }); + assertEquals(processedEntries, elements.subList(0, i + 1)); + } + } + + @Test + @SuppressWarnings("GuardedBy") + public void testContainerIterationRemove() throws Exception { + for (int pidToRemove : Arrays.asList(30, 20, 10)) { + AppExitInfoTracker.AppExitInfoContainer container = createBasicContainer(); + container.forEachRecordLocked((exitInfo) -> { + if (exitInfo.getPid() == pidToRemove) { + return AppExitInfoTracker.FOREACH_ACTION_REMOVE_ITEM; + } + return AppExitInfoTracker.FOREACH_ACTION_NONE; + }); + ArrayList<Integer> pidsRemaining = new ArrayList<Integer>(Arrays.asList(30, 20, 10)); + pidsRemaining.remove(new Integer(pidToRemove)); + checkPidsAre(container, pidsRemaining); + } + } + private static int makeExitStatus(int exitCode) { return (exitCode << 8) & 0xff00; } diff --git a/services/tests/mockingservicestests/src/com/android/server/am/OWNERS b/services/tests/mockingservicestests/src/com/android/server/am/OWNERS index 2cbc226da780..4fac647c4ceb 100644 --- a/services/tests/mockingservicestests/src/com/android/server/am/OWNERS +++ b/services/tests/mockingservicestests/src/com/android/server/am/OWNERS @@ -1,3 +1,4 @@ include /services/core/java/com/android/server/am/OWNERS per-file ApplicationStartInfoTest.java = yforta@google.com, carmenjackson@google.com, jji@google.com +per-file CachedAppOptimizerTest.java = file:/PERFORMANCE_OWNERS 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 9ab607de474d..0a6edf1b9831 100644 --- a/services/tests/mockingservicestests/src/com/android/server/pm/MockSystem.kt +++ b/services/tests/mockingservicestests/src/com/android/server/pm/MockSystem.kt @@ -314,6 +314,7 @@ class MockSystem(withSession: (StaticMockitoSessionBuilder) -> Unit = {}) { 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 13e255fe4ab8..1f2d11c19a19 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/mockingservicestests/src/com/android/server/trust/TrustManagerServiceTest.java b/services/tests/mockingservicestests/src/com/android/server/trust/TrustManagerServiceTest.java index 2a670294a470..1a398c5f1ec3 100644 --- a/services/tests/mockingservicestests/src/com/android/server/trust/TrustManagerServiceTest.java +++ b/services/tests/mockingservicestests/src/com/android/server/trust/TrustManagerServiceTest.java @@ -16,6 +16,8 @@ package com.android.server.trust; +import static android.security.Flags.FLAG_SHOULD_TRUST_MANAGER_LISTEN_FOR_PRIMARY_AUTH; +import static android.security.Flags.shouldTrustManagerListenForPrimaryAuth; import static android.service.trust.TrustAgentService.FLAG_GRANT_TRUST_TEMPORARY_AND_RENEWABLE; import static com.android.dx.mockito.inline.extended.ExtendedMockito.any; @@ -43,6 +45,7 @@ import static java.util.Collections.singleton; import android.Manifest; import android.annotation.Nullable; import android.app.ActivityManager; +import android.app.ActivityManagerInternal; import android.app.AlarmManager; import android.app.IActivityManager; import android.app.admin.DevicePolicyManager; @@ -72,9 +75,8 @@ import android.os.RemoteException; import android.os.ServiceManager; import android.os.UserHandle; import android.os.UserManager; -import android.platform.test.annotations.RequiresFlagsEnabled; -import android.platform.test.flag.junit.CheckFlagsRule; -import android.platform.test.flag.junit.DeviceFlagsValueProvider; +import android.platform.test.flag.junit.FlagsParameterization; +import android.platform.test.flag.junit.SetFlagsRule; import android.provider.Settings; import android.security.KeyStoreAuthorization; import android.service.trust.GrantTrustResult; @@ -93,6 +95,7 @@ import com.android.internal.widget.LockPatternUtils; import com.android.internal.widget.LockPatternUtils.StrongAuthTracker; import com.android.internal.widget.LockPatternUtils.StrongAuthTracker.StrongAuthFlags; import com.android.internal.widget.LockSettingsInternal; +import com.android.internal.widget.LockSettingsStateListener; import com.android.modules.utils.testing.ExtendedMockitoRule; import com.android.server.LocalServices; import com.android.server.SystemService; @@ -103,6 +106,7 @@ import org.junit.Before; import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; +import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; import org.mockito.ArgumentMatcher; import org.mockito.Mock; @@ -114,7 +118,16 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import platform.test.runner.parameterized.ParameterizedAndroidJunit4; +import platform.test.runner.parameterized.Parameters; + +@RunWith(ParameterizedAndroidJunit4.class) public class TrustManagerServiceTest { + @Parameters(name = "{0}") + public static List<FlagsParameterization> getParams() { + return FlagsParameterization.allCombinationsOf( + FLAG_SHOULD_TRUST_MANAGER_LISTEN_FOR_PRIMARY_AUTH); + } @Rule public final ExtendedMockitoRule mExtendedMockitoRule = new ExtendedMockitoRule.Builder(this) @@ -124,7 +137,7 @@ public class TrustManagerServiceTest { .build(); @Rule - public final CheckFlagsRule mCheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule(); + public final SetFlagsRule mSetFlagsRule; @Rule public final MockContext mMockContext = new MockContext( @@ -148,6 +161,7 @@ public class TrustManagerServiceTest { private final Map<ComponentName, ITrustAgentService.Stub> mMockTrustAgents = new HashMap<>(); private @Mock ActivityManager mActivityManager; + private @Mock ActivityManagerInternal mActivityManagerInternal; private @Mock AlarmManager mAlarmManager; private @Mock BiometricManager mBiometricManager; private @Mock DevicePolicyManager mDevicePolicyManager; @@ -164,6 +178,11 @@ public class TrustManagerServiceTest { private HandlerThread mHandlerThread; private TrustManagerService mService; private ITrustManager mTrustManager; + private ActivityManagerInternal mPreviousActivityManagerInternal; + + public TrustManagerServiceTest(FlagsParameterization flags) { + mSetFlagsRule = new SetFlagsRule(SetFlagsRule.DefaultInitValueType.DEVICE_DEFAULT, flags); + } @Before public void setUp() throws Exception { @@ -216,6 +235,11 @@ public class TrustManagerServiceTest { mMockContext.setMockPackageManager(mPackageManager); mMockContext.addMockSystemService(UserManager.class, mUserManager); doReturn(mWindowManager).when(() -> WindowManagerGlobal.getWindowManagerService()); + mPreviousActivityManagerInternal = LocalServices.getService( + ActivityManagerInternal.class); + LocalServices.removeServiceForTest(ActivityManagerInternal.class); + LocalServices.addService(ActivityManagerInternal.class, + mActivityManagerInternal); LocalServices.addService(SystemServiceManager.class, mock(SystemServiceManager.class)); grantPermission(Manifest.permission.ACCESS_KEYGUARD_SECURE_STORAGE); @@ -263,7 +287,14 @@ public class TrustManagerServiceTest { @After public void tearDown() { LocalServices.removeServiceForTest(SystemServiceManager.class); - mHandlerThread.quit(); + LocalServices.removeServiceForTest(ActivityManagerInternal.class); + if (mPreviousActivityManagerInternal != null) { + LocalServices.addService(ActivityManagerInternal.class, + mPreviousActivityManagerInternal); + } + if (mHandlerThread != null) { + mHandlerThread.quit(); + } } @Test @@ -418,7 +449,6 @@ public class TrustManagerServiceTest { // user, not the profile. This matches the authentication that is needed to unlock the device // for the profile again. @Test - @RequiresFlagsEnabled(android.security.Flags.FLAG_FIX_UNLOCKED_DEVICE_REQUIRED_KEYS_V2) public void testLockDeviceForManagedProfileWithUnifiedChallenge_usesParentBiometricSids() throws Exception { setupMocksForProfile(/* unifiedChallenge= */ true); @@ -586,11 +616,27 @@ public class TrustManagerServiceTest { } private void attemptSuccessfulUnlock(int userId) throws RemoteException { - mTrustManager.reportUnlockAttempt(/* successful= */ true, userId); + if (shouldTrustManagerListenForPrimaryAuth()) { + ArgumentCaptor<LockSettingsStateListener> captor = + ArgumentCaptor.forClass(LockSettingsStateListener.class); + verify(mLockSettingsInternal).registerLockSettingsStateListener(captor.capture()); + LockSettingsStateListener listener = captor.getValue(); + listener.onAuthenticationSucceeded(userId); + } else { + mTrustManager.reportUnlockAttempt(/* successful= */ true, userId); + } } private void attemptFailedUnlock(int userId) throws RemoteException { - mTrustManager.reportUnlockAttempt(/* successful= */ false, userId); + if (shouldTrustManagerListenForPrimaryAuth()) { + ArgumentCaptor<LockSettingsStateListener> captor = + ArgumentCaptor.forClass(LockSettingsStateListener.class); + verify(mLockSettingsInternal).registerLockSettingsStateListener(captor.capture()); + LockSettingsStateListener listener = captor.getValue(); + listener.onAuthenticationFailed(userId); + } else { + mTrustManager.reportUnlockAttempt(/* successful= */ false, userId); + } } private void grantRenewableTrust(ITrustAgentServiceCallback callback) throws RemoteException { @@ -617,7 +663,6 @@ public class TrustManagerServiceTest { } @Test - @RequiresFlagsEnabled(android.security.Flags.FLAG_FIX_UNLOCKED_DEVICE_REQUIRED_KEYS_V2) public void testKeystoreWeakUnlockEnabled_whenWeakFingerprintIsSetupAndAllowed() throws Exception { setupStrongAuthTrackerToAllowEverything(); @@ -626,7 +671,6 @@ public class TrustManagerServiceTest { } @Test - @RequiresFlagsEnabled(android.security.Flags.FLAG_FIX_UNLOCKED_DEVICE_REQUIRED_KEYS_V2) public void testKeystoreWeakUnlockEnabled_whenWeakFaceIsSetupAndAllowed() throws Exception { setupStrongAuthTrackerToAllowEverything(); setupFace(SensorProperties.STRENGTH_WEAK); @@ -634,7 +678,6 @@ public class TrustManagerServiceTest { } @Test - @RequiresFlagsEnabled(android.security.Flags.FLAG_FIX_UNLOCKED_DEVICE_REQUIRED_KEYS_V2) public void testKeystoreWeakUnlockEnabled_whenConvenienceFingerprintIsSetupAndAllowed() throws Exception { setupStrongAuthTrackerToAllowEverything(); @@ -643,7 +686,6 @@ public class TrustManagerServiceTest { } @Test - @RequiresFlagsEnabled(android.security.Flags.FLAG_FIX_UNLOCKED_DEVICE_REQUIRED_KEYS_V2) public void testKeystoreWeakUnlockEnabled_whenConvenienceFaceIsSetupAndAllowed() throws Exception { setupStrongAuthTrackerToAllowEverything(); @@ -652,7 +694,6 @@ public class TrustManagerServiceTest { } @Test - @RequiresFlagsEnabled(android.security.Flags.FLAG_FIX_UNLOCKED_DEVICE_REQUIRED_KEYS_V2) public void testKeystoreWeakUnlockDisabled_whenStrongAuthRequired() throws Exception { setupStrongAuthTracker(StrongAuthTracker.STRONG_AUTH_REQUIRED_AFTER_USER_LOCKDOWN, true); setupFace(SensorProperties.STRENGTH_WEAK); @@ -660,7 +701,6 @@ public class TrustManagerServiceTest { } @Test - @RequiresFlagsEnabled(android.security.Flags.FLAG_FIX_UNLOCKED_DEVICE_REQUIRED_KEYS_V2) public void testKeystoreWeakUnlockDisabled_whenNonStrongBiometricNotAllowed() throws Exception { setupStrongAuthTracker(StrongAuthTracker.STRONG_AUTH_NOT_REQUIRED, /* isNonStrongBiometricAllowed= */ false); @@ -669,7 +709,6 @@ public class TrustManagerServiceTest { } @Test - @RequiresFlagsEnabled(android.security.Flags.FLAG_FIX_UNLOCKED_DEVICE_REQUIRED_KEYS_V2) public void testKeystoreWeakUnlockDisabled_whenWeakFingerprintSensorIsPresentButNotEnrolled() throws Exception { setupStrongAuthTrackerToAllowEverything(); @@ -678,7 +717,6 @@ public class TrustManagerServiceTest { } @Test - @RequiresFlagsEnabled(android.security.Flags.FLAG_FIX_UNLOCKED_DEVICE_REQUIRED_KEYS_V2) public void testKeystoreWeakUnlockDisabled_whenWeakFaceSensorIsPresentButNotEnrolled() throws Exception { setupStrongAuthTrackerToAllowEverything(); @@ -687,7 +725,6 @@ public class TrustManagerServiceTest { } @Test - @RequiresFlagsEnabled(android.security.Flags.FLAG_FIX_UNLOCKED_DEVICE_REQUIRED_KEYS_V2) public void testKeystoreWeakUnlockDisabled_whenWeakFingerprintIsSetupButForbiddenByDevicePolicy() throws Exception { @@ -699,7 +736,6 @@ public class TrustManagerServiceTest { } @Test - @RequiresFlagsEnabled(android.security.Flags.FLAG_FIX_UNLOCKED_DEVICE_REQUIRED_KEYS_V2) public void testKeystoreWeakUnlockDisabled_whenWeakFaceIsSetupButForbiddenByDevicePolicy() throws Exception { setupStrongAuthTrackerToAllowEverything(); @@ -710,7 +746,6 @@ public class TrustManagerServiceTest { } @Test - @RequiresFlagsEnabled(android.security.Flags.FLAG_FIX_UNLOCKED_DEVICE_REQUIRED_KEYS_V2) public void testKeystoreWeakUnlockDisabled_whenOnlyStrongFingerprintIsSetup() throws Exception { setupStrongAuthTrackerToAllowEverything(); setupFingerprint(SensorProperties.STRENGTH_STRONG); @@ -718,7 +753,6 @@ public class TrustManagerServiceTest { } @Test - @RequiresFlagsEnabled(android.security.Flags.FLAG_FIX_UNLOCKED_DEVICE_REQUIRED_KEYS_V2) public void testKeystoreWeakUnlockDisabled_whenOnlyStrongFaceIsSetup() throws Exception { setupStrongAuthTrackerToAllowEverything(); setupFace(SensorProperties.STRENGTH_STRONG); @@ -726,7 +760,6 @@ public class TrustManagerServiceTest { } @Test - @RequiresFlagsEnabled(android.security.Flags.FLAG_FIX_UNLOCKED_DEVICE_REQUIRED_KEYS_V2) public void testKeystoreWeakUnlockDisabled_whenNoBiometricsAreSetup() throws Exception { setupStrongAuthTrackerToAllowEverything(); verifyWeakUnlockDisabled(); diff --git a/services/tests/servicestests/Android.bp b/services/tests/servicestests/Android.bp index 753db125ffe3..61906cf2fad1 100644 --- a/services/tests/servicestests/Android.bp +++ b/services/tests/servicestests/Android.bp @@ -84,6 +84,7 @@ android_test { "securebox", "flag-junit", "ravenwood-junit", + "net-tests-utils", "net_flags_lib", "CtsVirtualDeviceCommonLib", "com_android_server_accessibility_flags_lib", @@ -271,6 +272,10 @@ java_genrule { "$(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", @@ -327,7 +332,7 @@ test_module_config { 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 @@ -356,3 +361,319 @@ test_module_config { 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 000000000000..7fa891736efe --- /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 24561c59bba6..3d09da303b0f 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/contentprotection/OWNERS -include /core/java/android/view/contentcapture/OWNERS diff --git a/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecLocalDeviceTvTest.java b/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecLocalDeviceTvTest.java index 2a4b79730851..128d7381dc22 100644 --- a/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecLocalDeviceTvTest.java +++ b/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecLocalDeviceTvTest.java @@ -2046,4 +2046,61 @@ public class HdmiCecLocalDeviceTvTest { assertThat(mPowerManager.isInteractive()).isTrue(); } + + @Test + public void handleReportPhysicalAddress_DeviceDiscoveryActionInProgress_noNewDeviceAction() { + mHdmiControlService.getHdmiCecNetwork().clearDeviceList(); + mNativeWrapper.setPollAddressResponse(ADDR_PLAYBACK_1, SendMessageResult.SUCCESS); + mHdmiControlService.allocateLogicalAddress(mLocalDevices, INITIATED_BY_ENABLE_CEC); + mNativeWrapper.clearResultMessages(); + mTestLooper.dispatchAll(); + + HdmiCecMessage reportPhysicalAddressFromPlayback1 = + HdmiCecMessageBuilder.buildReportPhysicalAddressCommand( + ADDR_PLAYBACK_1, 0x1000, HdmiDeviceInfo.DEVICE_PLAYBACK); + HdmiCecMessage reportPhysicalAddressFromPlayback2 = + HdmiCecMessageBuilder.buildReportPhysicalAddressCommand( + ADDR_PLAYBACK_2, 0x2000, HdmiDeviceInfo.DEVICE_PLAYBACK); + HdmiCecMessage giveOsdName = HdmiCecMessageBuilder.buildGiveOsdNameCommand( + ADDR_TV, ADDR_PLAYBACK_2); + // Skip state waiting for <Report Physical Address> for DeviceDiscoveryAction s.t. message + // can be dispatched to local device TV. + mNativeWrapper.onCecMessage(reportPhysicalAddressFromPlayback1); + mNativeWrapper.clearResultMessages(); + mTestLooper.dispatchAll(); + + mNativeWrapper.onCecMessage(reportPhysicalAddressFromPlayback2); + mTestLooper.dispatchAll(); + + // NewDeviceAction did not start and <Give OSD Name> was not sent. + assertThat(mNativeWrapper.getResultMessages()).doesNotContain(giveOsdName); + } + + @Test + public void onOneTouchPlay_wakeUp_addCecDevice() { + assertThat(mHdmiControlService.getHdmiCecNetwork().getDeviceInfoList(false)) + .isEmpty(); + mHdmiCecLocalDeviceTv.mService.getHdmiCecConfig().setIntValue( + HdmiControlManager.CEC_SETTING_NAME_TV_WAKE_ON_ONE_TOUCH_PLAY, + HdmiControlManager.TV_WAKE_ON_ONE_TOUCH_PLAY_ENABLED); + mPowerManager.setInteractive(false); + mTestLooper.dispatchAll(); + + HdmiCecMessage textViewOn = HdmiCecMessageBuilder.buildTextViewOn(ADDR_PLAYBACK_1, + mTvLogicalAddress); + HdmiCecMessage activeSource = HdmiCecMessageBuilder.buildActiveSource(ADDR_PLAYBACK_1, + 0x1000); + assertThat(mHdmiCecLocalDeviceTv.dispatchMessage(textViewOn)).isEqualTo(Constants.HANDLED); + assertThat(mHdmiCecLocalDeviceTv.dispatchMessage(activeSource)).isEqualTo( + Constants.HANDLED); + mTestLooper.dispatchAll(); + assertThat(mPowerManager.isInteractive()).isTrue(); + + // FakePowerManagerWrapper#wakeUp() doesn't broadcast Intent.ACTION_SCREEN_ON so we have to + // manually call this method. + mHdmiControlService.onWakeUp(WAKE_UP_SCREEN_ON); + mTestLooper.dispatchAll(); + assertThat(mHdmiControlService.getHdmiCecNetwork().getDeviceInfoList(false)) + .hasSize(1); + } } 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 473d1dc22d7a..6577e09a986e 100644 --- a/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecMessageValidatorTest.java +++ b/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecMessageValidatorTest.java @@ -240,6 +240,9 @@ public class HdmiCecMessageValidatorTest { public void isValid_setAnalogueTimer_clearAnalogueTimer() { assertMessageValidity("04:33:0C:08:10:1E:04:30:08:00:13:AD:06").isEqualTo(OK); assertMessageValidity("04:34:04:0C:16:0F:08:37:00:02:EA:60:03:34").isEqualTo(OK); + // Allow [Recording Sequence] set multiple days of the week. + // e.g. Monday (0x02) | Tuesday (0x04) -> Monday or Tuesday (0x06) + assertMessageValidity("04:34:04:0C:16:0F:08:37:06:02:EA:60:03:34").isEqualTo(OK); assertMessageValidity("0F:33:0C:08:10:1E:04:30:08:00:13:AD:06") .isEqualTo(ERROR_DESTINATION); @@ -247,120 +250,120 @@ public class HdmiCecMessageValidatorTest { 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:21:00:C4:C2:11:D8:75:30") + 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:14:04:20").isEqualTo(ERROR_PARAMETER); + 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 @@ -393,9 +396,9 @@ public class HdmiCecMessageValidatorTest { // 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/hdmi/HdmiCecNetworkTest.java b/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecNetworkTest.java index 10f4308cbcfb..599a3b86e1af 100644 --- a/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecNetworkTest.java +++ b/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecNetworkTest.java @@ -396,7 +396,7 @@ public class HdmiCecNetworkTest { } @Test - public void cecDevices_tracking_updatesPhysicalAddress() { + public void cecDevices_tracking_updatesPhysicalAddress_add() { int logicalAddress = Constants.ADDR_PLAYBACK_1; int initialPhysicalAddress = 0x1000; int updatedPhysicalAddress = 0x2000; @@ -415,11 +415,12 @@ public class HdmiCecNetworkTest { assertThat(cecDeviceInfo.getPhysicalAddress()).isEqualTo(updatedPhysicalAddress); assertThat(cecDeviceInfo.getDeviceType()).isEqualTo(type); - // ADD for physical address first detected - // UPDATE for updating device with new physical address + // Handle case where PA is changed: Update CEC device information by calling + // addCecDevice(). assertThat(mDeviceEventListenerStatuses).containsExactly( HdmiControlManager.DEVICE_EVENT_ADD_DEVICE, - HdmiControlManager.DEVICE_EVENT_UPDATE_DEVICE); + HdmiControlManager.DEVICE_EVENT_REMOVE_DEVICE, + HdmiControlManager.DEVICE_EVENT_ADD_DEVICE); } @Test diff --git a/services/tests/servicestests/src/com/android/server/locksettings/LockSettingsServiceTestable.java b/services/tests/servicestests/src/com/android/server/locksettings/LockSettingsServiceTestable.java index f9077c4ae602..93fc071a5bb7 100644 --- a/services/tests/servicestests/src/com/android/server/locksettings/LockSettingsServiceTestable.java +++ b/services/tests/servicestests/src/com/android/server/locksettings/LockSettingsServiceTestable.java @@ -196,11 +196,6 @@ public class LockSettingsServiceTestable extends LockSettingsService { } @Override - void setKeystorePassword(byte[] password, int userHandle) { - - } - - @Override void initKeystoreSuperKeys(int userId, SyntheticPassword sp, boolean allowExisting) { } diff --git a/services/tests/servicestests/src/com/android/server/locksettings/LockscreenRepairModeTest.java b/services/tests/servicestests/src/com/android/server/locksettings/LockscreenRepairModeTest.java index 70150c507460..4396c679ec24 100644 --- a/services/tests/servicestests/src/com/android/server/locksettings/LockscreenRepairModeTest.java +++ b/services/tests/servicestests/src/com/android/server/locksettings/LockscreenRepairModeTest.java @@ -19,6 +19,8 @@ package com.android.server.locksettings; import static com.android.internal.widget.LockPatternUtils.USER_REPAIR_MODE; import static com.android.internal.widget.LockPatternUtils.VERIFY_FLAG_WRITE_REPAIR_MODE_PW; +import static com.google.common.truth.Truth.assertThat; + import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertSame; @@ -199,6 +201,27 @@ public class LockscreenRepairModeTest extends BaseLockSettingsServiceTests { .getResponseCode()); } + @Test + public void writeRepairModeCredential_noLock() { + assertThat(mService.writeRepairModeCredential(PRIMARY_USER_ID)).isFalse(); + } + + @Test + public void writeRepairModeCredential_hasLock() { + mService.setLockCredential(newPin("1234"), nonePassword(), PRIMARY_USER_ID); + assertThat(mService.writeRepairModeCredential(PRIMARY_USER_ID)).isTrue(); + } + + @Test + public void writeRepairModeCredential_verifyRepairModeUser() { + mService.setLockCredential(newPin("1234"), nonePassword(), PRIMARY_USER_ID); + mService.writeRepairModeCredential(PRIMARY_USER_ID); + setRepairModeActive(true); + + var response = mService.verifyCredential(newPin("1234"), USER_REPAIR_MODE, 0); + assertThat(response.isMatched()).isTrue(); + } + private void setRepairModeActive(boolean active) { Settings.Global.putInt(mContext.getContentResolver(), Settings.Global.REPAIR_MODE_ACTIVE, active ? 1 : 0); diff --git a/services/tests/servicestests/src/com/android/server/net/NetworkPolicyManagerServiceTest.java b/services/tests/servicestests/src/com/android/server/net/NetworkPolicyManagerServiceTest.java index 3d6884925098..dddab657be14 100644 --- a/services/tests/servicestests/src/com/android/server/net/NetworkPolicyManagerServiceTest.java +++ b/services/tests/servicestests/src/com/android/server/net/NetworkPolicyManagerServiceTest.java @@ -108,6 +108,7 @@ import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.anyLong; import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.ArgumentMatchers.argThat; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.isA; import static org.mockito.Mockito.CALLS_REAL_METHODS; @@ -165,6 +166,7 @@ import android.os.PowerExemptionManager; import android.os.PowerManager; import android.os.PowerManagerInternal; import android.os.PowerSaveState; +import android.os.Process; import android.os.RemoteException; import android.os.SimpleClock; import android.os.SystemClock; @@ -197,6 +199,7 @@ import androidx.test.filters.FlakyTest; import androidx.test.filters.MediumTest; import androidx.test.runner.AndroidJUnit4; +import com.android.internal.util.ArrayUtils; import com.android.internal.util.test.BroadcastInterceptingContext; import com.android.internal.util.test.BroadcastInterceptingContext.FutureIntent; import com.android.internal.util.test.FsUtil; @@ -2310,6 +2313,70 @@ public class NetworkPolicyManagerServiceTest { assertTrue(mService.isUidNetworkingBlocked(UID_A, false)); } + @SuppressWarnings("GuardedBy") // For not holding mUidRulesFirstLock + @Test + @RequiresFlagsEnabled(Flags.FLAG_NEVER_APPLY_RULES_TO_CORE_UIDS) + public void testRulesNeverAppliedToCoreUids() throws Exception { + clearInvocations(mNetworkManager); + + final int coreAppId = Process.FIRST_APPLICATION_UID - 102; + final int coreUid = UserHandle.getUid(USER_ID, coreAppId); + + // Enable all restrictions and add this core uid to all allowlists. + mService.mDeviceIdleMode = true; + mService.mRestrictPower = true; + setRestrictBackground(true); + expectHasUseRestrictedNetworksPermission(coreUid, true); + enableRestrictedMode(true); + final NetworkPolicyManagerInternal internal = LocalServices.getService( + NetworkPolicyManagerInternal.class); + internal.setLowPowerStandbyActive(true); + internal.setLowPowerStandbyAllowlist(new int[]{coreUid}); + internal.onTempPowerSaveWhitelistChange(coreAppId, true, REASON_OTHER, "testing"); + + when(mPowerExemptionManager.getAllowListedAppIds(anyBoolean())) + .thenReturn(new int[]{coreAppId}); + mPowerAllowlistReceiver.onReceive(mServiceContext, null); + + // A normal uid would undergo a rule change from denied to allowed on all chains, but we + // should not request any rule change for this core uid. + verify(mNetworkManager, never()).setFirewallUidRule(anyInt(), eq(coreUid), anyInt()); + verify(mNetworkManager, never()).setFirewallUidRules(anyInt(), + argThat(ar -> ArrayUtils.contains(ar, coreUid)), any(int[].class)); + } + + @SuppressWarnings("GuardedBy") // For not holding mUidRulesFirstLock + @Test + @RequiresFlagsEnabled(Flags.FLAG_NEVER_APPLY_RULES_TO_CORE_UIDS) + public void testRulesNeverAppliedToUidsWithoutInternetPermission() throws Exception { + clearInvocations(mNetworkManager); + + mService.mInternetPermissionMap.clear(); + expectHasInternetPermission(UID_A, false); + + // Enable all restrictions and add this uid to all allowlists. + mService.mDeviceIdleMode = true; + mService.mRestrictPower = true; + setRestrictBackground(true); + expectHasUseRestrictedNetworksPermission(UID_A, true); + enableRestrictedMode(true); + final NetworkPolicyManagerInternal internal = LocalServices.getService( + NetworkPolicyManagerInternal.class); + internal.setLowPowerStandbyActive(true); + internal.setLowPowerStandbyAllowlist(new int[]{UID_A}); + internal.onTempPowerSaveWhitelistChange(APP_ID_A, true, REASON_OTHER, "testing"); + + when(mPowerExemptionManager.getAllowListedAppIds(anyBoolean())) + .thenReturn(new int[]{APP_ID_A}); + mPowerAllowlistReceiver.onReceive(mServiceContext, null); + + // A normal uid would undergo a rule change from denied to allowed on all chains, but we + // should not request any rule this uid without the INTERNET permission. + verify(mNetworkManager, never()).setFirewallUidRule(anyInt(), eq(UID_A), anyInt()); + verify(mNetworkManager, never()).setFirewallUidRules(anyInt(), + argThat(ar -> ArrayUtils.contains(ar, UID_A)), any(int[].class)); + } + private boolean isUidState(int uid, int procState, int procStateSeq, int capability) { final NetworkPolicyManager.UidState uidState = mService.getUidStateForTest(uid); if (uidState == null) { 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 000000000000..c560c04e72cd --- /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/tests/timetests/src/com/android/server/timezonedetector/location/ZoneInfoDbTimeZoneProviderEventPreProcessorTest.java b/services/tests/timetests/src/com/android/server/timezonedetector/location/ZoneInfoDbTimeZoneProviderEventPreProcessorTest.java index f3440f7c9d1c..ea3b409e5929 100644 --- a/services/tests/timetests/src/com/android/server/timezonedetector/location/ZoneInfoDbTimeZoneProviderEventPreProcessorTest.java +++ b/services/tests/timetests/src/com/android/server/timezonedetector/location/ZoneInfoDbTimeZoneProviderEventPreProcessorTest.java @@ -39,13 +39,23 @@ public class ZoneInfoDbTimeZoneProviderEventPreProcessorTest { private static final long ARBITRARY_TIME_MILLIS = 11223344; + private final List<String> mNonExistingTimeZones = Arrays.asList( + "SystemV/HST10", "Atlantic/Atlantis", "EUROPE/LONDON", "Etc/GMT-5:30"); private final ZoneInfoDbTimeZoneProviderEventPreProcessor mPreProcessor = new ZoneInfoDbTimeZoneProviderEventPreProcessor(); + private static final TimeZoneProviderStatus ARBITRARY_TIME_ZONE_PROVIDER_STATUS = + new TimeZoneProviderStatus.Builder() + .setConnectivityDependencyStatus(DEPENDENCY_STATUS_OK) + .setLocationDetectionDependencyStatus(DEPENDENCY_STATUS_OK) + .setTimeZoneResolutionOperationStatus(OPERATION_STATUS_OK) + .build(); + @Test public void timeZoneIdsFromZoneInfoDbAreValid() { for (String timeZone : TimeZone.getAvailableIDs()) { - TimeZoneProviderEvent event = timeZoneProviderEvent(timeZone); + TimeZoneProviderEvent event = timeZoneProviderEvent(timeZone, + ARBITRARY_TIME_ZONE_PROVIDER_STATUS); assertWithMessage("Time zone %s should be supported", timeZone) .that(mPreProcessor.preProcess(event)).isEqualTo(event); } @@ -53,11 +63,9 @@ public class ZoneInfoDbTimeZoneProviderEventPreProcessorTest { @Test public void eventWithNonExistingZones_areMappedToUncertainEvent() { - List<String> nonExistingTimeZones = Arrays.asList( - "SystemV/HST10", "Atlantic/Atlantis", "EUROPE/LONDON", "Etc/GMT-5:30"); - - for (String timeZone : nonExistingTimeZones) { - TimeZoneProviderEvent event = timeZoneProviderEvent(timeZone); + for (String timeZone : mNonExistingTimeZones) { + TimeZoneProviderEvent event = timeZoneProviderEvent(timeZone, + ARBITRARY_TIME_ZONE_PROVIDER_STATUS); TimeZoneProviderStatus expectedProviderStatus = new TimeZoneProviderStatus.Builder(event.getTimeZoneProviderStatus()) @@ -73,14 +81,31 @@ public class ZoneInfoDbTimeZoneProviderEventPreProcessorTest { } } - private static TimeZoneProviderEvent timeZoneProviderEvent(String... timeZoneIds) { - TimeZoneProviderStatus providerStatus = new TimeZoneProviderStatus.Builder() - .setLocationDetectionDependencyStatus(DEPENDENCY_STATUS_OK) - .setConnectivityDependencyStatus(DEPENDENCY_STATUS_OK) - .setTimeZoneResolutionOperationStatus(OPERATION_STATUS_OK) - .build(); + @Test + public void eventWithNullProviderStatus_areMappedToUncertainEvent() { + for (String timeZone : mNonExistingTimeZones) { + TimeZoneProviderEvent eventWithNullStatus = timeZoneProviderEvent(timeZone, + /* providerStatus= */ null); + + TimeZoneProviderStatus expectedProviderStatus = + new TimeZoneProviderStatus.Builder() + .setTimeZoneResolutionOperationStatus(OPERATION_STATUS_FAILED) + .build(); + + TimeZoneProviderEvent expectedResultEvent = + TimeZoneProviderEvent.createUncertainEvent( + eventWithNullStatus.getCreationElapsedMillis(), + expectedProviderStatus); + assertWithMessage(timeZone + " with null time zone provider status") + .that(mPreProcessor.preProcess(eventWithNullStatus)) + .isEqualTo(expectedResultEvent); + } + } + + private static TimeZoneProviderEvent timeZoneProviderEvent(String timeZoneId, + TimeZoneProviderStatus providerStatus) { TimeZoneProviderSuggestion suggestion = new TimeZoneProviderSuggestion.Builder() - .setTimeZoneIds(Arrays.asList(timeZoneIds)) + .setTimeZoneIds(Arrays.asList(timeZoneId)) .setElapsedRealtimeMillis(ARBITRARY_TIME_MILLIS) .build(); return TimeZoneProviderEvent.createSuggestionEvent( diff --git a/services/tests/wmtests/src/com/android/server/wm/ScreenshotTests.java b/services/tests/wmtests/src/com/android/server/wm/ScreenshotTests.java index 280fe4c30739..34f7ebb0f7dd 100644 --- a/services/tests/wmtests/src/com/android/server/wm/ScreenshotTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/ScreenshotTests.java @@ -66,6 +66,7 @@ import org.junit.Rule; import org.junit.Test; import org.junit.rules.TestName; +import java.time.Duration; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; @@ -131,7 +132,7 @@ public class ScreenshotTests { assertTrue("Failed to wait for transaction to get committed", countDownLatch.await(WAIT_TIME_S, TimeUnit.SECONDS)); assertTrue("Failed to wait for stable geometry", - waitForStableWindowGeometry(WAIT_TIME_S, TimeUnit.SECONDS)); + waitForStableWindowGeometry(Duration.ofSeconds(WAIT_TIME_S))); ScreenCapture.LayerCaptureArgs args = new ScreenCapture.LayerCaptureArgs.Builder(secureSC) .setCaptureSecureLayers(true) @@ -212,7 +213,7 @@ public class ScreenshotTests { assertTrue("Failed to wait for transaction to get committed", countDownLatch.await(WAIT_TIME_S, TimeUnit.SECONDS)); assertTrue("Failed to wait for stable geometry", - waitForStableWindowGeometry(WAIT_TIME_S, TimeUnit.SECONDS)); + waitForStableWindowGeometry(Duration.ofSeconds(WAIT_TIME_S))); ScreenshotHardwareBuffer[] screenCapture = new ScreenshotHardwareBuffer[1]; Bitmap screenshot = null; diff --git a/services/tests/wmtests/src/com/android/server/wm/TrustedOverlayTests.java b/services/tests/wmtests/src/com/android/server/wm/TrustedOverlayTests.java index f1d84cfc636d..529e9b77b4e0 100644 --- a/services/tests/wmtests/src/com/android/server/wm/TrustedOverlayTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/TrustedOverlayTests.java @@ -49,6 +49,7 @@ import org.junit.Rule; import org.junit.Test; import org.junit.rules.TestName; +import java.time.Duration; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; @@ -144,7 +145,7 @@ public class TrustedOverlayTests { } } return false; - }, TIMEOUT_S, TimeUnit.SECONDS); + }, Duration.ofSeconds(TIMEOUT_S)); assertAndDumpWindowState(TAG, "Failed to find window or was not marked trusted", foundTrusted[0]); @@ -209,7 +210,7 @@ public class TrustedOverlayTests { } } return foundTrusted[0] && foundTrusted[1]; - }, TIMEOUT_S, TimeUnit.SECONDS); + }, Duration.ofSeconds(TIMEOUT_S)); if (!foundTrusted[0] || !foundTrusted[1]) { CtsWindowInfoUtils.dumpWindowsOnScreen(TAG, mName.getMethodName()); diff --git a/services/usage/OWNERS b/services/usage/OWNERS index 26d9b10c7907..f825f559d30d 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 6e845433492b..c8780546865e 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/usage/java/com/android/server/usage/UsageStatsDatabase.java b/services/usage/java/com/android/server/usage/UsageStatsDatabase.java index a8a90170ae4d..ba33eab5331a 100644 --- a/services/usage/java/com/android/server/usage/UsageStatsDatabase.java +++ b/services/usage/java/com/android/server/usage/UsageStatsDatabase.java @@ -33,6 +33,7 @@ import android.util.SparseArray; import android.util.TimeUtils; import com.android.internal.annotations.VisibleForTesting; +import com.android.internal.annotations.GuardedBy; import com.android.internal.util.ArrayUtils; import com.android.internal.util.IndentingPrintWriter; @@ -136,6 +137,7 @@ public class UsageStatsDatabase { // The obfuscated packages to tokens mappings file private final File mPackageMappingsFile; // Holds all of the data related to the obfuscated packages and their token mappings. + @GuardedBy("mLock") final PackagesTokenData mPackagesTokenData = new PackagesTokenData(); /** @@ -771,27 +773,30 @@ public class UsageStatsDatabase { * all of the stats at once has an amortized cost for future calls. */ void filterStats(IntervalStats stats) { - if (mPackagesTokenData.removedPackagesMap.isEmpty()) { - return; - } - final ArrayMap<String, Long> removedPackagesMap = mPackagesTokenData.removedPackagesMap; - - // filter out package usage stats - final int removedPackagesSize = removedPackagesMap.size(); - for (int i = 0; i < removedPackagesSize; i++) { - final String removedPackage = removedPackagesMap.keyAt(i); - final UsageStats usageStats = stats.packageStats.get(removedPackage); - if (usageStats != null && usageStats.mEndTimeStamp < removedPackagesMap.valueAt(i)) { - stats.packageStats.remove(removedPackage); + synchronized (mLock) { + if (mPackagesTokenData.removedPackagesMap.isEmpty()) { + return; + } + final ArrayMap<String, Long> removedPackagesMap = mPackagesTokenData.removedPackagesMap; + + // filter out package usage stats + final int removedPackagesSize = removedPackagesMap.size(); + for (int i = 0; i < removedPackagesSize; i++) { + final String removedPackage = removedPackagesMap.keyAt(i); + final UsageStats usageStats = stats.packageStats.get(removedPackage); + if (usageStats != null && + usageStats.mEndTimeStamp < removedPackagesMap.valueAt(i)) { + stats.packageStats.remove(removedPackage); + } } - } - // filter out events - for (int i = stats.events.size() - 1; i >= 0; i--) { - final UsageEvents.Event event = stats.events.get(i); - final Long timeRemoved = removedPackagesMap.get(event.mPackage); - if (timeRemoved != null && timeRemoved > event.mTimeStamp) { - stats.events.remove(i); + // filter out events + for (int i = stats.events.size() - 1; i >= 0; i--) { + final UsageEvents.Event event = stats.events.get(i); + final Long timeRemoved = removedPackagesMap.get(event.mPackage); + if (timeRemoved != null && timeRemoved > event.mTimeStamp) { + stats.events.remove(i); + } } } } @@ -1226,12 +1231,14 @@ public class UsageStatsDatabase { } void obfuscateCurrentStats(IntervalStats[] currentStats) { - if (mCurrentVersion < 5) { - return; - } - for (int i = 0; i < currentStats.length; i++) { - final IntervalStats stats = currentStats[i]; - stats.obfuscateData(mPackagesTokenData); + synchronized (mLock) { + if (mCurrentVersion < 5) { + return; + } + for (int i = 0; i < currentStats.length; i++) { + final IntervalStats stats = currentStats[i]; + stats.obfuscateData(mPackagesTokenData); + } } } 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 9ed894bc1ca9..509d95e01f47 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/telecomm/java/android/telecom/CallAudioState.java b/telecomm/java/android/telecom/CallAudioState.java index 49e9232ad535..14c9ea51c618 100644 --- a/telecomm/java/android/telecom/CallAudioState.java +++ b/telecomm/java/android/telecom/CallAudioState.java @@ -159,7 +159,7 @@ public final class CallAudioState implements Parcelable { @Override public String toString() { String bluetoothDeviceList = supportedBluetoothDevices.stream() - .map(BluetoothDevice::getAddress).collect(Collectors.joining(", ")); + .map(BluetoothDevice::toString).collect(Collectors.joining(", ")); return String.format(Locale.US, "[AudioState isMuted: %b, route: %s, supportedRouteMask: %s, " + diff --git a/telephony/OWNERS b/telephony/OWNERS index 7607c64150d8..92af034217a9 100644 --- a/telephony/OWNERS +++ b/telephony/OWNERS @@ -15,4 +15,4 @@ per-file CarrierConfigManager.java=set noparent per-file CarrierConfigManager.java=amruthr@google.com,tgunn@google.com,rgreenwalt@google.com,satk@google.com #Domain Selection is jointly owned, add additional owners for domain selection specific files -per-file TransportSelectorCallback.java,WwanSelectorCallback.java,DomainSelectionService.java,DomainSelectionService.aidl,DomainSelector.java,EmergencyRegResult.java,EmergencyRegResult.aidl,IDomainSelectionServiceController.aidl,IDomainSelector.aidl,ITransportSelectorCallback.aidl,ITransportSelectorResultCallback.aidl,IWwanSelectorCallback.aidl,IWwanSelectorResultCallback.aidl=hwangoo@google.com,forestchoi@google.com,avinashmp@google.com,mkoon@google.com,seheele@google.com,radhikaagrawal@google.com,jdyou@google.com +per-file TransportSelectorCallback.java,WwanSelectorCallback.java,DomainSelectionService.java,DomainSelectionService.aidl,DomainSelector.java,EmergencyRegResult.java,EmergencyRegResult.aidl,IDomainSelectionServiceController.aidl,IDomainSelector.aidl,ITransportSelectorCallback.aidl,ITransportSelectorResultCallback.aidl,IWwanSelectorCallback.aidl,IWwanSelectorResultCallback.aidl=hwangoo@google.com,jaesikkong@google.com,avinashmp@google.com,mkoon@google.com,seheele@google.com,radhikaagrawal@google.com,jdyou@google.com diff --git a/test-mock/Android.bp b/test-mock/Android.bp index e29d321e5105..71f303311047 100644 --- a/test-mock/Android.bp +++ b/test-mock/Android.bp @@ -47,14 +47,16 @@ java_sdk_library { compile_dex: true, default_to_stubs: true, dist_group: "android", + + // This module cannot generate stubs from the api signature files as stubs depends on the + // private APIs, which are not visible in the api signature files. + build_from_text_stub: false, } java_library { name: "android.test.mock.ravenwood", + defaults: ["ravenwood-internal-only-visibility-java"], srcs: [":android-test-mock-sources"], - visibility: [ - "//frameworks/base", - ], } android_ravenwood_test { diff --git a/test-mock/src/android/test/mock/MockContext.java b/test-mock/src/android/test/mock/MockContext.java index cf38bea55f2c..6bf7ff501217 100644 --- a/test-mock/src/android/test/mock/MockContext.java +++ b/test-mock/src/android/test/mock/MockContext.java @@ -479,6 +479,15 @@ public class MockContext extends Context { throw new UnsupportedOperationException(); } + /** @hide */ + @Override + public void sendOrderedBroadcastAsUserMultiplePermissions(Intent intent, UserHandle user, + String[] receiverPermissions, int appOp, Bundle options, + BroadcastReceiver resultReceiver, Handler scheduler, int initialCode, + String initialData, Bundle initialExtras) { + throw new UnsupportedOperationException(); + } + @Override public void sendOrderedBroadcast(Intent intent, String receiverPermission, String receiverAppOp, BroadcastReceiver resultReceiver, Handler scheduler, diff --git a/tests/BootImageProfileTest/OWNERS b/tests/BootImageProfileTest/OWNERS index 57303e748738..64775f824fa4 100644 --- a/tests/BootImageProfileTest/OWNERS +++ b/tests/BootImageProfileTest/OWNERS @@ -1,4 +1 @@ -calin@google.com -ngeoffray@google.com -vmarko@google.com -yawanng@google.com +include platform/art:main:/OWNERS_boot_profile diff --git a/tests/Input/src/com/android/test/input/AnrTest.kt b/tests/Input/src/com/android/test/input/AnrTest.kt index 8d1fc508ffe7..d32cedb24a36 100644 --- a/tests/Input/src/com/android/test/input/AnrTest.kt +++ b/tests/Input/src/com/android/test/input/AnrTest.kt @@ -40,7 +40,7 @@ import androidx.test.uiautomator.Until import com.android.cts.input.DebugInputRule import com.android.cts.input.UinputTouchScreen -import java.util.concurrent.TimeUnit +import java.time.Duration import org.junit.After import org.junit.Assert.assertEquals @@ -193,6 +193,6 @@ class AnrTest { val flags = " -W -n " val startCmd = "am start $flags $PACKAGE_NAME/.UnresponsiveGestureMonitorActivity" instrumentation.uiAutomation.executeShellCommand(startCmd) - waitForStableWindowGeometry(5L, TimeUnit.SECONDS) + waitForStableWindowGeometry(Duration.ofSeconds(5)) } } diff --git a/tests/PackageWatchdog/src/com/android/server/CrashRecoveryTest.java b/tests/PackageWatchdog/src/com/android/server/CrashRecoveryTest.java index 489ef4444e1d..c0e90f9232d6 100644 --- a/tests/PackageWatchdog/src/com/android/server/CrashRecoveryTest.java +++ b/tests/PackageWatchdog/src/com/android/server/CrashRecoveryTest.java @@ -35,6 +35,7 @@ import static org.mockito.Mockito.when; import android.Manifest; import android.content.Context; +import android.content.pm.ApplicationInfo; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.pm.VersionedPackage; @@ -47,6 +48,8 @@ import android.net.ConnectivityModuleConnector.ConnectivityModuleHealthListener; import android.os.Handler; import android.os.SystemProperties; import android.os.test.TestLooper; +import android.platform.test.annotations.DisableFlags; +import android.platform.test.annotations.EnableFlags; import android.platform.test.flag.junit.SetFlagsRule; import android.provider.DeviceConfig; import android.util.AtomicFile; @@ -75,6 +78,7 @@ import org.mockito.stubbing.Answer; import java.io.File; import java.lang.reflect.Field; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -288,7 +292,8 @@ public class CrashRecoveryTest { } @Test - public void testBootLoopWithRescuePartyAndRollbackPackageHealthObserver() throws Exception { + @DisableFlags(Flags.FLAG_DEPRECATE_FLAGS_AND_SETTINGS_RESETS) + public void testBootLoopWithRescuePartyAndRollbackObserver() throws Exception { PackageWatchdog watchdog = createWatchdog(); RescuePartyObserver rescuePartyObserver = setUpRescuePartyObserver(watchdog); RollbackPackageHealthObserver rollbackObserver = @@ -360,6 +365,361 @@ public class CrashRecoveryTest { verify(rescuePartyObserver, never()).executeBootLoopMitigation(2); } + @Test + @EnableFlags(Flags.FLAG_DEPRECATE_FLAGS_AND_SETTINGS_RESETS) + public void testBootLoopWithRescuePartyAndRollbackObserverNoFlags() throws Exception { + PackageWatchdog watchdog = createWatchdog(); + RescuePartyObserver rescuePartyObserver = setUpRescuePartyObserver(watchdog); + RollbackPackageHealthObserver rollbackObserver = + setUpRollbackPackageHealthObserver(watchdog); + + verify(rescuePartyObserver, never()).executeBootLoopMitigation(1); + verify(rollbackObserver, never()).executeBootLoopMitigation(1); + for (int i = 0; i < PackageWatchdog.DEFAULT_BOOT_LOOP_TRIGGER_COUNT; i++) { + watchdog.noteBoot(); + } + verify(rescuePartyObserver).executeBootLoopMitigation(1); + verify(rescuePartyObserver, never()).executeBootLoopMitigation(2); + verify(rollbackObserver, never()).executeBootLoopMitigation(1); + + watchdog.noteBoot(); + + verify(rescuePartyObserver, never()).executeBootLoopMitigation(2); + verify(rollbackObserver).executeBootLoopMitigation(1); + verify(rollbackObserver, never()).executeBootLoopMitigation(2); + // Update the list of available rollbacks after executing bootloop mitigation once + when(mRollbackManager.getAvailableRollbacks()).thenReturn(List.of(ROLLBACK_INFO_HIGH, + ROLLBACK_INFO_MANUAL)); + + watchdog.noteBoot(); + + verify(rescuePartyObserver, never()).executeBootLoopMitigation(2); + verify(rollbackObserver).executeBootLoopMitigation(2); + verify(rollbackObserver, never()).executeBootLoopMitigation(3); + // Update the list of available rollbacks after executing bootloop mitigation + when(mRollbackManager.getAvailableRollbacks()).thenReturn(List.of(ROLLBACK_INFO_MANUAL)); + + watchdog.noteBoot(); + + verify(rescuePartyObserver).executeBootLoopMitigation(2); + verify(rescuePartyObserver, never()).executeBootLoopMitigation(3); + verify(rollbackObserver, never()).executeBootLoopMitigation(3); + + moveTimeForwardAndDispatch(PackageWatchdog.DEFAULT_DEESCALATION_WINDOW_MS + 1); + Mockito.reset(rescuePartyObserver); + + for (int i = 0; i < PackageWatchdog.DEFAULT_BOOT_LOOP_TRIGGER_COUNT; i++) { + watchdog.noteBoot(); + } + verify(rescuePartyObserver).executeBootLoopMitigation(1); + verify(rescuePartyObserver, never()).executeBootLoopMitigation(2); + } + + @Test + @DisableFlags(Flags.FLAG_DEPRECATE_FLAGS_AND_SETTINGS_RESETS) + public void testCrashLoopWithRescuePartyAndRollbackObserver() throws Exception { + PackageWatchdog watchdog = createWatchdog(); + RescuePartyObserver rescuePartyObserver = setUpRescuePartyObserver(watchdog); + RollbackPackageHealthObserver rollbackObserver = + setUpRollbackPackageHealthObserver(watchdog); + VersionedPackage versionedPackageA = new VersionedPackage(APP_A, VERSION_CODE); + + when(mMockPackageManager.getApplicationInfo(anyString(), anyInt())).then(inv -> { + ApplicationInfo info = new ApplicationInfo(); + info.flags |= ApplicationInfo.FLAG_PERSISTENT + | ApplicationInfo.FLAG_SYSTEM; + return info; + }); + + raiseFatalFailureAndDispatch(watchdog, + Arrays.asList(versionedPackageA), PackageWatchdog.FAILURE_REASON_APP_CRASH); + + // Mitigation: SCOPED_DEVICE_CONFIG_RESET + verify(rescuePartyObserver).execute(versionedPackageA, + PackageWatchdog.FAILURE_REASON_APP_CRASH, 1); + verify(rescuePartyObserver, never()).execute(versionedPackageA, + PackageWatchdog.FAILURE_REASON_APP_CRASH, 2); + verify(rollbackObserver, never()).execute(versionedPackageA, + PackageWatchdog.FAILURE_REASON_APP_CRASH, 1); + + raiseFatalFailureAndDispatch(watchdog, + Arrays.asList(versionedPackageA), PackageWatchdog.FAILURE_REASON_APP_CRASH); + + // Mitigation: ALL_DEVICE_CONFIG_RESET + verify(rescuePartyObserver).execute(versionedPackageA, + PackageWatchdog.FAILURE_REASON_APP_CRASH, 2); + verify(rescuePartyObserver, never()).execute(versionedPackageA, + PackageWatchdog.FAILURE_REASON_APP_CRASH, 3); + verify(rollbackObserver, never()).execute(versionedPackageA, + PackageWatchdog.FAILURE_REASON_APP_CRASH, 1); + + raiseFatalFailureAndDispatch(watchdog, + Arrays.asList(versionedPackageA), PackageWatchdog.FAILURE_REASON_APP_CRASH); + + // Mitigation: WARM_REBOOT + verify(rescuePartyObserver).execute(versionedPackageA, + PackageWatchdog.FAILURE_REASON_APP_CRASH, 3); + verify(rescuePartyObserver, never()).execute(versionedPackageA, + PackageWatchdog.FAILURE_REASON_APP_CRASH, 4); + verify(rollbackObserver, never()).execute(versionedPackageA, + PackageWatchdog.FAILURE_REASON_APP_CRASH, 1); + + raiseFatalFailureAndDispatch(watchdog, + Arrays.asList(versionedPackageA), PackageWatchdog.FAILURE_REASON_APP_CRASH); + + // Mitigation: Low impact rollback + verify(rollbackObserver).execute(versionedPackageA, + PackageWatchdog.FAILURE_REASON_APP_CRASH, 1); + verify(rescuePartyObserver, never()).execute(versionedPackageA, + PackageWatchdog.FAILURE_REASON_APP_CRASH, 4); + + // update available rollbacks to mock rollbacks being applied after the call to + // rollbackObserver.execute + when(mRollbackManager.getAvailableRollbacks()).thenReturn( + List.of(ROLLBACK_INFO_HIGH, ROLLBACK_INFO_MANUAL)); + + raiseFatalFailureAndDispatch(watchdog, + Arrays.asList(versionedPackageA), PackageWatchdog.FAILURE_REASON_APP_CRASH); + + // DEFAULT_MAJOR_USER_IMPACT_LEVEL_THRESHOLD reached. No more mitigations applied + verify(rescuePartyObserver, never()).execute(versionedPackageA, + PackageWatchdog.FAILURE_REASON_APP_CRASH, 4); + verify(rollbackObserver, never()).execute(versionedPackageA, + PackageWatchdog.FAILURE_REASON_APP_CRASH, 2); + } + + @Test + @EnableFlags(Flags.FLAG_DEPRECATE_FLAGS_AND_SETTINGS_RESETS) + public void testCrashLoopWithRescuePartyAndRollbackObserverEnableDeprecateFlagReset() + throws Exception { + PackageWatchdog watchdog = createWatchdog(); + RescuePartyObserver rescuePartyObserver = setUpRescuePartyObserver(watchdog); + RollbackPackageHealthObserver rollbackObserver = + setUpRollbackPackageHealthObserver(watchdog); + VersionedPackage versionedPackageA = new VersionedPackage(APP_A, VERSION_CODE); + + when(mMockPackageManager.getApplicationInfo(anyString(), anyInt())).then(inv -> { + ApplicationInfo info = new ApplicationInfo(); + info.flags |= ApplicationInfo.FLAG_PERSISTENT + | ApplicationInfo.FLAG_SYSTEM; + return info; + }); + + + raiseFatalFailureAndDispatch(watchdog, + Arrays.asList(versionedPackageA), PackageWatchdog.FAILURE_REASON_APP_CRASH); + + // Mitigation: WARM_REBOOT + verify(rescuePartyObserver).execute(versionedPackageA, + PackageWatchdog.FAILURE_REASON_APP_CRASH, 1); + verify(rescuePartyObserver, never()).execute(versionedPackageA, + PackageWatchdog.FAILURE_REASON_APP_CRASH, 2); + verify(rollbackObserver, never()).execute(versionedPackageA, + PackageWatchdog.FAILURE_REASON_APP_CRASH, 1); + + raiseFatalFailureAndDispatch(watchdog, + Arrays.asList(versionedPackageA), PackageWatchdog.FAILURE_REASON_APP_CRASH); + + // Mitigation: Low impact rollback + verify(rollbackObserver).execute(versionedPackageA, + PackageWatchdog.FAILURE_REASON_APP_CRASH, 1); + verify(rescuePartyObserver, never()).execute(versionedPackageA, + PackageWatchdog.FAILURE_REASON_APP_CRASH, 2); + + // update available rollbacks to mock rollbacks being applied after the call to + // rollbackObserver.execute + when(mRollbackManager.getAvailableRollbacks()).thenReturn( + List.of(ROLLBACK_INFO_HIGH, ROLLBACK_INFO_MANUAL)); + + raiseFatalFailureAndDispatch(watchdog, + Arrays.asList(versionedPackageA), PackageWatchdog.FAILURE_REASON_APP_CRASH); + + // DEFAULT_MAJOR_USER_IMPACT_LEVEL_THRESHOLD reached. No more mitigations applied + verify(rescuePartyObserver, never()).execute(versionedPackageA, + PackageWatchdog.FAILURE_REASON_APP_CRASH, 2); + verify(rollbackObserver, never()).execute(versionedPackageA, + PackageWatchdog.FAILURE_REASON_APP_CRASH, 2); + } + + @Test + @DisableFlags(Flags.FLAG_DEPRECATE_FLAGS_AND_SETTINGS_RESETS) + public void testCrashLoopSystemUIWithRescuePartyAndRollbackObserver() throws Exception { + PackageWatchdog watchdog = createWatchdog(); + RescuePartyObserver rescuePartyObserver = setUpRescuePartyObserver(watchdog); + RollbackPackageHealthObserver rollbackObserver = + setUpRollbackPackageHealthObserver(watchdog); + String systemUi = "com.android.systemui"; + VersionedPackage versionedPackageUi = new VersionedPackage( + systemUi, VERSION_CODE); + RollbackInfo rollbackInfoUi = getRollbackInfo(systemUi, VERSION_CODE, 1, + PackageManager.ROLLBACK_USER_IMPACT_LOW); + when(mRollbackManager.getAvailableRollbacks()).thenReturn(List.of(ROLLBACK_INFO_LOW, + ROLLBACK_INFO_HIGH, ROLLBACK_INFO_MANUAL, rollbackInfoUi)); + + when(mMockPackageManager.getApplicationInfo(anyString(), anyInt())).then(inv -> { + ApplicationInfo info = new ApplicationInfo(); + info.flags |= ApplicationInfo.FLAG_PERSISTENT + | ApplicationInfo.FLAG_SYSTEM; + return info; + }); + + raiseFatalFailureAndDispatch(watchdog, + Arrays.asList(versionedPackageUi), PackageWatchdog.FAILURE_REASON_APP_CRASH); + + // Mitigation: SCOPED_DEVICE_CONFIG_RESET + verify(rescuePartyObserver).execute(versionedPackageUi, + PackageWatchdog.FAILURE_REASON_APP_CRASH, 1); + verify(rescuePartyObserver, never()).execute(versionedPackageUi, + PackageWatchdog.FAILURE_REASON_APP_CRASH, 2); + verify(rollbackObserver, never()).execute(versionedPackageUi, + PackageWatchdog.FAILURE_REASON_APP_CRASH, 1); + + raiseFatalFailureAndDispatch(watchdog, + Arrays.asList(versionedPackageUi), PackageWatchdog.FAILURE_REASON_APP_CRASH); + + // Mitigation: ALL_DEVICE_CONFIG_RESET + verify(rescuePartyObserver).execute(versionedPackageUi, + PackageWatchdog.FAILURE_REASON_APP_CRASH, 2); + verify(rescuePartyObserver, never()).execute(versionedPackageUi, + PackageWatchdog.FAILURE_REASON_APP_CRASH, 3); + verify(rollbackObserver, never()).execute(versionedPackageUi, + PackageWatchdog.FAILURE_REASON_APP_CRASH, 1); + + raiseFatalFailureAndDispatch(watchdog, + Arrays.asList(versionedPackageUi), PackageWatchdog.FAILURE_REASON_APP_CRASH); + + // Mitigation: WARM_REBOOT + verify(rescuePartyObserver).execute(versionedPackageUi, + PackageWatchdog.FAILURE_REASON_APP_CRASH, 3); + verify(rescuePartyObserver, never()).execute(versionedPackageUi, + PackageWatchdog.FAILURE_REASON_APP_CRASH, 4); + verify(rollbackObserver, never()).execute(versionedPackageUi, + PackageWatchdog.FAILURE_REASON_APP_CRASH, 1); + + raiseFatalFailureAndDispatch(watchdog, + Arrays.asList(versionedPackageUi), PackageWatchdog.FAILURE_REASON_APP_CRASH); + + // Mitigation: Low impact rollback + verify(rollbackObserver).execute(versionedPackageUi, + PackageWatchdog.FAILURE_REASON_APP_CRASH, 1); + verify(rescuePartyObserver, never()).execute(versionedPackageUi, + PackageWatchdog.FAILURE_REASON_APP_CRASH, 4); + verify(rollbackObserver, never()).execute(versionedPackageUi, + PackageWatchdog.FAILURE_REASON_APP_CRASH, 2); + + // update available rollbacks to mock rollbacks being applied after the call to + // rollbackObserver.execute + when(mRollbackManager.getAvailableRollbacks()).thenReturn( + List.of(ROLLBACK_INFO_HIGH, ROLLBACK_INFO_MANUAL)); + + raiseFatalFailureAndDispatch(watchdog, + Arrays.asList(versionedPackageUi), PackageWatchdog.FAILURE_REASON_APP_CRASH); + + // Mitigation: RESET_SETTINGS_UNTRUSTED_DEFAULTS + verify(rescuePartyObserver).execute(versionedPackageUi, + PackageWatchdog.FAILURE_REASON_APP_CRASH, 4); + verify(rescuePartyObserver, never()).execute(versionedPackageUi, + PackageWatchdog.FAILURE_REASON_APP_CRASH, 5); + verify(rollbackObserver, never()).execute(versionedPackageUi, + PackageWatchdog.FAILURE_REASON_APP_CRASH, 2); + + raiseFatalFailureAndDispatch(watchdog, + Arrays.asList(versionedPackageUi), PackageWatchdog.FAILURE_REASON_APP_CRASH); + + // Mitigation: RESET_SETTINGS_UNTRUSTED_CHANGES + verify(rescuePartyObserver).execute(versionedPackageUi, + PackageWatchdog.FAILURE_REASON_APP_CRASH, 5); + verify(rescuePartyObserver, never()).execute(versionedPackageUi, + PackageWatchdog.FAILURE_REASON_APP_CRASH, 6); + verify(rollbackObserver, never()).execute(versionedPackageUi, + PackageWatchdog.FAILURE_REASON_APP_CRASH, 2); + + raiseFatalFailureAndDispatch(watchdog, + Arrays.asList(versionedPackageUi), PackageWatchdog.FAILURE_REASON_APP_CRASH); + + // Mitigation: RESET_SETTINGS_TRUSTED_DEFAULTS + verify(rescuePartyObserver).execute(versionedPackageUi, + PackageWatchdog.FAILURE_REASON_APP_CRASH, 6); + verify(rescuePartyObserver, never()).execute(versionedPackageUi, + PackageWatchdog.FAILURE_REASON_APP_CRASH, 7); + verify(rollbackObserver, never()).execute(versionedPackageUi, + PackageWatchdog.FAILURE_REASON_APP_CRASH, 2); + + raiseFatalFailureAndDispatch(watchdog, + Arrays.asList(versionedPackageUi), PackageWatchdog.FAILURE_REASON_APP_CRASH); + + // Mitigation: Factory reset. High impact rollbacks are performed only for boot loops. + verify(rescuePartyObserver).execute(versionedPackageUi, + PackageWatchdog.FAILURE_REASON_APP_CRASH, 7); + verify(rescuePartyObserver, never()).execute(versionedPackageUi, + PackageWatchdog.FAILURE_REASON_APP_CRASH, 8); + verify(rollbackObserver, never()).execute(versionedPackageUi, + PackageWatchdog.FAILURE_REASON_APP_CRASH, 2); + } + + @Test + @EnableFlags(Flags.FLAG_DEPRECATE_FLAGS_AND_SETTINGS_RESETS) + public void testCrashLoopSystemUIWithRescuePartyAndRollbackObserverEnableDeprecateFlagReset() + throws Exception { + PackageWatchdog watchdog = createWatchdog(); + RescuePartyObserver rescuePartyObserver = setUpRescuePartyObserver(watchdog); + RollbackPackageHealthObserver rollbackObserver = + setUpRollbackPackageHealthObserver(watchdog); + String systemUi = "com.android.systemui"; + VersionedPackage versionedPackageUi = new VersionedPackage( + systemUi, VERSION_CODE); + RollbackInfo rollbackInfoUi = getRollbackInfo(systemUi, VERSION_CODE, 1, + PackageManager.ROLLBACK_USER_IMPACT_LOW); + when(mRollbackManager.getAvailableRollbacks()).thenReturn(List.of(ROLLBACK_INFO_LOW, + ROLLBACK_INFO_HIGH, ROLLBACK_INFO_MANUAL, rollbackInfoUi)); + + when(mMockPackageManager.getApplicationInfo(anyString(), anyInt())).then(inv -> { + ApplicationInfo info = new ApplicationInfo(); + info.flags |= ApplicationInfo.FLAG_PERSISTENT + | ApplicationInfo.FLAG_SYSTEM; + return info; + }); + + + raiseFatalFailureAndDispatch(watchdog, + Arrays.asList(versionedPackageUi), PackageWatchdog.FAILURE_REASON_APP_CRASH); + + // Mitigation: WARM_REBOOT + verify(rescuePartyObserver).execute(versionedPackageUi, + PackageWatchdog.FAILURE_REASON_APP_CRASH, 1); + verify(rescuePartyObserver, never()).execute(versionedPackageUi, + PackageWatchdog.FAILURE_REASON_APP_CRASH, 2); + verify(rollbackObserver, never()).execute(versionedPackageUi, + PackageWatchdog.FAILURE_REASON_APP_CRASH, 1); + + raiseFatalFailureAndDispatch(watchdog, + Arrays.asList(versionedPackageUi), PackageWatchdog.FAILURE_REASON_APP_CRASH); + + // Mitigation: Low impact rollback + verify(rollbackObserver).execute(versionedPackageUi, + PackageWatchdog.FAILURE_REASON_APP_CRASH, 1); + verify(rescuePartyObserver, never()).execute(versionedPackageUi, + PackageWatchdog.FAILURE_REASON_APP_CRASH, 2); + verify(rollbackObserver, never()).execute(versionedPackageUi, + PackageWatchdog.FAILURE_REASON_APP_CRASH, 2); + + // update available rollbacks to mock rollbacks being applied after the call to + // rollbackObserver.execute + when(mRollbackManager.getAvailableRollbacks()).thenReturn( + List.of(ROLLBACK_INFO_HIGH, ROLLBACK_INFO_MANUAL)); + + raiseFatalFailureAndDispatch(watchdog, + Arrays.asList(versionedPackageUi), PackageWatchdog.FAILURE_REASON_APP_CRASH); + + // Mitigation: Factory reset. High impact rollbacks are performed only for boot loops. + verify(rescuePartyObserver).execute(versionedPackageUi, + PackageWatchdog.FAILURE_REASON_APP_CRASH, 2); + verify(rescuePartyObserver, never()).execute(versionedPackageUi, + PackageWatchdog.FAILURE_REASON_APP_CRASH, 3); + verify(rollbackObserver, never()).execute(versionedPackageUi, + PackageWatchdog.FAILURE_REASON_APP_CRASH, 2); + } + RollbackPackageHealthObserver setUpRollbackPackageHealthObserver(PackageWatchdog watchdog) { RollbackPackageHealthObserver rollbackObserver = spy(new RollbackPackageHealthObserver(mSpyContext, mApexManager)); @@ -371,7 +731,6 @@ public class CrashRecoveryTest { watchdog.registerHealthObserver(rollbackObserver); return rollbackObserver; } - RescuePartyObserver setUpRescuePartyObserver(PackageWatchdog watchdog) { setCrashRecoveryPropRescueBootCount(0); RescuePartyObserver rescuePartyObserver = spy(RescuePartyObserver.getInstance(mSpyContext)); @@ -633,4 +992,20 @@ public class CrashRecoveryTest { mTestLooper.moveTimeForward(milliSeconds); mTestLooper.dispatchAll(); } + + private void raiseFatalFailureAndDispatch(PackageWatchdog watchdog, + List<VersionedPackage> packages, int failureReason) { + long triggerFailureCount = watchdog.getTriggerFailureCount(); + if (failureReason == PackageWatchdog.FAILURE_REASON_EXPLICIT_HEALTH_CHECK + || failureReason == PackageWatchdog.FAILURE_REASON_NATIVE_CRASH) { + triggerFailureCount = 1; + } + for (int i = 0; i < triggerFailureCount; i++) { + watchdog.onPackageFailure(packages, failureReason); + } + mTestLooper.dispatchAll(); + if (Flags.recoverabilityDetection()) { + moveTimeForwardAndDispatch(watchdog.DEFAULT_MITIGATION_WINDOW_MS); + } + } } diff --git a/tests/TrustTests/src/android/trust/test/GrantAndRevokeTrustTest.kt b/tests/TrustTests/src/android/trust/test/GrantAndRevokeTrustTest.kt index d0e56268a27d..0c3c7e2af6f2 100644 --- a/tests/TrustTests/src/android/trust/test/GrantAndRevokeTrustTest.kt +++ b/tests/TrustTests/src/android/trust/test/GrantAndRevokeTrustTest.kt @@ -17,9 +17,6 @@ package android.trust.test import android.content.pm.PackageManager -import android.platform.test.annotations.RequiresFlagsDisabled -import android.platform.test.annotations.RequiresFlagsEnabled -import android.platform.test.flag.junit.DeviceFlagsValueProvider import android.service.trust.GrantTrustResult import android.trust.BaseTrustAgentService import android.trust.TrustTestActivity @@ -58,7 +55,6 @@ class GrantAndRevokeTrustTest { .around(ScreenLockRule()) .around(lockStateTrackingRule) .around(trustAgentRule) - .around(DeviceFlagsValueProvider.createCheckFlagsRule()) @Before fun manageTrust() { @@ -93,7 +89,6 @@ class GrantAndRevokeTrustTest { } @Test - @RequiresFlagsEnabled(android.security.Flags.FLAG_FIX_UNLOCKED_DEVICE_REQUIRED_KEYS_V2) fun grantCannotActivelyUnlockDevice() { // On automotive, trust agents can actively unlock the device. assumeFalse(packageManager.hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE)) @@ -120,24 +115,6 @@ class GrantAndRevokeTrustTest { } @Test - @RequiresFlagsDisabled(android.security.Flags.FLAG_FIX_UNLOCKED_DEVICE_REQUIRED_KEYS_V2) - fun grantCouldCauseWrongDeviceLockedStateDueToBug() { - // On automotive, trust agents can actively unlock the device. - assumeFalse(packageManager.hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE)) - - // Verify that b/296464083 exists. That is, when the device is locked - // and a trust agent grants trust, the deviceLocked state incorrectly - // becomes false even though the device correctly remains locked. - uiDevice.sleep() - lockStateTrackingRule.assertLocked() - trustAgentRule.agent.grantTrust(GRANT_MESSAGE, 10000, 0) {} - uiDevice.wakeUp() - uiDevice.sleep() - await() - lockStateTrackingRule.assertUnlockedButNotReally() - } - - @Test fun grantDoesNotCallBack() { val callback = mock<(GrantTrustResult) -> Unit>() trustAgentRule.agent.grantTrust(GRANT_MESSAGE, 0, 0, callback) diff --git a/tests/TrustTests/src/android/trust/test/UnlockAttemptTest.kt b/tests/TrustTests/src/android/trust/test/UnlockAttemptTest.kt index 2c9361df63fd..f9e004bcd29e 100644 --- a/tests/TrustTests/src/android/trust/test/UnlockAttemptTest.kt +++ b/tests/TrustTests/src/android/trust/test/UnlockAttemptTest.kt @@ -17,6 +17,7 @@ package android.trust.test import android.app.trust.TrustManager import android.content.Context +import android.security.Flags.shouldTrustManagerListenForPrimaryAuth import android.trust.BaseTrustAgentService import android.trust.TrustTestActivity import android.trust.test.lib.LockStateTrackingRule @@ -154,13 +155,17 @@ class UnlockAttemptTest { private fun triggerSuccessfulUnlock() { screenLockRule.successfulScreenLockAttempt() - trustAgentRule.reportSuccessfulUnlock() + if (!shouldTrustManagerListenForPrimaryAuth()) { + trustAgentRule.reportSuccessfulUnlock() + } await() } private fun triggerFailedUnlock() { screenLockRule.failedScreenLockAttempt() - trustAgentRule.reportFailedUnlock() + if (!shouldTrustManagerListenForPrimaryAuth()) { + trustAgentRule.reportFailedUnlock() + } await() } diff --git a/tests/TrustTests/src/android/trust/test/lib/LockStateTrackingRule.kt b/tests/TrustTests/src/android/trust/test/lib/LockStateTrackingRule.kt index 01218099f34c..80d79478c898 100644 --- a/tests/TrustTests/src/android/trust/test/lib/LockStateTrackingRule.kt +++ b/tests/TrustTests/src/android/trust/test/lib/LockStateTrackingRule.kt @@ -64,13 +64,6 @@ class LockStateTrackingRule : TestRule { wait("not trusted") { trustState.trusted == false } } - // TODO(b/299298338) remove this when removing FLAG_FIX_UNLOCKED_DEVICE_REQUIRED_KEYS_V2 - fun assertUnlockedButNotReally() { - wait("device unlocked") { !keyguardManager.isDeviceLocked } - wait("not trusted") { trustState.trusted == false } - wait("keyguard locked") { windowManager.isKeyguardLocked } - } - fun assertUnlockedAndTrusted() { wait("device unlocked") { !keyguardManager.isDeviceLocked } wait("trusted") { trustState.trusted == true } diff --git a/tools/aapt2/cmd/Compile.cpp b/tools/aapt2/cmd/Compile.cpp index 031dd5bb139c..9b8c3b3d549c 100644 --- a/tools/aapt2/cmd/Compile.cpp +++ b/tools/aapt2/cmd/Compile.cpp @@ -836,6 +836,28 @@ int CompileCommand::Action(const std::vector<std::string>& args) { return 1; } + // Parse the feature flag values. An argument that starts with '@' points to a file to read flag + // values from. + std::vector<std::string> all_feature_flags_args; + for (const std::string& arg : feature_flags_args_) { + if (util::StartsWith(arg, "@")) { + const std::string path = arg.substr(1, arg.size() - 1); + std::string error; + if (!file::AppendArgsFromFile(path, &all_feature_flags_args, &error)) { + context.GetDiagnostics()->Error(android::DiagMessage(path) << error); + return 1; + } + } else { + all_feature_flags_args.push_back(arg); + } + } + + for (const std::string& arg : all_feature_flags_args) { + if (!ParseFeatureFlagsParameter(arg, context.GetDiagnostics(), &options_.feature_flag_values)) { + return 1; + } + } + return Compile(&context, file_collection.get(), archive_writer.get(), options_); } diff --git a/tools/aapt2/cmd/Compile.h b/tools/aapt2/cmd/Compile.h index 61c5b60adb76..70c8791524c8 100644 --- a/tools/aapt2/cmd/Compile.h +++ b/tools/aapt2/cmd/Compile.h @@ -24,6 +24,7 @@ #include "Command.h" #include "ResourceTable.h" #include "androidfw/IDiagnostics.h" +#include "cmd/Util.h" #include "format/Archive.h" #include "process/IResourceTableConsumer.h" @@ -45,6 +46,7 @@ struct CompileOptions { bool preserve_visibility_of_styleables = false; bool verbose = false; std::optional<std::string> product_; + FeatureFlagValues feature_flag_values; }; /** Parses flags and compiles resources to be used in linking. */ @@ -92,6 +94,12 @@ class CompileCommand : public Command { "Leave only resources specific to the given product. All " "other resources (including defaults) are removed.", &options_.product_); + AddOptionalFlagList("--feature-flags", + "Specify the values of feature flags. The pairs in the argument\n" + "are separated by ',' the name is separated from the value by '='.\n" + "The name can have a suffix of ':ro' to indicate it is read only." + "Example: \"flag1=true,flag2:ro=false,flag3=\" (flag3 has no given value).", + &feature_flags_args_); } int Action(const std::vector<std::string>& args) override; @@ -101,6 +109,7 @@ class CompileCommand : public Command { CompileOptions options_; std::optional<std::string> visibility_; std::optional<std::string> trace_folder_; + std::vector<std::string> feature_flags_args_; }; int Compile(IAaptContext* context, io::IFileCollection* inputs, IArchiveWriter* output_writer, diff --git a/tools/aapt2/cmd/Link.h b/tools/aapt2/cmd/Link.h index 8fe414f4f660..2f17853718ec 100644 --- a/tools/aapt2/cmd/Link.h +++ b/tools/aapt2/cmd/Link.h @@ -332,8 +332,9 @@ class LinkCommand : public Command { AddOptionalSwitch("-v", "Enables verbose logging.", &verbose_); AddOptionalFlagList("--feature-flags", "Specify the values of feature flags. The pairs in the argument\n" - "are separated by ',' and the name is separated from the value by '='.\n" - "Example: \"flag1=true,flag2=false,flag3=\" (flag3 has no given value).", + "are separated by ',' the name is separated from the value by '='.\n" + "The name can have a suffix of ':ro' to indicate it is read only." + "Example: \"flag1=true,flag2:ro=false,flag3=\" (flag3 has no given value).", &feature_flags_args_); AddOptionalSwitch("--non-updatable-system", "Mark the app as a non-updatable system app. This inserts\n" diff --git a/tools/aapt2/cmd/Util.cpp b/tools/aapt2/cmd/Util.cpp index 678d84628015..7739171b347f 100644 --- a/tools/aapt2/cmd/Util.cpp +++ b/tools/aapt2/cmd/Util.cpp @@ -128,7 +128,7 @@ bool ParseFeatureFlagsParameter(StringPiece arg, android::IDiagnostics* diag, if (parts.size() > 2) { diag->Error(android::DiagMessage() << "Invalid feature flag and optional value '" << flag_and_value - << "'. Must be in the format 'flag_name[=true|false]"); + << "'. Must be in the format 'flag_name[:ro][=true|false]"); return false; } @@ -138,6 +138,28 @@ bool ParseFeatureFlagsParameter(StringPiece arg, android::IDiagnostics* diag, return false; } + std::vector<std::string> name_parts = util::Split(flag_name, ':'); + if (name_parts.size() > 2) { + diag->Error(android::DiagMessage() + << "Invalid feature flag and optional value '" << flag_and_value + << "'. Must be in the format 'flag_name[:READ_ONLY|READ_WRITE][=true|false]"); + return false; + } + flag_name = name_parts[0]; + bool read_only = false; + if (name_parts.size() == 2) { + if (name_parts[1] == "ro" || name_parts[1] == "READ_ONLY") { + read_only = true; + } else if (name_parts[1] == "READ_WRITE") { + read_only = false; + } else { + diag->Error(android::DiagMessage() + << "Invalid feature flag and optional value '" << flag_and_value + << "'. Must be in the format 'flag_name[:READ_ONLY|READ_WRITE][=true|false]"); + return false; + } + } + std::optional<bool> flag_value = {}; if (parts.size() == 2) { StringPiece str_flag_value = util::TrimWhitespace(parts[1]); @@ -151,13 +173,13 @@ bool ParseFeatureFlagsParameter(StringPiece arg, android::IDiagnostics* diag, } } - if (auto [it, inserted] = - out_feature_flag_values->try_emplace(std::string(flag_name), flag_value); + auto ffp = FeatureFlagProperties{read_only, flag_value}; + if (auto [it, inserted] = out_feature_flag_values->try_emplace(std::string(flag_name), ffp); !inserted) { // We are allowing the same flag to appear multiple times, last value wins. diag->Note(android::DiagMessage() << "Value for feature flag '" << flag_name << "' was given more than once"); - it->second = flag_value; + it->second = ffp; } } return true; diff --git a/tools/aapt2/cmd/Util.h b/tools/aapt2/cmd/Util.h index 9ece5dd4d720..6b8813b34082 100644 --- a/tools/aapt2/cmd/Util.h +++ b/tools/aapt2/cmd/Util.h @@ -37,7 +37,17 @@ namespace aapt { -using FeatureFlagValues = std::map<std::string, std::optional<bool>, std::less<>>; +struct FeatureFlagProperties { + bool read_only; + std::optional<bool> enabled; + + FeatureFlagProperties(bool ro, std::optional<bool> e) : read_only(ro), enabled(e) { + } + + bool operator==(const FeatureFlagProperties&) const = default; +}; + +using FeatureFlagValues = std::map<std::string, FeatureFlagProperties, std::less<>>; // Parses a configuration density (ex. hdpi, xxhdpi, 234dpi, anydpi, etc). // Returns Nothing and logs a human friendly error message if the string was not legal. diff --git a/tools/aapt2/cmd/Util_test.cpp b/tools/aapt2/cmd/Util_test.cpp index 723d87ed0af3..78183409ad8f 100644 --- a/tools/aapt2/cmd/Util_test.cpp +++ b/tools/aapt2/cmd/Util_test.cpp @@ -383,21 +383,25 @@ TEST(UtilTest, ParseFeatureFlagsParameter_InvalidValue) { TEST(UtilTest, ParseFeatureFlagsParameter_DuplicateFlag) { auto diagnostics = test::ContextBuilder().Build()->GetDiagnostics(); FeatureFlagValues feature_flag_values; - ASSERT_TRUE( - ParseFeatureFlagsParameter("foo=true,bar=true,foo=false", diagnostics, &feature_flag_values)); - EXPECT_THAT(feature_flag_values, UnorderedElementsAre(Pair("foo", std::optional<bool>(false)), - Pair("bar", std::optional<bool>(true)))); + ASSERT_TRUE(ParseFeatureFlagsParameter("foo=true,bar:READ_WRITE=true,foo:ro=false", diagnostics, + &feature_flag_values)); + EXPECT_THAT( + feature_flag_values, + UnorderedElementsAre(Pair("foo", FeatureFlagProperties{true, std::optional<bool>(false)}), + Pair("bar", FeatureFlagProperties{false, std::optional<bool>(true)}))); } TEST(UtilTest, ParseFeatureFlagsParameter_Valid) { auto diagnostics = test::ContextBuilder().Build()->GetDiagnostics(); FeatureFlagValues feature_flag_values; - ASSERT_TRUE(ParseFeatureFlagsParameter("foo= true, bar =FALSE,baz=, quux", diagnostics, - &feature_flag_values)); - EXPECT_THAT(feature_flag_values, - UnorderedElementsAre(Pair("foo", std::optional<bool>(true)), - Pair("bar", std::optional<bool>(false)), - Pair("baz", std::nullopt), Pair("quux", std::nullopt))); + ASSERT_TRUE(ParseFeatureFlagsParameter("foo:READ_ONLY= true, bar:ro =FALSE,baz:READ_WRITE=, quux", + diagnostics, &feature_flag_values)); + EXPECT_THAT( + feature_flag_values, + UnorderedElementsAre(Pair("foo", FeatureFlagProperties{true, std::optional<bool>(true)}), + Pair("bar", FeatureFlagProperties{true, std::optional<bool>(false)}), + Pair("baz", FeatureFlagProperties{false, std::nullopt}), + Pair("quux", FeatureFlagProperties{false, std::nullopt}))); } TEST (UtilTest, AdjustSplitConstraintsForMinSdk) { diff --git a/tools/aapt2/link/FeatureFlagsFilter.cpp b/tools/aapt2/link/FeatureFlagsFilter.cpp index fdf3f74d4e18..9d40db521e13 100644 --- a/tools/aapt2/link/FeatureFlagsFilter.cpp +++ b/tools/aapt2/link/FeatureFlagsFilter.cpp @@ -63,12 +63,11 @@ class FlagsVisitor : public xml::Visitor { flag_name = flag_name.substr(1); } - if (auto it = feature_flag_values_.find(std::string(flag_name)); - it != feature_flag_values_.end()) { - if (it->second.has_value()) { + if (auto it = feature_flag_values_.find(flag_name); it != feature_flag_values_.end()) { + if (it->second.enabled.has_value()) { if (options_.remove_disabled_elements) { // Remove if flag==true && attr=="!flag" (negated) OR flag==false && attr=="flag" - return *it->second == negated; + return *it->second.enabled == negated; } } else if (options_.flags_must_have_value) { diagnostics_->Error(android::DiagMessage(node->line_number) diff --git a/tools/aapt2/link/FeatureFlagsFilter_test.cpp b/tools/aapt2/link/FeatureFlagsFilter_test.cpp index 53086cc30f18..2db2899e716c 100644 --- a/tools/aapt2/link/FeatureFlagsFilter_test.cpp +++ b/tools/aapt2/link/FeatureFlagsFilter_test.cpp @@ -48,7 +48,7 @@ TEST(FeatureFlagsFilterTest, NoFeatureFlagAttributes) { <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="android"> <permission android:name="FOO" /> </manifest>)EOF", - {{"flag", false}}); + {{"flag", FeatureFlagProperties{false, false}}}); ASSERT_THAT(doc, NotNull()); auto root = doc->root.get(); ASSERT_THAT(root, NotNull()); @@ -60,7 +60,7 @@ TEST(FeatureFlagsFilterTest, RemoveElementWithDisabledFlag) { <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="android"> <permission android:name="FOO" android:featureFlag="flag" /> </manifest>)EOF", - {{"flag", false}}); + {{"flag", FeatureFlagProperties{false, false}}}); ASSERT_THAT(doc, NotNull()); auto root = doc->root.get(); ASSERT_THAT(root, NotNull()); @@ -73,7 +73,7 @@ TEST(FeatureFlagsFilterTest, RemoveElementWithNegatedEnabledFlag) { <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="android"> <permission android:name="FOO" android:featureFlag="!flag" /> </manifest>)EOF", - {{"flag", true}}); + {{"flag", FeatureFlagProperties{false, true}}}); ASSERT_THAT(doc, NotNull()); auto root = doc->root.get(); ASSERT_THAT(root, NotNull()); @@ -86,7 +86,7 @@ TEST(FeatureFlagsFilterTest, KeepElementWithEnabledFlag) { <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="android"> <permission android:name="FOO" android:featureFlag="flag" /> </manifest>)EOF", - {{"flag", true}}); + {{"flag", FeatureFlagProperties{false, true}}}); ASSERT_THAT(doc, NotNull()); auto root = doc->root.get(); ASSERT_THAT(root, NotNull()); @@ -102,7 +102,7 @@ TEST(FeatureFlagsFilterTest, SideBySideEnabledAndDisabled) { <permission android:name="FOO" android:featureFlag="flag" android:protectionLevel="dangerous" /> </manifest>)EOF", - {{"flag", true}}); + {{"flag", FeatureFlagProperties{false, true}}}); ASSERT_THAT(doc, NotNull()); auto root = doc->root.get(); ASSERT_THAT(root, NotNull()); @@ -123,7 +123,7 @@ TEST(FeatureFlagsFilterTest, RemoveDeeplyNestedElement) { </activity> </application> </manifest>)EOF", - {{"flag", true}}); + {{"flag", FeatureFlagProperties{false, true}}}); ASSERT_THAT(doc, NotNull()); auto root = doc->root.get(); ASSERT_THAT(root, NotNull()); @@ -145,7 +145,7 @@ TEST(FeatureFlagsFilterTest, KeepDeeplyNestedElement) { </activity> </application> </manifest>)EOF", - {{"flag", true}}); + {{"flag", FeatureFlagProperties{false, true}}}); ASSERT_THAT(doc, NotNull()); auto root = doc->root.get(); ASSERT_THAT(root, NotNull()); @@ -162,7 +162,7 @@ TEST(FeatureFlagsFilterTest, FailOnEmptyFeatureFlagAttribute) { <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="android"> <permission android:name="FOO" android:featureFlag=" " /> </manifest>)EOF", - {{"flag", false}}); + {{"flag", FeatureFlagProperties{false, false}}}); ASSERT_THAT(doc, IsNull()); } @@ -171,7 +171,7 @@ TEST(FeatureFlagsFilterTest, FailOnFlagWithNoGivenValue) { <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="android"> <permission android:name="FOO" android:featureFlag="flag" /> </manifest>)EOF", - {{"flag", std::nullopt}}); + {{"flag", FeatureFlagProperties{false, std::nullopt}}}); ASSERT_THAT(doc, IsNull()); } @@ -180,7 +180,7 @@ TEST(FeatureFlagsFilterTest, FailOnUnrecognizedFlag) { <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="android"> <permission android:name="FOO" android:featureFlag="unrecognized" /> </manifest>)EOF", - {{"flag", true}}); + {{"flag", FeatureFlagProperties{false, true}}}); ASSERT_THAT(doc, IsNull()); } @@ -190,7 +190,7 @@ TEST(FeatureFlagsFilterTest, FailOnMultipleValidationErrors) { <permission android:name="FOO" android:featureFlag="bar" /> <permission android:name="FOO" android:featureFlag="unrecognized" /> </manifest>)EOF", - {{"flag", std::nullopt}}); + {{"flag", FeatureFlagProperties{false, std::nullopt}}}); ASSERT_THAT(doc, IsNull()); } @@ -199,7 +199,8 @@ TEST(FeatureFlagsFilterTest, OptionRemoveDisabledElementsIsFalse) { <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="android"> <permission android:name="FOO" android:featureFlag="flag" /> </manifest>)EOF", - {{"flag", false}}, {.remove_disabled_elements = false}); + {{"flag", FeatureFlagProperties{false, false}}}, + {.remove_disabled_elements = false}); ASSERT_THAT(doc, NotNull()); auto root = doc->root.get(); ASSERT_THAT(root, NotNull()); @@ -212,7 +213,8 @@ TEST(FeatureFlagsFilterTest, OptionFlagsMustHaveValueIsFalse) { <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="android"> <permission android:name="FOO" android:featureFlag="flag" /> </manifest>)EOF", - {{"flag", std::nullopt}}, {.flags_must_have_value = false}); + {{"flag", FeatureFlagProperties{false, std::nullopt}}}, + {.flags_must_have_value = false}); ASSERT_THAT(doc, NotNull()); auto root = doc->root.get(); ASSERT_THAT(root, NotNull()); @@ -225,7 +227,8 @@ TEST(FeatureFlagsFilterTest, OptionFailOnUnrecognizedFlagsIsFalse) { <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="android"> <permission android:name="FOO" android:featureFlag="unrecognized" /> </manifest>)EOF", - {{"flag", true}}, {.fail_on_unrecognized_flags = false}); + {{"flag", FeatureFlagProperties{false, true}}}, + {.fail_on_unrecognized_flags = false}); ASSERT_THAT(doc, NotNull()); auto root = doc->root.get(); ASSERT_THAT(root, NotNull()); diff --git a/tools/aapt2/util/Files.cpp b/tools/aapt2/util/Files.cpp index 02e4beaed949..8ae55b8868c3 100644 --- a/tools/aapt2/util/Files.cpp +++ b/tools/aapt2/util/Files.cpp @@ -189,7 +189,7 @@ void AppendPath(std::string* base, StringPiece part) { base->append(part.data(), part.size()); } -std::string BuildPath(std::vector<const StringPiece>&& args) { +std::string BuildPath(const std::vector<StringPiece>& args) { if (args.empty()) { return ""; } diff --git a/tools/aapt2/util/Files.h b/tools/aapt2/util/Files.h index 42eeaf2d2e2a..c1a42446ec3b 100644 --- a/tools/aapt2/util/Files.h +++ b/tools/aapt2/util/Files.h @@ -60,7 +60,7 @@ FileType GetFileType(const std::string& path); void AppendPath(std::string* base, android::StringPiece part); // Concatenates the list of paths and separates each part with the directory separator. -std::string BuildPath(std::vector<const android::StringPiece>&& args); +std::string BuildPath(const std::vector<android::StringPiece>& args); // Makes all the directories in `path`. The last element in the path is interpreted as a directory. bool mkdirs(const std::string& path); diff --git a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/HostStubGen.kt b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/HostStubGen.kt index 7212beb6ae4b..5dde265c79fb 100644 --- a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/HostStubGen.kt +++ b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/HostStubGen.kt @@ -33,6 +33,8 @@ import com.android.hoststubgen.visitors.PackageRedirectRemapper import org.objectweb.asm.ClassReader import org.objectweb.asm.ClassVisitor import org.objectweb.asm.ClassWriter +import org.objectweb.asm.commons.ClassRemapper +import org.objectweb.asm.commons.Remapper import org.objectweb.asm.util.CheckClassAdapter import java.io.BufferedInputStream import java.io.FileOutputStream @@ -70,7 +72,7 @@ class HostStubGen(val options: HostStubGenOptions) { } // Build the filters. - val filter = buildFilter(errors, allClasses, options) + val (filter, policyFileRemapper) = buildFilter(errors, allClasses, options) // Transform the jar. convert( @@ -82,6 +84,9 @@ class HostStubGen(val options: HostStubGenOptions) { allClasses, errors, stats, + policyFileRemapper, + options.numShards.get, + options.shard.get, ) // Dump statistics, if specified. @@ -107,7 +112,7 @@ class HostStubGen(val options: HostStubGenOptions) { errors: HostStubGenErrors, allClasses: ClassNodes, options: HostStubGenOptions, - ): OutputFilter { + ): Pair<OutputFilter, Remapper?> { // We build a "chain" of multiple filters here. // // The filters are build in from "inside", meaning the first filter created here is @@ -160,10 +165,14 @@ class HostStubGen(val options: HostStubGenOptions) { filter, ) + var policyFileRemapper: Remapper? = null + // Next, "text based" filter, which allows to override polices without touching // the target code. options.policyOverrideFile.ifSet { - filter = createFilterFromTextPolicyFile(it, allClasses, filter) + val (f, p) = createFilterFromTextPolicyFile(it, allClasses, filter) + filter = f + policyFileRemapper = p } // If `--intersect-stub-jar` is provided, load from these jar files too. @@ -178,7 +187,7 @@ class HostStubGen(val options: HostStubGenOptions) { // Apply the implicit filter. filter = ImplicitOutputFilter(errors, allClasses, filter) - return filter + return Pair(filter, policyFileRemapper) } /** @@ -205,6 +214,9 @@ class HostStubGen(val options: HostStubGenOptions) { classes: ClassNodes, errors: HostStubGenErrors, stats: HostStubGenStats, + remapper: Remapper?, + numShards: Int, + shard: Int, ) { log.i("Converting %s into [stub: %s, impl: %s] ...", inJar, outStubJar, outImplJar) log.i("ASM CheckClassAdapter is %s", if (enableChecker) "enabled" else "disabled") @@ -213,17 +225,32 @@ class HostStubGen(val options: HostStubGenOptions) { val packageRedirector = PackageRedirectRemapper(options.packageRedirects) + var itemIndex = 0 + var numItemsProcessed = 0 + var numItems = -1 // == Unknown + log.withIndent { // Open the input jar file and process each entry. ZipFile(inJar).use { inZip -> + + numItems = inZip.size() + val shardStart = numItems * shard / numShards + val shardNextStart = numItems * (shard + 1) / numShards + maybeWithZipOutputStream(outStubJar) { stubOutStream -> maybeWithZipOutputStream(outImplJar) { implOutStream -> val inEntries = inZip.entries() while (inEntries.hasMoreElements()) { val entry = inEntries.nextElement() + val inShard = (shardStart <= itemIndex) && (itemIndex < shardNextStart) + itemIndex++ + if (!inShard) { + continue + } convertSingleEntry(inZip, entry, stubOutStream, implOutStream, - filter, packageRedirector, enableChecker, classes, errors, - stats) + filter, packageRedirector, remapper, + enableChecker, classes, errors, stats) + numItemsProcessed++ } log.i("Converted all entries.") } @@ -233,7 +260,8 @@ class HostStubGen(val options: HostStubGenOptions) { } } val end = System.currentTimeMillis() - log.i("Done transforming the jar in %.1f second(s).", (end - start) / 1000.0) + log.i("Done transforming the jar in %.1f second(s). %d / %d item(s) processed.", + (end - start) / 1000.0, numItemsProcessed, numItems) } private fun <T> maybeWithZipOutputStream(filename: String?, block: (ZipOutputStream?) -> T): T { @@ -253,6 +281,7 @@ class HostStubGen(val options: HostStubGenOptions) { implOutStream: ZipOutputStream?, filter: OutputFilter, packageRedirector: PackageRedirectRemapper, + remapper: Remapper?, enableChecker: Boolean, classes: ClassNodes, errors: HostStubGenErrors, @@ -270,7 +299,7 @@ class HostStubGen(val options: HostStubGenOptions) { // If it's a class, convert it. if (name.endsWith(".class")) { processSingleClass(inZip, entry, stubOutStream, implOutStream, filter, - packageRedirector, enableChecker, classes, errors, stats) + packageRedirector, remapper, enableChecker, classes, errors, stats) return } @@ -321,6 +350,7 @@ class HostStubGen(val options: HostStubGenOptions) { implOutStream: ZipOutputStream?, filter: OutputFilter, packageRedirector: PackageRedirectRemapper, + remapper: Remapper?, enableChecker: Boolean, classes: ClassNodes, errors: HostStubGenErrors, @@ -332,16 +362,24 @@ class HostStubGen(val options: HostStubGenOptions) { log.d("Removing class: %s %s", classInternalName, classPolicy) return } + // If we're applying a remapper, we need to rename the file too. + var newName = entry.name + remapper?.mapType(classInternalName)?.let { remappedName -> + if (remappedName != classInternalName) { + log.d("Renaming class file: %s -> %s", classInternalName, remappedName) + newName = remappedName + ".class" + } + } // Generate stub first. if (stubOutStream != null && classPolicy.policy.needsInStub) { log.v("Creating stub class: %s Policy: %s", classInternalName, classPolicy) log.withIndent { BufferedInputStream(inZip.getInputStream(entry)).use { bis -> - val newEntry = ZipEntry(entry.name) + val newEntry = ZipEntry(newName) stubOutStream.putNextEntry(newEntry) convertClass(classInternalName, /*forImpl=*/false, bis, - stubOutStream, filter, packageRedirector, enableChecker, classes, - errors, null) + stubOutStream, filter, packageRedirector, remapper, + enableChecker, classes, errors, null) stubOutStream.closeEntry() } } @@ -350,11 +388,11 @@ class HostStubGen(val options: HostStubGenOptions) { log.v("Creating impl class: %s Policy: %s", classInternalName, classPolicy) log.withIndent { BufferedInputStream(inZip.getInputStream(entry)).use { bis -> - val newEntry = ZipEntry(entry.name) + val newEntry = ZipEntry(newName) implOutStream.putNextEntry(newEntry) convertClass(classInternalName, /*forImpl=*/true, bis, - implOutStream, filter, packageRedirector, enableChecker, classes, - errors, stats) + implOutStream, filter, packageRedirector, remapper, + enableChecker, classes, errors, stats) implOutStream.closeEntry() } } @@ -371,6 +409,7 @@ class HostStubGen(val options: HostStubGenOptions) { out: OutputStream, filter: OutputFilter, packageRedirector: PackageRedirectRemapper, + remapper: Remapper?, enableChecker: Boolean, classes: ClassNodes, errors: HostStubGenErrors, @@ -387,6 +426,12 @@ class HostStubGen(val options: HostStubGenOptions) { if (enableChecker) { outVisitor = CheckClassAdapter(outVisitor) } + + // Remapping should happen at the end. + remapper?.let { + outVisitor = ClassRemapper(outVisitor, remapper) + } + val visitorOptions = BaseAdapter.Options( enablePreTrace = options.enablePreTrace.get, enablePostTrace = options.enablePostTrace.get, @@ -395,7 +440,7 @@ class HostStubGen(val options: HostStubGenOptions) { stats = stats, ) outVisitor = BaseAdapter.getVisitor(classInternalName, classes, outVisitor, filter, - packageRedirector, forImpl, visitorOptions) + packageRedirector, remapper, forImpl, visitorOptions) cr.accept(outVisitor, ClassReader.EXPAND_FRAMES) val data = cw.toByteArray() diff --git a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/HostStubGenOptions.kt b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/HostStubGenOptions.kt index e192516d334d..2f833a873133 100644 --- a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/HostStubGenOptions.kt +++ b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/HostStubGenOptions.kt @@ -112,6 +112,9 @@ class HostStubGenOptions( var statsFile: SetOnce<String?> = SetOnce(null), var apiListFile: SetOnce<String?> = SetOnce(null), + + var numShards: SetOnce<Int> = SetOnce(1), + var shard: SetOnce<Int> = SetOnce(0), ) { companion object { @@ -162,6 +165,13 @@ class HostStubGenOptions( fun SetOnce<String?>.setNextStringArg(): String = nextArg().also { this.set(it) } fun MutableSet<String>.addUniqueAnnotationArg(): String = nextArg().also { this += ensureUniqueAnnotation(it) } + fun SetOnce<Int>.setNextIntArg(): String = nextArg().also { + try { + this.set(it.toInt()) + } catch (e: NumberFormatException) { + throw ArgumentsException("Invalid integer for $arg: $it") + } + } try { when (arg) { @@ -259,6 +269,9 @@ class HostStubGenOptions( "--stats-file" -> ret.statsFile.setNextStringArg() "--supported-api-list-file" -> ret.apiListFile.setNextStringArg() + "--num-shards" -> ret.numShards.setNextIntArg() + "--shard-index" -> ret.shard.setNextIntArg() + else -> throw ArgumentsException("Unknown option: $arg") } } catch (e: SetOnce.SetMoreThanOnceException) { @@ -396,6 +409,8 @@ class HostStubGenOptions( enableNonStubMethodCallDetection=$enableNonStubMethodCallDetection, statsFile=$statsFile, apiListFile=$apiListFile, + numShards=$numShards, + shard=$shard, } """.trimIndent() } diff --git a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/PackageFilter.kt b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/PackageFilter.kt new file mode 100644 index 000000000000..c67e6714d4c2 --- /dev/null +++ b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/PackageFilter.kt @@ -0,0 +1,61 @@ +/* + * 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.hoststubgen.filters + +import com.android.hoststubgen.asm.toHumanReadableClassName +import com.android.hoststubgen.utils.Trie + +/** + * Filter to apply a policy to classes inside a package, either directly or indirectly. + */ +class PackageFilter( + fallback: OutputFilter +) : DelegatingFilter(fallback) { + + private val mPackagePolicies = PackagePolicyTrie() + + // We want to pick the most specific filter for a package name. + // Since any package with a matching prefix is a valid match, we can use a prefix tree + // to help us find the nearest matching filter. + private class PackagePolicyTrie : Trie<String, String, FilterPolicyWithReason>() { + // Split package name into individual component + override fun splitToComponents(key: String): Iterator<String> { + return key.split('.').iterator() + } + } + + private fun getPackageKey(packageName: String): String { + return packageName.toHumanReadableClassName() + } + + private fun getPackageKeyFromClass(className: String): String { + val clazz = className.toHumanReadableClassName() + val idx = clazz.lastIndexOf('.') + return if (idx >= 0) clazz.substring(0, idx) else "" + } + + /** + * Add a policy to all classes inside a package, either directly or indirectly. + */ + fun addPolicy(packageName: String, policy: FilterPolicyWithReason) { + mPackagePolicies[getPackageKey(packageName)] = policy + } + + override fun getPolicyForClass(className: String): FilterPolicyWithReason { + return mPackagePolicies[getPackageKeyFromClass(className)] + ?: super.getPolicyForClass(className) + } +} diff --git a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/TextFileFilterPolicyParser.kt b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/TextFileFilterPolicyParser.kt index c5acd81f1cf2..18280034c2f4 100644 --- a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/TextFileFilterPolicyParser.kt +++ b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/TextFileFilterPolicyParser.kt @@ -22,11 +22,13 @@ import com.android.hoststubgen.log import com.android.hoststubgen.normalizeTextLine import com.android.hoststubgen.whitespaceRegex import org.objectweb.asm.Opcodes +import org.objectweb.asm.commons.Remapper import org.objectweb.asm.tree.ClassNode import java.io.BufferedReader import java.io.FileReader import java.io.PrintWriter import java.util.Objects +import java.util.regex.Pattern /** * Print a class node as a "keep" policy. @@ -60,11 +62,12 @@ fun createFilterFromTextPolicyFile( filename: String, classes: ClassNodes, fallback: OutputFilter, - ): OutputFilter { + ): Pair<OutputFilter, Remapper?> { log.i("Loading offloaded annotations from $filename ...") log.withIndent { val subclassFilter = SubclassFilter(classes, fallback) - val imf = InMemoryOutputFilter(classes, subclassFilter) + val packageFilter = PackageFilter(subclassFilter) + val imf = InMemoryOutputFilter(classes, packageFilter) var lineNo = 0 @@ -72,16 +75,14 @@ fun createFilterFromTextPolicyFile( var featureFlagsPolicy: FilterPolicyWithReason? = null var syspropsPolicy: FilterPolicyWithReason? = null var rFilePolicy: FilterPolicyWithReason? = null + val typeRenameSpec = mutableListOf<TextFilePolicyRemapper.TypeRenameSpec>() try { BufferedReader(FileReader(filename)).use { reader -> var className = "" while (true) { - var line = reader.readLine() - if (line == null) { - break - } + var line = reader.readLine() ?: break lineNo++ line = normalizeTextLine(line) @@ -95,6 +96,31 @@ fun createFilterFromTextPolicyFile( val fields = line.split(whitespaceRegex).toTypedArray() when (fields[0].lowercase()) { + "p", "package" -> { + if (fields.size < 3) { + throw ParseException("Package ('p') expects 2 fields.") + } + val name = fields[1] + val rawPolicy = fields[2] + if (resolveExtendingClass(name) != null) { + throw ParseException("Package can't be a super class type") + } + if (resolveSpecialClass(name) != SpecialClass.NotSpecial) { + throw ParseException("Package can't be a special class type") + } + if (rawPolicy.startsWith("!")) { + throw ParseException("Package can't have a substitution") + } + if (rawPolicy.startsWith("~")) { + throw ParseException("Package can't have a class load hook") + } + val policy = parsePolicy(rawPolicy) + if (!policy.isUsableWithClasses) { + throw ParseException("Package can't have policy '$policy'") + } + packageFilter.addPolicy(name, policy.withReason(FILTER_REASON)) + } + "c", "class" -> { if (fields.size < 3) { throw ParseException("Class ('c') expects 2 fields.") @@ -228,6 +254,22 @@ fun createFilterFromTextPolicyFile( imf.setRenameTo(className, fromName, signature, name) } } + "r", "rename" -> { + if (fields.size < 3) { + throw ParseException("Rename ('r') expects 2 fields.") + } + // Add ".*" to make it a prefix match. + val pattern = Pattern.compile(fields[1] + ".*") + + // Removing the leading /'s from the prefix. This allows + // using a single '/' as an empty suffix, which is useful to have a + // "negative" rename rule to avoid subsequent raname's from getting + // applied. (Which is needed for services.jar) + val prefix = fields[2].trimStart('/') + + typeRenameSpec += TextFilePolicyRemapper.TypeRenameSpec( + pattern, prefix) + } else -> { throw ParseException("Unknown directive \"${fields[0]}\"") @@ -239,9 +281,16 @@ fun createFilterFromTextPolicyFile( throw e.withSourceInfo(filename, lineNo) } + var remapper: TextFilePolicyRemapper? = null + if (typeRenameSpec.isNotEmpty()) { + remapper = TextFilePolicyRemapper(typeRenameSpec) + } + // Wrap the in-memory-filter with AHF. - return AndroidHeuristicsFilter( - classes, aidlPolicy, featureFlagsPolicy, syspropsPolicy, rFilePolicy, imf) + return Pair( + AndroidHeuristicsFilter( + classes, aidlPolicy, featureFlagsPolicy, syspropsPolicy, rFilePolicy, imf), + remapper) } } diff --git a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/TextFilePolicyRemapper.kt b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/TextFilePolicyRemapper.kt new file mode 100644 index 000000000000..2d94bb4758ba --- /dev/null +++ b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/TextFilePolicyRemapper.kt @@ -0,0 +1,59 @@ +/* + * 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.hoststubgen.filters + +import com.android.hoststubgen.log +import org.objectweb.asm.commons.Remapper +import java.util.regex.Pattern + +/** + * A [Remapper] that provides a simple "jarjar" functionality. + */ +class TextFilePolicyRemapper( + val typeRenameSpecs: List<TypeRenameSpec> +) : Remapper() { + /** + * When a package name matches [typeInternalNamePattern], we prepend [typeInternalNamePrefix] + * to it. + */ + data class TypeRenameSpec( + val typeInternalNamePattern: Pattern, + val typeInternalNamePrefix: String, + ) + + private val cache = mutableMapOf<String, String>() + + override fun mapType(typeInternalName: String): String { +// if (typeInternalName == null) { +// return null // do we need it?? +// } + cache[typeInternalName]?.let { + return it + } + + var mapped: String = typeInternalName + typeRenameSpecs.forEach { + if (it.typeInternalNamePattern.matcher(typeInternalName).matches()) { + mapped = it.typeInternalNamePrefix + typeInternalName + log.d("Renaming type $typeInternalName to $mapped") + } + } + cache[typeInternalName] = mapped + return mapped + } + + // TODO Do we need to implement mapPackage(), etc too? +} diff --git a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/utils/Trie.kt b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/utils/Trie.kt new file mode 100644 index 000000000000..1b3d79cddb8e --- /dev/null +++ b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/utils/Trie.kt @@ -0,0 +1,58 @@ +/* + * 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.hoststubgen.utils + +abstract class Trie<Key, Component, Value> { + + private val root = TrieNode<Component, Value>() + + abstract fun splitToComponents(key: Key): Iterator<Component> + + operator fun set(key: Key, value: Value) { + val node = root.getExactNode(splitToComponents(key)) + node.value = value + } + + operator fun get(key: Key): Value? { + return root.getNearestValue(null, splitToComponents(key)) + } + + private class TrieNode<Component, Value> { + private val children = mutableMapOf<Component, TrieNode<Component, Value>>() + var value: Value? = null + + fun getExactNode(components: Iterator<Component>): TrieNode<Component, Value> { + val n = components.next() + val child = children.getOrPut(n) { TrieNode() } + return if (components.hasNext()) { + child.getExactNode(components) + } else { + child + } + } + + fun getNearestValue(current: Value?, components: Iterator<Component>): Value? { + val n = components.next() + val child = children[n] ?: return current + val newValue = child.value ?: current + return if (components.hasNext()) { + child.getNearestValue(newValue, components) + } else { + newValue + } + } + } +} diff --git a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/visitors/BaseAdapter.kt b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/visitors/BaseAdapter.kt index c99ff0e5d990..bad0449f1efd 100644 --- a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/visitors/BaseAdapter.kt +++ b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/visitors/BaseAdapter.kt @@ -34,6 +34,7 @@ import org.objectweb.asm.FieldVisitor import org.objectweb.asm.MethodVisitor import org.objectweb.asm.Opcodes import org.objectweb.asm.commons.ClassRemapper +import org.objectweb.asm.commons.Remapper import org.objectweb.asm.util.TraceClassVisitor import java.io.PrintWriter @@ -259,13 +260,14 @@ abstract class BaseAdapter ( companion object { fun getVisitor( - classInternalName: String, - classes: ClassNodes, - nextVisitor: ClassVisitor, - filter: OutputFilter, - packageRedirector: PackageRedirectRemapper, - forImpl: Boolean, - options: Options, + classInternalName: String, + classes: ClassNodes, + nextVisitor: ClassVisitor, + filter: OutputFilter, + packageRedirector: PackageRedirectRemapper, + remapper: Remapper?, + forImpl: Boolean, + options: Options, ): ClassVisitor { var next = nextVisitor diff --git a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/visitors/PackageRedirectRemapper.kt b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/visitors/PackageRedirectRemapper.kt index b3790e12a111..e90ecd7ef678 100644 --- a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/visitors/PackageRedirectRemapper.kt +++ b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/visitors/PackageRedirectRemapper.kt @@ -20,6 +20,18 @@ import org.objectweb.asm.commons.Remapper /** * A [Remapper] for `--package-redirect` + * + * This is a feature to update all calls to specific packages to another package, which allows + * implementing a class in a different package, when the original package isn't allowed to modify. + * + * For example, using this, we can implement `dalvik.*` APIs in a separate package, and update + * all calls to the `dalvik` package to a different package. + * + * For this purpose, we don't expect the "renamed-from" classes to be in the target jar, + * so we don't apply the remapper to them. (The exclusion happens at the callsite of this class) + * + * TODO: Currently it's not used. Maybe remove, or just unify with the other remapper feature + * with TextFileFilterPolicyParser.kt. */ class PackageRedirectRemapper( packageRedirects: List<Pair<String, String>>, diff --git a/tools/hoststubgen/hoststubgen/test-tiny-framework/golden-output/01-hoststubgen-test-tiny-framework-orig-dump.txt b/tools/hoststubgen/hoststubgen/test-tiny-framework/golden-output/01-hoststubgen-test-tiny-framework-orig-dump.txt index dd638925a5bc..c127e677f84d 100644 --- a/tools/hoststubgen/hoststubgen/test-tiny-framework/golden-output/01-hoststubgen-test-tiny-framework-orig-dump.txt +++ b/tools/hoststubgen/hoststubgen/test-tiny-framework/golden-output/01-hoststubgen-test-tiny-framework-orig-dump.txt @@ -2706,6 +2706,187 @@ SourceFile: "TinyFrameworkPackageRedirect.java" RuntimeInvisibleAnnotations: x: #x() android.hosttest.annotation.HostSideTestWholeClassStub +## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkRenamedClassCaller.class + Compiled from "TinyFrameworkRenamedClassCaller.java" +public class com.android.hoststubgen.test.tinyframework.TinyFrameworkRenamedClassCaller + minor version: 0 + major version: 61 + flags: (0x0021) ACC_PUBLIC, ACC_SUPER + this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkRenamedClassCaller + super_class: #x // java/lang/Object + interfaces: 0, fields: 0, methods: 2, attributes: 2 + public com.android.hoststubgen.test.tinyframework.TinyFrameworkRenamedClassCaller(); + descriptor: ()V + flags: (0x0001) ACC_PUBLIC + Code: + stack=1, locals=1, args_size=1 + x: aload_0 + x: invokespecial #x // Method java/lang/Object."<init>":()V + x: return + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 0 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkRenamedClassCaller; + + public static int foo(int); + descriptor: (I)I + flags: (0x0009) ACC_PUBLIC, ACC_STATIC + Code: + stack=3, locals=1, args_size=1 + x: new #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed + x: dup + x: iload_0 + x: invokespecial #x // Method com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed."<init>":(I)V + x: invokevirtual #x // Method com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed.getValue:()I + x: ireturn + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 0 12 0 value I +} +SourceFile: "TinyFrameworkRenamedClassCaller.java" +RuntimeInvisibleAnnotations: + x: #x() + android.hosttest.annotation.HostSideTestWholeClassStub +## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed.class + Compiled from "TinyFrameworkToBeRenamed.java" +public class com.android.hoststubgen.test.tinyframework.TinyFrameworkToBeRenamed + minor version: 0 + major version: 61 + flags: (0x0021) ACC_PUBLIC, ACC_SUPER + this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed + super_class: #x // java/lang/Object + interfaces: 0, fields: 1, methods: 2, attributes: 2 + private final int mValue; + descriptor: I + flags: (0x0012) ACC_PRIVATE, ACC_FINAL + + public com.android.hoststubgen.test.tinyframework.TinyFrameworkToBeRenamed(int); + descriptor: (I)V + flags: (0x0001) ACC_PUBLIC + Code: + stack=2, locals=2, args_size=2 + x: aload_0 + x: invokespecial #x // Method java/lang/Object."<init>":()V + x: aload_0 + x: iload_1 + x: putfield #x // Field mValue:I + x: return + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 0 10 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed; + 0 10 1 value I + + public int getValue(); + descriptor: ()I + flags: (0x0001) ACC_PUBLIC + Code: + stack=1, locals=1, args_size=1 + x: aload_0 + x: getfield #x // Field mValue:I + x: ireturn + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 0 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed; +} +SourceFile: "TinyFrameworkToBeRenamed.java" +RuntimeInvisibleAnnotations: + x: #x() + android.hosttest.annotation.HostSideTestWholeClassStub +## Class: com/android/hoststubgen/test/tinyframework/packagetest/A.class + Compiled from "A.java" +public class com.android.hoststubgen.test.tinyframework.packagetest.A + minor version: 0 + major version: 61 + flags: (0x0021) ACC_PUBLIC, ACC_SUPER + this_class: #x // com/android/hoststubgen/test/tinyframework/packagetest/A + super_class: #x // java/lang/Object + interfaces: 0, fields: 0, methods: 1, attributes: 1 + public com.android.hoststubgen.test.tinyframework.packagetest.A(); + descriptor: ()V + flags: (0x0001) ACC_PUBLIC + Code: + stack=1, locals=1, args_size=1 + x: aload_0 + x: invokespecial #x // Method java/lang/Object."<init>":()V + x: return + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 0 5 0 this Lcom/android/hoststubgen/test/tinyframework/packagetest/A; +} +SourceFile: "A.java" +## Class: com/android/hoststubgen/test/tinyframework/packagetest/B.class + Compiled from "B.java" +public class com.android.hoststubgen.test.tinyframework.packagetest.B + minor version: 0 + major version: 61 + flags: (0x0021) ACC_PUBLIC, ACC_SUPER + this_class: #x // com/android/hoststubgen/test/tinyframework/packagetest/B + super_class: #x // java/lang/Object + interfaces: 0, fields: 0, methods: 1, attributes: 1 + public com.android.hoststubgen.test.tinyframework.packagetest.B(); + descriptor: ()V + flags: (0x0001) ACC_PUBLIC + Code: + stack=1, locals=1, args_size=1 + x: aload_0 + x: invokespecial #x // Method java/lang/Object."<init>":()V + x: return + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 0 5 0 this Lcom/android/hoststubgen/test/tinyframework/packagetest/B; +} +SourceFile: "B.java" +## Class: com/android/hoststubgen/test/tinyframework/packagetest/sub/A.class + Compiled from "A.java" +public class com.android.hoststubgen.test.tinyframework.packagetest.sub.A + minor version: 0 + major version: 61 + flags: (0x0021) ACC_PUBLIC, ACC_SUPER + this_class: #x // com/android/hoststubgen/test/tinyframework/packagetest/sub/A + super_class: #x // java/lang/Object + interfaces: 0, fields: 0, methods: 1, attributes: 1 + public com.android.hoststubgen.test.tinyframework.packagetest.sub.A(); + descriptor: ()V + flags: (0x0001) ACC_PUBLIC + Code: + stack=1, locals=1, args_size=1 + x: aload_0 + x: invokespecial #x // Method java/lang/Object."<init>":()V + x: return + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 0 5 0 this Lcom/android/hoststubgen/test/tinyframework/packagetest/sub/A; +} +SourceFile: "A.java" +## Class: com/android/hoststubgen/test/tinyframework/packagetest/sub/B.class + Compiled from "B.java" +public class com.android.hoststubgen.test.tinyframework.packagetest.sub.B + minor version: 0 + major version: 61 + flags: (0x0021) ACC_PUBLIC, ACC_SUPER + this_class: #x // com/android/hoststubgen/test/tinyframework/packagetest/sub/B + super_class: #x // java/lang/Object + interfaces: 0, fields: 0, methods: 1, attributes: 1 + public com.android.hoststubgen.test.tinyframework.packagetest.sub.B(); + descriptor: ()V + flags: (0x0001) ACC_PUBLIC + Code: + stack=1, locals=1, args_size=1 + x: aload_0 + x: invokespecial #x // Method java/lang/Object."<init>":()V + x: return + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 0 5 0 this Lcom/android/hoststubgen/test/tinyframework/packagetest/sub/B; +} +SourceFile: "B.java" ## Class: com/android/hoststubgen/test/tinyframework/subclasstest/C1.class Compiled from "C1.java" public class com.android.hoststubgen.test.tinyframework.subclasstest.C1 diff --git a/tools/hoststubgen/hoststubgen/test-tiny-framework/golden-output/02-hoststubgen-test-tiny-framework-host-stub-dump.txt b/tools/hoststubgen/hoststubgen/test-tiny-framework/golden-output/02-hoststubgen-test-tiny-framework-host-stub-dump.txt index 906a81cf45e3..17ba48c67d98 100644 --- a/tools/hoststubgen/hoststubgen/test-tiny-framework/golden-output/02-hoststubgen-test-tiny-framework-host-stub-dump.txt +++ b/tools/hoststubgen/hoststubgen/test-tiny-framework/golden-output/02-hoststubgen-test-tiny-framework-host-stub-dump.txt @@ -2177,6 +2177,88 @@ RuntimeVisibleAnnotations: RuntimeInvisibleAnnotations: x: #x() android.hosttest.annotation.HostSideTestWholeClassStub +## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkRenamedClassCaller.class + Compiled from "TinyFrameworkRenamedClassCaller.java" +public class com.android.hoststubgen.test.tinyframework.TinyFrameworkRenamedClassCaller + minor version: 0 + major version: 61 + flags: (0x0021) ACC_PUBLIC, ACC_SUPER + this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkRenamedClassCaller + super_class: #x // java/lang/Object + interfaces: 0, fields: 0, methods: 2, attributes: 3 + public com.android.hoststubgen.test.tinyframework.TinyFrameworkRenamedClassCaller(); + descriptor: ()V + flags: (0x0001) ACC_PUBLIC + Code: + stack=3, locals=1, args_size=1 + x: new #x // class java/lang/RuntimeException + x: dup + x: ldc #x // String Stub! + x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V + x: athrow + RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInStub + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl + + public static int foo(int); + descriptor: (I)I + flags: (0x0009) ACC_PUBLIC, ACC_STATIC + Code: + stack=3, locals=1, args_size=1 + x: new #x // class java/lang/RuntimeException + x: dup + x: ldc #x // String Stub! + x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V + x: athrow + RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInStub + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl +} +SourceFile: "TinyFrameworkRenamedClassCaller.java" +RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInStub + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl +RuntimeInvisibleAnnotations: + x: #x() + android.hosttest.annotation.HostSideTestWholeClassStub +## Class: com/android/hoststubgen/test/tinyframework/packagetest/A.class + Compiled from "A.java" +public class com.android.hoststubgen.test.tinyframework.packagetest.A + minor version: 0 + major version: 61 + flags: (0x0021) ACC_PUBLIC, ACC_SUPER + this_class: #x // com/android/hoststubgen/test/tinyframework/packagetest/A + super_class: #x // java/lang/Object + interfaces: 0, fields: 0, methods: 0, attributes: 2 +} +SourceFile: "A.java" +RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInStub + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl +## Class: com/android/hoststubgen/test/tinyframework/packagetest/sub/A.class + Compiled from "A.java" +public class com.android.hoststubgen.test.tinyframework.packagetest.sub.A + minor version: 0 + major version: 61 + flags: (0x0021) ACC_PUBLIC, ACC_SUPER + this_class: #x // com/android/hoststubgen/test/tinyframework/packagetest/sub/A + super_class: #x // java/lang/Object + interfaces: 0, fields: 0, methods: 0, attributes: 2 +} +SourceFile: "A.java" +RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInStub + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl ## Class: com/android/hoststubgen/test/tinyframework/subclasstest/C1.class Compiled from "C1.java" public class com.android.hoststubgen.test.tinyframework.subclasstest.C1 @@ -2387,3 +2469,62 @@ RuntimeVisibleAnnotations: RuntimeInvisibleAnnotations: x: #x() android.hosttest.annotation.HostSideTestWholeClassStub +## Class: rename_prefix/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed.class + Compiled from "TinyFrameworkToBeRenamed.java" +public class rename_prefix.com.android.hoststubgen.test.tinyframework.TinyFrameworkToBeRenamed + minor version: 0 + major version: 61 + flags: (0x0021) ACC_PUBLIC, ACC_SUPER + this_class: #x // rename_prefix/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed + super_class: #x // java/lang/Object + interfaces: 0, fields: 1, methods: 2, attributes: 3 + private final int mValue; + descriptor: I + flags: (0x0012) ACC_PRIVATE, ACC_FINAL + RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInStub + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl + + public rename_prefix.com.android.hoststubgen.test.tinyframework.TinyFrameworkToBeRenamed(int); + descriptor: (I)V + flags: (0x0001) ACC_PUBLIC + Code: + stack=3, locals=2, args_size=2 + x: new #x // class java/lang/RuntimeException + x: dup + x: ldc #x // String Stub! + x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V + x: athrow + RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInStub + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl + + public int getValue(); + descriptor: ()I + flags: (0x0001) ACC_PUBLIC + Code: + stack=3, locals=1, args_size=1 + x: new #x // class java/lang/RuntimeException + x: dup + x: ldc #x // String Stub! + x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V + x: athrow + RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInStub + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl +} +SourceFile: "TinyFrameworkToBeRenamed.java" +RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInStub + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl +RuntimeInvisibleAnnotations: + x: #x() + android.hosttest.annotation.HostSideTestWholeClassStub diff --git a/tools/hoststubgen/hoststubgen/test-tiny-framework/golden-output/03-hoststubgen-test-tiny-framework-host-impl-dump.txt b/tools/hoststubgen/hoststubgen/test-tiny-framework/golden-output/03-hoststubgen-test-tiny-framework-host-impl-dump.txt index 10bc91da2544..0f5f7e747a2e 100644 --- a/tools/hoststubgen/hoststubgen/test-tiny-framework/golden-output/03-hoststubgen-test-tiny-framework-host-impl-dump.txt +++ b/tools/hoststubgen/hoststubgen/test-tiny-framework/golden-output/03-hoststubgen-test-tiny-framework-host-impl-dump.txt @@ -3540,6 +3540,95 @@ RuntimeVisibleAnnotations: RuntimeInvisibleAnnotations: x: #x() android.hosttest.annotation.HostSideTestWholeClassStub +## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkRenamedClassCaller.class + Compiled from "TinyFrameworkRenamedClassCaller.java" +public class com.android.hoststubgen.test.tinyframework.TinyFrameworkRenamedClassCaller + minor version: 0 + major version: 61 + flags: (0x0021) ACC_PUBLIC, ACC_SUPER + this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkRenamedClassCaller + super_class: #x // java/lang/Object + interfaces: 0, fields: 0, methods: 2, attributes: 3 + public com.android.hoststubgen.test.tinyframework.TinyFrameworkRenamedClassCaller(); + descriptor: ()V + flags: (0x0001) ACC_PUBLIC + Code: + stack=1, locals=1, args_size=1 + x: aload_0 + x: invokespecial #x // Method java/lang/Object."<init>":()V + x: return + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 0 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkRenamedClassCaller; + RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInStub + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl + + public static int foo(int); + descriptor: (I)I + flags: (0x0009) ACC_PUBLIC, ACC_STATIC + Code: + stack=3, locals=1, args_size=1 + x: new #x // class rename_prefix/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed + x: dup + x: iload_0 + x: invokespecial #x // Method rename_prefix/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed."<init>":(I)V + x: invokevirtual #x // Method rename_prefix/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed.getValue:()I + x: ireturn + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 0 12 0 value I + RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInStub + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl +} +SourceFile: "TinyFrameworkRenamedClassCaller.java" +RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInStub + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl +RuntimeInvisibleAnnotations: + x: #x() + android.hosttest.annotation.HostSideTestWholeClassStub +## Class: com/android/hoststubgen/test/tinyframework/packagetest/A.class + Compiled from "A.java" +public class com.android.hoststubgen.test.tinyframework.packagetest.A + minor version: 0 + major version: 61 + flags: (0x0021) ACC_PUBLIC, ACC_SUPER + this_class: #x // com/android/hoststubgen/test/tinyframework/packagetest/A + super_class: #x // java/lang/Object + interfaces: 0, fields: 0, methods: 0, attributes: 2 +} +SourceFile: "A.java" +RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInStub + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl +## Class: com/android/hoststubgen/test/tinyframework/packagetest/sub/A.class + Compiled from "A.java" +public class com.android.hoststubgen.test.tinyframework.packagetest.sub.A + minor version: 0 + major version: 61 + flags: (0x0021) ACC_PUBLIC, ACC_SUPER + this_class: #x // com/android/hoststubgen/test/tinyframework/packagetest/sub/A + super_class: #x // java/lang/Object + interfaces: 0, fields: 0, methods: 0, attributes: 2 +} +SourceFile: "A.java" +RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInStub + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl ## Class: com/android/hoststubgen/test/tinyframework/subclasstest/C1.class Compiled from "C1.java" public class com.android.hoststubgen.test.tinyframework.subclasstest.C1 @@ -3930,3 +4019,70 @@ RuntimeVisibleAnnotations: RuntimeInvisibleAnnotations: x: #x() android.hosttest.annotation.HostSideTestWholeClassStub +## Class: rename_prefix/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed.class + Compiled from "TinyFrameworkToBeRenamed.java" +public class rename_prefix.com.android.hoststubgen.test.tinyframework.TinyFrameworkToBeRenamed + minor version: 0 + major version: 61 + flags: (0x0021) ACC_PUBLIC, ACC_SUPER + this_class: #x // rename_prefix/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed + super_class: #x // java/lang/Object + interfaces: 0, fields: 1, methods: 2, attributes: 3 + private final int mValue; + descriptor: I + flags: (0x0012) ACC_PRIVATE, ACC_FINAL + RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInStub + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl + + public rename_prefix.com.android.hoststubgen.test.tinyframework.TinyFrameworkToBeRenamed(int); + descriptor: (I)V + flags: (0x0001) ACC_PUBLIC + Code: + stack=2, locals=2, args_size=2 + x: aload_0 + x: invokespecial #x // Method java/lang/Object."<init>":()V + x: aload_0 + x: iload_1 + x: putfield #x // Field mValue:I + x: return + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 0 10 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed; + 0 10 1 value I + RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInStub + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl + + public int getValue(); + descriptor: ()I + flags: (0x0001) ACC_PUBLIC + Code: + stack=1, locals=1, args_size=1 + x: aload_0 + x: getfield #x // Field mValue:I + x: ireturn + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 0 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed; + RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInStub + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl +} +SourceFile: "TinyFrameworkToBeRenamed.java" +RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInStub + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl +RuntimeInvisibleAnnotations: + x: #x() + android.hosttest.annotation.HostSideTestWholeClassStub diff --git a/tools/hoststubgen/hoststubgen/test-tiny-framework/golden-output/12-hoststubgen-test-tiny-framework-host-ext-stub-dump.txt b/tools/hoststubgen/hoststubgen/test-tiny-framework/golden-output/12-hoststubgen-test-tiny-framework-host-ext-stub-dump.txt index 906a81cf45e3..17ba48c67d98 100644 --- a/tools/hoststubgen/hoststubgen/test-tiny-framework/golden-output/12-hoststubgen-test-tiny-framework-host-ext-stub-dump.txt +++ b/tools/hoststubgen/hoststubgen/test-tiny-framework/golden-output/12-hoststubgen-test-tiny-framework-host-ext-stub-dump.txt @@ -2177,6 +2177,88 @@ RuntimeVisibleAnnotations: RuntimeInvisibleAnnotations: x: #x() android.hosttest.annotation.HostSideTestWholeClassStub +## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkRenamedClassCaller.class + Compiled from "TinyFrameworkRenamedClassCaller.java" +public class com.android.hoststubgen.test.tinyframework.TinyFrameworkRenamedClassCaller + minor version: 0 + major version: 61 + flags: (0x0021) ACC_PUBLIC, ACC_SUPER + this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkRenamedClassCaller + super_class: #x // java/lang/Object + interfaces: 0, fields: 0, methods: 2, attributes: 3 + public com.android.hoststubgen.test.tinyframework.TinyFrameworkRenamedClassCaller(); + descriptor: ()V + flags: (0x0001) ACC_PUBLIC + Code: + stack=3, locals=1, args_size=1 + x: new #x // class java/lang/RuntimeException + x: dup + x: ldc #x // String Stub! + x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V + x: athrow + RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInStub + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl + + public static int foo(int); + descriptor: (I)I + flags: (0x0009) ACC_PUBLIC, ACC_STATIC + Code: + stack=3, locals=1, args_size=1 + x: new #x // class java/lang/RuntimeException + x: dup + x: ldc #x // String Stub! + x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V + x: athrow + RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInStub + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl +} +SourceFile: "TinyFrameworkRenamedClassCaller.java" +RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInStub + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl +RuntimeInvisibleAnnotations: + x: #x() + android.hosttest.annotation.HostSideTestWholeClassStub +## Class: com/android/hoststubgen/test/tinyframework/packagetest/A.class + Compiled from "A.java" +public class com.android.hoststubgen.test.tinyframework.packagetest.A + minor version: 0 + major version: 61 + flags: (0x0021) ACC_PUBLIC, ACC_SUPER + this_class: #x // com/android/hoststubgen/test/tinyframework/packagetest/A + super_class: #x // java/lang/Object + interfaces: 0, fields: 0, methods: 0, attributes: 2 +} +SourceFile: "A.java" +RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInStub + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl +## Class: com/android/hoststubgen/test/tinyframework/packagetest/sub/A.class + Compiled from "A.java" +public class com.android.hoststubgen.test.tinyframework.packagetest.sub.A + minor version: 0 + major version: 61 + flags: (0x0021) ACC_PUBLIC, ACC_SUPER + this_class: #x // com/android/hoststubgen/test/tinyframework/packagetest/sub/A + super_class: #x // java/lang/Object + interfaces: 0, fields: 0, methods: 0, attributes: 2 +} +SourceFile: "A.java" +RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInStub + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl ## Class: com/android/hoststubgen/test/tinyframework/subclasstest/C1.class Compiled from "C1.java" public class com.android.hoststubgen.test.tinyframework.subclasstest.C1 @@ -2387,3 +2469,62 @@ RuntimeVisibleAnnotations: RuntimeInvisibleAnnotations: x: #x() android.hosttest.annotation.HostSideTestWholeClassStub +## Class: rename_prefix/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed.class + Compiled from "TinyFrameworkToBeRenamed.java" +public class rename_prefix.com.android.hoststubgen.test.tinyframework.TinyFrameworkToBeRenamed + minor version: 0 + major version: 61 + flags: (0x0021) ACC_PUBLIC, ACC_SUPER + this_class: #x // rename_prefix/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed + super_class: #x // java/lang/Object + interfaces: 0, fields: 1, methods: 2, attributes: 3 + private final int mValue; + descriptor: I + flags: (0x0012) ACC_PRIVATE, ACC_FINAL + RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInStub + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl + + public rename_prefix.com.android.hoststubgen.test.tinyframework.TinyFrameworkToBeRenamed(int); + descriptor: (I)V + flags: (0x0001) ACC_PUBLIC + Code: + stack=3, locals=2, args_size=2 + x: new #x // class java/lang/RuntimeException + x: dup + x: ldc #x // String Stub! + x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V + x: athrow + RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInStub + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl + + public int getValue(); + descriptor: ()I + flags: (0x0001) ACC_PUBLIC + Code: + stack=3, locals=1, args_size=1 + x: new #x // class java/lang/RuntimeException + x: dup + x: ldc #x // String Stub! + x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V + x: athrow + RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInStub + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl +} +SourceFile: "TinyFrameworkToBeRenamed.java" +RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInStub + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl +RuntimeInvisibleAnnotations: + x: #x() + android.hosttest.annotation.HostSideTestWholeClassStub diff --git a/tools/hoststubgen/hoststubgen/test-tiny-framework/golden-output/13-hoststubgen-test-tiny-framework-host-ext-impl-dump.txt b/tools/hoststubgen/hoststubgen/test-tiny-framework/golden-output/13-hoststubgen-test-tiny-framework-host-ext-impl-dump.txt index fcf9a8c663ad..3beea643823a 100644 --- a/tools/hoststubgen/hoststubgen/test-tiny-framework/golden-output/13-hoststubgen-test-tiny-framework-host-ext-impl-dump.txt +++ b/tools/hoststubgen/hoststubgen/test-tiny-framework/golden-output/13-hoststubgen-test-tiny-framework-host-ext-impl-dump.txt @@ -4408,6 +4408,133 @@ RuntimeVisibleAnnotations: RuntimeInvisibleAnnotations: x: #x() android.hosttest.annotation.HostSideTestWholeClassStub +## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkRenamedClassCaller.class + Compiled from "TinyFrameworkRenamedClassCaller.java" +public class com.android.hoststubgen.test.tinyframework.TinyFrameworkRenamedClassCaller + minor version: 0 + major version: 61 + flags: (0x0021) ACC_PUBLIC, ACC_SUPER + this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkRenamedClassCaller + super_class: #x // java/lang/Object + interfaces: 0, fields: 0, methods: 3, attributes: 3 + private static {}; + descriptor: ()V + flags: (0x000a) ACC_PRIVATE, ACC_STATIC + Code: + stack=2, locals=0, args_size=0 + x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkRenamedClassCaller + x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded + x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onClassLoaded:(Ljava/lang/Class;Ljava/lang/String;)V + x: return + + public com.android.hoststubgen.test.tinyframework.TinyFrameworkRenamedClassCaller(); + descriptor: ()V + flags: (0x0001) ACC_PUBLIC + Code: + stack=4, locals=1, args_size=1 + x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkRenamedClassCaller + x: ldc #x // String <init> + x: ldc #x // String ()V + x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall + x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V + x: aload_0 + x: invokespecial #x // Method java/lang/Object."<init>":()V + x: return + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 11 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkRenamedClassCaller; + RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInStub + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl + + public static int foo(int); + descriptor: (I)I + flags: (0x0009) ACC_PUBLIC, ACC_STATIC + Code: + stack=4, locals=1, args_size=1 + x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkRenamedClassCaller + x: ldc #x // String foo + x: ldc #x // String (I)I + x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall + x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V + x: new #x // class rename_prefix/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed + x: dup + x: iload_0 + x: invokespecial #x // Method rename_prefix/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed."<init>":(I)V + x: invokevirtual #x // Method rename_prefix/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed.getValue:()I + x: ireturn + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 11 12 0 value I + RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInStub + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl +} +SourceFile: "TinyFrameworkRenamedClassCaller.java" +RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInStub + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl +RuntimeInvisibleAnnotations: + x: #x() + android.hosttest.annotation.HostSideTestWholeClassStub +## Class: com/android/hoststubgen/test/tinyframework/packagetest/A.class + Compiled from "A.java" +public class com.android.hoststubgen.test.tinyframework.packagetest.A + minor version: 0 + major version: 61 + flags: (0x0021) ACC_PUBLIC, ACC_SUPER + this_class: #x // com/android/hoststubgen/test/tinyframework/packagetest/A + super_class: #x // java/lang/Object + interfaces: 0, fields: 0, methods: 1, attributes: 2 + private static {}; + descriptor: ()V + flags: (0x000a) ACC_PRIVATE, ACC_STATIC + Code: + stack=2, locals=0, args_size=0 + x: ldc #x // class com/android/hoststubgen/test/tinyframework/packagetest/A + x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded + x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onClassLoaded:(Ljava/lang/Class;Ljava/lang/String;)V + x: return +} +SourceFile: "A.java" +RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInStub + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl +## Class: com/android/hoststubgen/test/tinyframework/packagetest/sub/A.class + Compiled from "A.java" +public class com.android.hoststubgen.test.tinyframework.packagetest.sub.A + minor version: 0 + major version: 61 + flags: (0x0021) ACC_PUBLIC, ACC_SUPER + this_class: #x // com/android/hoststubgen/test/tinyframework/packagetest/sub/A + super_class: #x // java/lang/Object + interfaces: 0, fields: 0, methods: 1, attributes: 2 + private static {}; + descriptor: ()V + flags: (0x000a) ACC_PRIVATE, ACC_STATIC + Code: + stack=2, locals=0, args_size=0 + x: ldc #x // class com/android/hoststubgen/test/tinyframework/packagetest/sub/A + x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded + x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onClassLoaded:(Ljava/lang/Class;Ljava/lang/String;)V + x: return +} +SourceFile: "A.java" +RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInStub + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl ## Class: com/android/hoststubgen/test/tinyframework/subclasstest/C1.class Compiled from "C1.java" public class com.android.hoststubgen.test.tinyframework.subclasstest.C1 @@ -4991,3 +5118,90 @@ RuntimeVisibleAnnotations: RuntimeInvisibleAnnotations: x: #x() android.hosttest.annotation.HostSideTestWholeClassStub +## Class: rename_prefix/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed.class + Compiled from "TinyFrameworkToBeRenamed.java" +public class rename_prefix.com.android.hoststubgen.test.tinyframework.TinyFrameworkToBeRenamed + minor version: 0 + major version: 61 + flags: (0x0021) ACC_PUBLIC, ACC_SUPER + this_class: #x // rename_prefix/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed + super_class: #x // java/lang/Object + interfaces: 0, fields: 1, methods: 3, attributes: 3 + private final int mValue; + descriptor: I + flags: (0x0012) ACC_PRIVATE, ACC_FINAL + RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInStub + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl + + private static {}; + descriptor: ()V + flags: (0x000a) ACC_PRIVATE, ACC_STATIC + Code: + stack=2, locals=0, args_size=0 + x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed + x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded + x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onClassLoaded:(Ljava/lang/Class;Ljava/lang/String;)V + x: return + + public rename_prefix.com.android.hoststubgen.test.tinyframework.TinyFrameworkToBeRenamed(int); + descriptor: (I)V + flags: (0x0001) ACC_PUBLIC + Code: + stack=4, locals=2, args_size=2 + x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed + x: ldc #x // String <init> + x: ldc #x // String (I)V + x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall + x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V + x: aload_0 + x: invokespecial #x // Method java/lang/Object."<init>":()V + x: aload_0 + x: iload_1 + x: putfield #x // Field mValue:I + x: return + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 11 10 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed; + 11 10 1 value I + RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInStub + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl + + public int getValue(); + descriptor: ()I + flags: (0x0001) ACC_PUBLIC + Code: + stack=4, locals=1, args_size=1 + x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed + x: ldc #x // String getValue + x: ldc #x // String ()I + x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall + x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V + x: aload_0 + x: getfield #x // Field mValue:I + x: ireturn + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 11 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed; + RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInStub + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl +} +SourceFile: "TinyFrameworkToBeRenamed.java" +RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInStub + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl +RuntimeInvisibleAnnotations: + x: #x() + android.hosttest.annotation.HostSideTestWholeClassStub diff --git a/tools/hoststubgen/hoststubgen/test-tiny-framework/policy-override-tiny-framework.txt b/tools/hoststubgen/hoststubgen/test-tiny-framework/policy-override-tiny-framework.txt index 696b6d009dc2..75c9721020bd 100644 --- a/tools/hoststubgen/hoststubgen/test-tiny-framework/policy-override-tiny-framework.txt +++ b/tools/hoststubgen/hoststubgen/test-tiny-framework/policy-override-tiny-framework.txt @@ -40,3 +40,17 @@ class *com.android.hoststubgen.test.tinyframework.subclasstest.CA remove class *com.android.hoststubgen.test.tinyframework.subclasstest.I1 keep class *com.android.hoststubgen.test.tinyframework.subclasstest.IA remove + +# Test package directive +package com.android.hoststubgen.test.tinyframework.packagetest stub +class com.android.hoststubgen.test.tinyframework.packagetest.B remove +class com.android.hoststubgen.test.tinyframework.packagetest.sub.B remove +# The following rules are the same as above +# class com.android.hoststubgen.test.tinyframework.packagetest.A stub +# class com.android.hoststubgen.test.tinyframework.packagetest.sub.A stub + + +# "rename" takes a type internal name, so '/'s is used as a separator. +# The leading / in the prefix is not needed (it'll be stripped), but it's added to make +# sure the stripping works. +rename ^.*/TinyFrameworkToBeRenamed$ /rename_prefix/
\ No newline at end of file diff --git a/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkRenamedClassCaller.java b/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkRenamedClassCaller.java new file mode 100644 index 000000000000..31a164af03f5 --- /dev/null +++ b/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkRenamedClassCaller.java @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2023 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.hoststubgen.test.tinyframework; + +import android.hosttest.annotation.HostSideTestWholeClassStub; + +@HostSideTestWholeClassStub +public class TinyFrameworkRenamedClassCaller { + /** Calls the class that'll be renamed. */ + public static int foo(int value) { + // When TinyFrameworkToBeRenamed gets renamed, this callsite should be updated too, + // so this code should work as-is. + return new TinyFrameworkToBeRenamed(value).getValue(); + } +} diff --git a/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed.java b/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed.java new file mode 100644 index 000000000000..1430bcb0276b --- /dev/null +++ b/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed.java @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2023 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.hoststubgen.test.tinyframework; + +import android.hosttest.annotation.HostSideTestWholeClassStub; + +/** + * This class will be renamed by the "rename" directive in the policy file. + */ +@HostSideTestWholeClassStub +public class TinyFrameworkToBeRenamed { + private final int mValue; + + public TinyFrameworkToBeRenamed(int value) { + mValue = value; + } + + public int getValue() { + return mValue; + } +} diff --git a/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/packagetest/A.java b/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/packagetest/A.java new file mode 100644 index 000000000000..6a52e4401b45 --- /dev/null +++ b/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/packagetest/A.java @@ -0,0 +1,19 @@ +/* + * 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.hoststubgen.test.tinyframework.packagetest; + +public class A { +} diff --git a/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/packagetest/B.java b/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/packagetest/B.java new file mode 100644 index 000000000000..1374a288f7aa --- /dev/null +++ b/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/packagetest/B.java @@ -0,0 +1,19 @@ +/* + * 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.hoststubgen.test.tinyframework.packagetest; + +public class B { +} diff --git a/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/packagetest/sub/A.java b/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/packagetest/sub/A.java new file mode 100644 index 000000000000..361a7fd04842 --- /dev/null +++ b/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/packagetest/sub/A.java @@ -0,0 +1,19 @@ +/* + * 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.hoststubgen.test.tinyframework.packagetest.sub; + +public class A { +} diff --git a/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/packagetest/sub/B.java b/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/packagetest/sub/B.java new file mode 100644 index 000000000000..716595a44243 --- /dev/null +++ b/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/packagetest/sub/B.java @@ -0,0 +1,19 @@ +/* + * 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.hoststubgen.test.tinyframework.packagetest.sub; + +public class B { +} diff --git a/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-test/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkClassTest.java b/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-test/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkClassTest.java index 37925e82bdb6..bf0f6545d1f5 100644 --- a/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-test/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkClassTest.java +++ b/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-test/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkClassTest.java @@ -334,4 +334,9 @@ public class TinyFrameworkClassTest { public void testRFileHeuristics() { assertThat(Nested.ARRAY.length).isEqualTo(1); } + + @Test + public void testTypeRename() { + assertThat(TinyFrameworkRenamedClassCaller.foo(1)).isEqualTo(1); + } } diff --git a/tools/hoststubgen/hoststubgen/test/com/android/hoststubgen/utils/TrieTest.kt b/tools/hoststubgen/hoststubgen/test/com/android/hoststubgen/utils/TrieTest.kt new file mode 100644 index 000000000000..081d03909926 --- /dev/null +++ b/tools/hoststubgen/hoststubgen/test/com/android/hoststubgen/utils/TrieTest.kt @@ -0,0 +1,47 @@ +/* + * 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.hoststubgen.utils + +import org.junit.Assert.assertEquals +import org.junit.Assert.assertNull +import org.junit.Test + +class TrieTest { + + private class TestTrie : Trie<String, Char, Int>() { + override fun splitToComponents(key: String): Iterator<Char> { + return key.toCharArray().iterator() + } + } + + @Test + fun testPrefixTree() { + val trie = TestTrie() + trie["ab"] = 1 + trie["abc"] = 2 + trie["ab123"] = 3 + assertNull(trie["a"]) + assertNull(trie["x"]) + assertNull(trie["a1"]) + assertEquals(1, trie["ab"]) + assertEquals(2, trie["abc"]) + assertEquals(2, trie["abcd"]) + assertEquals(1, trie["ab1"]) + assertEquals(1, trie["ab12"]) + assertEquals(3, trie["ab123"]) + assertEquals(1, trie["ab@"]) + } +} diff --git a/tools/hoststubgen/scripts/dump-jar b/tools/hoststubgen/scripts/dump-jar index 992665ed58ee..fe546fe9cc92 100755 --- a/tools/hoststubgen/scripts/dump-jar +++ b/tools/hoststubgen/scripts/dump-jar @@ -97,6 +97,7 @@ filter_output() { # - Remove the constant pool # - Remove the line number table # - Some other transient lines + # - Sometimes the javap shows mysterious warnings, so remove them too. # # `/PATTERN-1/,/PATTERN-1/{//!d}` is a trick to delete lines between two patterns, without # the start and the end lines. @@ -106,7 +107,8 @@ filter_output() { -e '/^ *line *[0-9][0-9]*: *[0-9][0-9]*$/d' \ -e '/SHA-256 checksum/d' \ -e '/Last modified/d' \ - -e '/^Classfile jar/d' + -e '/^Classfile jar/d' \ + -e '/\[warning\]/d' else cat # Print as-is. fi diff --git a/tools/lint/OWNERS b/tools/lint/OWNERS index 33e237d306fc..8e4569ee2a30 100644 --- a/tools/lint/OWNERS +++ b/tools/lint/OWNERS @@ -1,4 +1,5 @@ -brufino@google.com +mattgilbride@google.com +azharaa@google.com jsharkey@google.com per-file *CallingSettingsNonUserGetterMethods* = file:/packages/SettingsProvider/OWNERS diff --git a/tools/lint/fix/README.md b/tools/lint/fix/README.md index a5ac2be1c18a..18bda9287a50 100644 --- a/tools/lint/fix/README.md +++ b/tools/lint/fix/README.md @@ -6,7 +6,7 @@ Inspiration: go/refactor-the-platform-with-lint\ It's a python script that runs the framework linter, and then (optionally) copies modified files back into the source tree.\ -Why python, you ask? Because python is cool ¯\_(ツ)_/¯. +Why python, you ask? Because python is cool ¯\\\_(ツ)\_/¯. Incidentally, this exposes a much simpler way to run individual lint checks against individual modules, so it's useful beyond applying fixes. @@ -15,7 +15,7 @@ against individual modules, so it's useful beyond applying fixes. Lint is not allowed to modify source files directly via lint's `--apply-suggestions` flag. As a compromise, soong zips up the (potentially) modified sources and leaves them in an intermediate -directory. This script runs the lint, unpacks those files, and copies them back into the tree. +directory. This script runs the lint, unpacks those files, and copies them back into the tree. ## How do I run it? **WARNING: You probably want to commit/stash any changes to your working tree before doing this...** diff --git a/tools/protologtool/src/com/android/protolog/tool/ProtoLogTool.kt b/tools/protologtool/src/com/android/protolog/tool/ProtoLogTool.kt index 0f1373c34ce6..fd7d2b35bb6f 100644 --- a/tools/protologtool/src/com/android/protolog/tool/ProtoLogTool.kt +++ b/tools/protologtool/src/com/android/protolog/tool/ProtoLogTool.kt @@ -27,7 +27,6 @@ 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.ArrayAccessExpr import com.github.javaparser.ast.expr.ArrayCreationExpr import com.github.javaparser.ast.expr.ArrayInitializerExpr @@ -43,7 +42,10 @@ import com.github.javaparser.ast.expr.NullLiteralExpr 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 @@ -194,6 +196,7 @@ object ProtoLogTool { groups: Map<String, LogGroup>, protoLogGroupsClassName: String ) { + var needsCreateLogGroupsMap = false classDeclaration.fields.forEach { field -> field.getAnnotationByClass(ProtoLogToolInjected::class.java) .ifPresent { annotationExpr -> @@ -221,33 +224,10 @@ object ProtoLogTool { } ?: 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")) } ProtoLogToolInjected.Value.CACHE_UPDATER.name -> { field.setFinal(true) @@ -260,6 +240,45 @@ object ProtoLogTool { } } } + + 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 injectCacheClass( diff --git a/tools/sdkparcelables/src/com/android/sdkparcelables/Main.kt b/tools/sdkparcelables/src/com/android/sdkparcelables/Main.kt index 0b619488c49c..9c443324defb 100644 --- a/tools/sdkparcelables/src/com/android/sdkparcelables/Main.kt +++ b/tools/sdkparcelables/src/com/android/sdkparcelables/Main.kt @@ -23,13 +23,21 @@ import java.io.IOException import java.util.zip.ZipFile fun main(args: Array<String>) { - if (args.size != 2) { + if (args.size < 2 || args.size > 3) { usage() } val zipFileName = args[0] val aidlFileName = args[1] + var stable = false + if (args.size == 3) { + if (args[2] != "--guarantee_stable") { + usage() + } + stable = true + } + val zipFile: ZipFile try { @@ -55,6 +63,9 @@ fun main(args: Array<String>) { val outFile = File(aidlFileName) val outWriter = outFile.bufferedWriter() for (parcelable in parcelables) { + if (stable) { + outWriter.write("@JavaOnlyStableParcelable ") + } outWriter.write("parcelable ") outWriter.write(parcelable.replace('/', '.').replace('$', '.')) outWriter.write(";\n") diff --git a/tools/systemfeatures/Android.bp b/tools/systemfeatures/Android.bp new file mode 100644 index 000000000000..aca25eb8f603 --- /dev/null +++ b/tools/systemfeatures/Android.bp @@ -0,0 +1,63 @@ +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"], +} + +java_library_host { + name: "systemfeatures-gen-lib", + srcs: [ + "src/**/*.java", + "src/**/*.kt", + ], + static_libs: [ + "guava", + "javapoet", + ], +} + +java_binary_host { + name: "systemfeatures-gen-tool", + main_class: "com.android.systemfeatures.SystemFeaturesGenerator", + static_libs: ["systemfeatures-gen-lib"], +} + +// TODO(b/203143243): Add golden diff test for generated sources. +// Functional runtime behavior is covered in systemfeatures-gen-tests. +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 --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: --feature-apis=WATCH,PC > $(location RoFeatures.java)", + out: [ + "RwNoFeatures.java", + "RoNoFeatures.java", + "RwFeatures.java", + "RoFeatures.java", + ], + tools: ["systemfeatures-gen-tool"], +} + +java_test_host { + name: "systemfeatures-gen-tests", + test_suites: ["general-tests"], + srcs: [ + "tests/**/*.java", + ":systemfeatures-gen-tests-srcs", + ], + test_options: { + unit_test: true, + }, + static_libs: [ + "aconfig-annotations-lib", + "framework-annotations-lib", + "junit", + "objenesis", + "mockito", + "truth", + ], +} diff --git a/tools/systemfeatures/OWNERS b/tools/systemfeatures/OWNERS new file mode 100644 index 000000000000..66c8506f58be --- /dev/null +++ b/tools/systemfeatures/OWNERS @@ -0,0 +1 @@ +include /PERFORMANCE_OWNERS diff --git a/tools/systemfeatures/README.md b/tools/systemfeatures/README.md new file mode 100644 index 000000000000..5836f81e5fd3 --- /dev/null +++ b/tools/systemfeatures/README.md @@ -0,0 +1,11 @@ +# Build-time system feature support + +## Overview + +System features exposed from `PackageManager` are defined and aggregated as +`<feature>` xml attributes across various partitions, and are currently queried +at runtime through the framework. This directory contains tooling that will +support *build-time* queries of select system features, enabling optimizations +like code stripping and conditionally dependencies when so configured. + +### TODO(b/203143243): Expand readme after landing codegen. diff --git a/tools/systemfeatures/src/com/android/systemfeatures/SystemFeaturesGenerator.kt b/tools/systemfeatures/src/com/android/systemfeatures/SystemFeaturesGenerator.kt new file mode 100644 index 000000000000..e537ffcb56bd --- /dev/null +++ b/tools/systemfeatures/src/com/android/systemfeatures/SystemFeaturesGenerator.kt @@ -0,0 +1,267 @@ +/* + * 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.systemfeatures + +import com.google.common.base.CaseFormat +import com.squareup.javapoet.ClassName +import com.squareup.javapoet.JavaFile +import com.squareup.javapoet.MethodSpec +import com.squareup.javapoet.TypeSpec +import javax.lang.model.element.Modifier + +/* + * Simple Java code generator that takes as input a list of defined features and generates an + * accessory class based on the provided versions. + * + * <p>Example: + * + * <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: + * + * <pre> + * package com.foo; + * public final class RoSystemFeatures { + * @AssumeTrueForR8 + * public static boolean hasFeatureWatch(Context context); + * @AssumeFalseForR8 + * 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") + private val ASSUME_TRUE_CLASS = + ClassName.get("com.android.aconfig.annotations", "AssumeTrueForR8") + private val ASSUME_FALSE_CLASS = + ClassName.get("com.android.aconfig.annotations", "AssumeFalseForR8") + + private fun usage() { + println("Usage: SystemFeaturesGenerator <outputClassName> [options]") + 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. */ + @JvmStatic + fun main(args: Array<String>) { + if (args.size < 1) { + usage() + return + } + + var readonly = false + var outputClassName: ClassName? = null + 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) -> { + 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.") + usage() + return + } + + val classBuilder = + TypeSpec.classBuilder(outputClassName) + .addModifiers(Modifier.PUBLIC, Modifier.FINAL) + .addJavadoc("@hide") + + 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()) + .build() + .writeTo(System.out) + } + + /* + * Parses a feature argument of the form "--feature=$NAME:$VER", where "$VER" is optional. + * * "--feature=WATCH:0" -> Feature enabled w/ version 0 (default version when enabled) + * * "--feature=WATCH:7" -> Feature enabled w/ version 7 + * * "--feature=WATCH:" -> Feature disabled + */ + private fun parseFeatureArg(arg: String): FeatureArg { + val featureArgs = arg.substring(FEATURE_ARG.length).split(":") + val name = parseFeatureName(featureArgs[0]) + val version = featureArgs.getOrNull(1)?.toIntOrNull() + 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)}, + * returning the fallback value from PackageManager if not readonly. + */ + private fun addFeatureMethodsToClass( + builder: TypeSpec.Builder, + features: Collection<FeatureInfo>, + ) { + for (feature in features) { + // Turn "FEATURE_FOO" into "hasFeatureFoo". + val methodName = + "has" + CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, feature.name) + val methodBuilder = + MethodSpec.methodBuilder(methodName) + .addModifiers(Modifier.PUBLIC, Modifier.STATIC) + .returns(Boolean::class.java) + .addParameter(CONTEXT_CLASS, "context") + + if (feature.readonly) { + val featureEnabled = compareValues(feature.version, 0) >= 0 + methodBuilder.addAnnotation( + if (featureEnabled) ASSUME_TRUE_CLASS else ASSUME_FALSE_CLASS + ) + methodBuilder.addStatement("return $featureEnabled") + } else { + methodBuilder.addStatement( + "return hasFeatureFallback(context, \$T.\$N)", + PACKAGEMANAGER_CLASS, + feature.name + ) + } + builder.addMethod(methodBuilder.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() + ) + } + + /* + * Adds a generic query method to the class with the form: {@code public static boolean + * maybeHasFeature(String featureName, int version)}, returning null if the feature version is + * undefined or not readonly. + * + * This method is useful for internal usage within the framework, e.g., from the implementation + * of {@link android.content.pm.PackageManager#hasSystemFeature(Context)}, when we may only + * want a valid result if it's defined as readonly, and we want a custom fallback otherwise + * (e.g., to the existing runtime binder query). + */ + private fun addMaybeFeatureMethodToClass( + builder: TypeSpec.Builder, + features: Collection<FeatureInfo>, + ) { + val methodBuilder = + MethodSpec.methodBuilder("maybeHasFeature") + .addModifiers(Modifier.PUBLIC, Modifier.STATIC) + .addAnnotation(ClassName.get("android.annotation", "Nullable")) + .returns(Boolean::class.javaObjectType) // Use object type for nullability + .addParameter(String::class.java, "featureName") + .addParameter(Int::class.java, "version") + + 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() + } + methodBuilder.addStatement("return null") + builder.addMethod(methodBuilder.build()) + } + + 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/Context.java b/tools/systemfeatures/tests/Context.java new file mode 100644 index 000000000000..630bc0771a01 --- /dev/null +++ b/tools/systemfeatures/tests/Context.java @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.content; + +import android.content.pm.PackageManager; + +/** Stub for testing. */ +public class Context { + /** @hide */ + public PackageManager getPackageManager() { + return null; + } +} diff --git a/tools/systemfeatures/tests/PackageManager.java b/tools/systemfeatures/tests/PackageManager.java new file mode 100644 index 000000000000..db670482065a --- /dev/null +++ b/tools/systemfeatures/tests/PackageManager.java @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.content.pm; + +/** 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"; + + /** @hide */ + public boolean hasSystemFeature(String featureName, int version) { + return false; + } +} diff --git a/tools/systemfeatures/tests/SystemFeaturesGeneratorTest.java b/tools/systemfeatures/tests/SystemFeaturesGeneratorTest.java new file mode 100644 index 000000000000..6dfd244a807b --- /dev/null +++ b/tools/systemfeatures/tests/SystemFeaturesGeneratorTest.java @@ -0,0 +1,152 @@ +/* + * 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.systemfeatures; + +import static com.google.common.truth.Truth.assertThat; + +import static org.mockito.Mockito.anyInt; +import static org.mockito.Mockito.anyString; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import android.content.Context; +import android.content.pm.PackageManager; + +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnit; +import org.mockito.junit.MockitoRule; + +@RunWith(JUnit4.class) +public class SystemFeaturesGeneratorTest { + + @Rule public final MockitoRule mockito = MockitoJUnit.rule(); + + @Mock private Context mContext; + @Mock private PackageManager mPackageManager; + + @Before + public void setUp() { + when(mContext.getPackageManager()).thenReturn(mPackageManager); + } + + @Test + public void testReadonlyDisabledNoDefinedFeatures() { + // Always report null for conditional queries if readonly codegen is disabled. + assertThat(RwNoFeatures.maybeHasFeature(PackageManager.FEATURE_WATCH, 0)).isNull(); + assertThat(RwNoFeatures.maybeHasFeature(PackageManager.FEATURE_WIFI, 0)).isNull(); + assertThat(RwNoFeatures.maybeHasFeature(PackageManager.FEATURE_VULKAN, 0)).isNull(); + assertThat(RwNoFeatures.maybeHasFeature(PackageManager.FEATURE_AUTO, 0)).isNull(); + assertThat(RwNoFeatures.maybeHasFeature("com.arbitrary.feature", 0)).isNull(); + } + + @Test + public void testReadonlyNoDefinedFeatures() { + // If no features are explicitly declared as readonly available, always report + // null for conditional queries. + assertThat(RoNoFeatures.maybeHasFeature(PackageManager.FEATURE_WATCH, 0)).isNull(); + assertThat(RoNoFeatures.maybeHasFeature(PackageManager.FEATURE_WIFI, 0)).isNull(); + 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 + public void testReadonlyDisabledWithDefinedFeatures() { + // Always fall back to the PackageManager for defined, explicit features queries. + 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(); + + when(mPackageManager.hasSystemFeature(PackageManager.FEATURE_WIFI, 0)).thenReturn(true); + assertThat(RwFeatures.hasFeatureWifi(mContext)).isTrue(); + + when(mPackageManager.hasSystemFeature(PackageManager.FEATURE_VULKAN, 0)).thenReturn(false); + assertThat(RwFeatures.hasFeatureVulkan(mContext)).isFalse(); + + when(mPackageManager.hasSystemFeature(PackageManager.FEATURE_AUTO, 0)).thenReturn(false); + assertThat(RwFeatures.hasFeatureAuto(mContext)).isFalse(); + + // For defined and undefined features, conditional queries should report null (unknown). + assertThat(RwFeatures.maybeHasFeature(PackageManager.FEATURE_WATCH, 0)).isNull(); + assertThat(RwFeatures.maybeHasFeature(PackageManager.FEATURE_WIFI, 0)).isNull(); + assertThat(RwFeatures.maybeHasFeature(PackageManager.FEATURE_VULKAN, 0)).isNull(); + assertThat(RwFeatures.maybeHasFeature(PackageManager.FEATURE_AUTO, 0)).isNull(); + assertThat(RwFeatures.maybeHasFeature("com.arbitrary.feature", 0)).isNull(); + } + + @Test + public void testReadonlyWithDefinedFeatures() { + // Always use the build-time feature version for defined, explicit feature queries, never + // falling back to the runtime query. + assertThat(RoFeatures.hasFeatureWatch(mContext)).isTrue(); + assertThat(RoFeatures.hasFeatureWifi(mContext)).isTrue(); + assertThat(RoFeatures.hasFeatureVulkan(mContext)).isFalse(); + assertThat(RoFeatures.hasFeatureAuto(mContext)).isFalse(); + verify(mPackageManager, never()).hasSystemFeature(anyString(), anyInt()); + + // For defined feature types, conditional queries should reflect the build-time versions. + // VERSION=1 + assertThat(RoFeatures.maybeHasFeature(PackageManager.FEATURE_WATCH, -1)).isTrue(); + assertThat(RoFeatures.maybeHasFeature(PackageManager.FEATURE_WATCH, 0)).isTrue(); + assertThat(RoFeatures.maybeHasFeature(PackageManager.FEATURE_WATCH, 100)).isFalse(); + + // VERSION=0 + assertThat(RoFeatures.maybeHasFeature(PackageManager.FEATURE_WIFI, -1)).isTrue(); + assertThat(RoFeatures.maybeHasFeature(PackageManager.FEATURE_WIFI, 0)).isTrue(); + assertThat(RoFeatures.maybeHasFeature(PackageManager.FEATURE_WIFI, 100)).isFalse(); + + // VERSION=-1 + assertThat(RoFeatures.maybeHasFeature(PackageManager.FEATURE_VULKAN, -1)).isTrue(); + assertThat(RoFeatures.maybeHasFeature(PackageManager.FEATURE_VULKAN, 0)).isFalse(); + assertThat(RoFeatures.maybeHasFeature(PackageManager.FEATURE_VULKAN, 100)).isFalse(); + + // DISABLED + assertThat(RoFeatures.maybeHasFeature(PackageManager.FEATURE_AUTO, -1)).isFalse(); + 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(); + assertThat(RoFeatures.maybeHasFeature("com.arbitrary.feature", 100)).isNull(); + } +} |