using android::linkerconfig::modules::Section;
namespace {
-
-// Don't change the order here. The first pattern that matches with the
-// absolute path of an executable is selected.
-const std::vector<DirToSection> kDirToSection = {
- {"/system/bin/", "system"},
- {"/system/xbin/", "system"},
- {"/@{SYSTEM_EXT:system_ext}/bin/", "system"},
- {"/@{PRODUCT:product}/bin/", "system"},
-
- {"/odm/bin/", "vendor"},
- {"/vendor/bin/", "vendor"},
- {"/data/nativetest/odm", "vendor"},
- {"/data/nativetest64/odm", "vendor"},
- {"/data/benchmarktest/odm", "vendor"},
- {"/data/benchmarktest64/odm", "vendor"},
- {"/data/nativetest/vendor", "vendor"},
- {"/data/nativetest64/vendor", "vendor"},
- {"/data/benchmarktest/vendor", "vendor"},
- {"/data/benchmarktest64/vendor", "vendor"},
-
- {"/data/nativetest/unrestricted", "unrestricted"},
- {"/data/nativetest64/unrestricted", "unrestricted"},
-
- // TODO(b/123864775): Ensure tests are run from /data/nativetest{,64} or (if
- // necessary) the unrestricted subdirs above. Then clean this up.
- {"/data/local/tmp", "unrestricted"},
-
- {"/postinstall", "postinstall"},
- // Fallback entry to provide APEX namespace lookups for binaries anywhere
- // else. This must be last.
- {"/data", "system"},
-};
-
+void redirect_section(std::vector<DirToSection>& dirToSection,
+ const std::string& from, const std::string& to) {
+ for (auto& [key, val] : dirToSection) {
+ if (val == from) {
+ val = to;
+ }
+ }
+}
} // namespace
namespace android {
current_context.SetCurrentLinkerConfigType(LinkerConfigType::Vndklite);
}
+ // Don't change the order here. The first pattern that matches with the
+ // absolute path of an executable is selected.
+ std::vector<DirToSection> dirToSection = {
+ {"/system/bin/", "system"},
+ {"/system/xbin/", "system"},
+ {"/@{SYSTEM_EXT:system_ext}/bin/", "system"},
+
+ // Processes from the product partition will have a separate section if
+ // PRODUCT_PRODUCT_VNDK_VERSION is defined. Otherwise, they are run from
+ // the "system" section.
+ {"/@{PRODUCT:product}/bin/", "product"},
+
+ {"/odm/bin/", "vendor"},
+ {"/vendor/bin/", "vendor"},
+ {"/data/nativetest/odm", "vendor"},
+ {"/data/nativetest64/odm", "vendor"},
+ {"/data/benchmarktest/odm", "vendor"},
+ {"/data/benchmarktest64/odm", "vendor"},
+ {"/data/nativetest/vendor", "vendor"},
+ {"/data/nativetest64/vendor", "vendor"},
+ {"/data/benchmarktest/vendor", "vendor"},
+ {"/data/benchmarktest64/vendor", "vendor"},
+
+ {"/data/nativetest/unrestricted", "unrestricted"},
+ {"/data/nativetest64/unrestricted", "unrestricted"},
+
+ // TODO(b/123864775): Ensure tests are run from /data/nativetest{,64} or
+ // (if necessary) the unrestricted subdirs above. Then clean this up.
+ {"/data/local/tmp", "unrestricted"},
+
+ {"/postinstall", "postinstall"},
+ // Fallback entry to provide APEX namespace lookups for binaries anywhere
+ // else. This must be last.
+ {"/data", "system"},
+ };
+
sections.emplace_back(BuildSystemSection(current_context));
sections.emplace_back(BuildVendorSection(current_context));
+ if (android::linkerconfig::modules::IsProductVndkVersionDefined() &&
+ !android::linkerconfig::modules::IsVndkLiteDevice()) {
+ sections.emplace_back(BuildProductSection(current_context));
+ } else {
+ redirect_section(dirToSection, "product", "system");
+ }
+
sections.emplace_back(BuildUnrestrictedSection(current_context));
sections.emplace_back(BuildPostInstallSection(current_context));
return android::linkerconfig::modules::Configuration(std::move(sections),
- kDirToSection);
+ dirToSection);
}
} // namespace contents
} // namespace linkerconfig
return current_section == SectionType::Vendor;
}
+bool Context::IsProductSection() const {
+ return current_section == SectionType::Product;
+}
+
bool Context::IsDefaultConfig() const {
return current_linkerconfig_type == LinkerConfigType::Default;
}
}
std::string Context::GetSystemNamespaceName() const {
- return IsVendorSection() && !IsVndkliteConfig() ? "system" : "default";
+ return (IsVendorSection() || IsProductSection()) && !IsVndkliteConfig()
+ ? "system"
+ : "default";
}
void Context::SetCurrentLinkerConfigType(LinkerConfigType config_type) {
enum class SectionType {
System,
Vendor,
+ Product,
Other,
};
}
bool IsSystemSection() const;
bool IsVendorSection() const;
+ bool IsProductSection() const;
bool IsDefaultConfig() const;
bool IsLegacyConfig() const;
NamespaceBuilder BuildVendorDefaultNamespace;
NamespaceBuilder BuildSystemNamespace;
NamespaceBuilder BuildVndkInSystemNamespace;
+NamespaceBuilder BuildProductDefaultNamespace;
NamespaceBuilder BuildUnrestrictedDefaultNamespace;
NamespaceBuilder BuildPostInstallNamespace;
NamespaceBuilder BuildNeuralNetworksNamespace;
namespace contents {
SectionBuilder BuildSystemSection;
SectionBuilder BuildVendorSection;
+SectionBuilder BuildProductSection;
SectionBuilder BuildUnrestrictedSection;
SectionBuilder BuildLegacySection;
SectionBuilder BuildPostInstallSection;
SectionBuilder BuildRecoverySection;
} // namespace contents
} // namespace linkerconfig
-} // namespace android
\ No newline at end of file
+} // namespace android
"libmediandk.so",
"libvndksupport.so"};
-const std::vector<std::string> kLibsFromDefault = {"@{LLNDK_LIBRARIES}",
+const std::vector<std::string> kLibsFromDefault = {"@{LLNDK_LIBRARIES_VENDOR}",
"libbinder_ndk.so",
"libmediametrics.so"};
--- /dev/null
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// This is the default linker namespace for a vendor process (a process started
+// from /vendor/bin/*).
+
+#include "linkerconfig/environment.h"
+#include "linkerconfig/namespacebuilder.h"
+
+using android::linkerconfig::modules::AsanPath;
+using android::linkerconfig::modules::Namespace;
+
+namespace android {
+namespace linkerconfig {
+namespace contents {
+Namespace BuildProductDefaultNamespace([[maybe_unused]] const Context& ctx) {
+ Namespace ns("default", /*is_isolated=*/true, /*is_visible=*/true);
+
+ ns.AddSearchPath("/@{PRODUCT:product}/${LIB}", AsanPath::WITH_DATA_ASAN);
+ ns.AddPermittedPath("/@{PRODUCT:product}", AsanPath::WITH_DATA_ASAN);
+
+ ns.GetLink(ctx.GetSystemNamespaceName())
+ .AddSharedLib("@{LLNDK_LIBRARIES_PRODUCT}");
+ ns.GetLink("vndk").AddSharedLib({"@{VNDK_SAMEPROCESS_LIBRARIES_PRODUCT}",
+ "@{VNDK_CORE_LIBRARIES_PRODUCT}"});
+ if (android::linkerconfig::modules::IsVndkInSystemNamespace()) {
+ ns.GetLink("vndk_in_system")
+ .AddSharedLib("@{VNDK_USING_CORE_VARIANT_LIBRARIES}");
+ }
+ ns.GetLink("neuralnetworks").AddSharedLib("libneuralnetworks.so");
+
+ return ns;
+}
+} // namespace contents
+} // namespace linkerconfig
+} // namespace android
ns.AddSearchPath("/odm/${LIB}/vndk-sp", AsanPath::WITH_DATA_ASAN);
ns.AddSearchPath("/vendor/${LIB}/vndk-sp", AsanPath::WITH_DATA_ASAN);
- ns.AddSearchPath("/apex/com.android.vndk.v@{VNDK_VER}/${LIB}",
+ ns.AddSearchPath("/apex/com.android.vndk.v@{VENDOR_VNDK_VERSION}/${LIB}",
AsanPath::SAME_PATH);
ns.AddSearchPath("/odm/${LIB}", AsanPath::WITH_DATA_ASAN);
ns.AddSearchPath("/vendor/${LIB}", AsanPath::WITH_DATA_ASAN);
// Private LLNDK libs (e.g. libft2.so) are exceptionally allowed to this
// namespace because RS framework libs are using them.
ns.GetLink(ctx.GetSystemNamespaceName())
- .AddSharedLib({"@{LLNDK_LIBRARIES}", "@{PRIVATE_LLNDK_LIBRARIES:}"});
+ .AddSharedLib(
+ {"@{LLNDK_LIBRARIES_VENDOR}", "@{PRIVATE_LLNDK_LIBRARIES_VENDOR:}"});
ns.GetLink("neuralnetworks").AddSharedLib("libneuralnetworks.so");
// namespaces are tried in this order. rs should be before vndk because both
// are capable of loading libRS_internal.so
ns.GetLink("rs").AddSharedLib("libRS_internal.so");
- ns.GetLink(ctx.GetSystemNamespaceName()).AddSharedLib("@{LLNDK_LIBRARIES:}");
- ns.GetLink("vndk").AddSharedLib("@{VNDK_SAMEPROCESS_LIBRARIES:}");
+ ns.GetLink(ctx.GetSystemNamespaceName())
+ .AddSharedLib("@{LLNDK_LIBRARIES_VENDOR:}");
+ ns.GetLink("vndk").AddSharedLib("@{VNDK_SAMEPROCESS_LIBRARIES_VENDOR:}");
ns.GetLink("neuralnetworks").AddSharedLib("libneuralnetworks.so");
return ns;
// This namespace is where system libs (VNDK and LLNDK libs) are loaded for a
// vendor process.
+#include "linkerconfig/environment.h"
#include "linkerconfig/namespacebuilder.h"
using android::linkerconfig::modules::AsanPath;
+using android::linkerconfig::modules::IsProductVndkVersionDefined;
using android::linkerconfig::modules::Namespace;
namespace android {
Namespace ns("system", /*is_isolated=*/false, /*is_visible=*/false);
ns.AddSearchPath("/system/${LIB}", AsanPath::WITH_DATA_ASAN);
ns.AddSearchPath("/@{SYSTEM_EXT:system_ext}/${LIB}", AsanPath::WITH_DATA_ASAN);
- ns.AddSearchPath("/@{PRODUCT:product}/${LIB}", AsanPath::WITH_DATA_ASAN);
+ if (!IsProductVndkVersionDefined()) {
+ ns.AddSearchPath("/@{PRODUCT:product}/${LIB}", AsanPath::WITH_DATA_ASAN);
+ }
ns.GetLink("art").AddSharedLib(
{"libdexfile_external.so",
#include "linkerconfig/namespacebuilder.h"
using android::linkerconfig::modules::AsanPath;
+using android::linkerconfig::modules::IsProductVndkVersionDefined;
using android::linkerconfig::modules::Namespace;
namespace {
"/system/${LIB}/extractors",
"/system/${LIB}/hw",
"/@{SYSTEM_EXT:system_ext}/${LIB}",
- "/@{PRODUCT:product}/${LIB}",
// These are where odex files are located. libart has to be able to
// dlopen the files
for (const auto& path : kPermittedPaths) {
ns.AddPermittedPath(path, AsanPath::SAME_PATH);
}
+ if (!IsProductVndkVersionDefined()) {
+ // System processes can use product libs only if product VNDK is not enforced.
+ ns.AddPermittedPath("/@{PRODUCT:product}/${LIB}", AsanPath::SAME_PATH);
+ }
}
} // namespace
ns.AddSearchPath("/system/${LIB}", AsanPath::WITH_DATA_ASAN);
ns.AddSearchPath("/@{SYSTEM_EXT:system_ext}/${LIB}", AsanPath::WITH_DATA_ASAN);
- ns.AddSearchPath("/@{PRODUCT:product}/${LIB}", AsanPath::WITH_DATA_ASAN);
+ if (!IsProductVndkVersionDefined() || !is_fully_treblelized) {
+ // System processes can search product libs only if product VNDK is not
+ // enforced.
+ ns.AddSearchPath("/@{PRODUCT:product}/${LIB}", AsanPath::WITH_DATA_ASAN);
+ }
if (!is_fully_treblelized) {
ns.AddSearchPath("/vendor/${LIB}", AsanPath::WITH_DATA_ASAN);
ns.AddSearchPath("/odm/${LIB}", AsanPath::WITH_DATA_ASAN);
AsanPath::WITH_DATA_ASAN);
ns.AddSearchPath("/@{PRODUCT:product}/${LIB}", AsanPath::WITH_DATA_ASAN);
// Put system vndk at the last search order in vndk_lite for GSI
- ns.AddSearchPath("/apex/com.android.vndk.v@{VNDK_VER}/${LIB}",
+ ns.AddSearchPath("/apex/com.android.vndk.v@{VENDOR_VNDK_VERSION}/${LIB}",
AsanPath::SAME_PATH);
}
if (is_vndklite) {
ns.GetLink("art").AddSharedLib(kVndkLiteArtLibs);
} else {
- ns.GetLink(ctx.GetSystemNamespaceName()).AddSharedLib("@{LLNDK_LIBRARIES}");
- ns.GetLink("vndk").AddSharedLib(
- {"@{VNDK_SAMEPROCESS_LIBRARIES}", "@{VNDK_CORE_LIBRARIES}"});
+ ns.GetLink(ctx.GetSystemNamespaceName())
+ .AddSharedLib("@{LLNDK_LIBRARIES_VENDOR}");
+ ns.GetLink("vndk").AddSharedLib({"@{VNDK_SAMEPROCESS_LIBRARIES_VENDOR}",
+ "@{VNDK_CORE_LIBRARIES_VENDOR}"});
if (android::linkerconfig::modules::IsVndkInSystemNamespace()) {
ns.GetLink("vndk_in_system")
.AddSharedLib("@{VNDK_USING_CORE_VARIANT_LIBRARIES}");
namespace contents {
Namespace BuildVndkNamespace([[maybe_unused]] const Context& ctx) {
bool is_system_section = ctx.IsSystemSection();
+ bool is_product_section = ctx.IsProductSection();
bool is_vndklite = ctx.IsVndkliteConfig();
// Isolated but visible when used in the [system] section to allow links to be
// created at runtime, e.g. through android_link_namespaces in
/*is_visible=*/is_system_section);
if (is_system_section) {
+ // It is linked from vendor HAL. It must use vendor vndk libs.
ns.AddSearchPath("/odm/${LIB}/vndk-sp", AsanPath::WITH_DATA_ASAN);
ns.AddSearchPath("/vendor/${LIB}/vndk-sp", AsanPath::WITH_DATA_ASAN);
- ns.AddSearchPath("/apex/com.android.vndk.v@{VNDK_VER}/${LIB}",
+ ns.AddSearchPath("/apex/com.android.vndk.v@{VENDOR_VNDK_VERSION}/${LIB}",
+ AsanPath::SAME_PATH);
+ } else if (is_product_section) {
+ ns.AddSearchPath("/product/${LIB}/vndk-sp", AsanPath::WITH_DATA_ASAN);
+ ns.AddSearchPath("/product/${LIB}/vndk", AsanPath::WITH_DATA_ASAN);
+ ns.AddSearchPath("/apex/com.android.vndk.v@{PRODUCT_VNDK_VERSION}/${LIB}",
AsanPath::SAME_PATH);
} else {
ns.AddSearchPath("/odm/${LIB}/vndk-sp", AsanPath::WITH_DATA_ASAN);
ns.AddSearchPath("/odm/${LIB}/vndk", AsanPath::WITH_DATA_ASAN);
ns.AddSearchPath("/vendor/${LIB}/vndk-sp", AsanPath::WITH_DATA_ASAN);
ns.AddSearchPath("/vendor/${LIB}/vndk", AsanPath::WITH_DATA_ASAN);
- ns.AddSearchPath("/apex/com.android.vndk.v@{VNDK_VER}/${LIB}",
+ ns.AddSearchPath("/apex/com.android.vndk.v@{VENDOR_VNDK_VERSION}/${LIB}",
AsanPath::SAME_PATH);
}
ns.AddPermittedPath("/system/vendor/${LIB}/egl", AsanPath::NONE);
// This is exceptionally required since android.hidl.memory@1.0-impl.so is here
- ns.AddPermittedPath("/apex/com.android.vndk.v@{VNDK_VER}/${LIB}/hw",
- AsanPath::SAME_PATH);
+ ns.AddPermittedPath(
+ "/apex/com.android.vndk.v@{VENDOR_VNDK_VERSION}/${LIB}/hw",
+ AsanPath::SAME_PATH);
}
// For the [vendor] section, the links should be identical to that of the
// 'vndk_in_system' namespace, except the links to 'default' and 'vndk_in_system'.
- ns.GetLink(ctx.GetSystemNamespaceName()).AddSharedLib({"@{LLNDK_LIBRARIES}"});
+ if (is_product_section) {
+ ns.GetLink(ctx.GetSystemNamespaceName())
+ .AddSharedLib({"@{LLNDK_LIBRARIES_PRODUCT}"});
+ } else {
+ ns.GetLink(ctx.GetSystemNamespaceName())
+ .AddSharedLib({"@{LLNDK_LIBRARIES_VENDOR}"});
+ }
if (!is_vndklite) {
if (is_system_section) {
// the system namespace has higher priority than the "sphal" namespace.
ns.GetLink("sphal").AllowAllSharedLibs();
} else {
- // [vendor] section
+ // [vendor] or [product] section
ns.GetLink("default").AllowAllSharedLibs();
if (android::linkerconfig::modules::IsVndkInSystemNamespace()) {
#include "linkerconfig/environment.h"
using android::linkerconfig::modules::AsanPath;
+using android::linkerconfig::modules::IsProductVndkVersionDefined;
using android::linkerconfig::modules::Namespace;
namespace android {
// The search paths here should be kept the same as that of the 'system' namespace.
ns.AddSearchPath("/system/${LIB}", AsanPath::WITH_DATA_ASAN);
ns.AddSearchPath("/@{SYSTEM_EXT:system_ext}/${LIB}", AsanPath::WITH_DATA_ASAN);
- ns.AddSearchPath("/@{PRODUCT:product}/${LIB}", AsanPath::WITH_DATA_ASAN);
+ if (!IsProductVndkVersionDefined()) {
+ ns.AddSearchPath("/@{PRODUCT:product}/${LIB}", AsanPath::WITH_DATA_ASAN);
+ }
if (android::linkerconfig::modules::IsVndkInSystemNamespace()) {
ns.AddWhitelisted("@{VNDK_USING_CORE_VARIANT_LIBRARIES}");
// 1. 'vndk_in_system' needs to be freely linked back to 'vndk'.
// 2. 'vndk_in_system' does not need to link to 'default', as any library that
// requires anything vendor would not be a vndk_in_system library.
- ns.GetLink(ctx.GetSystemNamespaceName()).AddSharedLib("@{LLNDK_LIBRARIES}");
+ if (ctx.IsProductSection()) {
+ ns.GetLink(ctx.GetSystemNamespaceName())
+ .AddSharedLib("@{LLNDK_LIBRARIES_PRODUCT}");
+ } else {
+ ns.GetLink(ctx.GetSystemNamespaceName())
+ .AddSharedLib("@{LLNDK_LIBRARIES_VENDOR}");
+ }
ns.GetLink("vndk").AllowAllSharedLibs();
ns.GetLink("neuralnetworks").AddSharedLib("libneuralnetworks.so");
--- /dev/null
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Namespace config for product processes.
+
+#include "linkerconfig/sectionbuilder.h"
+
+#include "linkerconfig/common.h"
+#include "linkerconfig/environment.h"
+#include "linkerconfig/namespacebuilder.h"
+#include "linkerconfig/section.h"
+
+using android::linkerconfig::contents::SectionType;
+using android::linkerconfig::modules::Namespace;
+using android::linkerconfig::modules::Section;
+
+namespace android {
+namespace linkerconfig {
+namespace contents {
+Section BuildProductSection(Context& ctx) {
+ ctx.SetCurrentSection(SectionType::Product);
+ std::vector<Namespace> namespaces;
+
+ namespaces.emplace_back(BuildProductDefaultNamespace(ctx));
+ namespaces.emplace_back(BuildArtNamespace(ctx));
+ namespaces.emplace_back(BuildVndkNamespace(ctx));
+ namespaces.emplace_back(BuildSystemNamespace(ctx));
+ namespaces.emplace_back(BuildNeuralNetworksNamespace(ctx));
+
+ if (android::linkerconfig::modules::IsVndkInSystemNamespace()) {
+ namespaces.emplace_back(BuildVndkInSystemNamespace(ctx));
+ }
+
+ namespaces.emplace_back(BuildRuntimeNamespace(ctx));
+
+ Section section("product", std::move(namespaces));
+ AddStandardSystemLinks(ctx, §ion);
+ return section;
+}
+} // namespace contents
+} // namespace linkerconfig
+} // namespace android
#include "linkerconfig/variables.h"
inline void MockGenericVariables() {
- android::linkerconfig::modules::Variables::AddValue("VNDK_VER", "99");
+ android::linkerconfig::modules::Variables::AddValue("VENDOR_VNDK_VERSION",
+ "99");
+ android::linkerconfig::modules::Variables::AddValue("PRODUCT_VNDK_VERSION",
+ "99");
android::linkerconfig::modules::Variables::AddValue("PRODUCT", "product");
android::linkerconfig::modules::Variables::AddValue("SYSTEM_EXT",
"system_ext");
- android::linkerconfig::modules::Variables::AddValue("LLNDK_LIBRARIES",
+ android::linkerconfig::modules::Variables::AddValue("LLNDK_LIBRARIES_VENDOR",
+ "llndk_libraries");
+ android::linkerconfig::modules::Variables::AddValue("LLNDK_LIBRARIES_PRODUCT",
"llndk_libraries");
android::linkerconfig::modules::Variables::AddValue(
"SANITIZER_RUNTIME_LIBRARIES", "sanitizer_runtime_libraries");
android::linkerconfig::modules::Variables::AddValue(
- "PRIVATE_LLNDK_LIBRARIES", "private_llndk_libraries");
+ "PRIVATE_LLNDK_LIBRARIES_VENDOR", "private_llndk_libraries");
+ android::linkerconfig::modules::Variables::AddValue(
+ "PRIVATE_LLNDK_LIBRARIES_PRODUCT", "private_llndk_libraries");
+ android::linkerconfig::modules::Variables::AddValue(
+ "VNDK_SAMEPROCESS_LIBRARIES_VENDOR", "vndk_sameprocess_libraries");
android::linkerconfig::modules::Variables::AddValue(
- "VNDK_SAMEPROCESS_LIBRARIES", "vndk_sameprocess_libraries");
- android::linkerconfig::modules::Variables::AddValue("VNDK_CORE_LIBRARIES",
- "vndk_core_libraries");
+ "VNDK_SAMEPROCESS_LIBRARIES_PRODUCT", "vndk_sameprocess_libraries");
+ android::linkerconfig::modules::Variables::AddValue(
+ "VNDK_CORE_LIBRARIES_VENDOR", "vndk_core_libraries");
+ android::linkerconfig::modules::Variables::AddValue(
+ "VNDK_CORE_LIBRARIES_PRODUCT", "vndk_core_libraries");
android::linkerconfig::modules::Variables::AddValue(
"VNDK_USING_CORE_VARIANT_LIBRARIES", "");
}
inline void MockVndkVersion(std::string vndk_version) {
- android::linkerconfig::modules::Variables::AddValue("VNDK_VER", vndk_version);
+ android::linkerconfig::modules::Variables::AddValue("VENDOR_VNDK_VERSION",
+ vndk_version);
+ android::linkerconfig::modules::Variables::AddValue("PRODUCT_VNDK_VERSION",
+ vndk_version);
}
inline void MockVndkUsingCoreVariant() {
inline void MockVnkdLite() {
android::linkerconfig::modules::Variables::AddValue("ro.vndk.lite", "true");
-}
\ No newline at end of file
+}
auto vendor_lib_path = "/vendor/${LIB}";
auto vendor_vndk_lib_path = "/vendor/${LIB}/vndk";
auto vendor_vndksp_lib_path = "/vendor/${LIB}/vndk-sp";
- auto apex_vndk_lib_path = "/apex/com.android.vndk.v@{VNDK_VER}/${LIB}";
+ auto apex_vndk_lib_path =
+ "/apex/com.android.vndk.v@{VENDOR_VNDK_VERSION}/${LIB}";
auto fs = fsmap{
{system_lib_path, {libvndk, libvndksp}},
using android::base::ErrnoErrorf;
using android::base::Result;
+using android::linkerconfig::modules::GetProductVndkVersion;
using android::linkerconfig::modules::GetVendorVndkVersion;
using android::linkerconfig::modules::Variables;
using namespace android::linkerconfig::generator;
void LoadVndkVersionVariable() {
- Variables::AddValue("VNDK_VER", GetVendorVndkVersion());
+ Variables::AddValue("VENDOR_VNDK_VERSION", GetVendorVndkVersion());
+ Variables::AddValue("PRODUCT_VNDK_VERSION", GetProductVndkVersion());
}
Result<std::string> GetRealPath(std::string target_path) {
}
void LoadLibraryListVariables(const std::string& root) {
- auto private_library_path = root + "/system/etc/vndkprivate.libraries." +
- GetVendorVndkVersion() + ".txt";
- auto llndk_library_path =
+ auto private_library_path_vendor = root +
+ "/system/etc/vndkprivate.libraries." +
+ GetVendorVndkVersion() + ".txt";
+ auto llndk_library_path_vendor =
root + "/system/etc/llndk.libraries." + GetVendorVndkVersion() + ".txt";
- auto vndksp_library_path =
+ auto vndksp_library_path_vendor =
root + "/system/etc/vndksp.libraries." + GetVendorVndkVersion() + ".txt";
- auto vndkcore_library_path = root + "/system/etc/vndkcore.libraries." +
- GetVendorVndkVersion() + ".txt";
+ auto vndkcore_library_path_vendor = root + "/system/etc/vndkcore.libraries." +
+ GetVendorVndkVersion() + ".txt";
+
+ auto private_library_path_product = root +
+ "/system/etc/vndkprivate.libraries." +
+ GetProductVndkVersion() + ".txt";
+ auto llndk_library_path_product =
+ root + "/system/etc/llndk.libraries." + GetProductVndkVersion() + ".txt";
+ auto vndksp_library_path_product =
+ root + "/system/etc/vndksp.libraries." + GetProductVndkVersion() + ".txt";
+ auto vndkcore_library_path_product = root + "/system/etc/vndkcore.libraries." +
+ GetProductVndkVersion() + ".txt";
+
auto vndkcorevariant_library_path =
root + "/system/etc/vndkcorevariant.libraries.txt";
auto sanitizer_library_path = root + "/system/etc/sanitizer.libraries.txt";
- Variables::AddValue(
- "LLNDK_LIBRARIES",
- GetPublicLibrariesString(llndk_library_path, private_library_path));
+ Variables::AddValue("LLNDK_LIBRARIES_VENDOR",
+ GetPublicLibrariesString(llndk_library_path_vendor,
+ private_library_path_vendor));
+
+ Variables::AddValue("PRIVATE_LLNDK_LIBRARIES_VENDOR",
+ GetPrivateLibrariesString(llndk_library_path_vendor,
+ private_library_path_vendor));
+
+ Variables::AddValue("VNDK_SAMEPROCESS_LIBRARIES_VENDOR",
+ GetPublicLibrariesString(vndksp_library_path_vendor,
+ private_library_path_vendor));
+
+ Variables::AddValue("VNDK_CORE_LIBRARIES_VENDOR",
+ GetPublicLibrariesString(vndkcore_library_path_vendor,
+ private_library_path_vendor));
+
+ Variables::AddValue("LLNDK_LIBRARIES_PRODUCT",
+ GetPublicLibrariesString(llndk_library_path_product,
+ private_library_path_product));
- Variables::AddValue(
- "PRIVATE_LLNDK_LIBRARIES",
- GetPrivateLibrariesString(llndk_library_path, private_library_path));
+ Variables::AddValue("PRIVATE_LLNDK_LIBRARIES_PRODUCT",
+ GetPrivateLibrariesString(llndk_library_path_product,
+ private_library_path_product));
- Variables::AddValue(
- "VNDK_SAMEPROCESS_LIBRARIES",
- GetPublicLibrariesString(vndksp_library_path, private_library_path));
+ Variables::AddValue("VNDK_SAMEPROCESS_LIBRARIES_PRODUCT",
+ GetPublicLibrariesString(vndksp_library_path_product,
+ private_library_path_product));
- Variables::AddValue(
- "VNDK_CORE_LIBRARIES",
- GetPublicLibrariesString(vndkcore_library_path, private_library_path));
+ Variables::AddValue("VNDK_CORE_LIBRARIES_PRODUCT",
+ GetPublicLibrariesString(vndkcore_library_path_product,
+ private_library_path_product));
Variables::AddValue("VNDK_USING_CORE_VARIANT_LIBRARIES",
GetPublicLibrariesString(vndkcorevariant_library_path,
- private_library_path));
+ private_library_path_vendor));
Variables::AddValue("SANITIZER_RUNTIME_LIBRARIES",
GetLibrariesString(sanitizer_library_path));
return Variables::GetValue("ro.vndk.version").value_or("");
}
+std::string GetProductVndkVersion() {
+ return Variables::GetValue("ro.product.vndk.version").value_or("");
+}
+
+bool IsProductVndkVersionDefined() {
+ return Variables::GetValue("ro.product.vndk.version").has_value();
+}
+
bool IsRecoveryMode() {
return access("/system/bin/recovery", F_OK) == 0;
}
} // namespace modules
} // namespace linkerconfig
-} // namespace android
\ No newline at end of file
+} // namespace android
bool IsVndkLiteDevice();
bool IsVndkInSystemNamespace();
std::string GetVendorVndkVersion();
+std::string GetProductVndkVersion();
+bool IsProductVndkVersionDefined();
bool IsRecoveryMode();
} // namespace modules
} // namespace linkerconfig
-} // namespace android
\ No newline at end of file
+} // namespace android