Check /system/framework first in ArtDexFileLoader::Open.
This fixes art_dex_file_loader_test. The order was changed in:
https://android-review.googlesource.com/c/platform/art/+/915434
Test: art_dex_file_loader_test
Change-Id: Ie7c05b8ece43f74948036f9c516e6f87deb370b9
diff --git a/libdexfile/dex/art_dex_file_loader.cc b/libdexfile/dex/art_dex_file_loader.cc
index 0854b76..bfae667 100644
--- a/libdexfile/dex/art_dex_file_loader.cc
+++ b/libdexfile/dex/art_dex_file_loader.cc
@@ -544,9 +544,14 @@
// Location can contain multidex suffix, so fetch its canonical version. Note
// that this will call `realpath`.
std::string path = DexFileLoader::GetDexCanonicalLocation(location.c_str());
- if (LocationIsOnRuntimeModule(path.c_str()) || LocationIsOnConscryptModule(path.c_str())) {
+ // We check /system/framework before the runtime module location, because the
+ // runtime module location in a testing environment could be /system.
+ if (LocationIsOnSystemFramework(path.c_str())) {
+ dex_file->SetHiddenapiDomain(hiddenapi::Domain::kPlatform);
+ } else if (LocationIsOnRuntimeModule(path.c_str()) ||
+ LocationIsOnConscryptModule(path.c_str())) {
dex_file->SetHiddenapiDomain(hiddenapi::Domain::kCorePlatform);
- } else if (LocationIsOnApex(path.c_str()) || LocationIsOnSystemFramework(path.c_str())) {
+ } else if (LocationIsOnApex(path.c_str())) {
dex_file->SetHiddenapiDomain(hiddenapi::Domain::kPlatform);
} else {
dex_file->SetHiddenapiDomain(hiddenapi::Domain::kApplication);