Update paths and names for the new ART APEX.

Test: Build & boot
Test: atest CtsJniTestCases
Bug: 135753770
Exempt-From-Owner-Approval: Approved internally
Change-Id: Ic59b7bc8aae7ce521cf3ec9df4ab72aa611d0b75
Merged-In: Ic59b7bc8aae7ce521cf3ec9df4ab72aa611d0b75
This commit is contained in:
Martin Stjernholm 2019-07-17 22:17:58 +01:00
parent cc746b5193
commit df96e1f25c
8 changed files with 38 additions and 34 deletions

View file

@ -91,22 +91,22 @@ static bool ActivateFlattenedApexesIfPossible() {
return false; return false;
} }
// Special casing for the runtime APEX // Special casing for the ART APEX
constexpr const char kRuntimeApexMountPath[] = "/system/apex/com.android.runtime"; constexpr const char kArtApexMountPath[] = "/system/apex/com.android.art";
static const std::vector<std::string> kRuntimeApexDirNames = {"com.android.runtime.release", static const std::vector<std::string> kArtApexDirNames = {"com.android.art.release",
"com.android.runtime.debug"}; "com.android.art.debug"};
bool success = false; bool success = false;
for (const auto& name : kRuntimeApexDirNames) { for (const auto& name : kArtApexDirNames) {
std::string path = std::string(kSystemApex) + "/" + name; std::string path = std::string(kSystemApex) + "/" + name;
if (access(path.c_str(), F_OK) == 0) { if (access(path.c_str(), F_OK) == 0) {
if (mount(path.c_str(), kRuntimeApexMountPath, nullptr, MS_BIND, nullptr) == 0) { if (mount(path.c_str(), kArtApexMountPath, nullptr, MS_BIND, nullptr) == 0) {
success = true; success = true;
break; break;
} }
} }
} }
if (!success) { if (!success) {
PLOG(ERROR) << "Failed to bind mount the runtime APEX to " << kRuntimeApexMountPath; PLOG(ERROR) << "Failed to bind mount the ART APEX to " << kArtApexMountPath;
} }
return success; return success;
} }

View file

