diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-07-21 20:17:28 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-07-21 20:17:28 +0000 |
commit | ef5fe3c82ef2518928a467a76f59b6d5ecc12533 (patch) | |
tree | 2e03ed8d08dec913e86a8fffbb7cd8e210c8c238 | |
parent | 603eb48e4cf28a15ebcc717ea364406a07c47190 (diff) | |
parent | b3666a84055a8a93d821584594e9de496f123bb5 (diff) | |
download | art-android13-mainline-go-mediaprovider-release.tar.gz |
Snap for 8857176 from b3666a84055a8a93d821584594e9de496f123bb5 to mainline-go-mediaprovider-releaseaml_go_mpr_330912000android13-mainline-go-mediaprovider-release
Change-Id: I0a1dd58f087ba3a2ec4c309feb1e992f81d60ced
-rw-r--r-- | build/sdk/Android.bp | 11 | ||||
-rw-r--r-- | runtime/runtime.cc | 15 | ||||
-rwxr-xr-x | test/utils/regen-test-files | 18 |
3 files changed, 26 insertions, 18 deletions
diff --git a/build/sdk/Android.bp b/build/sdk/Android.bp index a9ee6754a1..9cafb8ae9d 100644 --- a/build/sdk/Android.bp +++ b/build/sdk/Android.bp @@ -93,13 +93,10 @@ art_module_sdk { }, android: { - bootclasspath_fragments: [ - // Adds the fragment and its contents to the sdk. - "art-bootclasspath-fragment", - ], - - systemserverclasspath_fragments: [ - "art-systemserverclasspath-fragment", + apexes: [ + // Adds exportable dependencies of the API to the sdk, + // e.g. *classpath_fragments. + "com.android.art", ], compat_configs: [ diff --git a/runtime/runtime.cc b/runtime/runtime.cc index 149c8a9c17..2de3eb5c74 100644 --- a/runtime/runtime.cc +++ b/runtime/runtime.cc @@ -178,6 +178,7 @@ #include "well_known_classes.h" #ifdef ART_TARGET_ANDROID +#include <android/api-level.h> #include <android/set_abort_message.h> #include "com_android_apex.h" namespace apex = com::android::apex; @@ -3358,13 +3359,21 @@ void Runtime::MadviseFileForRange(size_t madvise_size_limit_bytes, const uint8_t* map_begin, const uint8_t* map_end, const std::string& file_name) { +#ifdef ART_TARGET_ANDROID // Short-circuit the madvise optimization for background processes. This // avoids IO and memory contention with foreground processes, particularly // those involving app startup. - const Runtime* runtime = Runtime::Current(); - if (runtime != nullptr && !runtime->InJankPerceptibleProcessState()) { - return; + // Note: We can only safely short-circuit the madvise on T+, as it requires + // the framework to always immediately notify ART of process states. + static const int kApiLevel = android_get_device_api_level(); + const bool accurate_process_state_at_startup = kApiLevel >= __ANDROID_API_T__; + if (accurate_process_state_at_startup) { + const Runtime* runtime = Runtime::Current(); + if (runtime != nullptr && !runtime->InJankPerceptibleProcessState()) { + return; + } } +#endif // ART_TARGET_ANDROID // Ideal blockTransferSize for madvising files (128KiB) static constexpr size_t kIdealIoTransferSizeBytes = 128*1024; diff --git a/test/utils/regen-test-files b/test/utils/regen-test-files index 237ec960d4..edf6dd127d 100755 --- a/test/utils/regen-test-files +++ b/test/utils/regen-test-files @@ -736,18 +736,11 @@ class Generator: mts_test_shards = [] - # ART test (gtest & run-test) shard(s). - # TODO: Also handle the case of gtests requiring root access to the device - # (`art_gtest_eng_only_module_names`). + # ART run-tests shard(s). art_run_test_module_names = [ART_RUN_TEST_MODULE_NAME_PREFIX + t for t in art_run_tests] art_run_test_shards = split_list(art_run_test_module_names, NUM_MTS_ART_RUN_TEST_SHARDS) for i in range(len(art_run_test_shards)): art_tests_shard_i_tests = art_run_test_shards[i] - # Append ART gtests to the last ART run-test shard for now. - # If needed, consider moving them to their own shard to increase - # the parallelization of code coverage runs. - if i + 1 == len(art_run_test_shards): - art_tests_shard_i_tests.extend(art_gtest_mts_user_module_names) art_tests_shard_i = self.create_mts_test_shard( "ART run-tests", art_tests_shard_i_tests, i, 2020, ["TODO(rpl): Find a way to express this list in a more concise fashion."]) @@ -775,6 +768,15 @@ class Generator: other_cts_libcore_tests_shard_num, 2021) mts_test_shards.append(other_cts_libcore_tests_shard) + # ART gtests shard. + # TODO: Also handle the case of gtests requiring root access to the device + # (`art_gtest_eng_only_module_names`). + art_gtests_shard_num = len(mts_test_shards) + art_gtests_shard_tests = art_gtest_mts_user_module_names + art_gtests_shard = self.create_mts_test_shard( + "ART gtests", art_gtests_shard_tests, art_gtests_shard_num, 2022) + mts_test_shards.append(art_gtests_shard) + for s in mts_test_shards: s.regen_test_plan_file() s.regen_test_list_file() |