summaryrefslogtreecommitdiff
path: root/libartbase/base/file_utils.cc
diff options
context:
space:
mode:
author David Brazdil <dbrazdil@google.com> 2019-02-28 15:04:14 +0000
committer David Brazdil <dbrazdil@google.com> 2019-03-05 15:17:01 +0000
commite7e26d10a7a1446b42c00104b162bf07e7c01a04 (patch)
treefb571d4903a499d9effae5940440af5159b8548e /libartbase/base/file_utils.cc
parent815d5e5304a5b57db64d6829813a14e464d5c55f (diff)
Assign non-runtime /apex/* dex files to platform domain
Until now only /system/framework and /apex/com.android.runtime were known locations, assigning "platform" domain to the former and "core-platform" domain to the latter. The media and conscrypt modules were left in the "application" domain. This patch adds a hardcoded path to the apex root and assigns all dex files in subdirectories to the "platform" domain. This affects both conscrypt and media modules. Any other dex files on boot classpath are also assigned to "platform" on first access. A warning is printed in such case and it is now deduped to avoid logspam. Bug: 125701194 Bug: 119068555 Test: compiles, boots, no conscrypt/media warnings about missing domain Test: art/test.py -b -r -t 674 Change-Id: I33bef18459741095d3d99b541fc88b21cf547800
Diffstat (limited to 'libartbase/base/file_utils.cc')
-rw-r--r--libartbase/base/file_utils.cc11
1 files changed, 9 insertions, 2 deletions
diff --git a/libartbase/base/file_utils.cc b/libartbase/base/file_utils.cc
index 2436e4528a..9e49d05c7e 100644
--- a/libartbase/base/file_utils.cc
+++ b/libartbase/base/file_utils.cc
@@ -65,6 +65,9 @@ namespace art {
using android::base::StringPrintf;
static constexpr const char* kClassesDex = "classes.dex";
+static constexpr const char* kApexDefaultPath = "/apex/";
+static constexpr const char* kRuntimeApexEnvVar = "ANDROID_RUNTIME_ROOT";
+static constexpr const char* kRuntimeApexDefaultPath = "/apex/com.android.runtime";
bool ReadFileToString(const std::string& file_name, std::string* result) {
File file(file_name, O_RDONLY, false);
@@ -284,8 +287,8 @@ std::string ReplaceFileExtension(const std::string& filename, const std::string&
bool LocationIsOnRuntimeModule(const char* full_path) {
std::string error_msg;
- const char* runtime_path = GetAndroidDirSafe("ANDROID_RUNTIME_ROOT",
- "/apex/com.android.runtime",
+ const char* runtime_path = GetAndroidDirSafe(kRuntimeApexEnvVar,
+ kRuntimeApexDefaultPath,
&error_msg);
if (runtime_path == nullptr) {
return false;
@@ -293,6 +296,10 @@ bool LocationIsOnRuntimeModule(const char* full_path) {
return android::base::StartsWith(full_path, runtime_path);
}
+bool LocationIsOnApex(const char* full_path) {
+ return android::base::StartsWith(full_path, kApexDefaultPath);
+}
+
bool LocationIsOnSystem(const char* path) {
#ifdef _WIN32
UNUSED(path);