summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Nicolas Geoffray <ngeoffray@google.com> 2019-03-09 00:38:49 +0000
committer Nicolas Geoffray <ngeoffray@google.com> 2019-03-09 03:20:01 +0000
commit35e6caa39e407af25a8ecbadc4994a4f17c639dc (patch)
tree90cac934587ded4a453d2e9e8e3048c92093ede3
parent23a8eb6623cef293dafd0b7be184a1695279525a (diff)
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
-rw-r--r--libdexfile/dex/art_dex_file_loader.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/libdexfile/dex/art_dex_file_loader.cc b/libdexfile/dex/art_dex_file_loader.cc
index 0854b76bb5..bfae66724a 100644
--- a/libdexfile/dex/art_dex_file_loader.cc
+++ b/libdexfile/dex/art_dex_file_loader.cc
@@ -544,9 +544,14 @@ std::unique_ptr<DexFile> ArtDexFileLoader::OpenCommon(const uint8_t* base,
// 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);