diff --git a/base.mk b/base.mk index 2293510..ada5526 100644 --- a/base.mk +++ b/base.mk @@ -144,6 +144,7 @@ PRODUCT_COPY_FILES += \ device/phh/treble/files/bv9500plus-mtk-kpd.kl:system/phh/bv9500plus-mtk-kpd.kl \ device/phh/treble/files/moto-liber-gpio-keys.kl:system/phh/moto-liber-gpio-keys.kl \ device/phh/treble/files/tecno-touchpanel.kl:system/phh/tecno-touchpanel.kl \ + device/phh/treble/files/rosemary-excluded-input-devices.xml:system/phh/rosemary-excluded-input-devices.xml SELINUX_IGNORE_NEVERALLOWS := true diff --git a/files/rosemary-excluded-input-devices.xml b/files/rosemary-excluded-input-devices.xml new file mode 100644 index 0000000..bb484cf --- /dev/null +++ b/files/rosemary-excluded-input-devices.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ota/phh-ota.cpp b/ota/phh-ota.cpp index e90106a..895a897 100644 --- a/ota/phh-ota.cpp +++ b/ota/phh-ota.cpp @@ -14,6 +14,17 @@ using namespace std::chrono_literals; using namespace std::string_literals; using android::fiemap::IImageManager; + +std::string getNextSlot() { + std::string current_slot; + std::string next_slot = "a"; + if(android::base::ReadFileToString("/metadata/phh/img", ¤t_slot) && + current_slot.c_str()[0] == 'a') { + next_slot = "b"; + } + return next_slot; +} + int main(int argc, char **argv) { mkdir("/metadata/gsi/phh", 0771); chown("/metadata/gsi/phh", 0, 1000); @@ -27,27 +38,13 @@ int main(int argc, char **argv) { return 0; } if(argc>=2 && strcmp(argv[1], "switch-slot") == 0) { - std::string current_slot; - std::string next_slot; - if(!android::base::ReadFileToString("/metadata/phh/img", ¤t_slot)) { - next_slot = "a"; - } else { - if(current_slot.c_str()[0] == 'a') - next_slot = "b"; - } + std::string next_slot = getNextSlot(); mkdir("/metadata/phh", 0700); android::base::WriteStringToFile(next_slot, "/metadata/phh/img"); return 0; } if(argc>=2 && strcmp(argv[1], "new-slot") == 0) { - std::string current_slot; - std::string next_slot; - if(!android::base::ReadFileToString("/metadata/phh/img", ¤t_slot)) { - next_slot = "a"; - } else { - if(current_slot.c_str()[0] == 'a') - next_slot = "b"; - } + std::string next_slot = getNextSlot(); std::string imageName = "system_otaphh_"s + next_slot; diff --git a/rw-system.sh b/rw-system.sh index c8cbeaa..8e84e4c 100644 --- a/rw-system.sh +++ b/rw-system.sh @@ -147,7 +147,7 @@ changeKeylayout() { fi if getprop ro.vendor.build.fingerprint | grep -iq \ - -e poco/ -e redmi/ -e xiaomi/ ; then + -e poco/ -e POCO/ -e redmi/ -e xiaomi/ ; then if [ ! -f /mnt/phh/keylayout/uinput-goodix.kl ]; then cp /system/phh/empty /mnt/phh/keylayout/uinput-goodix.kl chmod 0644 /mnt/phh/keylayout/uinput-goodix.kl @@ -392,9 +392,9 @@ if getprop ro.vendor.build.fingerprint | grep -iq \ setprop persist.sys.qcom-brightness -1 fi -# Lenovo Z5s brightness flickers without this setting +# Lenovo Z5s & Xiaomi Mi10TLite brightness flickers without this setting if getprop ro.vendor.build.fingerprint | grep -iq \ - -e Lenovo/jd2019; then + -e Lenovo/jd2019 -e Xiaomi/gauguin -e Redmi/gauguin; then setprop persist.sys.qcom-brightness -1 fi @@ -424,7 +424,7 @@ if getprop ro.vendor.build.fingerprint | grep -q -i \ -e xiaomi/nitrogen -e xiaomi/whyred -e xiaomi/platina \ -e xiaomi/ysl -e nubia/nx60 -e nubia/nx61 -e xiaomi/tulip \ -e xiaomi/lavender -e xiaomi/olive -e xiaomi/olivelite -e xiaomi/pine \ - -e Redmi/lancelot -e Redmi/galahad; then + -e Redmi/lancelot -e Redmi/galahad -e POCO/evergreen; then setprop persist.sys.qcom-brightness "$(cat /sys/class/leds/lcd-backlight/max_brightness)" fi @@ -457,7 +457,7 @@ if getprop ro.vendor.build.fingerprint | grep -iq \ -e motorola/hannah -e motorola/james -e motorola/pettyl -e xiaomi/cepheus \ -e xiaomi/grus -e xiaomi/cereus -e xiaomi/cactus -e xiaomi/raphael -e xiaomi/davinci \ -e xiaomi/ginkgo -e xiaomi/willow -e xiaomi/laurel_sprout -e xiaomi/andromeda \ - -e redmi/curtana -e redmi/picasso \ + -e xiaomi/gauguin -e redmi/gauguin -e redmi/curtana -e redmi/picasso \ -e bq/Aquaris_M10 ; then mount -o bind /mnt/phh/empty_dir /vendor/lib64/soundfx mount -o bind /mnt/phh/empty_dir /vendor/lib/soundfx @@ -581,10 +581,17 @@ if getprop ro.vendor.build.fingerprint | grep -iq -e Redmi/merlin; then setprop debug.sf.enable_hwc_vds 0 fi +if getprop ro.vendor.build.fingerprint | grep -iq -e Redmi/lancelot; then + setprop debug.sf.enable_hwc_vds 1 +fi + if getprop ro.vendor.build.fingerprint | grep -iq -e Redmi/rosemary \ -e Redmi/secret -e Redmi/maltose; then setprop debug.sf.latch_unsignaled 1 setprop debug.sf.enable_hwc_vds 0 + + # Exclude FP input devices + mount -o bind /system/phh/rosemary-excluded-input-devices.xml /system/etc/excluded-input-devices.xml fi if getprop ro.vendor.build.fingerprint | grep -iq -E -e 'huawei|honor' || getprop persist.sys.overlay.huawei | grep -iq -E -e 'true'; then