• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include <android-base/strings.h>
25 
26 using android::linkerconfig::modules::Namespace;
27 
28 namespace android {
29 namespace linkerconfig {
30 namespace contents {
BuildRsNamespace(const Context & ctx)31 Namespace BuildRsNamespace([[maybe_unused]] const Context& ctx) {
32   Namespace ns(
33       "rs", /*is_isolated=*/!ctx.IsUnrestrictedSection(), /*is_visible=*/true);
34 
35   ns.AddSearchPath("/odm/${LIB}/vndk-sp");
36   ns.AddSearchPath("/vendor/${LIB}/vndk-sp");
37   ns.AddSearchPath("/apex/com.android.vndk.v" + Var("VENDOR_VNDK_VERSION") +
38                    "/${LIB}");
39   ns.AddSearchPath("/odm/${LIB}");
40   ns.AddSearchPath("/vendor/${LIB}");
41 
42   ns.AddPermittedPath("/odm/${LIB}");
43   ns.AddPermittedPath("/vendor/${LIB}");
44   ns.AddPermittedPath("/system/vendor/${LIB}");
45   ns.AddPermittedPath("/data");
46 
47   AddLlndkLibraries(ctx, &ns, VndkUserPartition::Vendor);
48   // Private LLNDK libs (e.g. libft2.so) are exceptionally allowed to this
49   // namespace because RS framework libs are using them.
50   ns.GetLink(ctx.GetSystemNamespaceName())
51       .AddSharedLib(Var("PRIVATE_LLNDK_LIBRARIES_VENDOR", ""));
52 
53   return ns;
54 }
55 }  // namespace contents
56 }  // namespace linkerconfig
57 }  // namespace android
58