2018-04-10 16:33:33 +00:00
#!/system/bin/sh
2020-10-25 20:08:28 +00:00
if [ -z " $debug " ] && [ -f /cache/phh-log ] ; then
mkdir -p /cache/phh
debug = 1 exec sh -x " $( readlink -f -- " $0 " ) " > /cache/phh/logs 2>& 1
else
# Allow accessing logs from system app
# Protected via SELinux for other apps
chmod 0755 /cache/phh
chmod 0644 /cache/phh/logs
fi
2018-04-10 16:33:33 +00:00
2021-01-19 22:46:40 +00:00
if [ -f /cache/phh-adb ] ; then
setprop ctl.stop adbd
setprop ctl.stop adbd_apex
mount -t configfs none /config
rm -Rf /config/usb_gadget
mkdir -p /config/usb_gadget/g1
echo 0x12d1 > /config/usb_gadget/g1/idVendor
echo 0x103A > /config/usb_gadget/g1/idProduct
mkdir -p /config/usb_gadget/g1/strings/0x409
echo phh > /config/usb_gadget/g1/strings/0x409/serialnumber
echo phh > /config/usb_gadget/g1/strings/0x409/manufacturer
echo phh > /config/usb_gadget/g1/strings/0x409/product
mkdir /config/usb_gadget/g1/functions/ffs.adb
mkdir /config/usb_gadget/g1/functions/mtp.gs0
mkdir /config/usb_gadget/g1/functions/ptp.gs1
mkdir /config/usb_gadget/g1/configs/c.1/
mkdir /config/usb_gadget/g1/configs/c.1/strings/0x409
echo 'ADB MTP' > /config/usb_gadget/g1/configs/c.1/strings/0x409/configuration
mkdir /dev/usb-ffs
chmod 0770 /dev/usb-ffs
chown shell:shell /dev/usb-ffs
mkdir /dev/usb-ffs/adb/
chmod 0770 /dev/usb-ffs/adb
chown shell:shell /dev/usb-ffs/adb
mount -t functionfs -o uid = 2000,gid= 2000 adb /dev/usb-ffs/adb
/apex/com.android.adbd/bin/adbd &
sleep 1
echo none > /config/usb_gadget/g1/UDC
ln -s /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/c.1/f1
ls /sys/class/udc | head -n 1 > /config/usb_gadget/g1/UDC
sleep 2
echo 2 > /sys/devices/virtual/android_usb/android0/port_mode
fi
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]+' ) "
2019-09-14 22:56:40 +00:00
if [ " $vndk " = 26 ] ; then
2021-02-22 09:04:19 +00:00
resetprop_phh ro.vndk.version 26
2019-09-14 22:56:40 +00:00
fi
2018-08-16 12:59:26 +00:00
setprop sys.usb.ffs.aio_compat true
2021-11-15 06:19:40 +00:00
if getprop ro.vendor.build.fingerprint | grep -q -i -e Blackview/BV9500Plus; then
setprop persist.adb.nonblocking_ffs true
else
setprop persist.adb.nonblocking_ffs false
fi
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
2020-11-07 23:36:09 +00:00
img = " $( find /dev/block -type l -iname kernel" $( getprop ro.boot.slot_suffix) " | grep by-name | head -n 1) "
[ -z " $img " ] && img = " $( find /dev/block -type l -iname boot" $( getprop ro.boot.slot_suffix) " | grep by-name | head -n 1) "
2019-03-04 21:01:39 +00:00
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) "
2021-10-13 15:03:08 +00:00
spl = " $( getSPL " $img " spl) "
2018-05-19 14:54:30 +00:00
setprop ro.keymaster.xxx.release " $Arelease "
2021-10-13 15:03:08 +00:00
setprop ro.keymaster.xxx.security_patch " $spl "
if [ -z " $Arelease " ] || [ -z " $spl " ] ; then
return 0
fi
2019-10-22 12:19:47 +00:00
setprop ro.keymaster.brn Android
2018-05-14 11:34:52 +00:00
2020-11-07 23:36:09 +00:00
if getprop ro.vendor.build.fingerprint | grep -qiE 'samsung.*star.*lte' ; then
additional = "/apex/com.android.vndk.v28/lib64/libsoftkeymasterdevice.so /apex/com.android.vndk.v29/lib64/libsoftkeymasterdevice.so"
else
getprop ro.vendor.build.fingerprint | grep -qiE '^samsung/' && return 0
fi
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 \
2020-09-27 18:12:09 +00:00
/apex/com.android.vndk.v26/lib/libsoftkeymasterdevice.so \
/apex/com.android.vndk.v26/lib64/libsoftkeymasterdevice.so \
2019-03-04 21:01:39 +00:00
/system/lib64/vndk/libsoftkeymasterdevice.so /system/lib/vndk/libsoftkeymasterdevice.so \
/system/lib/vndk-26/libsoftkeymasterdevice.so \
2019-09-08 23:13:30 +00:00
/system/lib/vndk-27/libsoftkeymasterdevice.so /system/lib64/vndk-27/libsoftkeymasterdevice.so \
2020-03-10 22:26:20 +00:00
/vendor/lib/libkeymaster3device.so /vendor/lib64/libkeymaster3device.so \
2020-04-14 07:49:49 +00:00
/vendor/lib/libMcTeeKeymaster.so /vendor/lib64/libMcTeeKeymaster.so \
2020-11-07 23:36:09 +00:00
/vendor/lib/hw/libMcTeeKeymaster.so /vendor/lib64/hw/libMcTeeKeymaster.so $additional ; 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' \
2019-10-22 12:19:47 +00:00
-e 's/ro.product.brand/ro.keymaster.brn/g' \
2019-03-04 21:01:39 +00:00
" /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-12-04 19:34:35 +00:00
if grep -q vendor.huawei.hardware.biometrics.fingerprint /vendor/etc/vintf/manifest.xml; then
changed = true
cp /system/phh/huawei/fingerprint.kl /mnt/phh/keylayout/fingerprint.kl
chmod 0644 /mnt/phh/keylayout/fingerprint.kl
fi
2018-09-03 12:58:11 +00:00
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
2020-06-06 16:41:52 +00:00
cp /system/phh/samsung-sec_touchkey.kl /mnt/phh/keylayout/sec_touchkey.kl
2018-09-03 12:58:11 +00:00
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 \
2021-05-01 12:17:43 +00:00
-e poco/ -e redmi/ -e xiaomi/ ; 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-12-25 07:26:37 +00:00
if getprop ro.vendor.build.fingerprint | grep -iq -e xiaomi/daisy; then
mpk = "/mnt/phh/keylayout"
cp /system/phh/daisy-buttonJack.kl ${ mpk } /msm8953-snd-card-mtp_Button_Jack.kl
changed = true
if [ ! -f /mnt/phh/keylayout/uinput-goodix.kl ] ; then
cp /system/phh/daisy-uinput-goodix.kl ${ mpk } /uinput-goodix.kl
changed = true
fi
if [ ! -f /mnt/phh/keylayout/uinput-fpc.kl ] ; then
cp /system/phh/daisy-uinput-fpc.kl ${ mpk } /uinput-fpc.kl
changed = true
fi
chmod 0644 ${ mpk } /uinput* ${ mpk } /msm8953*
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-10-26 19:05:56 +00:00
if getprop ro.vendor.build.fingerprint | grep -iq -E -e '^Nokia/Panther' ; then
cp /system/phh/nokia-soc_gpio_keys.kl /mnt/phh/keylayout/soc_gpio_keys.kl
chmod 0644 /mnt/phh/keylayout/soc_gpio_keys.kl
changed = true
fi
2019-11-04 21:56:22 +00:00
if getprop ro.vendor.build.fingerprint | grep -iq -E -e '^Lenovo/' && [ -f /sys/devices/virtual/touch/tp_dev/gesture_on ] ; then
2019-11-01 17:30:18 +00:00
cp /system/phh/lenovo-synaptics_dsx.kl /mnt/phh/keylayout/synaptics_dsx.kl
chmod 0644 /mnt/phh/keylayout/synaptics_dsx.kl
2020-03-13 15:23:57 +00:00
cp /system/phh/lenovo-synaptics_dsx.kl /mnt/phh/keylayout/fts_ts.kl
chmod 0644 /mnt/phh/keylayout/fts_ts.kl
2019-11-01 17:30:18 +00:00
changed = true
fi
2021-08-10 22:26:34 +00:00
if ( getprop ro.build.overlay.deviceid | grep -q -e RMX1931 -e RMX1941 -e CPH1859 -e CPH1861 -e RMX2185) ||
( grep -q OnePlus /odm/etc/$( getprop ro.boot.prjname) /*.prop) ; then
echo 1 > /proc/touchpanel/double_tap_enable
2020-02-21 15:35:07 +00:00
cp /system/phh/oppo-touchpanel.kl /mnt/phh/keylayout/touchpanel.kl
2020-07-02 16:28:48 +00:00
cp /system/phh/oppo-touchpanel.kl /mnt/phh/keylayout/mtk-tpd.kl
2020-02-21 15:35:07 +00:00
chmod 0644 /mnt/phh/keylayout/touchpanel.kl
2020-07-02 16:28:48 +00:00
chmod 0644 /mnt/phh/keylayout/mtk-tpd.kl
2020-02-21 15:35:07 +00:00
changed = true
fi
2020-02-27 13:46:38 +00:00
if getprop ro.vendor.build.fingerprint | grep -q -e google/; then
cp /system/phh/google-uinput-fpc.kl /mnt/phh/keylayout/uinput-fpc.kl
chmod 0644 /mnt/phh/keylayout/uinput-fpc.kl
changed = true
fi
2020-02-21 15:35:07 +00:00
2020-06-02 21:04:09 +00:00
if getprop ro.product.vendor.manufacturer | grep -q -e motorola; then
cp /system/phh/moto-uinput-egis.kl /mnt/phh/keylayout/uinput-egis.kl
2020-06-08 16:51:33 +00:00
cp /system/phh/moto-uinput-egis.kl /mnt/phh/keylayout/uinput-fpc.kl
2020-06-02 21:04:09 +00:00
chmod 0644 /mnt/phh/keylayout/uinput-egis.kl
2020-06-08 16:51:33 +00:00
chmod 0644 /mnt/phh/keylayout/uinput-fpc.kl
2020-06-02 21:04:09 +00:00
changed = true
fi
2020-06-20 18:11:04 +00:00
if getprop ro.vendor.build.fingerprint | grep -q -e nubia/NX659; then
cp /system/phh/nubia-nubia_synaptics_dsx.kl /mnt/phh/keylayout/nubia_synaptics_dsx.kl
chmod 0644 /mnt/phh/keylayout/nubia_synaptics_dsx.kl
changed = true
fi
2021-04-16 11:23:32 +00:00
if getprop ro.vendor.build.fingerprint | grep -q -i -e Teracube/Teracube_2e; then
cp /system/phh/teracube2e-mtk-kpd.kl /mnt/phh/keylayout/mtk-kpd.kl
chmod 0644 /mnt/phh/keylayout/mtk-kpd.kl
changed = true
fi
2020-08-05 18:38:12 +00:00
if getprop ro.vendor.asus.build.fp | grep -q ASUS_I01WD; then
cp /system/phh/zf6-goodixfp.kl /mnt/phh/keylayout/goodixfp.kl
cp /system/phh/zf6-googlekey_input.kl /mnt/phh/keylayout/googlekey_input.kl
chmod 0644 /mnt/phh/keylayout/goodixfp.kl
chmod 0644 /mnt/phh/keylayout/googlekey_input.kl
changed = true
fi
2021-04-08 12:20:28 +00:00
if getprop ro.vendor.build.fingerprint | grep -q -e Unihertz/; then
cp /system/phh/unihertz-mtk-kpd.kl /mnt/phh/keylayout/mtk-kpd.kl
cp /system/phh/unihertz-mtk-tpd.kl /mnt/phh/keylayout/mtk-tpd.kl
cp /system/phh/unihertz-mtk-tpd-kpd.kl /mnt/phh/keylayout/mtk-tpd-kpd.kl
cp /system/phh/unihertz-fingerprint_key.kl /mnt/phh/keylayout/fingerprint_key.kl
chmod 0644 /mnt/phh/keylayout/mtk-kpd.kl
chmod 0644 /mnt/phh/keylayout/mtk-tpd.kl
chmod 0644 /mnt/phh/keylayout/mtk-tpd-kpd.kl
chmod 0644 /mnt/phh/keylayout/fingerprint_key.kl
changed = true
fi
2021-11-15 06:00:07 +00:00
if getprop ro.vendor.build.fingerprint | grep -q -i -e Blackview/BV9500Plus; then
cp /system/phh/bv9500plus-mtk-kpd.kl /mnt/phh/keylayout/mtk-kpd.kl
chmod 0644 /mnt/phh/keylayout/mtk-kpd.kl
changed = true
fi
2021-12-03 12:25:37 +00:00
if getprop ro.product.vendor.device | grep -qi mfh505glm; then
cp /system/phh/empty /mnt/phh/keylayout/uinput-fpc.kl
chmod 0644 /mnt/phh/keylayout/uinput-fpc.kl
changed = true
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
}
2020-06-18 13:00:14 +00:00
if [ " $( getprop ro.product.vendor.manufacturer) " = motorola ] && getprop ro.vendor.product.name | grep -qE '^lima' ; then
for l in lib lib64; do
for f in mt6771 lima; do
mount /system/phh/empty /vendor/$l /hw/keystore.$f .so
done
done
setprop persist.sys.overlay.devinputjack true
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
2020-04-01 12:12:36 +00:00
else
remount system
mount -o remount,rw /
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 $(( 0 x$major )) $(( 0 x$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
2020-02-26 14:29:23 +00:00
for part in /dev/block/bootdevice/by-name/oppodycnvbk /dev/block/platform/bootdevice/by-name/nvdata; do
if [ -b " $part " ] ; then
2020-03-19 14:20:20 +00:00
oppoName = " $( grep -aohE '(RMX|CPH)[0-9]{4}' " $part " | head -n 1) "
2020-03-02 23:58:55 +00:00
if [ -n " $oppoName " ] ; then
setprop ro.build.overlay.deviceid " $oppoName "
fi
2020-02-26 14:29:23 +00:00
fi
done
2020-02-21 15:35:07 +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
2020-03-10 22:26:03 +00:00
foundFingerprint = false
2020-12-17 20:55:49 +00:00
for manifest in /vendor/manifest.xml /vendor/etc/vintf/manifest.xml /odm/etc/vintf/manifest.xml; do
2021-08-08 18:15:14 +00:00
if grep -q \
-e android.hardware.biometrics.fingerprint \
-e vendor.oppo.hardware.biometrics.fingerprint \
-e vendor.oplus.hardware.biometrics.fingerprint \
$manifest ;
then
2020-03-10 22:26:03 +00:00
foundFingerprint = true
fi
done
if [ " $foundFingerprint " = false ] ; 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-12-22 10:55:41 +00:00
# Xiaomi MiA3 uses OLED display which works best with this setting
if getprop ro.vendor.build.fingerprint | grep -iq \
-e iaomi/laurel_sprout; then
setprop persist.sys.qcom-brightness -1
fi
2020-03-13 16:14:11 +00:00
# Lenovo Z5s brightness flickers without this setting
if getprop ro.vendor.build.fingerprint | grep -iq \
-e Lenovo/jd2019; then
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 \
2021-05-02 16:15:07 +00:00
-e xiaomi/ysl -e nubia/nx60 -e nubia/nx61 -e xiaomi/tulip \
2020-10-13 16:48:21 +00:00
-e xiaomi/lavender -e xiaomi/olive -e xiaomi/olivelite -e xiaomi/pine \
2020-10-17 14:34:18 +00:00
-e Redmi/lancelot -e Redmi/galahad; 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
2020-08-13 13:48:14 +00:00
#Realme 6
2021-05-13 06:46:42 +00:00
if getprop ro.vendor.product.device | grep -iq -e RMX2001 -e RMX2151 -e RMX2111 -e RMX2111L1; then
2020-08-13 13:48:14 +00:00
setprop persist.sys.phh.fingerprint.nocleanup true
setprop persist.sys.qcom-brightness " $( cat /sys/class/leds/lcd-backlight/max_brightness) "
fi
2020-05-14 10:41:08 +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
2020-11-29 13:08:50 +00:00
if getprop ro.build.overlay.deviceid | grep -q -e CPH1859 -e CPH1861 -e RMX1811 -e RMX2185; then
2020-02-29 16:03:28 +00:00
setprop persist.sys.qcom-brightness " $( cat /sys/class/leds/lcd-backlight/max_brightness) "
fi
2021-05-13 06:46:42 +00:00
if getprop ro.build.overlay.deviceid | grep -iq -e RMX2020 -e RMX2027 -e RMX2040 -e RMX2193 -e RMX2191; then
2020-12-12 05:19:49 +00:00
setprop persist.sys.qcom-brightness 2047
setprop persist.sys.overlay.devinputjack true
setprop persist.sys.phh.fingerprint.nocleanup true
fi
2019-03-04 21:01:39 +00:00
if getprop ro.vendor.build.fingerprint | grep -iq \
2020-05-24 18:18:20 +00:00
-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 xiaomi/perseus/perseus -e xiaomi/platina/platina \
-e xiaomi/equuleus/equuleus -e motorola/nora -e xiaomi/nitrogen \
-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 \
2021-09-03 10:49:00 +00:00
-e xiaomi/ginkgo -e xiaomi/willow -e xiaomi/laurel_sprout -e xiaomi/andromeda \
2021-07-31 09:29:47 +00:00
-e iaomi/renoir \
2021-05-11 16:58:54 +00:00
-e redmi/curtana -e redmi/picasso \
-e bq/Aquaris_M10 ; 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
2021-05-11 16:59:28 +00:00
if getprop ro.vendor.build.fingerprint | grep -iq \
-e bq/Aquaris_M10 ; then
setprop ro.surface_flinger.primary_display_orientation ORIENTATION_90
fi
2020-03-07 20:06:44 +00:00
if getprop ro.build.fingerprint | grep -iq \
-e motorola/channel; then
mount -o bind /mnt/phh/empty_dir /vendor/lib64/soundfx
mount -o bind /mnt/phh/empty_dir /vendor/lib/soundfx
setprop ro.audio.ignore_effects true
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
2020-03-15 12:28:30 +00:00
setprop ro.audio.ignore_effects true
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
2021-05-02 16:15:07 +00:00
if getprop ro.vendor.build.fingerprint | grep -iq -e iaomi/cactus -e iaomi/cereus; then
2020-02-20 13:39:40 +00:00
setprop debug.stagefright.omx_default_rank.sw-audio 1
setprop debug.stagefright.omx_default_rank 0
fi
2020-02-20 16:28:35 +00:00
mount -o bind /system/phh/empty /vendor/lib/libpdx_default_transport.so
mount -o bind /system/phh/empty /vendor/lib64/libpdx_default_transport.so
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
2019-10-22 13:26:22 +00:00
setprop ro.skia.ignore_swizzle true
2019-12-08 16:09:40 +00:00
if [ " $vndk " = 26 ] || [ " $vndk " = 27 ] ; then
2019-12-10 16:17:16 +00:00
setprop debug.hwui.use_buffer_age false
2019-12-08 16:09:40 +00:00
fi
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
2020-05-14 10:41:08 +00:00
if getprop ro.hardware | grep -qF exynos; then
2019-03-04 21:01:39 +00:00
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
2020-05-14 10:41:08 +00:00
2019-12-08 17:30:35 +00:00
if getprop ro.vendor.product.device | grep -q -e nora -e rhannah; then
setprop debug.sf.latch_unsignaled 1
fi
2018-11-08 18:09:31 +00:00
2021-09-04 15:49:07 +00:00
if getprop ro.vendor.build.fingerprint | grep -iq -e xiaomi/daisy; then
2019-12-25 07:29:25 +00:00
setprop debug.sf.latch_unsignaled 1
setprop debug.sf.enable_hwc_vds 1
fi
2021-09-04 15:49:07 +00:00
if getprop ro.vendor.build.fingerprint | grep -iq -e Redmi/merlin; then
setprop debug.sf.latch_unsignaled 1
setprop debug.sf.enable_hwc_vds 0
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
2021-08-26 10:50:24 +00:00
mount -o bind /system/phh/empty /vendor/overlay/BluetoothResCommon.apk
mount -o bind /system/phh/empty /vendor/overlay/RazerCherylBluetoothRes.apk
2019-05-03 21:47:14 +00:00
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-11-19 22:54:22 +00:00
if getprop ro.vendor.build.fingerprint | grep -qE '^xiaomi/wayne/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
2021-06-03 20:44:44 +00:00
if [ $( find /vendor/etc/audio -type f | wc -l) -le 3 ] ; then
mount -o bind /mnt/phh/empty_dir /vendor/etc/audio || true
fi
2019-03-20 22:56:08 +00:00
2020-04-28 14:03:33 +00:00
for f in /vendor/lib{ ,64} /hw/com.qti.chi.override.so /vendor/lib{ ,64} /libVD*; do
2019-03-20 22:56:08 +00:00
[ ! -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' \
2020-02-29 15:56:36 +00:00
-e 's/ro.product.brand/sys.phh.xx.brand/g' \
2020-04-28 14:03:33 +00:00
-e 's/ro.product.model/sys.phh.xx.model/g' \
2019-03-20 22:56:08 +00:00
" /mnt/phh/ $b "
chcon " $ctxt " " /mnt/phh/ $b "
mount -o bind " /mnt/phh/ $b " " $f "
2020-06-08 16:51:33 +00:00
manufacturer = $( getprop ro.product.vendor.manufacturer)
[ -z " $manufacturer " ] && manufacturer = $( getprop ro.product.manufacturer)
model = $( getprop ro.product.vendor.model)
[ -z " $model " ] && model = $( getprop ro.product.odm.model)
setprop sys.phh.xx.manufacturer " $manufacturer "
2020-02-29 15:56:36 +00:00
setprop sys.phh.xx.brand " $( getprop ro.product.vendor.brand) "
2020-06-08 16:51:33 +00:00
setprop sys.phh.xx.model " $model "
2019-03-20 22:56:08 +00:00
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
2019-09-12 18:57:30 +00:00
setprop persist.sys.phh.samsung_fingerprint 0
2019-08-12 20:50:17 +00:00
#obviously broken perms
2020-04-04 22:05:12 +00:00
if [ " $( stat -c '%U' /sys/class/sec/tsp/cmd) " = = "root" ] &&
[ " $( stat -c '%G' /sys/class/sec/tsp/cmd) " = = "root" ] ; then
2019-08-12 20:50:17 +00:00
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
2019-08-12 20:50:17 +00:00
fi
2019-08-21 22:35:41 +00:00
2019-08-21 22:45:53 +00:00
if [ " $( stat -c '%U' /sys/class/sec/tsp/input/enabled) " = = "root" ] &&
[ " $( stat -c '%G' /sys/class/sec/tsp/input/enabled) " = = "root" ] ; then
chown system:system /sys/class/sec/tsp/input/enabled
2019-08-22 09:36:17 +00:00
chcon u:object_r:sysfs_ss_writable:s0 /sys/class/sec/tsp/input/enabled
2019-08-21 22:45:53 +00:00
setprop ctl.restart sec-miscpower-1-0
fi
2020-04-25 18:10:25 +00:00
if [ " $( stat -c '%U' /sys/class/camera/flash/rear_flash) " = = "root" ] &&
[ " $( stat -c '%G' /sys/class/camera/flash/rear_flash) " = = "root" ] ; then
chown system:system /sys/class/camera/flash/rear_flash
chcon u:object_r:sysfs_camera_writable:s0 /sys/class/camera/flash/rear_flash
fi
2019-08-21 22:35:41 +00:00
fi
2021-03-16 11:38:34 +00:00
# For Nubia Red Magic 6 audio policy configuration
if getprop ro.vendor.build.fingerprint | grep -q -e nubia/NX669; then
umount /vendor/etc/audio
sku = " $( getprop ro.boot.product.vendor.sku) "
mount /vendor/etc/audio/sku_${ sku } _qssi/audio_policy_configuration.xml /vendor/etc/audio/sku_$sku /audio_policy_configuration.xml
fi
2021-06-07 16:47:49 +00:00
# For ZF8, the "best" audio policy isn't the one for QSSI
if getprop ro.vendor.build.fingerprint | grep -q -e /ASUS_I006D:; then
umount /vendor/etc/audio
sku = " $( getprop ro.boot.product.vendor.sku) "
mount /vendor/etc/audio/ZS590KS/audio_policy_configuration_ZS590KS.xml /vendor/etc/audio/sku_$sku /audio_policy_configuration.xml
fi
2021-02-02 21:03:11 +00:00
setprop ctl.stop console
dmesg -n 1
2021-11-03 21:43:25 +00:00
if [ -f /system/phh/secure ] || [ -f /metadata/phh/secure ] ; then
2019-08-21 22:35:41 +00:00
copyprop( ) {
p = " $( getprop " $2 " ) "
if [ " $p " ] ; then
2021-02-22 09:04:19 +00:00
resetprop_phh " $1 " " $( getprop " $2 " ) "
2019-08-21 22:35:41 +00:00
fi
}
copyprop ro.build.device ro.vendor.build.device
2019-12-08 20:07:21 +00:00
copyprop ro.system.build.fingerprint ro.vendor.build.fingerprint
2019-08-21 22:35:41 +00:00
copyprop ro.bootimage.build.fingerprint ro.vendor.build.fingerprint
copyprop ro.build.fingerprint ro.vendor.build.fingerprint
copyprop ro.build.device ro.vendor.product.device
2019-12-08 20:07:21 +00:00
copyprop ro.product.system.device ro.vendor.product.device
2019-08-21 22:35:41 +00:00
copyprop ro.product.device ro.vendor.product.device
2019-12-08 20:07:21 +00:00
copyprop ro.product.system.device ro.product.vendor.device
2019-08-21 22:35:41 +00:00
copyprop ro.product.device ro.product.vendor.device
2019-12-08 20:07:21 +00:00
copyprop ro.product.system.name ro.vendor.product.name
2019-08-21 22:35:41 +00:00
copyprop ro.product.name ro.vendor.product.name
2019-12-08 20:07:21 +00:00
copyprop ro.product.system.name ro.product.vendor.device
2019-08-21 22:35:41 +00:00
copyprop ro.product.name ro.product.vendor.device
2019-12-08 20:07:21 +00:00
copyprop ro.system.product.brand ro.vendor.product.brand
2019-08-21 22:35:41 +00:00
copyprop ro.product.brand ro.vendor.product.brand
2019-12-08 20:07:21 +00:00
copyprop ro.product.system.model ro.vendor.product.model
2019-08-21 22:35:41 +00:00
copyprop ro.product.model ro.vendor.product.model
2019-12-08 20:07:21 +00:00
copyprop ro.product.system.model ro.product.vendor.model
2019-08-21 22:35:41 +00:00
copyprop ro.product.model ro.product.vendor.model
copyprop ro.build.product ro.vendor.product.model
copyprop ro.build.product ro.product.vendor.model
2019-12-08 20:07:21 +00:00
copyprop ro.system.product.manufacturer ro.vendor.product.manufacturer
2019-08-21 22:35:41 +00:00
copyprop ro.product.manufacturer ro.vendor.product.manufacturer
2019-12-08 20:07:21 +00:00
copyprop ro.system.product.manufacturer ro.product.vendor.manufacturer
2019-08-21 22:35:41 +00:00
copyprop ro.product.manufacturer ro.product.vendor.manufacturer
2020-05-13 08:13:30 +00:00
( getprop ro.vendor.build.security_patch; getprop ro.keymaster.xxx.security_patch) | sort | tail -n 1 | while read v; do
2021-02-22 09:04:19 +00:00
[ -n " $v " ] && resetprop_phh ro.build.version.security_patch " $v "
2020-05-13 08:13:30 +00:00
done
2021-02-22 09:04:19 +00:00
resetprop_phh ro.build.tags release-keys
resetprop_phh ro.boot.vbmeta.device_state locked
resetprop_phh ro.boot.verifiedbootstate green
resetprop_phh ro.boot.flash.locked 1
resetprop_phh ro.boot.veritymode enforcing
resetprop_phh ro.boot.warranty_bit 0
resetprop_phh ro.warranty_bit 0
resetprop_phh ro.debuggable 0
resetprop_phh ro.secure 1
resetprop_phh ro.build.type user
resetprop_phh ro.build.selinux 0
resetprop_phh ro.adb.secure 1
2019-08-21 22:35:41 +00:00
setprop ctl.restart adbd
2021-11-03 21:43:25 +00:00
# Hide system/xbin/su
mount /mnt/phh/empty_dir /system/xbin
mount /mnt/phh/empty_dir /system/app/me.phh.superuser
mount /system/phh/empty /system/xbin/phh-su
else
mkdir /mnt/phh/xbin
chmod 0755 /mnt/phh/xbin
chcon u:object_r:system_file:s0 /mnt/phh/xbin
#phh-su will bind over this empty file to make a real su
touch /mnt/phh/xbin/su
chcon u:object_r:system_file:s0 /mnt/phh/xbin/su
mount -o bind /mnt/phh/xbin /system/xbin
2019-08-11 20:59:32 +00:00
fi
2019-09-12 18:57:42 +00:00
2019-11-07 21:46:16 +00:00
for abi in "" 64; do
f = /vendor/lib$abi /libstagefright_foundation.so
if [ -f " $f " ] ; then
2020-06-22 16:12:17 +00:00
for vndk in 26 27 28 29; do
2020-09-30 09:53:11 +00:00
mount " $f " /system/system_ext/apex/com.android.vndk.v$vndk /lib$abi /libstagefright_foundation.so
2019-11-07 21:46:16 +00:00
done
fi
done
2019-09-12 18:57:42 +00:00
setprop ro.product.first_api_level " $vndk "
2019-11-30 19:38:41 +00:00
if getprop ro.boot.boot_devices | grep -v , | grep -qE .; then
ln -s /dev/block/platform/$( getprop ro.boot.boot_devices) /dev/block/bootdevice
fi
if [ -c /dev/dsm ] ; then
2020-03-10 12:09:09 +00:00
# /dev/dsm is a magic device on Kirin chipsets that teecd needs to access.
# Make sure that permissions are right.
2019-11-30 19:38:41 +00:00
chown system:system /dev/dsm
chmod 0660 /dev/dsm
2020-03-04 15:10:28 +00:00
2020-03-10 12:09:09 +00:00
# The presence of /dev/dsm indicates that we have a teecd,
# which needs /sec_storage and /data/sec_storage_data
2019-11-30 19:38:41 +00:00
mkdir -p /data/sec_storage_data
chown system:system /data/sec_storage_data
2020-03-10 12:09:09 +00:00
chcon -R u:object_r:teecd_data_file:s0 /data/sec_storage_data
2020-03-10 14:28:32 +00:00
if mount | grep -q " on /sec_storage " ; then
2020-03-10 12:09:09 +00:00
# /sec_storage is already mounted by the vendor, don't try to create and mount it
# ourselves. However, some devices have /sec_storage owned by root, which means that
# the fingerprint daemon (running as system) cannot access it.
chown -R system:system /sec_storage
chmod -R 0660 /sec_storage
chcon -R u:object_r:teecd_data_file:s0 /sec_storage
else
# No /sec_storage provided by vendor, mount /data/sec_storage_data to it
mount /data/sec_storage_data /sec_storage
chown system:system /sec_storage
chcon u:object_r:teecd_data_file:s0 /sec_storage
fi
2019-11-30 19:38:41 +00:00
fi
2019-12-01 16:02:34 +00:00
2019-12-06 20:34:44 +00:00
has_hostapd = false
for i in odm oem vendor product; do
if grep -qF android.hardware.wifi.hostapd /$i /etc/vintf/manifest.xml; then
has_hostapd = true
fi
2021-03-08 12:32:33 +00:00
for j in /$i /etc/vintf/manifest/*; do
if grep -qF android.hardware.wifi.hostapd $j ; then
has_hostapd = true
fi
done
2019-12-06 20:34:44 +00:00
done
if [ " $has_hostapd " = false ] ; then
setprop persist.sys.phh.system_hostapd true
fi
2019-12-08 23:54:05 +00:00
#Weird /odm/phone.prop Huawei stuff
2020-01-14 09:40:43 +00:00
HW_PRODID = " $( sed -nE 's/.*productid=([0-9xa-f]*).*/\1/p' /proc/cmdline) "
[ -z " $HW_PRODID " ] && HW_PRODID = " 0x $( od -A none -t x1 /sys/firmware/devicetree/base/hisi,modem_id | sed s/' ' //g) "
for part in odm vendor; do
if [ -f /$part /phone.prop ] ; then
if [ -n " $HW_PRODID " ] ; then
eval " $( awk 'BEGIN { a=0 }; /\[.*\].*/ { a=0 }; tolower($0) ~ /.*' " $HW_PRODID " '.*/ { a=1 }; /.*=.*/ { if(a == 1) print $0 }' /$part /phone.prop | sed -nE 's/(.*)=(.*)/setprop \1 "\2";/p' ) "
fi
2019-12-08 23:54:05 +00:00
fi
2020-01-14 09:40:43 +00:00
done
2020-01-02 01:41:59 +00:00
# Fix sprd adf for surfaceflinger to start
# Somehow the names of the device nodes are incorrect on Android 10; fix them by mknod
if [ -e /dev/sprd-adf-dev ] ; then
mknod -m666 /dev/adf0 c 250 0
mknod -m666 /dev/adf-interface0.0 c 250 1
mknod -m666 /dev/adf-overlay-engine0.0 c 250 2
restorecon /dev/adf0 /dev/adf-interface0.0 /dev/adf-overlay-engine0.0
2020-01-14 01:59:18 +00:00
# SPRD GL causes crashes in system_server (not currently observed in other processes)
# Tell the system to avoid using hardware acceleration in system_server.
setprop ro.config.avoid_gfx_accel true
2020-01-02 01:41:59 +00:00
fi
2020-01-11 11:36:06 +00:00
2020-12-16 13:01:15 +00:00
# Fix sensor services crashing on SPRD devices with Pie vendor
if getprop ro.hardware.keystore | grep -iq sprd && [ " $vndk " -le 28 ] ; then
setprop persist.sys.phh.disable_sensor_direct_report true
fi
2020-01-11 11:36:06 +00:00
# Fix manual network selection with old modem
# https://github.com/LineageOS/android_hardware_ril/commit/e3d006fa722c02fc26acdfcaa43a3f3a1378eba9
if getprop ro.vendor.build.fingerprint | grep -iq \
-e xiaomi/polaris -e xiaomi/whyred; then
setprop persist.sys.phh.radio.use_old_mnc_format true
fi
2020-02-29 15:56:36 +00:00
2020-03-06 17:41:32 +00:00
if getprop ro.build.overlay.deviceid | grep -qE '^RMX' ; then
2021-02-22 09:04:19 +00:00
resetprop_phh ro.vendor.gsi.build.flavor byPass
2020-08-05 18:38:30 +00:00
setprop oppo.camera.packname com.oppo.engineermode.camera
2020-02-29 15:56:36 +00:00
setprop sys.phh.xx.brand realme
fi
2020-03-06 17:41:32 +00:00
if [ -f /sys/firmware/devicetree/base/oppo,prjversion ] ; then
setprop ro.separate.soft $(( 0 x$( od -w4 -j4 -An -tx1 /sys/firmware/devicetree/base/oppo,prjversion | tr -d ' ' | head -n 1) ))
fi
if [ -f /proc/oppoVersion/prjVersion ] ; then
setprop ro.separate.soft $( cat /proc/oppoVersion/prjVersion)
fi
2021-08-10 21:23:42 +00:00
if grep -q -F ro.separate.soft /odm/build.prop; then
setprop ro.separate.soft " $( sed -nE 's/^ro.separate.soft=(.*)/\1/p' /odm/build.prop) "
fi
2020-03-06 17:41:32 +00:00
echo 1 > /proc/tfa98xx/oppo_tfa98xx_fw_update
2021-05-11 10:20:40 +00:00
if ! grep -q -E -e '.*#write .*tp_fw_update' /vendor/etc/init/hw/*touch*; then
echo 1 > /proc/touchpanel/tp_fw_update
fi
2020-03-06 17:41:32 +00:00
2020-03-10 22:26:20 +00:00
if getprop ro.build.overlay.deviceid | grep -qE '^RMX' ; then
chmod 0660 /sys/devices/platform/soc/soc:fpc_fpc1020/{ irq,irq_enable,wakelock_enable}
if [ " $( stat -c '%U' /sys/devices/platform/soc/soc:fpc_fpc1020/irq) " = = "root" ] &&
[ " $( stat -c '%G' /sys/devices/platform/soc/soc:fpc_fpc1020/irq) " = = "root" ] ; then
chown system:system /sys/devices/platform/soc/soc:fpc_fpc1020/{ irq,irq_enable,wakelock_enable}
setprop persist.sys.phh.fingerprint.nocleanup true
fi
fi
2020-03-11 16:28:09 +00:00
2020-06-23 19:40:55 +00:00
if [ " $vndk " -le 28 ] && getprop ro.hardware | grep -q -e mt6761 -e mt6763 -e mt6765 -e mt6785 -e mt8768 -e mt6779 -e mt6771 -e mt8766; then
2020-03-11 16:28:09 +00:00
setprop debug.stagefright.ccodec 0
fi
2020-04-04 21:57:10 +00:00
if getprop ro.omc.build.version | grep -qE .; then
for f in $( find /odm -name \* .apk) ; do
mount /system/phh/empty $f
done
fi
2020-04-13 17:52:39 +00:00
2020-04-13 18:25:57 +00:00
if getprop ro.vendor.build.fingerprint | grep -qiE \
-e Nokia/Plate2 \
-e razer/cheryl ; then
2020-04-13 17:52:39 +00:00
setprop media.settings.xml "/vendor/etc/media_profiles_vendor.xml"
fi
2021-02-22 09:04:19 +00:00
resetprop_phh service.adb.root 0
2020-05-14 09:00:04 +00:00
2020-05-14 13:47:02 +00:00
# This is for Samsung Galaxy devices with HBM FOD
# On those devices, a magic Layer usageBits switches to "mask_brightness"
# But default is 255, so set it to max instead
2020-05-14 16:31:37 +00:00
cat /sys/class/backlight/*/max_brightness | sort -n | tail -n 1 > /sys/class/lcd/panel/mask_brightness
2020-05-20 17:57:33 +00:00
if getprop ro.vendor.build.fingerprint | grep -qiE '^xiaomi/' ; then
setprop persist.sys.phh.fod.xiaomi true
fi
if getprop ro.vendor.build.fingerprint | grep -qiE '^samsung/' ; then
2020-06-24 09:11:02 +00:00
for f in /sys/class/lcd/panel/actual_mask_brightness /sys/class/lcd/panel/mask_brightness /sys/class/lcd/panel/device/backlight/panel/brightness /sys/class/backlight/panel0-backlight/brightness; do
2021-01-30 21:57:53 +00:00
if [ " $( stat -c '%U' " $f " ) " = = "root" ] ; then
chcon u:object_r:sysfs_lcd_writable:s0 $f
chmod 0644 $f
chown system:system $f
fi
2020-06-24 09:11:02 +00:00
done
2020-05-20 17:57:33 +00:00
setprop persist.sys.phh.fod.samsung true
fi
if getprop ro.vendor.build.fingerprint | grep -qiE '^oneplus/' ; then
setprop persist.sys.phh.fod.bbk true
fi
if getprop ro.build.overlay.deviceid | grep -qiE -e '^RMX' -e '^CPH' ; then
setprop persist.sys.phh.fod.bbk true
fi
2020-05-20 19:40:03 +00:00
if getprop ro.build.overlay.deviceid | grep -iq -e RMX1941 -e RMX1945 -e RMX1943 -e RMX1942; then
setprop persist.sys.qcom-brightness " $( cat /sys/class/leds/lcd-backlight/max_brightness) "
setprop persist.sys.phh.mainkeys 0
fi
2020-05-24 17:21:58 +00:00
2020-12-12 02:57:23 +00:00
if getprop ro.build.overlay.deviceid | grep -iq -e RMX2185 -e RMX1941 -e RMX1945 -e RMX1943 -e RMX1942; then
2020-11-30 10:00:25 +00:00
setprop persist.sys.overlay.devinputjack true
fi
2021-02-22 09:04:19 +00:00
resetprop_phh ro.bluetooth.library_name libbluetooth.so
2020-05-28 09:44:21 +00:00
2020-05-29 08:13:16 +00:00
if getprop ro.vendor.build.fingerprint | grep -iq xiaomi/cepheus; then
2020-05-28 09:44:21 +00:00
setprop ro.netflix.bsp_rev Q855-16947-1
fi
2020-05-29 08:13:16 +00:00
if getprop ro.vendor.build.fingerprint | grep -qi redmi/curtana; then
setprop ro.netflix.bsp_rev Q6250-19132-1
fi
2020-06-03 12:13:33 +00:00
# Set props for Vsmart Live's fod
if getprop ro.vendor.build.fingerprint | grep -q vsmart/V620A_open; then
setprop persist.sys.fp.fod.location.X_Y 447,1812
setprop persist.sys.fp.fod.size.width_height 186,186
fi
2020-06-05 18:34:22 +00:00
setprop vendor.display.res_switch_en 1
2020-06-19 22:19:13 +00:00
if getprop ro.bionic.cpu_variant | grep -q kryo300; then
2021-02-22 09:04:19 +00:00
resetprop_phh ro.bionic.cpu_variant cortex-a75
2020-06-19 22:19:13 +00:00
setprop dalvik.vm.isa.arm64.variant cortex-a75
2020-06-19 22:31:29 +00:00
setprop dalvik.vm.isa.arm64.features runtime
2020-06-19 22:19:13 +00:00
fi
2021-02-22 09:04:19 +00:00
resetprop_phh ro.control_privapp_permissions log
2020-09-27 18:12:39 +00:00
if [ -f /vendor/etc/init/vendor.ozoaudio.media.c2@1.0-service.rc ] ; then
if [ " $vndk " -le 29 ] ; then
mount /system/etc/seccomp_policy/mediacodec.policy /vendor/etc/seccomp_policy/codec2.vendor.base.policy
fi
fi
2020-09-30 20:38:28 +00:00
if [ " $vndk " -le 27 ] ; then
setprop persist.sys.phh.no_present_or_validate true
fi
2020-10-05 20:12:49 +00:00
2021-10-15 15:30:35 +00:00
[ -d /mnt/vendor/persist ] && mount /mnt/vendor/persist /persist
2020-10-06 17:55:11 +00:00
2020-10-26 21:46:16 +00:00
for f in $( find /sys -name fts_gesture_mode) ; do
setprop persist.sys.phh.focaltech_node " $f "
done
2020-10-06 17:55:11 +00:00
if [ " $vndk " -le 27 ] && [ -f /vendor/bin/mnld ] ; then
setprop persist.sys.phh.sdk_override /vendor/bin/mnld= 26
fi
2021-02-23 14:00:54 +00:00
# Disable secondary watchdogs
echo -n V > /dev/watchdog1
2021-10-28 18:05:02 +00:00
if [ " $vndk " -le 30 ] ; then
# On older vendor the default behavior was to disable color management
# Don't override vendor value, merely add a fallback
setprop ro.surface_flinger.use_color_management false
fi
2021-12-01 18:15:23 +00:00
# Disable ODM display overlay for Realme GT ME, which is annoyingly hard to override
if getprop ro.boot.prjname | grep -qi 21615; then
mount -o bind /system/phh/empty /odm/overlay/android_framework_res_overlay.display.product.21615.apk
fi
2021-12-08 18:36:39 +00:00
setprop debug.sf.latch_unsignaled 1
if [ " $( stat -c '%U' /dev/nxp_smartpa_dev) " = = "root" ] &&
[ " $( stat -c '%G' /dev/nxp_smartpa_dev) " = = "root" ] ; then
chown root:audio /dev/nxp_smartpa_dev
chmod 0660 /dev/nxp_smartpa_dev
fi
if getprop ro.odm.build.fingerprint | grep -q Huawei/Chicago; then
setprop ctl.stop aptouch
fi