mirror of
https://github.com/Evolution-X-Devices/device_xiaomi_rosemary
synced 2026-01-27 18:07:31 +00:00
* hwname is required for detecting actual device, maltose having same region (Global) with rosemary Change-Id: I6aa1f9d856db6e7e0195c511bbb35e987d51c1fc
40 lines
1.1 KiB
C++
40 lines
1.1 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, "");
|
|
std::string sku_value = GetProperty(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)) {
|
|
set_variant_props(variant);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
void set_variant_props(const variant_info_t variant) {
|
|
set_ro_build_prop("device", variant.device, true);
|
|
property_override("ro.boot.hardware.sku", variant.device);
|
|
|
|
if (variant.nfc)
|
|
property_override(SKU_PROP, "nfc");
|
|
}
|