From fb6a5c00ef02cda7ea919d717daaf46abd0414e4 Mon Sep 17 00:00:00 2001 From: Roland Levillain Date: Fri, 29 Mar 2019 20:20:16 +0000 Subject: 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 --- libartbase/base/file_utils.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'libartbase/base/file_utils.cc') 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, -- cgit v1.2.3-59-g8ed1b