summaryrefslogtreecommitdiff
path: root/libartbase/base/file_utils.cc
diff options
context:
space:
mode:
authorRoland Levillain <rpl@google.com>2019-03-29 20:20:16 +0000
committerRoland Levillain <rpl@google.com>2019-04-12 13:47:09 +0100
commitfb6a5c00ef02cda7ea919d717daaf46abd0414e4 (patch)
tree9ecfaac9bee174b3b31e0294c46c4d32a5f7b714 /libartbase/base/file_utils.cc
parentf160394fda141184f0ec3d139ec5ca810f142bda (diff)
Add and use art::GetAndroidRuntimeBinDir.
This method returns the location of the directory containing the Android Runtime binaries, which is expected to be the Android Runtime APEX's bin directory on target and the Android Root's bin directory on host (at least for now). Also remove art::CommonArtTestImpl::GetTestAndroidRoot as it is no longer used. Test: ART gtests on host and target Bug: 121117762 Change-Id: I4593bbd4d675ca9d3f7b708482aac82c1892a9ad
Diffstat (limited to 'libartbase/base/file_utils.cc')
-rw-r--r--libartbase/base/file_utils.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/libartbase/base/file_utils.cc b/libartbase/base/file_utils.cc
index 1a1310342c..f2a2d406e6 100644
--- a/libartbase/base/file_utils.cc
+++ b/libartbase/base/file_utils.cc
@@ -271,6 +271,17 @@ std::string GetAndroidRuntimeRoot() {
return ret;
}
+std::string GetAndroidRuntimeBinDir() {
+ // Environment variable `ANDROID_RUNTIME_ROOT` is defined as
+ // `$ANDROID_HOST_OUT/com.android.runtime` on host. However, host ART binaries
+ // are still installed in `$ANDROID_HOST_OUT/bin` (i.e. outside the Android
+ // Runtime Root). The situation is cleaner on target, where
+ // `ANDROID_RUNTIME_ROOT` is `$ANDROID_ROOT/apex/com.android.runtime` and ART
+ // binaries are installed in `$ANDROID_ROOT/apex/com.android.runtime/bin`.
+ std::string android_runtime_root = kIsTargetBuild ? GetAndroidRuntimeRoot() : GetAndroidRoot();
+ return android_runtime_root + "/bin";
+}
+
std::string GetAndroidDataSafe(std::string* error_msg) {
const char* android_dir = GetAndroidDirSafe(kAndroidDataEnvVar,
kAndroidDataDefaultPath,