2018-04-10 16:33:33 +00:00
|
|
|
#!/system/bin/sh
|
|
|
|
|
2019-01-04 00:10:38 +00:00
|
|
|
#Uncomment me to output sh -x of this script to /cache/phh/logs
|
|
|
|
#if [ -z "$debug" ];then
|
|
|
|
# mkdir -p /cache/phh
|
|
|
|
# debug=1 exec sh -x "$(readlink -f -- "$0")" > /cache/phh/logs 2>&1
|
|
|
|
#fi
|
2018-04-10 16:33:33 +00:00
|
|
|
|
2018-09-17 12:04:50 +00:00
|
|
|
vndk="$(getprop persist.sys.vndk)"
|
2019-07-17 18:08:40 +00:00
|
|
|
[ -z "$vndk" ] && vndk="$(getprop ro.vndk.version |grep -oE '^[0-9]+')"
|
2018-08-16 12:59:26 +00:00
|
|
|
setprop sys.usb.ffs.aio_compat true
|
2018-08-14 18:02:34 +00:00
|
|
|
|
2018-05-14 11:34:52 +00:00
|
|
|
fixSPL() {
|
2019-03-04 21:01:39 +00:00
|
|
|
if [ "$(getprop ro.product.cpu.abi)" = "armeabi-v7a" ]; then
|
|
|
|
setprop ro.keymaster.mod 'AOSP on ARM32'
|
2018-05-19 14:54:30 +00:00
|
|
|
else
|
2019-03-04 21:01:39 +00:00
|
|
|
setprop ro.keymaster.mod 'AOSP on ARM64'
|
2018-05-19 14:54:30 +00:00
|
|
|
fi
|
2019-03-04 21:01:39 +00:00
|
|
|
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)"
|
|
|
|
if [ -n "$img" ]; then
|
2018-05-14 11:34:52 +00:00
|
|
|
#Rewrite SPL/Android version if needed
|
2019-02-28 21:48:04 +00:00
|
|
|
Arelease="$(getSPL "$img" android)"
|
2018-05-19 14:54:30 +00:00
|
|
|
setprop ro.keymaster.xxx.release "$Arelease"
|
2019-02-28 21:48:04 +00:00
|
|
|
setprop ro.keymaster.xxx.security_patch "$(getSPL "$img" spl)"
|
2018-05-14 11:34:52 +00:00
|
|
|
|
2019-03-04 21:01:39 +00:00
|
|
|
getprop ro.vendor.build.fingerprint | grep -qiE '^samsung/' && return 0
|
2018-11-18 20:44:01 +00:00
|
|
|
for f in \
|
2019-03-04 21:01:39 +00:00
|
|
|
/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/libsoftkeymasterdevice.so /system/lib/vndk/libsoftkeymasterdevice.so \
|
|
|
|
/system/lib/vndk-26/libsoftkeymasterdevice.so \
|
|
|
|
/system/lib/vndk-27/libsoftkeymasterdevice.so /system/lib64/vndk-27/libsoftkeymasterdevice.so; do
|
2019-03-04 20:54:48 +00:00
|
|
|
[ ! -f "$f" ] && continue
|
2019-03-04 21:01:39 +00:00
|
|
|
# shellcheck disable=SC2010
|
|
|
|
ctxt="$(ls -lZ "$f" | grep -oE 'u:object_r:[^:]*:s0')"
|
|
|
|
b="$(echo "$f" | tr / _)"
|
2018-05-14 11:34:52 +00:00
|
|
|
|
2019-03-04 20:54:48 +00:00
|
|
|
cp -a "$f" "/mnt/phh/$b"
|
2018-05-19 14:54:30 +00:00
|
|
|
sed -i \
|
2019-03-04 21:01:39 +00:00
|
|
|
-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.product.model/ro.keymaster.mod/g' \
|
|
|
|
"/mnt/phh/$b"
|
2019-03-04 20:54:48 +00:00
|
|
|
chcon "$ctxt" "/mnt/phh/$b"
|
|
|
|
mount -o bind "/mnt/phh/$b" "$f"
|
2018-05-14 11:34:52 +00:00
|
|
|
done
|
2019-03-04 21:01:39 +00:00
|
|
|
if [ "$(getprop init.svc.keymaster-3-0)" = "running" ]; then
|
|
|
|
setprop ctl.restart keymaster-3-0
|
|
|
|
fi
|
|
|
|
if [ "$(getprop init.svc.teed)" = "running" ]; then
|
|
|
|
setprop ctl.restart teed
|
|
|
|
fi
|
2018-05-14 11:34:52 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2018-09-03 12:58:11 +00:00
|
|
|
changeKeylayout() {
|
|
|
|
cp -a /system/usr/keylayout /mnt/phh/keylayout
|
|
|
|
changed=false
|
|
|
|
|
2019-03-04 21:01:39 +00:00
|
|
|
if getprop ro.vendor.build.fingerprint |
|
2019-08-19 22:03:14 +00:00
|
|
|
grep -qE -e "^samsung"; then
|
2018-09-03 12:58:11 +00:00
|
|
|
changed=true
|
|
|
|
|
|
|
|
cp /system/phh/samsung-gpio_keys.kl /mnt/phh/keylayout/gpio_keys.kl
|
|
|
|
cp /system/phh/samsung-sec_touchscreen.kl /mnt/phh/keylayout/sec_touchscreen.kl
|
|
|
|
chmod 0644 /mnt/phh/keylayout/gpio_keys.kl /mnt/phh/keylayout/sec_touchscreen.kl
|
|
|
|
fi
|
|
|
|
|
2019-03-04 21:01:39 +00:00
|
|
|
if getprop ro.vendor.build.fingerprint | grep -iq \
|
2018-12-28 15:33:23 +00:00
|
|
|
-e xiaomi/polaris -e xiaomi/sirius -e xiaomi/dipper \
|
|
|
|
-e xiaomi/wayne -e xiaomi/jasmine -e xiaomi/jasmine_sprout \
|
2019-01-15 19:24:21 +00:00
|
|
|
-e xiaomi/platina -e iaomi/perseus -e xiaomi/ysl \
|
2019-05-06 13:53:00 +00:00
|
|
|
-e xiaomi/nitrogen -e xiaomi/daisy -e xiaomi/sakura \
|
2019-05-20 21:32:56 +00:00
|
|
|
-e xiaomi/whyred -e xiaomi/tulip; then
|
2019-06-11 04:58:49 +00:00
|
|
|
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
|
|
|
|
changed=true
|
|
|
|
fi
|
|
|
|
if [ ! -f /mnt/phh/keylayout/uinput-fpc.kl ]; then
|
|
|
|
cp /system/phh/empty /mnt/phh/keylayout/uinput-fpc.kl
|
|
|
|
chmod 0644 /mnt/phh/keylayout/uinput-fpc.kl
|
|
|
|
changed=true
|
|
|
|
fi
|
2018-09-03 13:06:54 +00:00
|
|
|
fi
|
|
|
|
|
2019-03-04 21:01:39 +00:00
|
|
|
if getprop ro.vendor.build.fingerprint | grep -qi oneplus/oneplus6/oneplus6; then
|
2018-09-09 22:32:11 +00:00
|
|
|
cp /system/phh/oneplus6-synaptics_s3320.kl /mnt/phh/keylayout/synaptics_s3320.kl
|
|
|
|
chmod 0644 /mnt/phh/keylayout/synaptics_s3320.kl
|
|
|
|
changed=true
|
|
|
|
fi
|
|
|
|
|
2019-03-20 22:56:24 +00:00
|
|
|
if getprop ro.vendor.build.fingerprint | grep -iq -e iaomi/perseus -e iaomi/cepheus; then
|
2018-11-23 11:35:46 +00:00
|
|
|
cp /system/phh/mimix3-gpio-keys.kl /mnt/phh/keylayout/gpio-keys.kl
|
|
|
|
chmod 0644 /mnt/phh/keylayout/gpio-keys.kl
|
|
|
|
changed=true
|
|
|
|
fi
|
|
|
|
|
2019-03-04 21:01:39 +00:00
|
|
|
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
|
|
|
|
chmod 0644 /mnt/phh/keylayout/gpio-keys.kl
|
|
|
|
changed=true
|
2018-12-16 21:04:04 +00:00
|
|
|
fi
|
|
|
|
|
2019-03-04 21:01:39 +00:00
|
|
|
if [ "$changed" = true ]; then
|
2018-09-03 12:58:11 +00:00
|
|
|
mount -o bind /mnt/phh/keylayout /system/usr/keylayout
|
|
|
|
restorecon -R /system/usr/keylayout
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2019-03-04 21:01:39 +00:00
|
|
|
if mount -o remount,rw /system; then
|
|
|
|
resize2fs "$(grep ' /system ' /proc/mounts | cut -d ' ' -f 1)" || true
|
|
|
|
elif mount -o remount,rw /; then
|
2019-08-21 20:40:36 +00:00
|
|
|
major="$(stat -c '%D' /.|sed -E 's/^([0-9a-f]+)([0-9a-f]{2})$/\1/g')"
|
|
|
|
minor="$(stat -c '%D' /.|sed -E 's/^([0-9a-f]+)([0-9a-f]{2})$/\2/g')"
|
|
|
|
mknod /dev/tmp-phh b $((0x$major)) $((0x$minor))
|
2019-03-04 21:01:39 +00:00
|
|
|
resize2fs /dev/root || true
|
2019-08-21 20:40:36 +00:00
|
|
|
resize2fs /dev/tmp-phh || true
|
2018-04-10 16:33:33 +00:00
|
|
|
fi
|
2018-05-19 20:07:12 +00:00
|
|
|
mount -o remount,ro /system || true
|
|
|
|
mount -o remount,ro / || true
|
2018-04-10 16:33:33 +00:00
|
|
|
|
2018-08-29 16:30:35 +00:00
|
|
|
mkdir -p /mnt/phh/
|
|
|
|
mount -t tmpfs -o rw,nodev,relatime,mode=755,gid=0 none /mnt/phh || true
|
2018-09-04 17:35:16 +00:00
|
|
|
mkdir /mnt/phh/empty_dir
|
2018-05-14 11:34:52 +00:00
|
|
|
fixSPL
|
2018-04-24 20:36:59 +00:00
|
|
|
|
2018-09-03 12:58:11 +00:00
|
|
|
changeKeylayout
|
|
|
|
|
2019-07-17 18:07:43 +00:00
|
|
|
mount /system/phh/empty /vendor/bin/vendor.samsung.security.proca@1.0-service || true
|
|
|
|
|
2019-03-04 21:01:39 +00:00
|
|
|
if grep vendor.huawei.hardware.biometrics.fingerprint /vendor/manifest.xml; then
|
2018-04-30 11:56:06 +00:00
|
|
|
mount -o bind system/phh/huawei/fingerprint.kl /vendor/usr/keylayout/fingerprint.kl
|
|
|
|
fi
|
2018-05-14 11:34:52 +00:00
|
|
|
|
2019-03-04 21:01:39 +00:00
|
|
|
if ! grep android.hardware.biometrics.fingerprint /vendor/manifest.xml && ! grep android.hardware.biometrics.fingerprint /vendor/etc/vintf/manifest.xml; then
|
2018-05-18 13:09:30 +00:00
|
|
|
mount -o bind system/phh/empty /system/etc/permissions/android.hardware.fingerprint.xml
|
|
|
|
fi
|
|
|
|
|
2019-07-17 18:11:18 +00:00
|
|
|
if ! grep android.hardware.bluetooth /vendor/manifest.xml && ! grep android.hardware.bluetooth /vendor/etc/vintf/manifest.xml; then
|
|
|
|
mount -o bind system/phh/empty /system/etc/permissions/android.hardware.bluetooth.xml
|
|
|
|
mount -o bind system/phh/empty /system/etc/permissions/android.hardware.bluetooth_le.xml
|
|
|
|
fi
|
|
|
|
|
2019-03-04 21:01:39 +00:00
|
|
|
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
|
2019-02-28 21:48:04 +00:00
|
|
|
setprop persist.sys.qcom-brightness "$(cat /sys/class/backlight/panel0-backlight/max_brightness)"
|
2018-06-10 20:54:14 +00:00
|
|
|
fi
|
2018-06-15 13:03:02 +00:00
|
|
|
|
2018-12-16 21:04:04 +00:00
|
|
|
#Sony don't use Qualcomm HAL, so they don't have their mess
|
2019-03-04 21:01:39 +00:00
|
|
|
if getprop ro.vendor.build.fingerprint | grep -qE 'Sony/'; then
|
2018-12-16 21:04:04 +00:00
|
|
|
setprop persist.sys.qcom-brightness -1
|
|
|
|
fi
|
|
|
|
|
2019-03-04 21:01:39 +00:00
|
|
|
if getprop ro.vendor.build.fingerprint | grep -qi oneplus/oneplus6/oneplus6; then
|
|
|
|
resize2fs /dev/block/platform/soc/1d84000.ufshc/by-name/userdata
|
2018-06-15 13:03:02 +00:00
|
|
|
fi
|
2018-07-01 21:00:28 +00:00
|
|
|
|
2019-03-04 21:01:39 +00:00
|
|
|
if getprop ro.vendor.build.fingerprint | grep -q full_k50v1_64 || getprop ro.hardware | grep -q mt6580; then
|
|
|
|
setprop persist.sys.overlay.nightmode false
|
2018-07-01 21:00:28 +00:00
|
|
|
fi
|
2018-07-01 21:06:11 +00:00
|
|
|
|
2019-03-04 21:01:39 +00:00
|
|
|
if getprop ro.wlan.mtk.wifi.5g | grep -q 1; then
|
|
|
|
setprop persist.sys.overlay.wifi5g true
|
2018-07-01 21:06:11 +00:00
|
|
|
fi
|
2018-07-17 16:02:41 +00:00
|
|
|
|
2019-03-04 21:01:39 +00:00
|
|
|
if grep -qF 'mkdir /data/.fps 0770 system fingerp' vendor/etc/init/hw/init.mmi.rc; then
|
2018-07-17 16:02:41 +00:00
|
|
|
mkdir -p /data/.fps
|
|
|
|
chmod 0770 /data/.fps
|
|
|
|
chown system:9015 /data/.fps
|
|
|
|
|
|
|
|
chown system:9015 /sys/devices/soc/soc:fpc_fpc1020/irq
|
|
|
|
chown system:9015 /sys/devices/soc/soc:fpc_fpc1020/irq_cnt
|
|
|
|
fi
|
2018-08-27 08:25:27 +00:00
|
|
|
|
2019-03-04 21:01:39 +00:00
|
|
|
if getprop ro.vendor.build.fingerprint | grep -q -i \
|
2018-12-28 15:33:23 +00:00
|
|
|
-e xiaomi/clover -e xiaomi/wayne -e xiaomi/sakura \
|
|
|
|
-e xiaomi/nitrogen -e xiaomi/whyred -e xiaomi/platina \
|
2019-06-03 04:53:40 +00:00
|
|
|
-e xiaomi/ysl -e nubia/nx60 -e nubia/nx61 -e xiaomi/tulip -e xiaomi/lavender; then
|
2019-02-28 21:48:04 +00:00
|
|
|
setprop persist.sys.qcom-brightness "$(cat /sys/class/leds/lcd-backlight/max_brightness)"
|
2018-08-29 14:34:14 +00:00
|
|
|
fi
|
|
|
|
|
2019-02-01 10:17:27 +00:00
|
|
|
if getprop ro.vendor.product.device |grep -iq -e RMX1801 -e RMX1803 -e RMX1807;then
|
2019-03-20 22:56:35 +00:00
|
|
|
setprop persist.sys.qcom-brightness "$(cat /sys/class/leds/lcd-backlight/max_brightness)"
|
2019-02-01 10:17:27 +00:00
|
|
|
fi
|
|
|
|
|
2019-03-04 21:01:39 +00:00
|
|
|
if getprop ro.vendor.build.fingerprint | grep -iq \
|
|
|
|
-e Xiaomi/beryllium/beryllium -e Xiaomi/sirius/sirius \
|
|
|
|
-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 iaomi/equuleus/equuleus -e motorola/nora -e xiaomi/nitrogen \
|
2019-05-18 10:04:35 +00:00
|
|
|
-e motorola/hannah -e motorola/james -e motorola/pettyl -e iaomi/cepheus \
|
2019-06-06 06:45:47 +00:00
|
|
|
-e iaomi/grus -e xiaomi/cereus -e iaomi/raphael;then
|
2018-09-08 03:35:40 +00:00
|
|
|
mount -o bind /mnt/phh/empty_dir /vendor/lib64/soundfx
|
|
|
|
mount -o bind /mnt/phh/empty_dir /vendor/lib/soundfx
|
2019-05-22 18:41:25 +00:00
|
|
|
setprop ro.audio.ignore_effects true
|
2018-09-04 17:35:16 +00:00
|
|
|
fi
|
|
|
|
|
2019-03-04 21:01:39 +00:00
|
|
|
if [ "$(getprop ro.vendor.product.manufacturer)" = "motorola" ] || [ "$(getprop ro.product.vendor.manufacturer)" = "motorola" ]; then
|
2019-05-05 17:45:48 +00:00
|
|
|
if getprop ro.vendor.product.device | grep -q -e nora -e ali -e hannah -e evert -e jeter -e deen -e james -e pettyl -e jater; then
|
2019-03-04 21:01:39 +00:00
|
|
|
if [ "$vndk" -ge 28 ]; then
|
2019-02-28 21:48:04 +00:00
|
|
|
f="/vendor/lib/libeffects.so"
|
|
|
|
# shellcheck disable=SC2010
|
2019-03-04 21:01:39 +00:00
|
|
|
ctxt="$(ls -lZ $f | grep -oE 'u:object_r:[^:]*:s0')"
|
|
|
|
b="$(echo "$f" | tr / _)"
|
2019-02-28 21:48:04 +00:00
|
|
|
|
|
|
|
cp -a $f "/mnt/phh/$b"
|
|
|
|
sed -i \
|
|
|
|
's/%zu errors during loading of configuration: %s/%zu errors during loading of configuration: ss/g' \
|
|
|
|
"/mnt/phh/$b"
|
|
|
|
chcon "$ctxt" "/mnt/phh/$b"
|
|
|
|
mount -o bind "/mnt/phh/$b" $f
|
|
|
|
else
|
|
|
|
mount -o bind /mnt/phh/empty_dir /vendor/lib64/soundfx
|
|
|
|
mount -o bind /mnt/phh/empty_dir /vendor/lib/soundfx
|
|
|
|
fi
|
2019-01-04 00:10:55 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2019-03-04 21:01:39 +00:00
|
|
|
if getprop ro.vendor.build.fingerprint | grep -q -i -e xiaomi/wayne -e xiaomi/jasmine; then
|
2018-09-26 10:01:10 +00:00
|
|
|
setprop persist.imx376_sunny.low.lux 310
|
|
|
|
setprop persist.imx376_sunny.light.lux 280
|
|
|
|
setprop persist.imx376_ofilm.low.lux 310
|
|
|
|
setprop persist.imx376_ofilm.light.lux 280
|
2019-04-22 23:20:05 +00:00
|
|
|
echo "none" > /sys/class/leds/led:torch_2/trigger
|
2018-09-26 10:01:10 +00:00
|
|
|
fi
|
|
|
|
|
2019-03-04 21:01:39 +00:00
|
|
|
for f in /vendor/lib/mtk-ril.so /vendor/lib64/mtk-ril.so /vendor/lib/libmtk-ril.so /vendor/lib64/libmtk-ril.so; do
|
2018-08-29 16:30:35 +00:00
|
|
|
[ ! -f $f ] && continue
|
2019-03-04 20:54:48 +00:00
|
|
|
# shellcheck disable=SC2010
|
2019-03-04 21:01:39 +00:00
|
|
|
ctxt="$(ls -lZ "$f" | grep -oE 'u:object_r:[^:]*:s0')"
|
|
|
|
b="$(echo "$f" | tr / _)"
|
2018-08-29 16:30:35 +00:00
|
|
|
|
2019-03-04 20:54:48 +00:00
|
|
|
cp -a "$f" "/mnt/phh/$b"
|
2018-08-29 16:30:35 +00:00
|
|
|
sed -i \
|
|
|
|
-e 's/AT+EAIC=2/AT+EAIC=3/g' \
|
2019-03-04 20:54:48 +00:00
|
|
|
"/mnt/phh/$b"
|
|
|
|
chcon "$ctxt" "/mnt/phh/$b"
|
|
|
|
mount -o bind "/mnt/phh/$b" "$f"
|
2019-02-26 22:14:06 +00:00
|
|
|
|
|
|
|
setprop persist.sys.phh.radio.force_cognitive true
|
2019-03-31 15:37:13 +00:00
|
|
|
setprop persist.sys.radio.ussd.fix true
|
2018-08-29 16:30:35 +00:00
|
|
|
done
|
|
|
|
|
2018-08-27 08:25:27 +00:00
|
|
|
mount -o bind /system/phh/empty /vendor/overlay/SysuiDarkTheme/SysuiDarkTheme.apk || true
|
2018-09-28 17:21:03 +00:00
|
|
|
mount -o bind /system/phh/empty /vendor/overlay/SysuiDarkTheme/SysuiDarkThemeOverlay.apk || true
|
2018-09-04 17:35:16 +00:00
|
|
|
|
2019-03-04 21:01:39 +00:00
|
|
|
if grep -qF 'PowerVR Rogue GE8100' /vendor/lib/egl/GLESv1_CM_mtk.so ||
|
|
|
|
grep -qF 'PowerVR Rogue' /vendor/lib/egl/libGLESv1_CM_mtk.so ||
|
2019-05-16 20:04:48 +00:00
|
|
|
( (getprop ro.product.board; getprop ro.board.platform) | grep -qiE -e msm8917 -e msm8937 -e msm8940); then
|
2018-12-03 21:40:34 +00:00
|
|
|
|
2019-03-04 21:01:39 +00:00
|
|
|
setprop debug.hwui.renderer opengl
|
2018-09-06 18:46:30 +00:00
|
|
|
fi
|
2018-09-04 17:35:16 +00:00
|
|
|
|
2018-09-09 19:38:33 +00:00
|
|
|
#If we have both Samsung and AOSP power hal, take Samsung's
|
2019-03-31 16:57:41 +00:00
|
|
|
if [ -f /vendor/bin/hw/vendor.samsung.hardware.miscpower@1.0-service ] && [ "$vndk" -lt 28 ]; then
|
2019-03-04 21:01:39 +00:00
|
|
|
mount -o bind /system/phh/empty /vendor/bin/hw/android.hardware.power@1.0-service
|
2018-09-09 19:38:33 +00:00
|
|
|
fi
|
2018-09-17 12:04:50 +00:00
|
|
|
|
2019-03-04 21:01:39 +00:00
|
|
|
if [ "$vndk" = 27 ] || [ "$vndk" = 26 ]; then
|
2018-09-17 12:04:50 +00:00
|
|
|
mount -o bind /system/phh/libnfc-nci-oreo.conf /system/etc/libnfc-nci.conf
|
|
|
|
fi
|
2018-09-17 14:18:55 +00:00
|
|
|
|
2019-03-04 21:01:39 +00:00
|
|
|
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
|
2018-09-17 14:18:55 +00:00
|
|
|
mount -o bind /system/phh/empty /vendor/app/ims/ims.apk
|
|
|
|
fi
|
2018-11-04 22:36:25 +00:00
|
|
|
|
2019-03-04 21:01:39 +00:00
|
|
|
if getprop ro.hardware | grep -qF samsungexynos; then
|
|
|
|
setprop debug.sf.latch_unsignaled 1
|
2018-11-04 22:36:25 +00:00
|
|
|
fi
|
2018-11-06 19:40:56 +00:00
|
|
|
|
2019-03-04 21:01:39 +00:00
|
|
|
if getprop ro.product.model | grep -qF ANE; then
|
|
|
|
setprop debug.sf.latch_unsignaled 1
|
2018-11-08 18:09:31 +00:00
|
|
|
fi
|
|
|
|
|
2019-03-04 21:01:39 +00:00
|
|
|
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
|
|
|
|
mount -o bind "$p" /system/etc/libnfc-nxp.conf ||
|
|
|
|
mount -o bind /product/etc/libnfc-nxp.conf /system/etc/libnfc-nxp.conf || true
|
2019-01-04 16:52:15 +00:00
|
|
|
|
2019-03-04 21:01:39 +00:00
|
|
|
p=/product/etc/nfc/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
|
2019-01-04 16:52:15 +00:00
|
|
|
|
2019-03-04 21:01:39 +00:00
|
|
|
mount -o bind /system/phh/libnfc-nci-huawei.conf /system/etc/libnfc-nci.conf
|
2019-01-04 16:52:15 +00:00
|
|
|
fi
|
|
|
|
|
2019-03-31 16:57:41 +00:00
|
|
|
if getprop ro.vendor.build.fingerprint | grep -qE -e ".*(crown|star)[q2]*lte.*" -e ".*(SC-0[23]K|SCV3[89]).*" && [ "$vndk" -lt 28 ]; then
|
2019-03-04 21:01:39 +00:00
|
|
|
for f in /vendor/lib/libfloatingfeature.so /vendor/lib64/libfloatingfeature.so; do
|
|
|
|
[ ! -f "$f" ] && continue
|
|
|
|
# shellcheck disable=SC2010
|
|
|
|
ctxt="$(ls -lZ "$f" | grep -oE 'u:object_r:[^:]*:s0')"
|
|
|
|
b="$(echo "$f" | tr / _)"
|
|
|
|
|
|
|
|
cp -a "$f" "/mnt/phh/$b"
|
|
|
|
sed -i \
|
|
|
|
-e 's;/system/etc/floating_feature.xml;/system/ph/sam-9810-flo_feat.xml;g' \
|
|
|
|
"/mnt/phh/$b"
|
|
|
|
chcon "$ctxt" "/mnt/phh/$b"
|
|
|
|
mount -o bind "/mnt/phh/$b" "$f"
|
2019-05-03 21:47:14 +00:00
|
|
|
|
|
|
|
setprop ro.audio.monitorRotation true
|
2019-03-04 21:01:39 +00:00
|
|
|
done
|
2018-11-06 19:40:56 +00:00
|
|
|
fi
|
2018-11-18 20:44:01 +00:00
|
|
|
|
2019-05-03 21:47:14 +00:00
|
|
|
# This matches both Razer Phone 1 & 2
|
|
|
|
if getprop ro.vendor.build.fingerprint |grep -qE razer/cheryl;then
|
|
|
|
setprop ro.audio.monitorRotation true
|
|
|
|
fi
|
|
|
|
|
2019-03-04 21:01:39 +00:00
|
|
|
if getprop ro.vendor.build.fingerprint | grep -qiE '^samsung'; then
|
|
|
|
if getprop ro.hardware | grep -q qcom; then
|
|
|
|
setprop persist.sys.overlay.devinputjack false
|
|
|
|
fi
|
2019-01-26 10:36:54 +00:00
|
|
|
|
2019-03-04 21:01:39 +00:00
|
|
|
if getprop ro.hardware | grep -q -e samsungexynos7870 -e qcom; then
|
|
|
|
if [ "$vndk" -le 27 ]; then
|
|
|
|
setprop persist.sys.phh.sdk_override /vendor/bin/hw/rild=27
|
|
|
|
fi
|
|
|
|
fi
|
2019-02-05 23:52:54 +00:00
|
|
|
fi
|
2019-01-30 13:12:47 +00:00
|
|
|
|
2019-04-24 08:47:32 +00:00
|
|
|
if getprop ro.vendor.build.fingerprint | grep -qE '^xiaomi/(daisy|wayne)/(daisy|wayne).*'; then
|
2019-03-04 21:01:39 +00:00
|
|
|
# Fix camera on DND, ugly workaround but meh
|
|
|
|
setprop audio.camerasound.force true
|
2019-01-03 23:33:01 +00:00
|
|
|
fi
|
|
|
|
|
2018-11-18 20:44:01 +00:00
|
|
|
mount -o bind /mnt/phh/empty_dir /vendor/etc/audio || true
|
2019-03-20 22:56:08 +00:00
|
|
|
|
|
|
|
for f in /vendor/lib{,64}/hw/com.qti.chi.override.so;do
|
|
|
|
[ ! -f $f ] && continue
|
|
|
|
# shellcheck disable=SC2010
|
|
|
|
ctxt="$(ls -lZ "$f" | grep -oE 'u:object_r:[^:]*:s0')"
|
|
|
|
b="$(echo "$f" | tr / _)"
|
|
|
|
|
|
|
|
cp -a "$f" "/mnt/phh/$b"
|
|
|
|
sed -i \
|
|
|
|
-e 's/ro.product.manufacturer/sys.phh.xx.manufacturer/g' \
|
|
|
|
"/mnt/phh/$b"
|
|
|
|
chcon "$ctxt" "/mnt/phh/$b"
|
|
|
|
mount -o bind "/mnt/phh/$b" "$f"
|
|
|
|
|
|
|
|
setprop sys.phh.xx.manufacturer "$(getprop ro.product.vendor.manufacturer)"
|
|
|
|
done
|
2019-06-12 13:41:25 +00:00
|
|
|
|
|
|
|
if [ -n "$(getprop ro.boot.product.hardware.sku)" ] && [ -z "$(getprop ro.hw.oemName)" ];then
|
|
|
|
setprop ro.hw.oemName "$(getprop ro.boot.product.hardware.sku)"
|
|
|
|
fi
|
2019-08-11 20:59:32 +00:00
|
|
|
|
|
|
|
if getprop ro.vendor.build.fingerprint | grep -qiE '^samsung/' && [ "$vndk" -ge 28 ];then
|
|
|
|
setprop persist.sys.phh.samsung_fingerprint -1
|
2019-08-12 20:50:17 +00:00
|
|
|
#obviously broken perms
|
|
|
|
if [ "$(stat -c '%A' /sys/class/sec/tsp/ear_detect_enable)" == "-rw-rw-r--" ] &&
|
|
|
|
[ "$(stat -c '%U' /sys/class/sec/tsp/ear_detect_enable)" == "root" ] &&
|
|
|
|
[ "$(stat -c '%G' /sys/class/sec/tsp/ear_detect_enable)" == "root" ];then
|
|
|
|
|
|
|
|
chcon u:object_r:sysfs_ss_writable:s0 /sys/class/sec/tsp/ear_detect_enable
|
|
|
|
chown system /sys/class/sec/tsp/ear_detect_enable
|
|
|
|
|
2019-08-14 21:35:36 +00:00
|
|
|
chcon u:object_r:sysfs_ss_writable:s0 /sys/class/sec/tsp/cmd{,_list,_result,_status}
|
|
|
|
chown system /sys/class/sec/tsp/cmd{,_list,_result,_status}
|
2019-08-21 20:00:44 +00:00
|
|
|
|
|
|
|
chown system /sys/class/power_supply/battery/wc_tx_en
|
|
|
|
chcon u:object_r:sysfs_app_writable:s0 /sys/class/power_supply/battery/wc_tx_en
|
|
|
|
|
|
|
|
chown system:system /sys/class/sec/tsp/input/enabled
|
2019-08-12 20:50:17 +00:00
|
|
|
fi
|
2019-08-11 20:59:32 +00:00
|
|
|
fi
|