sm8150-common: libinit: Introduce libvariant and related Soong select

Change-Id: I1aa99abc47d483cba2a0552e497667212919358c
This commit is contained in:
Sebastiano Barezzi
2025-10-30 02:16:06 +01:00
parent c4580d732a
commit 54bd30a3c0
8 changed files with 75 additions and 25 deletions

View File

@@ -1,25 +1,24 @@
//
// Copyright (C) 2021 The LineageOS Project
// Copyright (C) 2021-2025 The LineageOS Project
//
// SPDX-License-Identifier: Apache-2.0
//
cc_library_static {
name: "libinit_xiaomi_msmnile",
name: "init_xiaomi_msmnile",
srcs: [
"init_xiaomi_msmnile.cpp",
"libinit_dalvik_heap.cpp",
"libinit_variant.cpp",
"libinit_utils.cpp",
],
whole_static_libs: ["libbase"],
export_include_dirs: ["include"],
recovery_available: true,
}
cc_library_static {
name: "init_xiaomi_msmnile",
srcs: ["init_xiaomi_msmnile.cpp"],
whole_static_libs: ["libinit_xiaomi_msmnile"],
header_libs: ["libvariant_headers"],
whole_static_libs: [
"libbase",
] + select(soong_config_variable("xiaomi_msmnile", "variant_lib"), {
any @ lib: [lib],
default: ["libvariant_default"],
}),
include_dirs: ["system/core/init"],
recovery_available: true,
}

View File

@@ -6,22 +6,10 @@
#pragma once
#include <string>
#include <libvariant.h>
#include <vector>
struct variant_info {
std::string hwc_value;
std::string sku_value;
std::string brand;
std::string device;
std::string marketname;
std::string model;
std::string build_fingerprint;
bool nfc;
};
void search_variant(const std::vector<variant_info>& variants);
void set_variant_props(const variant_info& variant);

View File

@@ -7,7 +7,12 @@
#include "vendor_init.h"
#include "include/libinit_dalvik_heap.h"
#include "include/libinit_variant.h"
#include <libvariant.h>
void vendor_load_properties() {
search_variant(variants);
set_dalvik_heap();
}

View File

@@ -10,6 +10,7 @@
#include <android-base/logging.h>
#include <android-base/properties.h>
#include <string>
using android::base::GetProperty;

View File

@@ -0,0 +1,12 @@
//
// Copyright (C) 2025 The LineageOS Project
//
// SPDX-License-Identifier: Apache-2.0
//
cc_library_static {
name: "libvariant_default",
srcs: ["libvariant_default.cpp"],
header_libs: ["libvariant_headers"],
recovery_available: true,
}

View File

@@ -0,0 +1,9 @@
/*
* Copyright (C) 2025 The LineageOS Project
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <libvariant.h>
const std::vector<variant_info> variants;

View File

@@ -0,0 +1,11 @@
//
// Copyright (C) 2025 The LineageOS Project
//
// SPDX-License-Identifier: Apache-2.0
//
cc_library_headers {
name: "libvariant_headers",
export_include_dirs: ["include"],
recovery_available: true,
}

View File

@@ -0,0 +1,25 @@
/*
* Copyright (C) 2021-2025 The LineageOS Project
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include <string>
#include <vector>
struct variant_info {
std::string hwc_value;
std::string sku_value;
std::string brand;
std::string device;
std::string marketname;
std::string model;
std::string build_fingerprint;
bool nfc;
};
extern const std::vector<variant_info> variants;