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 17 #ifndef ART_LIBNATIVELOADER_PUBLIC_LIBRARIES_H_ 18 #define ART_LIBNATIVELOADER_PUBLIC_LIBRARIES_H_ 19 20 #include <algorithm> 21 #include <string> 22 23 #include <android-base/result.h> 24 25 namespace android::nativeloader { 26 27 using 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. 32 const std::string& preloadable_public_libraries(); 33 const std::string& default_public_libraries(); 34 const std::string& art_public_libraries(); 35 const std::string& statsd_public_libraries(); 36 const std::string& vendor_public_libraries(); 37 const std::string& extended_public_libraries(); 38 const std::string& neuralnetworks_public_libraries(); 39 const std::string& llndk_libraries_product(); 40 const std::string& llndk_libraries_vendor(); 41 const std::string& vndksp_libraries_product(); 42 const std::string& vndksp_libraries_vendor(); 43 44 // Returns true if libnativeloader is running on devices and the device has 45 // ro.product.vndk.version property. It returns false for host. 46 bool is_product_vndk_version_defined(); 47 48 std::string get_vndk_version(bool is_product_vndk); 49 50 // These are exported for testing 51 namespace internal { 52 53 enum Bitness { ALL = 0, ONLY_32, ONLY_64 }; 54 55 struct ConfigEntry { 56 std::string soname; 57 bool nopreload; 58 Bitness bitness; 59 }; 60 61 Result<std::vector<std::string>> ParseConfig( 62 const std::string& file_content, 63 const std::function<Result<bool>(const ConfigEntry& /* entry */)>& filter_fn); 64 65 } // namespace internal 66 67 } // namespace android::nativeloader 68 69 #endif // ART_LIBNATIVELOADER_PUBLIC_LIBRARIES_H_ 70