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 // This namespace is exclusively for Renderscript internal libraries. This 18 // namespace has slightly looser restriction than the vndk namespace because of 19 // the genuine characteristics of Renderscript; /data is in the permitted path 20 // to load the compiled *.so file and libmediandk.so can be used here. 21 22 #include "linkerconfig/namespacebuilder.h" 23 24 using android::linkerconfig::modules::Namespace; 25 26 namespace android { 27 namespace linkerconfig { 28 namespace contents { BuildRsNamespace(const Context & ctx)29Namespace BuildRsNamespace([[maybe_unused]] const Context& ctx) { 30 Namespace ns( 31 "rs", /*is_isolated=*/!ctx.IsUnrestrictedSection(), /*is_visible=*/true); 32 33 ns.AddSearchPath("/odm/${LIB}/vndk-sp"); 34 ns.AddSearchPath("/vendor/${LIB}/vndk-sp"); 35 ns.AddSearchPath("/apex/com.android.vndk.v" + Var("VENDOR_VNDK_VERSION") + 36 "/${LIB}"); 37 ns.AddSearchPath("/odm/${LIB}"); 38 ns.AddSearchPath("/vendor/${LIB}"); 39 40 ns.AddPermittedPath("/odm/${LIB}"); 41 ns.AddPermittedPath("/vendor/${LIB}"); 42 ns.AddPermittedPath("/system/vendor/${LIB}"); 43 ns.AddPermittedPath("/data"); 44 45 // Private LLNDK libs (e.g. libft2.so) are exceptionally allowed to this 46 // namespace because RS framework libs are using them. 47 ns.GetLink(ctx.GetSystemNamespaceName()) 48 .AddSharedLib({Var("LLNDK_LIBRARIES_VENDOR"), 49 Var("PRIVATE_LLNDK_LIBRARIES_VENDOR", "")}); 50 51 ns.AddRequires(std::vector{"libneuralnetworks.so"}); 52 53 return ns; 54 } 55 } // namespace contents 56 } // namespace linkerconfig 57 } // namespace android 58