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 #pragma once 17 18 #include <algorithm> 19 #include <map> 20 #include <string> 21 #include <vector> 22 23 #include <android-base/result.h> 24 25 namespace android { 26 namespace linkerconfig { 27 namespace modules { 28 struct ApexInfo { 29 std::string name; 30 std::string namespace_name; 31 std::string path; 32 std::string partition; 33 std::vector<std::string> provide_libs; 34 std::vector<std::string> require_libs; 35 std::vector<std::string> jni_libs; 36 std::vector<std::string> permitted_paths; 37 std::vector<std::string> public_libs; 38 bool has_bin; 39 bool has_lib; 40 bool visible; 41 bool has_shared_lib; 42 43 ApexInfo() = default; // for std::map::operator[] ApexInfoApexInfo44 ApexInfo(std::string name, std::string path, 45 std::vector<std::string> provide_libs, 46 std::vector<std::string> require_libs, 47 std::vector<std::string> jni_libs, 48 std::vector<std::string> permitted_paths, bool has_bin, bool has_lib, 49 bool visible, bool has_shared_lib) 50 : name(std::move(name)), 51 path(std::move(path)), 52 provide_libs(std::move(provide_libs)), 53 require_libs(std::move(require_libs)), 54 jni_libs(std::move(jni_libs)), 55 permitted_paths(std::move(permitted_paths)), 56 has_bin(has_bin), 57 has_lib(has_lib), 58 visible(visible), 59 has_shared_lib(has_shared_lib) { 60 this->namespace_name = this->name; 61 std::replace( 62 this->namespace_name.begin(), this->namespace_name.end(), '.', '_'); 63 } 64 65 bool InSystem() const; 66 bool InProduct() const; 67 bool InVendor() const; 68 }; 69 70 android::base::Result<std::map<std::string, ApexInfo>> ScanActiveApexes( 71 const std::string& root); 72 } // namespace modules 73 } // namespace linkerconfig 74 } // namespace android 75