shfmt -i4 -w

This commit is contained in:
Pierre-Hugues Husson 2019-03-04 22:01:39 +01:00
parent a8b1cfb7cb
commit c97cc4c507

View File

@ -10,47 +10,46 @@ 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 \
/vendor/lib64/hw/android.hardware.keymaster@3.0-impl-qti.so /vendor/lib/hw/android.hardware.keymaster@3.0-impl-qti.so \ /vendor/lib64/hw/android.hardware.keymaster@3.0-impl-qti.so /vendor/lib/hw/android.hardware.keymaster@3.0-impl-qti.so \
/system/lib64/vndk-26/libsoftkeymasterdevice.so /vendor/bin/teed \ /system/lib64/vndk-26/libsoftkeymasterdevice.so /vendor/bin/teed \
/system/lib64/vndk/libsoftkeymasterdevice.so /system/lib/vndk/libsoftkeymasterdevice.so \ /system/lib64/vndk/libsoftkeymasterdevice.so /system/lib/vndk/libsoftkeymasterdevice.so \
/system/lib/vndk-26/libsoftkeymasterdevice.so \ /system/lib/vndk-26/libsoftkeymasterdevice.so \
/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 # 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 / _)"
cp -a "$f" "/mnt/phh/$b" cp -a "$f" "/mnt/phh/$b"
sed -i \ sed -i \
-e 's/ro.build.version.release/ro.keymaster.xxx.release/g' \ -e 's/ro.build.version.release/ro.keymaster.xxx.release/g' \
-e 's/ro.build.version.security_patch/ro.keymaster.xxx.security_patch/g' \ -e 's/ro.build.version.security_patch/ro.keymaster.xxx.security_patch/g' \
-e 's/ro.product.model/ro.keymaster.mod/g' \ -e 's/ro.product.model/ro.keymaster.mod/g' \
"/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"
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
} }
@ -58,8 +57,8 @@ changeKeylayout() {
cp -a /system/usr/keylayout /mnt/phh/keylayout cp -a /system/usr/keylayout /mnt/phh/keylayout
changed=false changed=false
if getprop ro.vendor.build.fingerprint | \ if getprop ro.vendor.build.fingerprint |
grep -qE -e ".*(crown|star)[q2]*lte.*" -e ".*(SC-0[23]K|SCV3[89]).*";then grep -qE -e ".*(crown|star)[q2]*lte.*" -e ".*(SC-0[23]K|SCV3[89]).*"; then
changed=true changed=true
cp /system/phh/samsung-gpio_keys.kl /mnt/phh/keylayout/gpio_keys.kl cp /system/phh/samsung-gpio_keys.kl /mnt/phh/keylayout/gpio_keys.kl
@ -67,11 +66,11 @@ changeKeylayout() {
chmod 0644 /mnt/phh/keylayout/gpio_keys.kl /mnt/phh/keylayout/sec_touchscreen.kl chmod 0644 /mnt/phh/keylayout/gpio_keys.kl /mnt/phh/keylayout/sec_touchscreen.kl
fi fi
if getprop ro.vendor.build.fingerprint |grep -iq \ if getprop ro.vendor.build.fingerprint | grep -iq \
-e xiaomi/polaris -e xiaomi/sirius -e xiaomi/dipper \ -e xiaomi/polaris -e xiaomi/sirius -e xiaomi/dipper \
-e xiaomi/wayne -e xiaomi/jasmine -e xiaomi/jasmine_sprout \ -e xiaomi/wayne -e xiaomi/jasmine -e xiaomi/jasmine_sprout \
-e xiaomi/platina -e iaomi/perseus -e xiaomi/ysl \ -e xiaomi/platina -e iaomi/perseus -e xiaomi/ysl \
-e xiaomi/nitrogen -e xiaomi/daisy -e xiaomi/sakura;then -e xiaomi/nitrogen -e xiaomi/daisy -e xiaomi/sakura; then
cp /system/phh/empty /mnt/phh/keylayout/uinput-goodix.kl cp /system/phh/empty /mnt/phh/keylayout/uinput-goodix.kl
chmod 0644 /mnt/phh/keylayout/uinput-goodix.kl chmod 0644 /mnt/phh/keylayout/uinput-goodix.kl
cp /system/phh/empty /mnt/phh/keylayout/uinput-fpc.kl cp /system/phh/empty /mnt/phh/keylayout/uinput-fpc.kl
@ -79,34 +78,34 @@ changeKeylayout() {
changed=true changed=true
fi fi
if getprop ro.vendor.build.fingerprint |grep -qi oneplus/oneplus6/oneplus6;then if getprop ro.vendor.build.fingerprint | grep -qi oneplus/oneplus6/oneplus6; then
cp /system/phh/oneplus6-synaptics_s3320.kl /mnt/phh/keylayout/synaptics_s3320.kl cp /system/phh/oneplus6-synaptics_s3320.kl /mnt/phh/keylayout/synaptics_s3320.kl
chmod 0644 /mnt/phh/keylayout/synaptics_s3320.kl chmod 0644 /mnt/phh/keylayout/synaptics_s3320.kl
changed=true changed=true
fi fi
if getprop ro.vendor.build.fingerprint |grep -iq -e iaomi/perseus;then if getprop ro.vendor.build.fingerprint | grep -iq -e iaomi/perseus; then
cp /system/phh/mimix3-gpio-keys.kl /mnt/phh/keylayout/gpio-keys.kl cp /system/phh/mimix3-gpio-keys.kl /mnt/phh/keylayout/gpio-keys.kl
chmod 0644 /mnt/phh/keylayout/gpio-keys.kl chmod 0644 /mnt/phh/keylayout/gpio-keys.kl
changed=true changed=true
fi fi
if getprop ro.vendor.build.fingerprint |grep -iq -E -e '^Sony/G834';then if getprop ro.vendor.build.fingerprint | grep -iq -E -e '^Sony/G834'; then
cp /system/phh/sony-gpio-keys.kl /mnt/phh/keylayout/gpio-keys.kl cp /system/phh/sony-gpio-keys.kl /mnt/phh/keylayout/gpio-keys.kl
chmod 0644 /mnt/phh/keylayout/gpio-keys.kl chmod 0644 /mnt/phh/keylayout/gpio-keys.kl
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
mount -o remount,ro /system || true mount -o remount,ro /system || true
mount -o remount,ro / || true mount -o remount,ro / || true
@ -118,38 +117,37 @@ fixSPL
changeKeylayout changeKeylayout
if grep vendor.huawei.hardware.biometrics.fingerprint /vendor/manifest.xml; then
if grep vendor.huawei.hardware.biometrics.fingerprint /vendor/manifest.xml;then
mount -o bind system/phh/huawei/fingerprint.kl /vendor/usr/keylayout/fingerprint.kl mount -o bind system/phh/huawei/fingerprint.kl /vendor/usr/keylayout/fingerprint.kl
fi fi
if ! grep android.hardware.biometrics.fingerprint /vendor/manifest.xml && ! grep android.hardware.biometrics.fingerprint /vendor/etc/vintf/manifest.xml;then if ! grep android.hardware.biometrics.fingerprint /vendor/manifest.xml && ! grep android.hardware.biometrics.fingerprint /vendor/etc/vintf/manifest.xml; then
mount -o bind system/phh/empty /system/etc/permissions/android.hardware.fingerprint.xml mount -o bind system/phh/empty /system/etc/permissions/android.hardware.fingerprint.xml
fi 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
if getprop ro.vendor.build.fingerprint |grep -qE 'Sony/';then if getprop ro.vendor.build.fingerprint | grep -qE 'Sony/'; then
setprop persist.sys.qcom-brightness -1 setprop persist.sys.qcom-brightness -1
fi fi
if getprop ro.vendor.build.fingerprint |grep -qi oneplus/oneplus6/oneplus6;then if getprop ro.vendor.build.fingerprint | grep -qi oneplus/oneplus6/oneplus6; then
resize2fs /dev/block/platform/soc/1d84000.ufshc/by-name/userdata resize2fs /dev/block/platform/soc/1d84000.ufshc/by-name/userdata
fi fi
if getprop ro.vendor.build.fingerprint |grep -q full_k50v1_64 || getprop ro.hardware |grep -q mt6580 ;then if getprop ro.vendor.build.fingerprint | grep -q full_k50v1_64 || getprop ro.hardware | grep -q mt6580; then
setprop persist.sys.overlay.nightmode false setprop persist.sys.overlay.nightmode false
fi fi
if getprop ro.wlan.mtk.wifi.5g |grep -q 1;then if getprop ro.wlan.mtk.wifi.5g | grep -q 1; then
setprop persist.sys.overlay.wifi5g true setprop persist.sys.overlay.wifi5g true
fi fi
if grep -qF 'mkdir /data/.fps 0770 system fingerp' vendor/etc/init/hw/init.mmi.rc;then if grep -qF 'mkdir /data/.fps 0770 system fingerp' vendor/etc/init/hw/init.mmi.rc; then
mkdir -p /data/.fps mkdir -p /data/.fps
chmod 0770 /data/.fps chmod 0770 /data/.fps
chown system:9015 /data/.fps chown system:9015 /data/.fps
@ -158,30 +156,30 @@ if grep -qF 'mkdir /data/.fps 0770 system fingerp' vendor/etc/init/hw/init.mmi.r
chown system:9015 /sys/devices/soc/soc:fpc_fpc1020/irq_cnt chown system:9015 /sys/devices/soc/soc:fpc_fpc1020/irq_cnt
fi fi
if getprop ro.vendor.build.fingerprint |grep -q -i \ 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 \
-e Xiaomi/beryllium/beryllium -e Xiaomi/sirius/sirius \ -e Xiaomi/beryllium/beryllium -e Xiaomi/sirius/sirius \
-e Xiaomi/dipper/dipper -e Xiaomi/ursa/ursa -e Xiaomi/polaris/polaris \ -e Xiaomi/dipper/dipper -e Xiaomi/ursa/ursa -e Xiaomi/polaris/polaris \
-e motorola/ali/ali -e iaomi/perseus/perseus -e iaomi/platina/platina \ -e motorola/ali/ali -e iaomi/perseus/perseus -e iaomi/platina/platina \
-e iaomi/equuleus/equuleus -e motorola/nora -e xiaomi/nitrogen \ -e iaomi/equuleus/equuleus -e motorola/nora -e xiaomi/nitrogen \
-e motorola/hannah -e motorola/james -e motorola/pettyl;then -e motorola/hannah -e motorola/james -e motorola/pettyl; then
mount -o bind /mnt/phh/empty_dir /vendor/lib64/soundfx mount -o bind /mnt/phh/empty_dir /vendor/lib64/soundfx
mount -o bind /mnt/phh/empty_dir /vendor/lib/soundfx mount -o bind /mnt/phh/empty_dir /vendor/lib/soundfx
fi fi
if [ "$(getprop ro.vendor.product.manufacturer)" = "motorola" ] || [ "$(getprop ro.product.vendor.manufacturer)" = "motorola" ];then if [ "$(getprop ro.vendor.product.manufacturer)" = "motorola" ] || [ "$(getprop ro.product.vendor.manufacturer)" = "motorola" ]; then
if getprop ro.vendor.product.device |grep -q -e nora -e ali -e hannah -e evert -e jeter -e deen -e james -e pettyl;then if getprop ro.vendor.product.device | grep -q -e nora -e ali -e hannah -e evert -e jeter -e deen -e james -e pettyl; then
if [ "$vndk" -ge 28 ];then if [ "$vndk" -ge 28 ]; then
f="/vendor/lib/libeffects.so" f="/vendor/lib/libeffects.so"
# shellcheck disable=SC2010 # 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 / _)"
cp -a $f "/mnt/phh/$b" cp -a $f "/mnt/phh/$b"
sed -i \ sed -i \
@ -196,33 +194,33 @@ if [ "$(getprop ro.vendor.product.manufacturer)" = "motorola" ] || [ "$(getprop
fi fi
fi fi
for f in /vendor/lib/libeffects.so /vendor/lib64/libeffects.so;do for f in /vendor/lib/libeffects.so /vendor/lib64/libeffects.so; do
[ ! -f $f ] && continue [ ! -f $f ] && continue
f="/vendor/lib/libeffects.so" f="/vendor/lib/libeffects.so"
# shellcheck disable=SC2010 # 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 / _)"
cp -a "$f" "/mnt/phh/$b" cp -a "$f" "/mnt/phh/$b"
sed -i \ sed -i \
's/%zu errors during loading of configuration: %s/%zu errors during loading of configuration: ss/g' \ 's/%zu errors during loading of configuration: %s/%zu errors during loading of configuration: ss/g' \
"/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"
done done
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
setprop persist.imx376_sunny.low.lux 310 setprop persist.imx376_sunny.low.lux 310
setprop persist.imx376_sunny.light.lux 280 setprop persist.imx376_sunny.light.lux 280
setprop persist.imx376_ofilm.low.lux 310 setprop persist.imx376_ofilm.low.lux 310
setprop persist.imx376_ofilm.light.lux 280 setprop persist.imx376_ofilm.light.lux 280
fi fi
for f in /vendor/lib/mtk-ril.so /vendor/lib64/mtk-ril.so /vendor/lib/libmtk-ril.so /vendor/lib64/libmtk-ril.so;do for f in /vendor/lib/mtk-ril.so /vendor/lib64/mtk-ril.so /vendor/lib/libmtk-ril.so /vendor/lib64/libmtk-ril.so; do
[ ! -f $f ] && continue [ ! -f $f ] && continue
# shellcheck disable=SC2010 # 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 / _)"
cp -a "$f" "/mnt/phh/$b" cp -a "$f" "/mnt/phh/$b"
sed -i \ sed -i \
@ -237,77 +235,77 @@ done
mount -o bind /system/phh/empty /vendor/overlay/SysuiDarkTheme/SysuiDarkTheme.apk || true mount -o bind /system/phh/empty /vendor/overlay/SysuiDarkTheme/SysuiDarkTheme.apk || true
mount -o bind /system/phh/empty /vendor/overlay/SysuiDarkTheme/SysuiDarkThemeOverlay.apk || true mount -o bind /system/phh/empty /vendor/overlay/SysuiDarkTheme/SysuiDarkThemeOverlay.apk || true
if grep -qF 'PowerVR Rogue GE8100' /vendor/lib/egl/GLESv1_CM_mtk.so || \ if grep -qF 'PowerVR Rogue GE8100' /vendor/lib/egl/GLESv1_CM_mtk.so ||
grep -qF 'PowerVR Rogue' /vendor/lib/egl/libGLESv1_CM_mtk.so || \ grep -qF 'PowerVR Rogue' /vendor/lib/egl/libGLESv1_CM_mtk.so ||
(getprop ro.product.board | grep -qiE -e msm8917 -e msm8937 -e msm8940);then (getprop ro.product.board | grep -qiE -e msm8917 -e msm8937 -e msm8940); then
setprop debug.hwui.renderer opengl setprop debug.hwui.renderer opengl
fi fi
#If we have both Samsung and AOSP power hal, take Samsung's #If we have both Samsung and AOSP power hal, take Samsung's
if [ -f /vendor/bin/hw/vendor.samsung.hardware.miscpower@1.0-service ];then if [ -f /vendor/bin/hw/vendor.samsung.hardware.miscpower@1.0-service ]; then
mount -o bind /system/phh/empty /vendor/bin/hw/android.hardware.power@1.0-service mount -o bind /system/phh/empty /vendor/bin/hw/android.hardware.power@1.0-service
fi fi
if [ "$vndk" = 27 ] || [ "$vndk" = 26 ];then if [ "$vndk" = 27 ] || [ "$vndk" = 26 ]; then
mount -o bind /system/phh/libnfc-nci-oreo.conf /system/etc/libnfc-nci.conf mount -o bind /system/phh/libnfc-nci-oreo.conf /system/etc/libnfc-nci.conf
fi fi
if busybox_phh unzip -p /vendor/app/ims/ims.apk classes.dex |grep -qF -e Landroid/telephony/ims/feature/MmTelFeature -e Landroid/telephony/ims/feature/MMTelFeature;then if busybox_phh unzip -p /vendor/app/ims/ims.apk classes.dex | grep -qF -e Landroid/telephony/ims/feature/MmTelFeature -e Landroid/telephony/ims/feature/MMTelFeature; then
mount -o bind /system/phh/empty /vendor/app/ims/ims.apk mount -o bind /system/phh/empty /vendor/app/ims/ims.apk
fi fi
if getprop ro.hardware |grep -qF samsungexynos;then if getprop ro.hardware | grep -qF samsungexynos; then
setprop debug.sf.latch_unsignaled 1 setprop debug.sf.latch_unsignaled 1
fi fi
if getprop ro.product.model |grep -qF ANE;then if getprop ro.product.model | grep -qF ANE; then
setprop debug.sf.latch_unsignaled 1 setprop debug.sf.latch_unsignaled 1
fi fi
if getprop ro.vendor.build.fingerprint |grep -iq -E -e 'huawei|honor' || getprop persist.sys.overlay.huawei |grep -iq -E -e 'true' ; then if getprop ro.vendor.build.fingerprint | grep -iq -E -e 'huawei|honor' || getprop persist.sys.overlay.huawei | grep -iq -E -e 'true'; then
p=/product/etc/nfc/libnfc_nxp_*_*.conf p=/product/etc/nfc/libnfc_nxp_*_*.conf
mount -o bind "$p" /system/etc/libnfc-nxp.conf || \ mount -o bind "$p" /system/etc/libnfc-nxp.conf ||
mount -o bind /product/etc/libnfc-nxp.conf /system/etc/libnfc-nxp.conf || true mount -o bind /product/etc/libnfc-nxp.conf /system/etc/libnfc-nxp.conf || true
p=/product/etc/nfc/libnfc_brcm_*_*.conf p=/product/etc/nfc/libnfc_brcm_*_*.conf
mount -o bind "$p" /system/etc/libnfc-brcm.conf || \ mount -o bind "$p" /system/etc/libnfc-brcm.conf ||
mount -o bind /product/etc/libnfc-nxp.conf /system/etc/libnfc-nxp.conf || true mount -o bind /product/etc/libnfc-nxp.conf /system/etc/libnfc-nxp.conf || true
mount -o bind /system/phh/libnfc-nci-huawei.conf /system/etc/libnfc-nci.conf mount -o bind /system/phh/libnfc-nci-huawei.conf /system/etc/libnfc-nci.conf
fi fi
if getprop ro.vendor.build.fingerprint | grep -qE -e ".*(crown|star)[q2]*lte.*" -e ".*(SC-0[23]K|SCV3[89]).*";then if getprop ro.vendor.build.fingerprint | grep -qE -e ".*(crown|star)[q2]*lte.*" -e ".*(SC-0[23]K|SCV3[89]).*"; then
for f in /vendor/lib/libfloatingfeature.so /vendor/lib64/libfloatingfeature.so;do for f in /vendor/lib/libfloatingfeature.so /vendor/lib64/libfloatingfeature.so; do
[ ! -f "$f" ] && continue [ ! -f "$f" ] && continue
# shellcheck disable=SC2010 # 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 / _)"
cp -a "$f" "/mnt/phh/$b" cp -a "$f" "/mnt/phh/$b"
sed -i \ sed -i \
-e 's;/system/etc/floating_feature.xml;/system/ph/sam-9810-flo_feat.xml;g' \ -e 's;/system/etc/floating_feature.xml;/system/ph/sam-9810-flo_feat.xml;g' \
"/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"
done done
fi fi
if getprop ro.vendor.build.fingerprint |grep -qiE '^samsung';then if getprop ro.vendor.build.fingerprint | grep -qiE '^samsung'; then
if getprop ro.hardware |grep -q qcom;then if getprop ro.hardware | grep -q qcom; then
setprop persist.sys.overlay.devinputjack false setprop persist.sys.overlay.devinputjack false
fi fi
if getprop ro.hardware |grep -q -e samsungexynos7870 -e qcom;then if getprop ro.hardware | grep -q -e samsungexynos7870 -e qcom; then
if [ "$vndk" -le 27 ];then if [ "$vndk" -le 27 ]; then
setprop persist.sys.phh.sdk_override /vendor/bin/hw/rild=27 setprop persist.sys.phh.sdk_override /vendor/bin/hw/rild=27
fi fi
fi fi
fi fi
if getprop ro.vendor.build.fingerprint | grep -qE '^xiaomi/daisy/daisy_sprout:8.1.0/OPM.*'; then if getprop ro.vendor.build.fingerprint | grep -qE '^xiaomi/daisy/daisy_sprout:8.1.0/OPM.*'; then
# Fix camera on DND, ugly workaround but meh # Fix camera on DND, ugly workaround but meh
setprop audio.camerasound.force true setprop audio.camerasound.force true
fi fi
mount -o bind /mnt/phh/empty_dir /vendor/etc/audio || true mount -o bind /mnt/phh/empty_dir /vendor/etc/audio || true