sm8150-common: libinit: Introduce libvariant and related Soong select
Change-Id: I1aa99abc47d483cba2a0552e497667212919358c
This commit is contained in:
@@ -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,
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
#include <android-base/logging.h>
|
||||
#include <android-base/properties.h>
|
||||
#include <string>
|
||||
|
||||
using android::base::GetProperty;
|
||||
|
||||
|
||||
12
libinit/libvariant_default/Android.bp
Normal file
12
libinit/libvariant_default/Android.bp
Normal 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,
|
||||
}
|
||||
9
libinit/libvariant_default/libvariant_default.cpp
Normal file
9
libinit/libvariant_default/libvariant_default.cpp
Normal 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;
|
||||
11
libinit/libvariant_headers/Android.bp
Normal file
11
libinit/libvariant_headers/Android.bp
Normal 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,
|
||||
}
|
||||
25
libinit/libvariant_headers/include/libvariant.h
Normal file
25
libinit/libvariant_headers/include/libvariant.h
Normal 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;
|
||||
Reference in New Issue
Block a user