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 where system libs (VNDK and LLNDK libs) are loaded for a
18 // vendor process.
19 
20 #include "linkerconfig/common.h"
21 #include "linkerconfig/environment.h"
22 #include "linkerconfig/namespacebuilder.h"
23 
24 using android::linkerconfig::modules::AsanPath;
25 using android::linkerconfig::modules::IsProductVndkVersionDefined;
26 using android::linkerconfig::modules::Namespace;
27 
28 namespace android {
29 namespace linkerconfig {
30 namespace contents {
31 Namespace BuildSystemNamespace([[maybe_unused]] const Context& ctx) {
32   Namespace ns("system", /*is_isolated=*/false, /*is_visible=*/false);
33   ns.AddSearchPath("/system/${LIB}", AsanPath::WITH_DATA_ASAN);
34   ns.AddSearchPath(Var("SYSTEM_EXT") + "/${LIB}", AsanPath::WITH_DATA_ASAN);
35   if (!IsProductVndkVersionDefined()) {
36     ns.AddSearchPath(Var("PRODUCT") + "/${LIB}", AsanPath::WITH_DATA_ASAN);
37   }
38 
39   ns.AddRequires(std::vector{"libdexfile_external.so",
40                              "libdexfiled_external.so",
41                              "libnativebridge.so",
42                              "libnativehelper.so",
43                              "libnativeloader.so",
44                              "libandroidicu.so",
45                              // TODO(b/120786417 or b/134659294): libicuuc.so
46                              // and libicui18n.so are kept for app compat.
47                              "libicui18n.so",
48                              "libicuuc.so"});
49 
50   ns.AddProvides(GetSystemStubLibraries());
51   return ns;
52 }
53 }  // namespace contents
54 }  // namespace linkerconfig
55 }  // namespace android
56