diff --git a/Android.bp b/Android.bp index 9515b25..909d423 100644 --- a/Android.bp +++ b/Android.bp @@ -1,2 +1,9 @@ soong_namespace { } + +install_symlink { + name: "sku_sweet_audio_symlink", + installed_location: "etc/audio/sku_sweet", + symlink_target: "/vendor/etc", + vendor: true, +} diff --git a/BoardConfig.mk b/BoardConfig.mk index be051f2..235915e 100644 --- a/BoardConfig.mk +++ b/BoardConfig.mk @@ -1,5 +1,5 @@ # -# Copyright (C) 2021 The LineageOS Project +# Copyright (C) 2021-2024 The LineageOS Project # # SPDX-License-Identifier: Apache-2.0 # @@ -17,14 +17,11 @@ TARGET_PROVIDES_AUDIO_EXTNS := true # HIDL DEVICE_MANIFEST_FILE += $(DEVICE_PATH)/configs/hidl/manifest.xml -ODM_MANIFEST_SKUS += sweet -ODM_MANIFEST_SWEET_FILES := \ +DEVICE_MANIFEST_SKUS += sweet +DEVICE_MANIFEST_SWEET_FILES := \ + $(DEVICE_MANIFEST_FILE) \ $(DEVICE_PATH)/configs/hidl/manifest-nfc.xml -# Init -TARGET_INIT_VENDOR_LIB := //$(DEVICE_PATH):libinit_sweet -TARGET_RECOVERY_DEVICE_MODULES := libinit_sweet - # Kernel 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 # 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 TARGET_SCREEN_DENSITY := 440 diff --git a/device.mk b/device.mk index 5433b1a..2f4779b 100644 --- a/device.mk +++ b/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 # @@ -15,7 +15,8 @@ PRODUCT_SHIPPING_API_LEVEL := 30 # Audio PRODUCT_PACKAGES += \ - libtinycompress + libtinycompress \ + sku_sweet_audio_symlink PRODUCT_COPY_FILES += \ $(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 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.hcef.xml:$(TARGET_COPY_OUT_ODM)/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.uicc.xml:$(TARGET_COPY_OUT_ODM)/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/com.android.nfc_extras.xml:$(TARGET_COPY_OUT_ODM)/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/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_VENDOR)/etc/permissions/sku_sweet/android.hardware.nfc.hcef.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_VENDOR)/etc/permissions/sku_sweet/android.hardware.nfc.uicc.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_VENDOR)/etc/permissions/sku_sweet/com.android.nfc_extras.xml \ + frameworks/native/data/etc/com.nxp.mifare.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/sku_sweet/com.nxp.mifare.xml # IR PRODUCT_PACKAGES += \ @@ -93,6 +94,19 @@ PRODUCT_PACKAGES += \ PRODUCT_SOONG_NAMESPACES += \ $(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 PRODUCT_PACKAGES += \ vndservicemanager diff --git a/init/Android.bp b/init/Android.bp deleted file mode 100644 index b5b981e..0000000 --- a/init/Android.bp +++ /dev/null @@ -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"], -} diff --git a/init/init_sweet.cpp b/init/init_sweet.cpp deleted file mode 100644 index d8fc1fd..0000000 --- a/init/init_sweet.cpp +++ /dev/null @@ -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 - -#include -#define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_ -#include - -using android::base::GetProperty; - -std::vector 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()); - } -} diff --git a/lineage_sweet.mk b/lineage_sweet.mk index b92d27a..7892401 100644 --- a/lineage_sweet.mk +++ b/lineage_sweet.mk @@ -23,3 +23,5 @@ PRODUCT_MANUFACTURER := 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 +PRODUCT_BUILD_PROP_OVERRIDES += \ + PRIVATE_BUILD_DESC="sweet_global-user 13 TKQ1.221013.002 V14.0.9.0.TKFMIXM release-keys" diff --git a/properties/build_GLOBAL.prop b/properties/build_GLOBAL.prop new file mode 100644 index 0000000..2d7eb38 --- /dev/null +++ b/properties/build_GLOBAL.prop @@ -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 diff --git a/properties/build_INDIA-pro.prop b/properties/build_INDIA-pro.prop new file mode 100644 index 0000000..b52d3ed --- /dev/null +++ b/properties/build_INDIA-pro.prop @@ -0,0 +1,4 @@ +# Indian pro model +ro.product.odm.device=sweetin +ro.product.odm.model=M2101K6I +ro.product.mod_device=sweetin_in_global diff --git a/properties/build_INDIA-std.prop b/properties/build_INDIA-std.prop new file mode 100644 index 0000000..7573fc1 --- /dev/null +++ b/properties/build_INDIA-std.prop @@ -0,0 +1,4 @@ +# Indian standard model +ro.product.odm.device=sweetin +ro.product.odm.model=M2101K6P +ro.product.mod_device=sweetin_in_global diff --git a/properties/build_JAPAN.prop b/properties/build_JAPAN.prop new file mode 100644 index 0000000..f8d47fc --- /dev/null +++ b/properties/build_JAPAN.prop @@ -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 diff --git a/properties/odm.prop b/properties/odm.prop new file mode 100644 index 0000000..5f3f211 --- /dev/null +++ b/properties/odm.prop @@ -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 diff --git a/vendor.prop b/properties/vendor.prop similarity index 86% rename from vendor.prop rename to properties/vendor.prop index 8723b11..fc60669 100644 --- a/vendor.prop +++ b/properties/vendor.prop @@ -16,3 +16,6 @@ vendor.display.override_doze_mode=1 # Fluence ro.vendor.audio.sdk.fluencetype=fluence + +# System properties +ro.product.property_source_order=odm,vendor,product,system_ext,system diff --git a/rootdir/etc/init.sweet.rc b/rootdir/etc/init.sweet.rc index f29f425..d8de975 100644 --- a/rootdir/etc/init.sweet.rc +++ b/rootdir/etc/init.sweet.rc @@ -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 service vendor.nfc_hal_service /vendor/bin/hw/android.hardware.nfc@1.2-service