sweet: Get rid of libinit
* Use the `import` function of build.prop files to override the model-specific properties based on the ro.boot.hwc and product SKU values, both set by the bootloader * Set a custom product property source order, so that the ODM and vendor properties have preference over the other sources * Switch to vendor SKU for enabling NFC exclusively on variants that support it, as the product SKU is set by the bootloader * Create a symlink from /vendor/etc/audio/sku_sweet to /vendor/etc, as the audio HAL takes the former as directory for audio configs if SKU is set to `sweet` Change-Id: I312a059e0cbcbad6aa052bd32142b70dcf0a7adc Signed-off-by: danielml <daniel@danielml.dev>
This commit is contained in:
parent
59803d53d8
commit
601fddecdf
@ -1,2 +1,9 @@
|
|||||||
soong_namespace {
|
soong_namespace {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
install_symlink {
|
||||||
|
name: "sku_sweet_audio_symlink",
|
||||||
|
installed_location: "etc/audio/sku_sweet",
|
||||||
|
symlink_target: "/vendor/etc",
|
||||||
|
vendor: true,
|
||||||
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Copyright (C) 2021 The LineageOS Project
|
# Copyright (C) 2021-2024 The LineageOS Project
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
#
|
#
|
||||||
@ -17,14 +17,11 @@ TARGET_PROVIDES_AUDIO_EXTNS := true
|
|||||||
|
|
||||||
# HIDL
|
# HIDL
|
||||||
DEVICE_MANIFEST_FILE += $(DEVICE_PATH)/configs/hidl/manifest.xml
|
DEVICE_MANIFEST_FILE += $(DEVICE_PATH)/configs/hidl/manifest.xml
|
||||||
ODM_MANIFEST_SKUS += sweet
|
DEVICE_MANIFEST_SKUS += sweet
|
||||||
ODM_MANIFEST_SWEET_FILES := \
|
DEVICE_MANIFEST_SWEET_FILES := \
|
||||||
|
$(DEVICE_MANIFEST_FILE) \
|
||||||
$(DEVICE_PATH)/configs/hidl/manifest-nfc.xml
|
$(DEVICE_PATH)/configs/hidl/manifest-nfc.xml
|
||||||
|
|
||||||
# Init
|
|
||||||
TARGET_INIT_VENDOR_LIB := //$(DEVICE_PATH):libinit_sweet
|
|
||||||
TARGET_RECOVERY_DEVICE_MODULES := libinit_sweet
|
|
||||||
|
|
||||||
# Kernel
|
# Kernel
|
||||||
TARGET_KERNEL_CONFIG += vendor/sweet.config
|
TARGET_KERNEL_CONFIG += vendor/sweet.config
|
||||||
|
|
||||||
@ -39,7 +36,8 @@ BOARD_USERDATAIMAGE_PARTITION_SIZE := 114980532224
|
|||||||
BOARD_QTI_DYNAMIC_PARTITIONS_SIZE := 9122611200 # (BOARD_SUPER_PARTITION_SIZE - 4194304) 4MiB overhead
|
BOARD_QTI_DYNAMIC_PARTITIONS_SIZE := 9122611200 # (BOARD_SUPER_PARTITION_SIZE - 4194304) 4MiB overhead
|
||||||
|
|
||||||
# Properties
|
# Properties
|
||||||
TARGET_VENDOR_PROP += $(DEVICE_PATH)/vendor.prop
|
TARGET_ODM_PROP += $(DEVICE_PATH)/properties/odm.prop
|
||||||
|
TARGET_VENDOR_PROP += $(DEVICE_PATH)/properties/vendor.prop
|
||||||
|
|
||||||
# Screen density
|
# Screen density
|
||||||
TARGET_SCREEN_DENSITY := 440
|
TARGET_SCREEN_DENSITY := 440
|
||||||
|
32
device.mk
32
device.mk
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Copyright (C) 2021 The LineageOS Project
|
# Copyright (C) 2021-2024 The LineageOS Project
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
#
|
#
|
||||||
@ -15,7 +15,8 @@ PRODUCT_SHIPPING_API_LEVEL := 30
|
|||||||
|
|
||||||
# Audio
|
# Audio
|
||||||
PRODUCT_PACKAGES += \
|
PRODUCT_PACKAGES += \
|
||||||
libtinycompress
|
libtinycompress \
|
||||||
|
sku_sweet_audio_symlink
|
||||||
|
|
||||||
PRODUCT_COPY_FILES += \
|
PRODUCT_COPY_FILES += \
|
||||||
$(LOCAL_PATH)/configs/audio/audio_platform_info_intcodec.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_platform_info_intcodec.xml \
|
$(LOCAL_PATH)/configs/audio/audio_platform_info_intcodec.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_platform_info_intcodec.xml \
|
||||||
@ -53,13 +54,13 @@ PRODUCT_COPY_FILES += \
|
|||||||
$(LOCAL_PATH)/configs/nfc/libnfc-nxp.conf:$(TARGET_COPY_OUT_VENDOR)/etc/libnfc-nxp.conf
|
$(LOCAL_PATH)/configs/nfc/libnfc-nxp.conf:$(TARGET_COPY_OUT_VENDOR)/etc/libnfc-nxp.conf
|
||||||
|
|
||||||
PRODUCT_COPY_FILES += \
|
PRODUCT_COPY_FILES += \
|
||||||
frameworks/native/data/etc/android.hardware.nfc.ese.xml:$(TARGET_COPY_OUT_ODM)/etc/permissions/sku_sweet/android.hardware.nfc.ese.xml \
|
frameworks/native/data/etc/android.hardware.nfc.ese.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/sku_sweet/android.hardware.nfc.ese.xml \
|
||||||
frameworks/native/data/etc/android.hardware.nfc.hcef.xml:$(TARGET_COPY_OUT_ODM)/etc/permissions/sku_sweet/android.hardware.nfc.hcef.xml \
|
frameworks/native/data/etc/android.hardware.nfc.hcef.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/sku_sweet/android.hardware.nfc.hcef.xml \
|
||||||
frameworks/native/data/etc/android.hardware.nfc.hce.xml:$(TARGET_COPY_OUT_ODM)/etc/permissions/sku_sweet/android.hardware.nfc.hce.xml \
|
frameworks/native/data/etc/android.hardware.nfc.hce.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/sku_sweet/android.hardware.nfc.hce.xml \
|
||||||
frameworks/native/data/etc/android.hardware.nfc.uicc.xml:$(TARGET_COPY_OUT_ODM)/etc/permissions/sku_sweet/android.hardware.nfc.uicc.xml \
|
frameworks/native/data/etc/android.hardware.nfc.uicc.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/sku_sweet/android.hardware.nfc.uicc.xml \
|
||||||
frameworks/native/data/etc/android.hardware.nfc.xml:$(TARGET_COPY_OUT_ODM)/etc/permissions/sku_sweet/android.hardware.nfc.xml \
|
frameworks/native/data/etc/android.hardware.nfc.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/sku_sweet/android.hardware.nfc.xml \
|
||||||
frameworks/native/data/etc/com.android.nfc_extras.xml:$(TARGET_COPY_OUT_ODM)/etc/permissions/sku_sweet/com.android.nfc_extras.xml \
|
frameworks/native/data/etc/com.android.nfc_extras.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/sku_sweet/com.android.nfc_extras.xml \
|
||||||
frameworks/native/data/etc/com.nxp.mifare.xml:$(TARGET_COPY_OUT_ODM)/etc/permissions/sku_sweet/com.nxp.mifare.xml
|
frameworks/native/data/etc/com.nxp.mifare.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/sku_sweet/com.nxp.mifare.xml
|
||||||
|
|
||||||
# IR
|
# IR
|
||||||
PRODUCT_PACKAGES += \
|
PRODUCT_PACKAGES += \
|
||||||
@ -93,6 +94,19 @@ PRODUCT_PACKAGES += \
|
|||||||
PRODUCT_SOONG_NAMESPACES += \
|
PRODUCT_SOONG_NAMESPACES += \
|
||||||
$(LOCAL_PATH)
|
$(LOCAL_PATH)
|
||||||
|
|
||||||
|
# System properties
|
||||||
|
PRODUCT_COPY_FILES += \
|
||||||
|
$(LOCAL_PATH)/properties/build_GLOBAL.prop:$(TARGET_COPY_OUT_ODM)/etc/build_GLOBAL.prop \
|
||||||
|
$(LOCAL_PATH)/properties/build_INDIA-pro.prop:$(TARGET_COPY_OUT_ODM)/etc/build_INDIA-pro.prop \
|
||||||
|
$(LOCAL_PATH)/properties/build_INDIA-std.prop:$(TARGET_COPY_OUT_ODM)/etc/build_INDIA-std.prop \
|
||||||
|
$(LOCAL_PATH)/properties/build_JAPAN.prop:$(TARGET_COPY_OUT_ODM)/etc/build_JAPAN.prop
|
||||||
|
|
||||||
|
PRODUCT_COPY_FILES += \
|
||||||
|
$(LOCAL_PATH)/properties/build_GLOBAL.prop:$(TARGET_COPY_OUT_RECOVERY)/root/build_GLOBAL.prop \
|
||||||
|
$(LOCAL_PATH)/properties/build_INDIA-pro.prop:$(TARGET_COPY_OUT_RECOVERY)/root/build_INDIA-pro.prop \
|
||||||
|
$(LOCAL_PATH)/properties/build_INDIA-std.prop:$(TARGET_COPY_OUT_RECOVERY)/root/build_INDIA-std.prop \
|
||||||
|
$(LOCAL_PATH)/properties/build_JAPAN.prop:$(TARGET_COPY_OUT_RECOVERY)/root/build_JAPAN.prop
|
||||||
|
|
||||||
# Vendor service manager
|
# Vendor service manager
|
||||||
PRODUCT_PACKAGES += \
|
PRODUCT_PACKAGES += \
|
||||||
vndservicemanager
|
vndservicemanager
|
||||||
|
@ -1,25 +0,0 @@
|
|||||||
//
|
|
||||||
// Copyright (C) 2020 The LineageOS Project
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
//
|
|
||||||
|
|
||||||
cc_library_static {
|
|
||||||
name: "libinit_sweet",
|
|
||||||
srcs: ["init_sweet.cpp"],
|
|
||||||
recovery_available: true,
|
|
||||||
include_dirs: [
|
|
||||||
"system/core/init",
|
|
||||||
],
|
|
||||||
shared_libs: ["libbase"],
|
|
||||||
}
|
|
@ -1,125 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright (C) 2020 The LineageOS Project.
|
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
|
||||||
modification, are permitted provided that the following conditions are
|
|
||||||
met:
|
|
||||||
* Redistributions of source code must retain the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer.
|
|
||||||
* Redistributions in binary form must reproduce the above
|
|
||||||
copyright notice, this list of conditions and the following
|
|
||||||
disclaimer in the documentation and/or other materials provided
|
|
||||||
with the distribution.
|
|
||||||
* Neither the name of The Linux Foundation nor the names of its
|
|
||||||
contributors may be used to endorse or promote products derived
|
|
||||||
from this software without specific prior written permission.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
|
||||||
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
|
||||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
|
||||||
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
|
||||||
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
||||||
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
|
||||||
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
|
||||||
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include <android-base/properties.h>
|
|
||||||
#define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_
|
|
||||||
#include <sys/_system_properties.h>
|
|
||||||
|
|
||||||
using android::base::GetProperty;
|
|
||||||
|
|
||||||
std::vector<std::string> ro_props_default_source_order = {
|
|
||||||
"",
|
|
||||||
"odm.",
|
|
||||||
"product.",
|
|
||||||
"system.",
|
|
||||||
"system_ext.",
|
|
||||||
"vendor.",
|
|
||||||
"vendor_dlkm.",
|
|
||||||
};
|
|
||||||
|
|
||||||
void property_override(char const prop[], char const value[], bool add = true)
|
|
||||||
{
|
|
||||||
prop_info *pi;
|
|
||||||
|
|
||||||
pi = (prop_info *) __system_property_find(prop);
|
|
||||||
if (pi)
|
|
||||||
__system_property_update(pi, value, strlen(value));
|
|
||||||
else if (add)
|
|
||||||
__system_property_add(prop, strlen(prop), value, strlen(value));
|
|
||||||
}
|
|
||||||
|
|
||||||
void set_ro_build_prop(const std::string &prop, const std::string &value) {
|
|
||||||
for (const auto &source : ro_props_default_source_order) {
|
|
||||||
auto prop_name = "ro." + source + "build." + prop;
|
|
||||||
if (source == "")
|
|
||||||
property_override(prop_name.c_str(), value.c_str());
|
|
||||||
else
|
|
||||||
property_override(prop_name.c_str(), value.c_str(), false);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
void set_ro_product_prop(const std::string &prop, const std::string &value) {
|
|
||||||
for (const auto &source : ro_props_default_source_order) {
|
|
||||||
auto prop_name = "ro.product." + source + prop;
|
|
||||||
property_override(prop_name.c_str(), value.c_str(), false);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
void vendor_load_properties() {
|
|
||||||
std::string region;
|
|
||||||
std::string sku;
|
|
||||||
region = GetProperty("ro.boot.hwc", "GLOBAL");
|
|
||||||
sku = GetProperty("ro.boot.product.hardware.sku","pro");
|
|
||||||
|
|
||||||
std::string model;
|
|
||||||
std::string device;
|
|
||||||
std::string fingerprint;
|
|
||||||
std::string description;
|
|
||||||
std::string mod_device;
|
|
||||||
|
|
||||||
if (region == "GLOBAL") {
|
|
||||||
model = "M2101K6G";
|
|
||||||
device = "sweet";
|
|
||||||
fingerprint = "Redmi/sweet_eea/sweet:13/TKQ1.221013.002/V14.0.7.0.TKFEUXM:user/release-keys";
|
|
||||||
description = "sweet_eea-user 13 TKQ1.221013.002 V14.0.7.0.TKFEUXM release-keys";
|
|
||||||
mod_device = "sweet_eea_global";
|
|
||||||
property_override("ro.boot.product.hardware.sku", "sweet");
|
|
||||||
} else if (region == "JAPAN") {
|
|
||||||
model = "M2101K6R";
|
|
||||||
device = "sweet";
|
|
||||||
fingerprint = "Redmi/sweet_global/sweet:13/TKQ1.221013.002/V14.0.9.0.TKFMIXM:user/release-keys";
|
|
||||||
description = "sweet_global-user 13 TKQ1.221013.002 V14.0.9.0.TKFMIXM release-keys";
|
|
||||||
mod_device = "sweet_global";
|
|
||||||
property_override("ro.boot.product.hardware.sku", "sweet");
|
|
||||||
} else if (region == "INDIA") {
|
|
||||||
if (sku == "std") {
|
|
||||||
model = "M2101K6P";
|
|
||||||
device = "sweetin";
|
|
||||||
fingerprint = "Redmi/sweetin/sweetin:13/TKQ1.221013.002/V14.0.1.0.TKFINXM:user/release-keys";
|
|
||||||
description = "sweetin-user 13 TKQ1.221013.002 V14.0.1.0.TKFINXM release-keys";
|
|
||||||
mod_device = "sweetin_in_global";
|
|
||||||
} else {
|
|
||||||
model = "M2101K6I";
|
|
||||||
device = "sweetin";
|
|
||||||
fingerprint = "Redmi/sweetinpro/sweetin:13/TKQ1.221013.002/V14.0.1.0.TKFINXM:user/release-keys";
|
|
||||||
description = "sweetinpro-user 13 TKQ1.221013.002 V14.0.1.0.TKFINXM release-keys";
|
|
||||||
mod_device = "sweetin_in_global";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
set_ro_build_prop("fingerprint", fingerprint);
|
|
||||||
set_ro_product_prop("device", device);
|
|
||||||
set_ro_product_prop("model", model);
|
|
||||||
property_override("ro.build.description", description.c_str());
|
|
||||||
if (mod_device != "") {
|
|
||||||
property_override("ro.product.mod_device", mod_device.c_str());
|
|
||||||
}
|
|
||||||
}
|
|
@ -23,3 +23,5 @@ PRODUCT_MANUFACTURER := Xiaomi
|
|||||||
PRODUCT_GMS_CLIENTID_BASE := android-xiaomi
|
PRODUCT_GMS_CLIENTID_BASE := android-xiaomi
|
||||||
|
|
||||||
BUILD_FINGERPRINT := Redmi/sweet_global/sweet:13/TKQ1.221013.002/V14.0.9.0.TKFMIXM:user/release-keys
|
BUILD_FINGERPRINT := Redmi/sweet_global/sweet:13/TKQ1.221013.002/V14.0.9.0.TKFMIXM:user/release-keys
|
||||||
|
PRODUCT_BUILD_PROP_OVERRIDES += \
|
||||||
|
PRIVATE_BUILD_DESC="sweet_global-user 13 TKQ1.221013.002 V14.0.9.0.TKFMIXM release-keys"
|
||||||
|
5
properties/build_GLOBAL.prop
Normal file
5
properties/build_GLOBAL.prop
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# Global model
|
||||||
|
ro.boot.product.vendor.sku=sweet
|
||||||
|
ro.product.odm.device=sweet
|
||||||
|
ro.product.odm.model=M2101K6G
|
||||||
|
ro.product.mod_device=sweet_eea_global
|
4
properties/build_INDIA-pro.prop
Normal file
4
properties/build_INDIA-pro.prop
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# Indian pro model
|
||||||
|
ro.product.odm.device=sweetin
|
||||||
|
ro.product.odm.model=M2101K6I
|
||||||
|
ro.product.mod_device=sweetin_in_global
|
4
properties/build_INDIA-std.prop
Normal file
4
properties/build_INDIA-std.prop
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# Indian standard model
|
||||||
|
ro.product.odm.device=sweetin
|
||||||
|
ro.product.odm.model=M2101K6P
|
||||||
|
ro.product.mod_device=sweetin_in_global
|
5
properties/build_JAPAN.prop
Normal file
5
properties/build_JAPAN.prop
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# Japan model
|
||||||
|
ro.boot.product.vendor.sku=sweet
|
||||||
|
ro.product.odm.device=sweet
|
||||||
|
ro.product.odm.model=M2101K6R
|
||||||
|
ro.product.mod_device=sweet_global
|
7
properties/odm.prop
Normal file
7
properties/odm.prop
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# Model-specific properties
|
||||||
|
import /odm/etc/build_${ro.boot.hwc}.prop
|
||||||
|
import /odm/etc/build_${ro.boot.hwc}-${ro.boot.product.hardware.sku}.prop
|
||||||
|
|
||||||
|
# Model-specific properties (recovery)
|
||||||
|
import /build_${ro.boot.hwc}.prop
|
||||||
|
import /build_${ro.boot.hwc}-${ro.boot.product.hardware.sku}.prop
|
@ -16,3 +16,6 @@ vendor.display.override_doze_mode=1
|
|||||||
|
|
||||||
# Fluence
|
# Fluence
|
||||||
ro.vendor.audio.sdk.fluencetype=fluence
|
ro.vendor.audio.sdk.fluencetype=fluence
|
||||||
|
|
||||||
|
# System properties
|
||||||
|
ro.product.property_source_order=odm,vendor,product,system_ext,system
|
@ -1,4 +1,4 @@
|
|||||||
on property:ro.boot.product.hardware.sku=sweet
|
on property:ro.boot.product.vendor.sku=sweet
|
||||||
enable vendor.nfc_hal_service
|
enable vendor.nfc_hal_service
|
||||||
|
|
||||||
service vendor.nfc_hal_service /vendor/bin/hw/android.hardware.nfc@1.2-service
|
service vendor.nfc_hal_service /vendor/bin/hw/android.hardware.nfc@1.2-service
|
||||||
|
Loading…
Reference in New Issue
Block a user