Jiyong Park | 40a6077 | 2019-05-03 16:21:31 +0900 | [diff] [blame] | 1 | /* |
| 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 | #pragma once |
| 17 | |
Jiyong Park | 5db5d19 | 2019-07-22 20:29:08 +0900 | [diff] [blame] | 18 | #include <algorithm> |
Jiyong Park | 40a6077 | 2019-05-03 16:21:31 +0900 | [diff] [blame] | 19 | #include <string> |
| 20 | |
Jiyong Park | 5db5d19 | 2019-07-22 20:29:08 +0900 | [diff] [blame] | 21 | #include <android-base/result.h> |
| 22 | |
Jiyong Park | 40a6077 | 2019-05-03 16:21:31 +0900 | [diff] [blame] | 23 | namespace android::nativeloader { |
| 24 | |
Jiyong Park | 5db5d19 | 2019-07-22 20:29:08 +0900 | [diff] [blame] | 25 | using android::base::Result; |
| 26 | |
Jiyong Park | 40a6077 | 2019-05-03 16:21:31 +0900 | [diff] [blame] | 27 | // These provide the list of libraries that are available to the namespace for apps. |
| 28 | // Not all of the libraries are available to apps. Depending on the context, |
| 29 | // e.g., if it is a vendor app or not, different set of libraries are made available. |
Jiyong Park | 5db5d19 | 2019-07-22 20:29:08 +0900 | [diff] [blame] | 30 | const std::string& preloadable_public_libraries(); |
Jiyong Park | 5b8b306 | 2019-05-03 18:11:49 +0900 | [diff] [blame] | 31 | const std::string& default_public_libraries(); |
Jiyong Park | 40a6077 | 2019-05-03 16:21:31 +0900 | [diff] [blame] | 32 | const std::string& runtime_public_libraries(); |
| 33 | const std::string& vendor_public_libraries(); |
Jiyong Park | 5b8b306 | 2019-05-03 18:11:49 +0900 | [diff] [blame] | 34 | const std::string& extended_public_libraries(); |
Przemyslaw Szczepaniak | 0bb871d | 2019-07-10 12:08:57 +0100 | [diff] [blame] | 35 | const std::string& neuralnetworks_public_libraries(); |
Jiyong Park | 5b8b306 | 2019-05-03 18:11:49 +0900 | [diff] [blame] | 36 | const std::string& llndk_libraries(); |
| 37 | const std::string& vndksp_libraries(); |
Jiyong Park | 40a6077 | 2019-05-03 16:21:31 +0900 | [diff] [blame] | 38 | |
Jiyong Park | 5db5d19 | 2019-07-22 20:29:08 +0900 | [diff] [blame] | 39 | // These are exported for testing |
| 40 | namespace internal { |
| 41 | |
| 42 | enum Bitness { ALL = 0, ONLY_32, ONLY_64 }; |
| 43 | |
| 44 | struct ConfigEntry { |
| 45 | std::string soname; |
| 46 | bool nopreload; |
| 47 | Bitness bitness; |
| 48 | }; |
| 49 | |
| 50 | Result<std::vector<std::string>> ParseConfig( |
| 51 | const std::string& file_content, |
| 52 | const std::function<Result<bool>(const ConfigEntry& /* entry */)>& filter_fn); |
| 53 | |
| 54 | } // namespace internal |
| 55 | |
| 56 | } // namespace android::nativeloader |