force effects change

This commit is contained in:
Pierre-Hugues Husson 2019-02-28 23:35:47 +01:00
parent cb35d750de
commit 2a1b5b7e11

View File

@ -10,18 +10,18 @@ vndk="$(getprop persist.sys.vndk)"
setprop sys.usb.ffs.aio_compat true setprop sys.usb.ffs.aio_compat true
fixSPL() { fixSPL() {
if [ "$(getprop ro.product.cpu.abi)" == "armeabi-v7a" ];then if [ "$(getprop ro.product.cpu.abi)" = "armeabi-v7a" ];then
setprop ro.keymaster.mod 'AOSP on ARM32' setprop ro.keymaster.mod 'AOSP on ARM32'
else else
setprop ro.keymaster.mod 'AOSP on ARM64' setprop ro.keymaster.mod 'AOSP on ARM64'
fi fi
img="$(find /dev/block -type l -name kernel$(getprop ro.boot.slot_suffix) |grep by-name |head -n 1)" img="$(find /dev/block -type l -name kernel"$(getprop ro.boot.slot_suffix)" |grep by-name |head -n 1)"
[ -z "$img" ] && img="$(find /dev/block -type l -name boot$(getprop ro.boot.slot_suffix) |grep by-name |head -n 1)" [ -z "$img" ] && img="$(find /dev/block -type l -name boot"$(getprop ro.boot.slot_suffix)" |grep by-name |head -n 1)"
if [ -n "$img" ];then if [ -n "$img" ];then
#Rewrite SPL/Android version if needed #Rewrite SPL/Android version if needed
Arelease="$(getSPL $img android)" Arelease="$(getSPL "$img" android)"
setprop ro.keymaster.xxx.release "$Arelease" setprop ro.keymaster.xxx.release "$Arelease"
setprop ro.keymaster.xxx.security_patch "$(getSPL $img spl)" setprop ro.keymaster.xxx.security_patch "$(getSPL "$img" spl)"
getprop ro.vendor.build.fingerprint |grep -qiE '^samsung/' && return 0 getprop ro.vendor.build.fingerprint |grep -qiE '^samsung/' && return 0
for f in \ for f in \
@ -32,6 +32,7 @@ fixSPL() {
/system/lib/vndk-27/libsoftkeymasterdevice.so /system/lib64/vndk-27/libsoftkeymasterdevice.so \ /system/lib/vndk-27/libsoftkeymasterdevice.so /system/lib64/vndk-27/libsoftkeymasterdevice.so \
;do ;do
[ ! -f $f ] && continue [ ! -f $f ] && continue
# shellcheck disable=SC2010
ctxt="$(ls -lZ $f |grep -oE 'u:object_r:[^:]*:s0')" ctxt="$(ls -lZ $f |grep -oE 'u:object_r:[^:]*:s0')"
b="$(echo "$f"|tr / _)" b="$(echo "$f"|tr / _)"
@ -44,10 +45,10 @@ fixSPL() {
chcon "$ctxt" /mnt/phh/$b chcon "$ctxt" /mnt/phh/$b
mount -o bind /mnt/phh/$b $f mount -o bind /mnt/phh/$b $f
done done
if [ "$(getprop init.svc.keymaster-3-0)" == "running" ];then if [ "$(getprop init.svc.keymaster-3-0)" = "running" ];then
setprop ctl.restart keymaster-3-0 setprop ctl.restart keymaster-3-0
fi fi
if [ "$(getprop init.svc.teed)" == "running" ];then if [ "$(getprop init.svc.teed)" = "running" ];then
setprop ctl.restart teed setprop ctl.restart teed
fi fi
fi fi
@ -96,14 +97,14 @@ changeKeylayout() {
changed=true changed=true
fi fi
if [ "$changed" == true ];then if [ "$changed" = true ];then
mount -o bind /mnt/phh/keylayout /system/usr/keylayout mount -o bind /mnt/phh/keylayout /system/usr/keylayout
restorecon -R /system/usr/keylayout restorecon -R /system/usr/keylayout
fi fi
} }
if mount -o remount,rw /system;then if mount -o remount,rw /system;then
resize2fs $(grep ' /system ' /proc/mounts |cut -d ' ' -f 1) || true resize2fs "$(grep ' /system ' /proc/mounts |cut -d ' ' -f 1)" || true
elif mount -o remount,rw /;then elif mount -o remount,rw /;then
resize2fs /dev/root || true resize2fs /dev/root || true
fi fi
@ -128,7 +129,7 @@ fi
if getprop ro.hardware |grep -qF qcom && [ -f /sys/class/backlight/panel0-backlight/max_brightness ] && \ if getprop ro.hardware |grep -qF qcom && [ -f /sys/class/backlight/panel0-backlight/max_brightness ] && \
grep -qvE '^255$' /sys/class/backlight/panel0-backlight/max_brightness;then grep -qvE '^255$' /sys/class/backlight/panel0-backlight/max_brightness;then
setprop persist.sys.qcom-brightness $(cat /sys/class/backlight/panel0-backlight/max_brightness) setprop persist.sys.qcom-brightness "$(cat /sys/class/backlight/panel0-backlight/max_brightness)"
fi fi
#Sony don't use Qualcomm HAL, so they don't have their mess #Sony don't use Qualcomm HAL, so they don't have their mess
@ -161,7 +162,7 @@ if getprop ro.vendor.build.fingerprint |grep -q -i \
-e xiaomi/clover -e xiaomi/wayne -e xiaomi/sakura \ -e xiaomi/clover -e xiaomi/wayne -e xiaomi/sakura \
-e xiaomi/nitrogen -e xiaomi/whyred -e xiaomi/platina \ -e xiaomi/nitrogen -e xiaomi/whyred -e xiaomi/platina \
-e xiaomi/ysl;then -e xiaomi/ysl;then
setprop persist.sys.qcom-brightness $(cat /sys/class/leds/lcd-backlight/max_brightness) setprop persist.sys.qcom-brightness "$(cat /sys/class/leds/lcd-backlight/max_brightness)"
fi fi
if getprop ro.vendor.build.fingerprint |grep -iq \ if getprop ro.vendor.build.fingerprint |grep -iq \
@ -177,6 +178,13 @@ fi
if [ "$(getprop ro.vendor.product.manufacturer)" == "motorola" ];then if [ "$(getprop ro.vendor.product.manufacturer)" == "motorola" ];then
if getprop ro.vendor.product.device |grep -q -e nora -e ali -e hannah -e evert -e jeter;then if getprop ro.vendor.product.device |grep -q -e nora -e ali -e hannah -e evert -e jeter;then
mount -o bind /mnt/phh/empty_dir /vendor/lib64/soundfx
mount -o bind /mnt/phh/empty_dir /vendor/lib/soundfx
fi
fi
if true;then
f="/vendor/lib/libeffects.so" f="/vendor/lib/libeffects.so"
ctxt="$(ls -lZ $f |grep -oE 'u:object_r:[^:]*:s0')" ctxt="$(ls -lZ $f |grep -oE 'u:object_r:[^:]*:s0')"
b="$(echo "$f"|tr / _)" b="$(echo "$f"|tr / _)"
@ -187,10 +195,6 @@ if [ "$(getprop ro.vendor.product.manufacturer)" == "motorola" ];then
/mnt/phh/$b /mnt/phh/$b
chcon "$ctxt" /mnt/phh/$b chcon "$ctxt" /mnt/phh/$b
mount -o bind /mnt/phh/$b $f mount -o bind /mnt/phh/$b $f
mount -o bind /mnt/phh/empty_dir /vendor/lib64/soundfx
mount -o bind /mnt/phh/empty_dir /vendor/lib/soundfx
fi
fi fi
if getprop ro.vendor.build.fingerprint |grep -q -i -e xiaomi/wayne -e xiaomi/jasmine;then if getprop ro.vendor.build.fingerprint |grep -q -i -e xiaomi/wayne -e xiaomi/jasmine;then