@ -63,6 +63,10 @@ android_namespace_t* FindExportedNamespace(const char* caller_location) {
LOG_ALWAYS_FATAL_IF((dot_index == std::string::npos), LOG_ALWAYS_FATAL_IF((dot_index == std::string::npos),
"Error finding namespace of apex: no dot in apex name %s", caller_location); "Error finding namespace of apex: no dot in apex name %s", caller_location);
std::string name = location.substr(dot_index + 1, slash_index - dot_index - 1); std::string name = location.substr(dot_index + 1, slash_index - dot_index - 1);
// TODO(b/139408016): Rename the runtime namespace to "art".
if (name == "art") {
name = "runtime";
}
android_namespace_t* boot_namespace = android_get_exported_namespace(name.c_str()); android_namespace_t* boot_namespace = android_get_exported_namespace(name.c_str());
LOG_ALWAYS_FATAL_IF((boot_namespace == nullptr), LOG_ALWAYS_FATAL_IF((boot_namespace == nullptr),
"Error finding namespace of apex: no namespace called %s", name.c_str()); "Error finding namespace of apex: no namespace called %s", name.c_str());

View file

@ -49,12 +49,12 @@ constexpr const char* kVendorPublicLibrariesFile = "/vendor/etc/public.libraries
constexpr const char* kLlndkLibrariesFile = "/system/etc/llndk.libraries.txt"; constexpr const char* kLlndkLibrariesFile = "/system/etc/llndk.libraries.txt";
constexpr const char* kVndkLibrariesFile = "/system/etc/vndksp.libraries.txt"; constexpr const char* kVndkLibrariesFile = "/system/etc/vndksp.libraries.txt";
const std::vector<const std::string> kRuntimePublicLibraries = { const std::vector<const std::string> kArtApexPublicLibraries = {
"libicuuc.so", "libicuuc.so",
"libicui18n.so", "libicui18n.so",
}; };
constexpr const char* kRuntimeApexLibPath = "/apex/com.android.runtime/" LIB; constexpr const char* kArtApexLibPath = "/apex/com.android.art/" LIB;
constexpr const char* kNeuralNetworksApexPublicLibrary = "libneuralnetworks.so"; constexpr const char* kNeuralNetworksApexPublicLibrary = "libneuralnetworks.so";
@ -182,8 +182,8 @@ static std::string InitDefaultPublicLibraries(bool for_preload) {
// For example, libicuuc.so is exposed to classloader namespace from runtime namespace. // For example, libicuuc.so is exposed to classloader namespace from runtime namespace.
// Unfortunately, it does not have stable C symbols, and default namespace should only use // Unfortunately, it does not have stable C symbols, and default namespace should only use
// stable symbols in libandroidicu.so. http://b/120786417 // stable symbols in libandroidicu.so. http://b/120786417
for (const std::string& lib_name : kRuntimePublicLibraries) { for (const std::string& lib_name : kArtApexPublicLibraries) {
std::string path(kRuntimeApexLibPath); std::string path(kArtApexLibPath);
path.append("/").append(lib_name); path.append("/").append(lib_name);
struct stat s; struct stat s;
@ -207,9 +207,9 @@ static std::string InitDefaultPublicLibraries(bool for_preload) {
return android::base::Join(*sonames, ':'); return android::base::Join(*sonames, ':');
} }
static std::string InitRuntimePublicLibraries() { static std::string InitArtPublicLibraries() {
CHECK(sizeof(kRuntimePublicLibraries) > 0); CHECK(sizeof(kArtApexPublicLibraries) > 0);
std::string list = android::base::Join(kRuntimePublicLibraries, ":"); std::string list = android::base::Join(kArtApexPublicLibraries, ":");
std::string additional_libs = additional_public_libraries(); std::string additional_libs = additional_public_libraries();
if (!additional_libs.empty()) { if (!additional_libs.empty()) {
@ -277,7 +277,7 @@ const std::string& default_public_libraries() {
} }
const std::string& runtime_public_libraries() { const std::string& runtime_public_libraries() {
static std::string list = InitRuntimePublicLibraries(); static std::string list = InitArtPublicLibraries();
return list; return list;
} }

View file

@ -214,7 +214,7 @@ LOCAL_MODULE := ld.config.txt
LOCAL_MODULE_CLASS := ETC LOCAL_MODULE_CLASS := ETC
LOCAL_MODULE_PATH := $(TARGET_OUT_ETC) LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)
# Start of runtime APEX compatibility. # Start of i18n and ART APEX compatibility.
# #
# Meta-comment: # Meta-comment:
# The placing of this section is somewhat arbitrary. The LOCAL_POST_INSTALL_CMD # The placing of this section is somewhat arbitrary. The LOCAL_POST_INSTALL_CMD
@ -226,7 +226,7 @@ LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)
# come to rely on them. # come to rely on them.
# http://b/121248172 - create a link from /system/usr/icu to # http://b/121248172 - create a link from /system/usr/icu to
# /apex/com.android.runtime/etc/icu so that apps can find the ICU .dat file. # /apex/com.android.i18n/etc/icu so that apps can find the ICU .dat file.
# A symlink can't overwrite a directory and the /system/usr/icu directory once # A symlink can't overwrite a directory and the /system/usr/icu directory once
# existed so the required structure must be created whatever we find. # existed so the required structure must be created whatever we find.
LOCAL_POST_INSTALL_CMD = mkdir -p $(TARGET_OUT)/usr && rm -rf $(TARGET_OUT)/usr/icu LOCAL_POST_INSTALL_CMD = mkdir -p $(TARGET_OUT)/usr && rm -rf $(TARGET_OUT)/usr/icu
@ -248,10 +248,10 @@ ART_BINARIES := \
LOCAL_POST_INSTALL_CMD += && mkdir -p $(TARGET_OUT)/bin LOCAL_POST_INSTALL_CMD += && mkdir -p $(TARGET_OUT)/bin
$(foreach b,$(ART_BINARIES), \ $(foreach b,$(ART_BINARIES), \
$(eval LOCAL_POST_INSTALL_CMD += \ $(eval LOCAL_POST_INSTALL_CMD += \
&& ln -sf /apex/com.android.runtime/bin/$(b) $(TARGET_OUT)/bin/$(b)) \ && ln -sf /apex/com.android.art/bin/$(b) $(TARGET_OUT)/bin/$(b)) \
) )
# End of runtime APEX compatibilty. # End of i18n and ART APEX compatibilty.
ifeq ($(_enforce_vndk_at_runtime),true) ifeq ($(_enforce_vndk_at_runtime),true)

View file

@ -85,8 +85,8 @@ namespace.runtime.isolated = true
# android_link_namespaces in libnativeloader. # android_link_namespaces in libnativeloader.
namespace.runtime.visible = true namespace.runtime.visible = true
namespace.runtime.search.paths = /apex/com.android.runtime/${LIB} namespace.runtime.search.paths = /apex/com.android.art/${LIB}
namespace.runtime.asan.search.paths = /apex/com.android.runtime/${LIB} namespace.runtime.asan.search.paths = /apex/com.android.art/${LIB}
namespace.runtime.links = default namespace.runtime.links = default
# Need allow_all_shared_libs because libart.so can dlopen oat files in # Need allow_all_shared_libs because libart.so can dlopen oat files in
# /system/framework and /data. # /system/framework and /data.

View file

@ -166,8 +166,8 @@ namespace.runtime.isolated = true
# android_link_namespaces in libnativeloader. # android_link_namespaces in libnativeloader.
namespace.runtime.visible = true namespace.runtime.visible = true
namespace.runtime.search.paths = /apex/com.android.runtime/${LIB} namespace.runtime.search.paths = /apex/com.android.art/${LIB}
namespace.runtime.asan.search.paths = /apex/com.android.runtime/${LIB} namespace.runtime.asan.search.paths = /apex/com.android.art/${LIB}
namespace.runtime.links = default namespace.runtime.links = default
# Need allow_all_shared_libs because libart.so can dlopen oat files in # Need allow_all_shared_libs because libart.so can dlopen oat files in
# /system/framework and /data. # /system/framework and /data.
@ -488,8 +488,8 @@ namespace.default.link.neuralnetworks.shared_libs = libneuralnetworks.so
############################################################################### ###############################################################################
namespace.runtime.isolated = true namespace.runtime.isolated = true
namespace.runtime.search.paths = /apex/com.android.runtime/${LIB} namespace.runtime.search.paths = /apex/com.android.art/${LIB}
namespace.runtime.asan.search.paths = /apex/com.android.runtime/${LIB} namespace.runtime.asan.search.paths = /apex/com.android.art/${LIB}
namespace.runtime.links = system namespace.runtime.links = system
# TODO(b/130340935): Use a dynamically created linker namespace similar to # TODO(b/130340935): Use a dynamically created linker namespace similar to
# classloader-namespace for oat files, and tighten this up. # classloader-namespace for oat files, and tighten this up.
@ -695,8 +695,8 @@ namespace.runtime.isolated = true
# android_link_namespaces in libnativeloader. # android_link_namespaces in libnativeloader.
namespace.runtime.visible = true namespace.runtime.visible = true
namespace.runtime.search.paths = /apex/com.android.runtime/${LIB} namespace.runtime.search.paths = /apex/com.android.art/${LIB}
namespace.runtime.asan.search.paths = /apex/com.android.runtime/${LIB} namespace.runtime.asan.search.paths = /apex/com.android.art/${LIB}
namespace.runtime.links = default namespace.runtime.links = default
# TODO(b/130340935): Use a dynamically created linker namespace similar to # TODO(b/130340935): Use a dynamically created linker namespace similar to
# classloader-namespace for oat files, and tighten this up. # classloader-namespace for oat files, and tighten this up.

View file

@ -105,8 +105,8 @@ namespace.runtime.isolated = true
# android_link_namespaces in libnativeloader. # android_link_namespaces in libnativeloader.
namespace.runtime.visible = true namespace.runtime.visible = true
namespace.runtime.search.paths = /apex/com.android.runtime/${LIB} namespace.runtime.search.paths = /apex/com.android.art/${LIB}
namespace.runtime.asan.search.paths = /apex/com.android.runtime/${LIB} namespace.runtime.asan.search.paths = /apex/com.android.art/${LIB}
namespace.runtime.links = default namespace.runtime.links = default
# Need allow_all_shared_libs because libart.so can dlopen oat files in # Need allow_all_shared_libs because libart.so can dlopen oat files in
# /system/framework and /data. # /system/framework and /data.
@ -419,8 +419,8 @@ namespace.default.link.neuralnetworks.shared_libs = libneuralnetworks.so
############################################################################### ###############################################################################
namespace.runtime.isolated = true namespace.runtime.isolated = true
namespace.runtime.search.paths = /apex/com.android.runtime/${LIB} namespace.runtime.search.paths = /apex/com.android.art/${LIB}
namespace.runtime.asan.search.paths = /apex/com.android.runtime/${LIB} namespace.runtime.asan.search.paths = /apex/com.android.art/${LIB}
namespace.runtime.links = default namespace.runtime.links = default
# TODO(b/130340935): Use a dynamically created linker namespace similar to # TODO(b/130340935): Use a dynamically created linker namespace similar to
# classloader-namespace for oat files, and tighten this up. # classloader-namespace for oat files, and tighten this up.
@ -503,8 +503,8 @@ namespace.runtime.isolated = true
# android_link_namespaces in libnativeloader. # android_link_namespaces in libnativeloader.
namespace.runtime.visible = true namespace.runtime.visible = true
namespace.runtime.search.paths = /apex/com.android.runtime/${LIB} namespace.runtime.search.paths = /apex/com.android.art/${LIB}
namespace.runtime.asan.search.paths = /apex/com.android.runtime/${LIB} namespace.runtime.asan.search.paths = /apex/com.android.art/${LIB}
namespace.runtime.links = default namespace.runtime.links = default
# TODO(b/130340935): Use a dynamically created linker namespace similar to # TODO(b/130340935): Use a dynamically created linker namespace similar to
# classloader-namespace for oat files, and tighten this up. # classloader-namespace for oat files, and tighten this up.

View file

@ -5,7 +5,7 @@ on early-init
export ANDROID_ASSETS /system/app export ANDROID_ASSETS /system/app
export ANDROID_DATA /data export ANDROID_DATA /data
export ANDROID_STORAGE /storage export ANDROID_STORAGE /storage
export ANDROID_RUNTIME_ROOT /apex/com.android.runtime export ANDROID_RUNTIME_ROOT /apex/com.android.art
export ANDROID_I18N_ROOT /apex/com.android.i18n export ANDROID_I18N_ROOT /apex/com.android.i18n
export ANDROID_TZDATA_ROOT /apex/com.android.tzdata export ANDROID_TZDATA_ROOT /apex/com.android.tzdata
export EXTERNAL_STORAGE /sdcard export EXTERNAL_STORAGE /sdcard