1 /* 2 * Copyright (C) 2020 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 #include "linkerconfig/sectionbuilder.h" 18 19 #include "linkerconfig/context.h" 20 #include "linkerconfig/namespace.h" 21 #include "linkerconfig/namespacebuilder.h" 22 #include "linkerconfig/section.h" 23 24 using android::linkerconfig::contents::SectionType; 25 using android::linkerconfig::modules::Namespace; 26 using android::linkerconfig::modules::Section; 27 28 namespace android { 29 namespace linkerconfig { 30 namespace contents { BuildIsolatedSection(Context & ctx)31Section BuildIsolatedSection(Context& ctx) { 32 ctx.SetCurrentSection(SectionType::Other); 33 std::vector<Namespace> namespaces; 34 35 namespaces.emplace_back(BuildIsolatedDefaultNamespace(ctx)); 36 namespaces.emplace_back(BuildSystemNamespace(ctx)); 37 38 std::set<std::string> visible_apexes; 39 40 // APEXes with JNI libs or public libs should be visible 41 for (const auto& apex : ctx.GetApexModules()) { 42 if (apex.jni_libs.size() > 0 || apex.public_libs.size() > 0) { 43 visible_apexes.insert(apex.name); 44 } 45 } 46 47 return BuildSection(ctx, "isolated", std::move(namespaces), visible_apexes); 48 } 49 } // namespace contents 50 } // namespace linkerconfig 51 } // namespace android 52