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/basecontext.h"
18 
19 namespace android {
20 namespace linkerconfig {
21 namespace modules {
BaseContext()22 BaseContext::BaseContext() : strict_(false) {
23 }
24 
AddApexModule(ApexInfo apex_module)25 void BaseContext::AddApexModule(ApexInfo apex_module) {
26   apex_modules_.push_back(std::move(apex_module));
27 }
28 
GetApexModules() const29 const std::vector<ApexInfo>& BaseContext::GetApexModules() const {
30   return apex_modules_;
31 }
32 
SetStrictMode(bool strict)33 void BaseContext::SetStrictMode(bool strict) {
34   strict_ = strict;
35 }
36 
IsStrictMode() const37 bool BaseContext::IsStrictMode() const {
38   return strict_;
39 }
40 
BuildApexNamespace(const ApexInfo & apex_info,bool visible) const41 Namespace BaseContext::BuildApexNamespace(const ApexInfo& apex_info,
42                                           bool visible) const {
43   Namespace ns(apex_info.namespace_name,
44                /*is_isolated=*/true,
45                visible);
46   InitializeWithApex(ns, apex_info);
47   return ns;
48 }
49 
50 }  // namespace modules
51 }  // namespace linkerconfig
52 }  // namespace android
53