blob: 4d34e3606f0b62701200ee3a8d6a84449735e447 [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 */
Orion Hodson31b3ffa2019-10-14 10:27:00 +010016
17#ifndef ART_LIBNATIVELOADER_PUBLIC_LIBRARIES_H_
18#define ART_LIBNATIVELOADER_PUBLIC_LIBRARIES_H_
Orion Hodson9b16e342019-10-09 13:29:16 +010019
20#include <algorithm>
21#include <string>
22
23#include <android-base/result.h>
24
25namespace android::nativeloader {
26
27using android::base::Result;
28
29// These provide the list of libraries that are available to the namespace for apps.
30// Not all of the libraries are available to apps. Depending on the context,
31// e.g., if it is a vendor app or not, different set of libraries are made available.
32const std::string& preloadable_public_libraries();
33const std::string& default_public_libraries();
34const std::string& art_public_libraries();
Luke Huang5c017722019-12-17 10:54:26 +080035const std::string& cronet_public_libraries();
Orion Hodson9b16e342019-10-09 13:29:16 +010036const std::string& vendor_public_libraries();
37const std::string& extended_public_libraries();
38const std::string& neuralnetworks_public_libraries();
39const std::string& llndk_libraries();
40const std::string& vndksp_libraries();
41
Justin Yun3db26d52019-12-16 14:09:39 +090042// Returns true if libnativeloader is running on devices and the device has
43// ro.product.vndk.version property. It returns falso for host.
44bool is_product_vndk_version_defined();
45
Orion Hodson9b16e342019-10-09 13:29:16 +010046// These are exported for testing
47namespace internal {
48
49enum Bitness { ALL = 0, ONLY_32, ONLY_64 };
50
51struct ConfigEntry {
52 std::string soname;
53 bool nopreload;
54 Bitness bitness;
55};
56
57Result<std::vector<std::string>> ParseConfig(
58 const std::string& file_content,
59 const std::function<Result<bool>(const ConfigEntry& /* entry */)>& filter_fn);
60
61} // namespace internal
62
63} // namespace android::nativeloader
Orion Hodson31b3ffa2019-10-14 10:27:00 +010064
65#endif // ART_LIBNATIVELOADER_PUBLIC_LIBRARIES_H_