mirror of
https://github.com/Evolution-X-Devices/device_xiaomi_rosemary
synced 2026-01-27 13:35:09 +00:00
rosemary: libinit: Override device model in a stock way
* Detect variant via vendor sku prop * Revert recent libinit changes Change-Id: I31c13f33368410f35ad3c7eca04f6c60306e1f8f
This commit is contained in:
@@ -12,9 +12,14 @@
|
||||
|
||||
typedef struct variant_info {
|
||||
std::string hwc_value;
|
||||
std::string hwname_value;
|
||||
std::string sku_value;
|
||||
std::string vendor_sku_value;
|
||||
|
||||
std::string brand;
|
||||
std::string device;
|
||||
std::string marketname;
|
||||
std::string model;
|
||||
std::string build_fingerprint;
|
||||
|
||||
bool nfc;
|
||||
} variant_info_t;
|
||||
|
||||
@@ -10,25 +10,44 @@
|
||||
#include "vendor_init.h"
|
||||
|
||||
static const variant_info_t maltose_info = {
|
||||
.hwc_value = "Global",
|
||||
.hwname_value="maltose",
|
||||
.hwc_value = "",
|
||||
.sku_value = "",
|
||||
.vendor_sku_value = "maltose",
|
||||
|
||||
.brand = "Redmi",
|
||||
.device = "maltose",
|
||||
.marketname = "Redmi Note 10S",
|
||||
.model = "M2101K7BL",
|
||||
.build_fingerprint = "Redmi/maltose_global/maltose:11/RP1A.200720.011/V12.5.16.0.RKLMIXM:user/release-keys",
|
||||
|
||||
.nfc = false,
|
||||
};
|
||||
|
||||
static const variant_info_t rosemary_info = {
|
||||
.hwc_value = "Global",
|
||||
.hwname_value="rosemary",
|
||||
.hwc_value = "",
|
||||
.sku_value = "",
|
||||
.vendor_sku_value = "rosemary",
|
||||
|
||||
.brand = "Redmi",
|
||||
.device = "rosemary",
|
||||
.marketname = "Redmi Note 10S",
|
||||
.model = "M2101K7BNY",
|
||||
.build_fingerprint = "Redmi/rosemary_global/rosemary:11/RP1A.200720.011/V12.5.16.0.RKLMIXM:user/release-keys",
|
||||
|
||||
.nfc = true,
|
||||
};
|
||||
|
||||
static const variant_info_t secret_info = {
|
||||
.hwname_value="secret",
|
||||
.hwc_value = "",
|
||||
.sku_value = "",
|
||||
.vendor_sku_value = "secret",
|
||||
|
||||
.brand = "Redmi",
|
||||
.device = "secret",
|
||||
.marketname = "Redmi Note 10S",
|
||||
.model = "M2101K7BG",
|
||||
.build_fingerprint = "Redmi/secret_global/secret:11/RP1A.200720.011/V12.5.16.0.RKLMIXM:user/release-keys",
|
||||
|
||||
.nfc = false,
|
||||
};
|
||||
|
||||
|
||||
@@ -12,18 +12,18 @@
|
||||
using android::base::GetProperty;
|
||||
|
||||
#define HWC_PROP "ro.boot.hwc"
|
||||
#define HWNAME_PROP "ro.boot.hwname"
|
||||
#define SKU_PROP "ro.boot.product.hardware.sku"
|
||||
#define VENDOR_SKU_PROP "ro.boot.product.vendor.sku"
|
||||
|
||||
void search_variant(const std::vector<variant_info_t> variants) {
|
||||
std::string hwc_value = GetProperty(HWC_PROP, "");
|
||||
std::string hwname_value = GetProperty(HWNAME_PROP, "");
|
||||
std::string sku_value = GetProperty(SKU_PROP, "");
|
||||
std::string vendor_sku_value = GetProperty(VENDOR_SKU_PROP, "");
|
||||
|
||||
for (const auto& variant : variants) {
|
||||
if ((variant.hwc_value == "" || variant.hwc_value == hwc_value) &&
|
||||
(variant.hwname_value == "" || variant.hwname_value == hwname_value) &&
|
||||
(variant.sku_value == "" || variant.sku_value == sku_value)) {
|
||||
(variant.sku_value == "" || variant.sku_value == sku_value) &&
|
||||
(variant.vendor_sku_value == "" || variant.vendor_sku_value == vendor_sku_value)) {
|
||||
set_variant_props(variant);
|
||||
break;
|
||||
}
|
||||
@@ -31,7 +31,16 @@ void search_variant(const std::vector<variant_info_t> variants) {
|
||||
}
|
||||
|
||||
void set_variant_props(const variant_info_t variant) {
|
||||
set_ro_build_prop("brand", variant.brand, true);
|
||||
set_ro_build_prop("device", variant.device, true);
|
||||
set_ro_build_prop("marketname", variant.marketname, true);
|
||||
set_ro_build_prop("model", variant.model, true);
|
||||
|
||||
set_ro_build_prop("fingerprint", variant.build_fingerprint);
|
||||
property_override("ro.bootimage.build.fingerprint", variant.build_fingerprint);
|
||||
|
||||
property_override("ro.build.description", fingerprint_to_description(variant.build_fingerprint));
|
||||
|
||||
property_override("ro.boot.hardware.sku", variant.device);
|
||||
|
||||
if (variant.nfc)
|
||||
|
||||
Reference in New Issue
Block a user