blob: c3f38f6c8d69dc29b6b73e0adf7f5f612c64a818 [file] [log] [blame]
Orion Hodson9b16e342019-10-09 13:29:16 +01001/*
2 * Copyright (C) 2019 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#define LOG_TAG "nativeloader"
18
19#include "public_libraries.h"
20
21#include <dirent.h>
22
23#include <algorithm>
Jooyung Han538f99a2020-03-03 00:46:50 +090024#include <map>
Orion Hodson9b16e342019-10-09 13:29:16 +010025#include <memory>
Jooyung Hancd616d02020-09-01 14:53:23 +090026#include <regex>
27#include <string>
Orion Hodson9b16e342019-10-09 13:29:16 +010028
29#include <android-base/file.h>
30#include <android-base/logging.h>
31#include <android-base/properties.h>
32#include <android-base/result.h>
33#include <android-base/strings.h>
34#include <log/log.h>
35
Nicolas Geoffray7ca8b672020-04-24 15:43:48 +010036#if defined(ART_TARGET_ANDROID)
Justin Yun3db26d52019-12-16 14:09:39 +090037#include <android/sysprop/VndkProperties.sysprop.h>
38#endif
39
Orion Hodson9b16e342019-10-09 13:29:16 +010040#include "utils.h"
41
42namespace android::nativeloader {
43
Orion Hodson9b16e342019-10-09 13:29:16 +010044using android::base::ErrnoError;
Orion Hodson9b16e342019-10-09 13:29:16 +010045using android::base::Result;
Jeffrey Huang52575032020-02-11 17:33:45 -080046using internal::ConfigEntry;
47using internal::ParseConfig;
Jooyung Hancd616d02020-09-01 14:53:23 +090048using internal::ParseApexLibrariesConfig;
Jeffrey Huang52575032020-02-11 17:33:45 -080049using std::literals::string_literals::operator""s;
Orion Hodson9b16e342019-10-09 13:29:16 +010050
51namespace {
52
53constexpr const char* kDefaultPublicLibrariesFile = "/etc/public.libraries.txt";
54constexpr const char* kExtendedPublicLibrariesFilePrefix = "public.libraries-";
55constexpr const char* kExtendedPublicLibrariesFileSuffix = ".txt";
Jooyung Hancd616d02020-09-01 14:53:23 +090056constexpr const char* kApexLibrariesConfigFile = "/linkerconfig/apex.libraries.config.txt";
Orion Hodson9b16e342019-10-09 13:29:16 +010057constexpr const char* kVendorPublicLibrariesFile = "/vendor/etc/public.libraries.txt";
Jooyung Han26f7d102020-02-22 23:39:23 +090058constexpr const char* kLlndkLibrariesFile = "/apex/com.android.vndk.v{}/etc/llndk.libraries.{}.txt";
59constexpr const char* kVndkLibrariesFile = "/apex/com.android.vndk.v{}/etc/vndksp.libraries.{}.txt";
Orion Hodson9b16e342019-10-09 13:29:16 +010060
Orion Hodson9b16e342019-10-09 13:29:16 +010061
Jeffrey Huang52575032020-02-11 17:33:45 -080062constexpr const char* kStatsdApexPublicLibrary = "libstats_jni.so";
63
Orion Hodson9b16e342019-10-09 13:29:16 +010064// TODO(b/130388701): do we need this?
65std::string root_dir() {
66 static const char* android_root_env = getenv("ANDROID_ROOT");
67 return android_root_env != nullptr ? android_root_env : "/system";
68}
69
70bool debuggable() {
71 static bool debuggable = android::base::GetBoolProperty("ro.debuggable", false);
72 return debuggable;
73}
74
Justin Yun089c1352020-02-06 16:53:08 +090075std::string vndk_version_str(bool use_product_vndk) {
Jooyung Han26f7d102020-02-22 23:39:23 +090076 if (use_product_vndk) {
77 static std::string product_vndk_version = get_vndk_version(true);
78 return product_vndk_version;
79 } else {
80 static std::string vendor_vndk_version = get_vndk_version(false);
81 return vendor_vndk_version;
Orion Hodson9b16e342019-10-09 13:29:16 +010082 }
Orion Hodson9b16e342019-10-09 13:29:16 +010083}
84
85// For debuggable platform builds use ANDROID_ADDITIONAL_PUBLIC_LIBRARIES environment
86// variable to add libraries to the list. This is intended for platform tests only.
87std::string additional_public_libraries() {
88 if (debuggable()) {
89 const char* val = getenv("ANDROID_ADDITIONAL_PUBLIC_LIBRARIES");
90 return val ? val : "";
91 }
92 return "";
93}
94
Jooyung Han26f7d102020-02-22 23:39:23 +090095// insert vndk version in every {} placeholder
Justin Yun089c1352020-02-06 16:53:08 +090096void InsertVndkVersionStr(std::string* file_name, bool use_product_vndk) {
Orion Hodson9b16e342019-10-09 13:29:16 +010097 CHECK(file_name != nullptr);
Jooyung Han26f7d102020-02-22 23:39:23 +090098 auto version = vndk_version_str(use_product_vndk);
99 size_t pos = file_name->find("{}");
100 while (pos != std::string::npos) {
101 file_name->replace(pos, 2, version);
102 pos = file_name->find("{}", pos + version.size());
Orion Hodson9b16e342019-10-09 13:29:16 +0100103 }
Orion Hodson9b16e342019-10-09 13:29:16 +0100104}
105
106const std::function<Result<bool>(const struct ConfigEntry&)> always_true =
107 [](const struct ConfigEntry&) -> Result<bool> { return true; };
108
109Result<std::vector<std::string>> ReadConfig(
110 const std::string& configFile,
111 const std::function<Result<bool>(const ConfigEntry& /* entry */)>& filter_fn) {
112 std::string file_content;
113 if (!base::ReadFileToString(configFile, &file_content)) {
114 return ErrnoError();
115 }
116 Result<std::vector<std::string>> result = ParseConfig(file_content, filter_fn);
Bernie Innocenti4bd58952020-02-06 15:43:57 +0900117 if (!result.ok()) {
Orion Hodson9b16e342019-10-09 13:29:16 +0100118 return Errorf("Cannot parse {}: {}", configFile, result.error().message());
119 }
120 return result;
121}
122
123void ReadExtensionLibraries(const char* dirname, std::vector<std::string>* sonames) {
124 std::unique_ptr<DIR, decltype(&closedir)> dir(opendir(dirname), closedir);
125 if (dir != nullptr) {
126 // Failing to opening the dir is not an error, which can happen in
127 // webview_zygote.
128 while (struct dirent* ent = readdir(dir.get())) {
129 if (ent->d_type != DT_REG && ent->d_type != DT_LNK) {
130 continue;
131 }
132 const std::string filename(ent->d_name);
133 std::string_view fn = filename;
134 if (android::base::ConsumePrefix(&fn, kExtendedPublicLibrariesFilePrefix) &&
135 android::base::ConsumeSuffix(&fn, kExtendedPublicLibrariesFileSuffix)) {
136 const std::string company_name(fn);
137 const std::string config_file_path = dirname + "/"s + filename;
138 LOG_ALWAYS_FATAL_IF(
139 company_name.empty(),
140 "Error extracting company name from public native library list file path \"%s\"",
141 config_file_path.c_str());
142
143 auto ret = ReadConfig(
144 config_file_path, [&company_name](const struct ConfigEntry& entry) -> Result<bool> {
145 if (android::base::StartsWith(entry.soname, "lib") &&
146 android::base::EndsWith(entry.soname, "." + company_name + ".so")) {
147 return true;
148 } else {
149 return Errorf("Library name \"{}\" does not end with the company name {}.",
150 entry.soname, company_name);
151 }
152 });
Bernie Innocenti4bd58952020-02-06 15:43:57 +0900153 if (ret.ok()) {
Orion Hodson9b16e342019-10-09 13:29:16 +0100154 sonames->insert(sonames->end(), ret->begin(), ret->end());
155 } else {
156 LOG_ALWAYS_FATAL("Error reading public native library list from \"%s\": %s",
157 config_file_path.c_str(), ret.error().message().c_str());
158 }
159 }
160 }
161 }
162}
163
164static std::string InitDefaultPublicLibraries(bool for_preload) {
165 std::string config_file = root_dir() + kDefaultPublicLibrariesFile;
166 auto sonames =
167 ReadConfig(config_file, [&for_preload](const struct ConfigEntry& entry) -> Result<bool> {
168 if (for_preload) {
169 return !entry.nopreload;
170 } else {
171 return true;
172 }
173 });
Bernie Innocenti4bd58952020-02-06 15:43:57 +0900174 if (!sonames.ok()) {
Orion Hodson9b16e342019-10-09 13:29:16 +0100175 LOG_ALWAYS_FATAL("Error reading public native library list from \"%s\": %s",
176 config_file.c_str(), sonames.error().message().c_str());
177 return "";
178 }
179
180 std::string additional_libs = additional_public_libraries();
181 if (!additional_libs.empty()) {
182 auto vec = base::Split(additional_libs, ":");
183 std::copy(vec.begin(), vec.end(), std::back_inserter(*sonames));
184 }
185
186 // If this is for preloading libs, don't remove the libs from APEXes.
187 if (for_preload) {
188 return android::base::Join(*sonames, ':');
189 }
190
Jooyung Hancd616d02020-09-01 14:53:23 +0900191 // Remove the public libs provided by apexes because these libs are available
192 // from apex namespaces.
193 for (const auto& p : apex_public_libraries()) {
194 // TODO(b/167578583) remove this `if` block after fixing the bug
195 // Skip ART APEX to keep behaviors
196 if (p.first == "com_android_art") {
Orion Hodson9b16e342019-10-09 13:29:16 +0100197 continue;
198 }
Jooyung Hancd616d02020-09-01 14:53:23 +0900199 auto public_libs = base::Split(p.second, ":");
200 sonames->erase(std::remove_if(sonames->begin(), sonames->end(), [&public_libs](const std::string& v) {
201 return std::find(public_libs.begin(), public_libs.end(), v) != public_libs.end();
202 }), sonames->end());
Orion Hodson9b16e342019-10-09 13:29:16 +0100203 }
204 return android::base::Join(*sonames, ':');
205}
206
Orion Hodson9b16e342019-10-09 13:29:16 +0100207static std::string InitVendorPublicLibraries() {
208 // This file is optional, quietly ignore if the file does not exist.
209 auto sonames = ReadConfig(kVendorPublicLibrariesFile, always_true);
Bernie Innocenti4bd58952020-02-06 15:43:57 +0900210 if (!sonames.ok()) {
Orion Hodson9b16e342019-10-09 13:29:16 +0100211 return "";
212 }
213 return android::base::Join(*sonames, ':');
214}
215
Justin Yun0cc40272019-12-16 16:47:40 +0900216// read /system/etc/public.libraries-<companyname>.txt,
217// /system_ext/etc/public.libraries-<companyname>.txt and
Orion Hodson9b16e342019-10-09 13:29:16 +0100218// /product/etc/public.libraries-<companyname>.txt which contain partner defined
219// system libs that are exposed to apps. The libs in the txt files must be
220// named as lib<name>.<companyname>.so.
221static std::string InitExtendedPublicLibraries() {
222 std::vector<std::string> sonames;
223 ReadExtensionLibraries("/system/etc", &sonames);
Justin Yun0cc40272019-12-16 16:47:40 +0900224 ReadExtensionLibraries("/system_ext/etc", &sonames);
Orion Hodson9b16e342019-10-09 13:29:16 +0100225 ReadExtensionLibraries("/product/etc", &sonames);
226 return android::base::Join(sonames, ':');
227}
228
Justin Yun089c1352020-02-06 16:53:08 +0900229static std::string InitLlndkLibrariesVendor() {
Orion Hodson9b16e342019-10-09 13:29:16 +0100230 std::string config_file = kLlndkLibrariesFile;
Justin Yun089c1352020-02-06 16:53:08 +0900231 InsertVndkVersionStr(&config_file, false);
232 auto sonames = ReadConfig(config_file, always_true);
Bernie Innocentic1375632020-02-13 10:37:03 +0900233 if (!sonames.ok()) {
Jooyung Han26f7d102020-02-22 23:39:23 +0900234 LOG_ALWAYS_FATAL("%s: %s", config_file.c_str(), sonames.error().message().c_str());
Justin Yun089c1352020-02-06 16:53:08 +0900235 return "";
236 }
237 return android::base::Join(*sonames, ':');
238}
239
240static std::string InitLlndkLibrariesProduct() {
Justin Yun696882f2020-03-24 13:31:19 +0900241 if (!is_product_vndk_version_defined()) {
242 return "";
243 }
Justin Yun089c1352020-02-06 16:53:08 +0900244 std::string config_file = kLlndkLibrariesFile;
245 InsertVndkVersionStr(&config_file, true);
Orion Hodson9b16e342019-10-09 13:29:16 +0100246 auto sonames = ReadConfig(config_file, always_true);
Bernie Innocenti4bd58952020-02-06 15:43:57 +0900247 if (!sonames.ok()) {
Jooyung Han26f7d102020-02-22 23:39:23 +0900248 LOG_ALWAYS_FATAL("%s: %s", config_file.c_str(), sonames.error().message().c_str());
Orion Hodson9b16e342019-10-09 13:29:16 +0100249 return "";
250 }
251 return android::base::Join(*sonames, ':');
252}
253
Justin Yuneb4f08c2020-02-18 11:29:07 +0900254static std::string InitVndkspLibrariesVendor() {
Orion Hodson9b16e342019-10-09 13:29:16 +0100255 std::string config_file = kVndkLibrariesFile;
Justin Yun089c1352020-02-06 16:53:08 +0900256 InsertVndkVersionStr(&config_file, false);
Orion Hodson9b16e342019-10-09 13:29:16 +0100257 auto sonames = ReadConfig(config_file, always_true);
Bernie Innocenti4bd58952020-02-06 15:43:57 +0900258 if (!sonames.ok()) {
Orion Hodson9b16e342019-10-09 13:29:16 +0100259 LOG_ALWAYS_FATAL("%s", sonames.error().message().c_str());
260 return "";
261 }
262 return android::base::Join(*sonames, ':');
263}
264
Justin Yuneb4f08c2020-02-18 11:29:07 +0900265static std::string InitVndkspLibrariesProduct() {
Justin Yun696882f2020-03-24 13:31:19 +0900266 if (!is_product_vndk_version_defined()) {
267 return "";
268 }
Justin Yuneb4f08c2020-02-18 11:29:07 +0900269 std::string config_file = kVndkLibrariesFile;
270 InsertVndkVersionStr(&config_file, true);
271 auto sonames = ReadConfig(config_file, always_true);
272 if (!sonames.ok()) {
273 LOG_ALWAYS_FATAL("%s", sonames.error().message().c_str());
274 return "";
275 }
276 return android::base::Join(*sonames, ':');
277}
278
Jeffrey Huang52575032020-02-11 17:33:45 -0800279static std::string InitStatsdPublicLibraries() {
280 return kStatsdApexPublicLibrary;
281}
282
Jooyung Hancd616d02020-09-01 14:53:23 +0900283static std::map<std::string, std::string> InitApexLibraries(const std::string& tag) {
Jooyung Han538f99a2020-03-03 00:46:50 +0900284 std::string file_content;
Jooyung Hancd616d02020-09-01 14:53:23 +0900285 if (!base::ReadFileToString(kApexLibrariesConfigFile, &file_content)) {
286 // config is optional
Jooyung Han538f99a2020-03-03 00:46:50 +0900287 return {};
288 }
Jooyung Hancd616d02020-09-01 14:53:23 +0900289 auto config = ParseApexLibrariesConfig(file_content, tag);
Jooyung Han538f99a2020-03-03 00:46:50 +0900290 if (!config.ok()) {
Jooyung Hancd616d02020-09-01 14:53:23 +0900291 LOG_ALWAYS_FATAL("%s: %s", kApexLibrariesConfigFile, config.error().message().c_str());
Jooyung Han538f99a2020-03-03 00:46:50 +0900292 return {};
293 }
294 return *config;
295}
296
Jooyung Hancd616d02020-09-01 14:53:23 +0900297struct ApexLibrariesConfigLine {
298 std::string tag;
299 std::string apex_namespace;
300 std::string library_list;
301};
302
303const std::regex kApexNamespaceRegex("[0-9a-zA-Z_]+");
304const std::regex kLibraryListRegex("[0-9a-zA-Z.:@+_-]+");
305
306Result<ApexLibrariesConfigLine> ParseApexLibrariesConfigLine(const std::string& line) {
307 std::vector<std::string> tokens = base::Split(line, " ");
308 if (tokens.size() != 3) {
309 return Errorf("Malformed line \"{}\"", line);
310 }
311 if (tokens[0] != "jni" && tokens[0] != "public") {
312 return Errorf("Invalid tag \"{}\"", line);
313 }
314 if (!std::regex_match(tokens[1], kApexNamespaceRegex)) {
315 return Errorf("Invalid apex_namespace \"{}\"", line);
316 }
317 if (!std::regex_match(tokens[2], kLibraryListRegex)) {
318 return Errorf("Invalid library_list \"{}\"", line);
319 }
320 return ApexLibrariesConfigLine{std::move(tokens[0]), std::move(tokens[1]), std::move(tokens[2])};
321}
322
Orion Hodson9b16e342019-10-09 13:29:16 +0100323} // namespace
324
325const std::string& preloadable_public_libraries() {
326 static std::string list = InitDefaultPublicLibraries(/*for_preload*/ true);
327 return list;
328}
329
330const std::string& default_public_libraries() {
331 static std::string list = InitDefaultPublicLibraries(/*for_preload*/ false);
332 return list;
333}
334
Orion Hodson9b16e342019-10-09 13:29:16 +0100335const std::string& vendor_public_libraries() {
336 static std::string list = InitVendorPublicLibraries();
337 return list;
338}
339
340const std::string& extended_public_libraries() {
341 static std::string list = InitExtendedPublicLibraries();
342 return list;
343}
344
Jeffrey Huang52575032020-02-11 17:33:45 -0800345const std::string& statsd_public_libraries() {
346 static std::string list = InitStatsdPublicLibraries();
347 return list;
348}
349
Justin Yun089c1352020-02-06 16:53:08 +0900350const std::string& llndk_libraries_product() {
351 static std::string list = InitLlndkLibrariesProduct();
352 return list;
353}
354
355const std::string& llndk_libraries_vendor() {
356 static std::string list = InitLlndkLibrariesVendor();
Orion Hodson9b16e342019-10-09 13:29:16 +0100357 return list;
358}
359
Justin Yuneb4f08c2020-02-18 11:29:07 +0900360const std::string& vndksp_libraries_product() {
361 static std::string list = InitVndkspLibrariesProduct();
362 return list;
363}
364
365const std::string& vndksp_libraries_vendor() {
366 static std::string list = InitVndkspLibrariesVendor();
Orion Hodson9b16e342019-10-09 13:29:16 +0100367 return list;
368}
369
Jooyung Han538f99a2020-03-03 00:46:50 +0900370const std::string& apex_jni_libraries(const std::string& apex_ns_name) {
Jooyung Hancd616d02020-09-01 14:53:23 +0900371 static std::map<std::string, std::string> jni_libraries = InitApexLibraries("jni");
Jooyung Han538f99a2020-03-03 00:46:50 +0900372 return jni_libraries[apex_ns_name];
373}
374
Jooyung Hancd616d02020-09-01 14:53:23 +0900375const std::map<std::string, std::string>& apex_public_libraries() {
376 static std::map<std::string, std::string> public_libraries = InitApexLibraries("public");
377 return public_libraries;
378}
379
Justin Yun3db26d52019-12-16 14:09:39 +0900380bool is_product_vndk_version_defined() {
Nicolas Geoffray7ca8b672020-04-24 15:43:48 +0100381#if defined(ART_TARGET_ANDROID)
Justin Yun3db26d52019-12-16 14:09:39 +0900382 return android::sysprop::VndkProperties::product_vndk_version().has_value();
383#else
384 return false;
385#endif
386}
387
Justin Yun089c1352020-02-06 16:53:08 +0900388std::string get_vndk_version(bool is_product_vndk) {
Nicolas Geoffray7ca8b672020-04-24 15:43:48 +0100389#if defined(ART_TARGET_ANDROID)
Justin Yun089c1352020-02-06 16:53:08 +0900390 if (is_product_vndk) {
391 return android::sysprop::VndkProperties::product_vndk_version().value_or("");
392 }
393 return android::sysprop::VndkProperties::vendor_vndk_version().value_or("");
394#else
395 if (is_product_vndk) {
396 return android::base::GetProperty("ro.product.vndk.version", "");
397 }
398 return android::base::GetProperty("ro.vndk.version", "");
399#endif
400}
401
Orion Hodson9b16e342019-10-09 13:29:16 +0100402namespace internal {
403// Exported for testing
404Result<std::vector<std::string>> ParseConfig(
405 const std::string& file_content,
406 const std::function<Result<bool>(const ConfigEntry& /* entry */)>& filter_fn) {
407 std::vector<std::string> lines = base::Split(file_content, "\n");
408
409 std::vector<std::string> sonames;
410 for (auto& line : lines) {
411 auto trimmed_line = base::Trim(line);
412 if (trimmed_line[0] == '#' || trimmed_line.empty()) {
413 continue;
414 }
415
416 std::vector<std::string> tokens = android::base::Split(trimmed_line, " ");
417 if (tokens.size() < 1 || tokens.size() > 3) {
418 return Errorf("Malformed line \"{}\"", line);
419 }
420 struct ConfigEntry entry = {.soname = "", .nopreload = false, .bitness = ALL};
421 size_t i = tokens.size();
422 while (i-- > 0) {
423 if (tokens[i] == "nopreload") {
424 entry.nopreload = true;
425 } else if (tokens[i] == "32" || tokens[i] == "64") {
426 if (entry.bitness != ALL) {
427 return Errorf("Malformed line \"{}\": bitness can be specified only once", line);
428 }
429 entry.bitness = tokens[i] == "32" ? ONLY_32 : ONLY_64;
430 } else {
431 if (i != 0) {
432 return Errorf("Malformed line \"{}\"", line);
433 }
434 entry.soname = tokens[i];
435 }
436 }
437
438 // skip 32-bit lib on 64-bit process and vice versa
439#if defined(__LP64__)
440 if (entry.bitness == ONLY_32) continue;
441#else
442 if (entry.bitness == ONLY_64) continue;
443#endif
444
445 Result<bool> ret = filter_fn(entry);
Bernie Innocenti4bd58952020-02-06 15:43:57 +0900446 if (!ret.ok()) {
Orion Hodson9b16e342019-10-09 13:29:16 +0100447 return ret.error();
448 }
449 if (*ret) {
450 // filter_fn has returned true.
451 sonames.push_back(entry.soname);
452 }
453 }
454 return sonames;
455}
456
Jooyung Hancd616d02020-09-01 14:53:23 +0900457// Parses apex.libraries.config.txt file generated by linkerconfig which looks like
458// system/linkerconfig/testdata/golden_output/stages/apex.libraries.config.txt
459// and returns mapping of <apex namespace> to <library list> which matches <tag>.
460//
461// The file is line-based and each line consists of "<tag> <apex namespace> <library list>".
462//
463// <tag> explains what <library list> is. (e.g "jni", "public")
464// <library list> is colon-separated list of library names. (e.g "libfoo.so:libbar.so")
465//
466// If <tag> is "jni", <library list> is the list of JNI libraries exposed by <apex namespace>.
467// If <tag> is "public", <library list> is the list of public libraries exposed by <apex namespace>.
468// Public libraries are the libs listed in /system/etc/public.libraries.txt.
469Result<std::map<std::string, std::string>> ParseApexLibrariesConfig(const std::string& file_content, const std::string& tag) {
Jooyung Han538f99a2020-03-03 00:46:50 +0900470 std::map<std::string, std::string> entries;
471 std::vector<std::string> lines = base::Split(file_content, "\n");
472 for (auto& line : lines) {
473 auto trimmed_line = base::Trim(line);
474 if (trimmed_line[0] == '#' || trimmed_line.empty()) {
475 continue;
476 }
Jooyung Hancd616d02020-09-01 14:53:23 +0900477 auto config_line = ParseApexLibrariesConfigLine(trimmed_line);
478 if (!config_line.ok()) {
479 return config_line.error();
Jooyung Han538f99a2020-03-03 00:46:50 +0900480 }
Jooyung Hancd616d02020-09-01 14:53:23 +0900481 if (config_line->tag != tag) {
482 continue;
483 }
484 entries[config_line->apex_namespace] = config_line->library_list;
485 }
486
487 // TODO(b/167578583) remove this `if` block after fixing the bug
488 if (tag == "public") {
489 std::string additional_libs = additional_public_libraries();
490 if (!additional_libs.empty()) {
491 entries["com_android_art"] += ':' + additional_libs;
492 }
Jooyung Han538f99a2020-03-03 00:46:50 +0900493 }
494 return entries;
495}
496
Orion Hodson9b16e342019-10-09 13:29:16 +0100497} // namespace internal
498
499} // namespace android::nativeloader