summaryrefslogtreecommitdiff
path: root/libartbase/base/file_utils.h
diff options
context:
space:
mode:
author Roland Levillain <rpl@google.com> 2019-04-05 18:53:58 +0100
committer Roland Levillain <rpl@google.com> 2019-04-12 10:59:09 +0000
commit50eec3d36d805874e1611e9df829b1313ef711bb (patch)
tree014971f52c9e955c686fab58a6420c5d37bec233 /libartbase/base/file_utils.h
parentdc2fbb6d9834733214c6cdedbacd526603754a74 (diff)
Adjust the dladdr-based introspection logic used in art::GetAndroidRootSafe.
This logic originally assumed that the libartbase library linked into the current binary was always located in a directory within the Android Root. This is no longer true on target since libartbase moved to the Runtime APEX; therefore we now only use that logic on host in art::GetAndroidRootSafe. Eventually we should be able to use this logic on target to find the Android Runtime Root (in art::GetAndroidRuntimeRootSafe), as libartbase is installed in the Runtime APEX. However, this is not always true at the moment, as ART gtests still install another copy of libartbase in /system/lib(64) (the Android Root) on target. Also improve the documentation of methods `art::GetAndroidRoot(Safe)` and `art::GetAndroidRuntimeRoot(Safe)`. Test: m test-art-host-gtest-file_utils_test Bug: 121117762 Bug: 129534335 Change-Id: I835207110dae0a550c06ac98ed4915241cc61c6f
Diffstat (limited to 'libartbase/base/file_utils.h')
-rw-r--r--libartbase/base/file_utils.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/libartbase/base/file_utils.h b/libartbase/base/file_utils.h
index 92b09c98c0..2115e954f8 100644
--- a/libartbase/base/file_utils.h
+++ b/libartbase/base/file_utils.h
@@ -29,11 +29,26 @@ namespace art {
bool ReadFileToString(const std::string& file_name, std::string* result);
+// These methods return the Android Root, which is the historical location of
+// the Android "system" directory, containing the built Android artifacts. On
+// target, this is normally "/system". On host this is usually a directory under
+// the build tree, e.g. "$ANDROID_BUILD_TOP/out/host/linux-x86". The location of
+// the Android Root can be overriden using the ANDROID_ROOT environment
+// variable.
+//
// Find $ANDROID_ROOT, /system, or abort.
std::string GetAndroidRoot();
// Find $ANDROID_ROOT, /system, or return an empty string.
std::string GetAndroidRootSafe(/*out*/ std::string* error_msg);
+// These methods return the Android Runtime Root, which is the location of the
+// (activated) Android Runtime APEX module. On target, this is normally
+// "/apex/com.android.runtime". On host, this is usually a subdirectory of the
+// Android Root, e.g.
+// "$ANDROID_BUILD_TOP/out/host/linux-x86/com.android.runtime". The location of
+// the Android Runtime Root can be overriden using the ANDROID_RUNTIME_ROOT
+// environment variable.
+//
// Find $ANDROID_RUNTIME_ROOT, /apex/com.android.runtime, or abort.
std::string GetAndroidRuntimeRoot();
// Find $ANDROID_RUNTIME_ROOT, /apex/com.android.runtime, or return an empty string.