mirror of
https://github.com/PixelExperience-Devices/device_xiaomi_sm6250-common.git
synced 2025-04-29 10:37:35 +09:00
* This libinit has been made to commonize device variants props handling [dereference23: Adapt for Xiaomi SM6250] Signed-off-by: Alexander Winkowski <dereference23@outlook.com> Change-Id: Iab68ff451ab1d6e861fb4cda4ef07fad3123ecde
42 lines
1.2 KiB
C++
42 lines
1.2 KiB
C++
/*
|
|
* Copyright (C) 2021 The LineageOS Project
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
#include <android-base/properties.h>
|
|
#include <libinit_utils.h>
|
|
|
|
#include <libinit_variant.h>
|
|
|
|
using android::base::GetProperty;
|
|
|
|
#define HWC_PROP "ro.boot.hwc"
|
|
#define HWNAME_PROP "ro.boot.hwname"
|
|
#define SKU_PROP "ro.boot.product.hardware.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, "");
|
|
|
|
for (const auto& variant : variants) {
|
|
if ((variant.hwc_value == "" || variant.hwc_value == hwc_value) && (variant.device == hwname_value)) {
|
|
set_variant_props(variant);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
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("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", variant.build_description);
|
|
|
|
if (variant.nfc)
|
|
property_override(SKU_PROP, "nfc");
|
|
}
|