Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RMX1831: FP clearing after reboot fixup #221

Open
wants to merge 47 commits into
base: android-11.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
b8e1d18
Actually we want to force samsung workaround off
phhusson Sep 9, 2019
64d8b7d
Add prop to disable incoming calls sed
Dinolek Sep 13, 2019
eff02a1
Merge pull request #118 from Dinolek/android-9.0
phhusson Sep 13, 2019
d73bb66
latch_unsignaled on mt6771
phhusson Sep 14, 2019
40e7ecc
[device] Added "ro.audio.ignore_effects true" for davinci
kuba3351 Oct 5, 2019
c325426
Merge pull request #120 from kuba3351/patch-1
phhusson Oct 5, 2019
9212d15
Add privapp-permissions whitelist for PhhTrebleApp
AndyCGYan Oct 25, 2019
5711a57
Merge pull request #121 from AndyCGYan/ppw
phhusson Oct 25, 2019
954d215
Support Nokia 4.2 assistant button
phhusson Oct 26, 2019
b560c36
fix sound for redmi note 8 (ginko)
Nov 11, 2019
214ee50
Merge pull request #123 from lead4good/android-9.0
phhusson Nov 11, 2019
4bd3bbd
[daisy] revert camera in DnD fix
Nov 19, 2019
71eef45
Fix backlight on Redmi 8A (olivelite)
milankragujevic Nov 20, 2019
7a6d88a
Merge pull request #127 from redmi8a/android-9.0
phhusson Nov 21, 2019
dc8484b
Fix fingerprint on Honor View 10
phhusson Nov 30, 2019
c0eb03e
Fix backlight on Redmi 7A (pine)
YaAlex3 Dec 2, 2019
7329ffd
Merge pull request #128 from YaAlex3/android-9.0
phhusson Dec 2, 2019
39b0a00
Detect whether vendor has an hostapd by checking manifest
phhusson Dec 6, 2019
897f17c
SPL got from boot.img is safer than from vendor (there can be mismatch)
phhusson Dec 8, 2019
8a6837d
Add support for Huawei's phone.prop
phhusson Dec 8, 2019
f41734e
fix: add sound support for xiaomi a3
Dec 9, 2019
344ff91
Merge pull request #131 from lead4good/android-9.0
phhusson Dec 9, 2019
ba9d46f
Merge pull request #125 from eremitein/android-9.0
phhusson Dec 11, 2019
21655a0
fix: mia3 brightness scale
Dec 22, 2019
e975ed9
Merge pull request #136 from lead4good/android-9.0
phhusson Dec 22, 2019
4700841
Fix audio on Redmi Note 8T (willow)
DarkJoker360 Jan 8, 2020
656465a
Merge pull request #142 from DarkJoker360/android-9.0
phhusson Jan 8, 2020
73b2078
Fix dualsim for some Huawei phones (#143)
washinson Jan 14, 2020
06aaf84
Add Redmi 7 - onc(lite) to fingerprint input events blacklist
semekh Jan 21, 2020
0639e66
Add smoothness for Lenovo Moto E5 in Pie Builds
pcurz Feb 7, 2020
93bec7c
Merge pull request #148 from XavierWrz/patch-1
phhusson Feb 7, 2020
f7eb2c6
Enable latch_unsignaled on exynos devices
SamarV-121 Feb 19, 2020
90d6401
Merge pull request #150 from SamarV-121/patch-1
phhusson Feb 19, 2020
a67704f
Fix brightness on Redmi Note 8 Pro
jumper047 Feb 19, 2020
c832c77
Fix regexp
jumper047 Feb 20, 2020
6a7718a
Properly delete superuser app
myst33d Feb 20, 2020
e60db73
Merge pull request #153 from myst33d/android-9.0
phhusson Feb 20, 2020
0e1cf08
* rw-system.sh: simplify begonia regexp
jumper047 Feb 20, 2020
d3b3d20
Fix begonia fingerprint sensor behavior
jumper047 Feb 20, 2020
f29508b
Fix typo
jumper047 Feb 20, 2020
ce67941
Merge pull request #151 from jumper047/patch-1
phhusson Feb 21, 2020
58dd996
[xiaomi] Use persist.sys.phh.xiaomi.dt2w prop to control DT2W
cheah Mar 26, 2020
7e2b58b
Merge pull request #139 from cheah/fix-xiaomi-dt2w
phhusson Mar 26, 2020
d5b3121
Fix exynos grep command to apply setprop correctly
ponces May 13, 2020
aca15ba
Simplify the exynos grep command even further and remove some whitespace
ponces May 14, 2020
09e6efa
Merge pull request #185 from ponces/android-9.0
phhusson May 14, 2020
36e03dd
RMX1831: Fixed FP cleanup in phh GSI.
LokeshV790 Dec 29, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion base.mk
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ PRODUCT_PACKAGES += \

PRODUCT_COPY_FILES += \
device/phh/treble/rw-system.sh:system/bin/rw-system.sh \
device/phh/treble/phh-prop-handler.sh:system/bin/phh-prop-handler.sh \
device/phh/treble/fixSPL/getSPL.arm:system/bin/getSPL

PRODUCT_COPY_FILES += \
Expand Down Expand Up @@ -107,7 +108,8 @@ PRODUCT_COPY_FILES += \
device/phh/treble/files/huawei-fingerprint.kl:system/phh/huawei/fingerprint.kl \
device/phh/treble/files/samsung-sec_e-pen.idc:system/usr/idc/sec_e-pen.idc \
device/phh/treble/files/samsung-9810-floating_feature.xml:system/ph/sam-9810-flo_feat.xml \
device/phh/treble/files/mimix3-gpio-keys.kl:system/phh/mimix3-gpio-keys.kl
device/phh/treble/files/mimix3-gpio-keys.kl:system/phh/mimix3-gpio-keys.kl \
device/phh/treble/files/nokia-soc_gpio_keys.kl:system/phh/nokia-soc_gpio_keys.kl

SELINUX_IGNORE_NEVERALLOWS := true

Expand Down Expand Up @@ -138,3 +140,6 @@ PRODUCT_PACKAGES += \
PRODUCT_COPY_FILES += \
device/phh/treble/phh-securize.sh:system/bin/phh-securize.sh \

# Privapp-permissions whitelist for PhhTrebleApp
PRODUCT_COPY_FILES += \
device/phh/treble/privapp-permissions-me.phh.treble.app.xml:system/etc/permissions/privapp-permissions-me.phh.treble.app.xml
2 changes: 2 additions & 0 deletions board-base.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ TARGET_SYSTEM_PROP := device/phh/treble/system.prop $(TARGET_SYSTEM_PROP)
BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR := device/phh/treble/bluetooth
TARGET_EXFAT_DRIVER := exfat
DEVICE_FRAMEWORK_MANIFEST_FILE := device/phh/treble/framework_manifest.xml

BOARD_ROOT_EXTRA_FOLDERS += sec_storage
6 changes: 6 additions & 0 deletions files/nokia-soc_gpio_keys.kl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# SPDX-License-Identifier: Apache-2.0

key 114 VOLUME_DOWN
key 115 VOLUME_UP
key 116 POWER
key 236 ASSIST
60 changes: 60 additions & 0 deletions phh-prop-handler.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/system/bin/sh
set -o pipefail

display_usage() {
echo -e "\nUsage:\n ./phh-prop-handler.sh [prop]\n"
}

if [ "$#" -ne 1 ]; then
display_usage
exit 1
fi

prop_value=$(getprop "$1")

xiaomi_toggle_dt2w_proc_node() {
DT2W_PROC_NODES=("/proc/touchpanel/wakeup_gesture"
"/proc/tp_wakeup_gesture"
"/proc/tp_gesture")
for node in "${DT2W_PROC_NODES[@]}"; do
[ ! -f "${node}" ] && continue
echo "Trying to set dt2w mode with /proc node: ${node}"
echo "$1" >"${node}"
[[ "$(cat "${node}")" -eq "$1" ]] # Check result
return
done
return 1
}

xiaomi_toggle_dt2w_event_node() {
for ev in $(
cd /sys/class/input || return
echo event*
); do
[ ! -f "/sys/class/input/${ev}/device/device/gesture_mask" ] &&
[ ! -f "/sys/class/input/${ev}/device/wake_gesture" ] && continue
echo "Trying to set dt2w mode with event node: /dev/input/${ev}"
if [ "$1" -eq 1 ]; then
# Enable
sendevent /dev/input/"${ev}" 0 1 5
return
else
# Disable
sendevent /dev/input/"${ev}" 0 1 4
return
fi
done
return 1
}

if [ "$1" == "persist.sys.phh.xiaomi.dt2w" ]; then
if [[ "$prop_value" -ne 0 && "$prop_value" -ne 1 ]]; then
exit 1
fi

if ! xiaomi_toggle_dt2w_proc_node "$prop_value"; then
# Fallback to event node method
xiaomi_toggle_dt2w_event_node "$prop_value"
fi
exit $?
fi
2 changes: 1 addition & 1 deletion phh-securize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ rm /system/xbin/su
rm /system/bin/phh-su
rm /system/etc/init/su.rc
rm /system/bin/phh-securize.sh
rm -Rf /system/bin/me.phh.superuser/
rm -Rf /system/app/me.phh.superuser/
mount -o remount,ro /
mount -o remount,ro /system
sync
Expand Down
6 changes: 6 additions & 0 deletions privapp-permissions-me.phh.treble.app.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<permissions>
<privapp-permissions package="me.phh.treble.app">
<permission name="android.permission.INTERACT_ACROSS_USERS"/>
</privapp-permissions>
</permissions>
87 changes: 74 additions & 13 deletions rw-system.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ changeKeylayout() {
if getprop ro.vendor.build.fingerprint | grep -iq \
-e xiaomi/polaris -e xiaomi/sirius -e xiaomi/dipper \
-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 Redmi/begonia\
-e xiaomi/nitrogen -e xiaomi/daisy -e xiaomi/sakura \
-e xiaomi/whyred -e xiaomi/tulip; then
-e xiaomi/whyred -e xiaomi/tulip -e xiaomi/onc; then
if [ ! -f /mnt/phh/keylayout/uinput-goodix.kl ]; then
cp /system/phh/empty /mnt/phh/keylayout/uinput-goodix.kl
chmod 0644 /mnt/phh/keylayout/uinput-goodix.kl
Expand Down Expand Up @@ -103,6 +103,12 @@ changeKeylayout() {
changed=true
fi

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

if [ "$changed" = true ]; then
mount -o bind /mnt/phh/keylayout /system/usr/keylayout
restorecon -R /system/usr/keylayout
Expand Down Expand Up @@ -153,6 +159,12 @@ if getprop ro.vendor.build.fingerprint | grep -qE 'Sony/'; then
setprop persist.sys.qcom-brightness -1
fi

# 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

if getprop ro.vendor.build.fingerprint | grep -qi oneplus/oneplus6/oneplus6; then
resize2fs /dev/block/platform/soc/1d84000.ufshc/by-name/userdata
fi
Expand All @@ -177,11 +189,12 @@ fi
if getprop ro.vendor.build.fingerprint | grep -q -i \
-e xiaomi/clover -e xiaomi/wayne -e xiaomi/sakura \
-e xiaomi/nitrogen -e xiaomi/whyred -e xiaomi/platina \
-e xiaomi/ysl -e nubia/nx60 -e nubia/nx61 -e xiaomi/tulip -e xiaomi/lavender; then
-e xiaomi/ysl -e nubia/nx60 -e nubia/nx61 -e xiaomi/tulip \
-e xiaomi/lavender -e xiaomi/olivelite -e xiaomi/pine -e Redmi/begonia; then
setprop persist.sys.qcom-brightness "$(cat /sys/class/leds/lcd-backlight/max_brightness)"
fi

if getprop ro.vendor.product.device |grep -iq -e RMX1801 -e RMX1803 -e RMX1807;then
if getprop ro.vendor.product.device |grep -iq -e RMX1801 -e RMX1803 -e RMX1807;then
setprop persist.sys.qcom-brightness "$(cat /sys/class/leds/lcd-backlight/max_brightness)"
fi

Expand All @@ -191,7 +204,8 @@ if getprop ro.vendor.build.fingerprint | grep -iq \
-e motorola/ali/ali -e iaomi/perseus/perseus -e iaomi/platina/platina \
-e iaomi/equuleus/equuleus -e motorola/nora -e xiaomi/nitrogen \
-e motorola/hannah -e motorola/james -e motorola/pettyl -e iaomi/cepheus \
-e iaomi/grus -e xiaomi/cereus -e iaomi/raphael;then
-e iaomi/grus -e xiaomi/cereus -e iaomi/raphael -e iaomi/davinci \
-e iaomi/ginkgo -e iaomi/laurel_sprout -e iaomi/willow;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
Expand Down Expand Up @@ -228,6 +242,12 @@ 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
[ ! -f $f ] && continue

setprop persist.sys.phh.radio.force_cognitive true
setprop persist.sys.radio.ussd.fix true

if getprop persist.sys.mtk.disable.incoming.fix | grep -q 1; then break; fi

# shellcheck disable=SC2010
ctxt="$(ls -lZ "$f" | grep -oE 'u:object_r:[^:]*:s0')"
b="$(echo "$f" | tr / _)"
Expand All @@ -238,9 +258,6 @@ for f in /vendor/lib/mtk-ril.so /vendor/lib64/mtk-ril.so /vendor/lib/libmtk-ril.
"/mnt/phh/$b"
chcon "$ctxt" "/mnt/phh/$b"
mount -o bind "/mnt/phh/$b" "$f"

setprop persist.sys.phh.radio.force_cognitive true
setprop persist.sys.radio.ussd.fix true
done

mount -o bind /system/phh/empty /vendor/overlay/SysuiDarkTheme/SysuiDarkTheme.apk || true
Expand All @@ -266,11 +283,15 @@ if busybox_phh unzip -p /vendor/app/ims/ims.apk classes.dex | grep -qF -e Landro
mount -o bind /system/phh/empty /vendor/app/ims/ims.apk
fi

if getprop ro.hardware | grep -qF samsungexynos; then
if getprop ro.hardware | grep -q -e exynos -e mt6771; then
setprop debug.sf.latch_unsignaled 1
fi

if getprop ro.product.model | grep -qF -e ANE; then
setprop debug.sf.latch_unsignaled 1
fi

if getprop ro.product.model | grep -qF ANE; then
if getprop ro.vendor.product.device | grep -q -e nora -e rhannah; then
setprop debug.sf.latch_unsignaled 1
fi

Expand Down Expand Up @@ -321,11 +342,16 @@ if getprop ro.vendor.build.fingerprint | grep -qiE '^samsung'; then
fi
fi

if getprop ro.vendor.build.fingerprint | grep -qE '^xiaomi/(daisy|wayne)/(daisy|wayne).*'; then
if getprop ro.vendor.build.fingerprint | grep -qE '^xiaomi/wayne/wayne.*'; then
# Fix camera on DND, ugly workaround but meh
setprop audio.camerasound.force true
fi

if getprop persist.sys.phh.fingerprint.nocleanup | grep -qE '^realme/RMX1831/RMX1831.*'; then
# Fix fingerprint cleanup after reboot in RMX1831 aka realme U1
setprop.sys.phh.fingerprint.nocleanup true
fi

mount -o bind /mnt/phh/empty_dir /vendor/etc/audio || true

for f in /vendor/lib{,64}/hw/com.qti.chi.override.so;do
Expand All @@ -349,7 +375,7 @@ if [ -n "$(getprop ro.boot.product.hardware.sku)" ] && [ -z "$(getprop ro.hw.oem
fi

if getprop ro.vendor.build.fingerprint | grep -qiE '^samsung/' && [ "$vndk" -ge 28 ];then
setprop persist.sys.phh.samsung_fingerprint -1
setprop persist.sys.phh.samsung_fingerprint 0
#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" ] &&
Expand Down Expand Up @@ -397,8 +423,8 @@ if [ -f /system/phh/secure ];then
copyprop ro.build.product ro.product.vendor.model
copyprop ro.product.manufacturer ro.vendor.product.manufacturer
copyprop ro.product.manufacturer ro.product.vendor.manufacturer
copyprop ro.build.version.security_patch ro.keymaster.xxx.security_patch
copyprop ro.build.version.security_patch ro.vendor.build.security_patch
copyprop ro.build.version.security_patch ro.keymaster.xxx.security_patch
resetprop ro.build.tags release-keys
resetprop ro.boot.vbmeta.device_state locked
resetprop ro.boot.verifiedbootstate green
Expand All @@ -414,3 +440,38 @@ if [ -f /system/phh/secure ];then
resetprop ro.adb.secure 1
setprop ctl.restart adbd
fi

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
chown system:system /dev/dsm
chmod 0660 /dev/dsm
mkdir -p /data/sec_storage_data
chown system:system /data/sec_storage_data
chcon u:object_r:teecd_data_file_system:s0 /data/sec_storage_data
mount /data/sec_storage_data /sec_storage
fi

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
done

if [ "$has_hostapd" = false ];then
setprop persist.sys.phh.system_hostapd true
fi

#Weird /odm/phone.prop Huawei stuff
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
fi
done
3 changes: 3 additions & 0 deletions sepolicy/file_contexts
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@

/system/bin/fsck\.exfat u:object_r:fsck_exec:s0
/system/bin/fsck\.ntfs u:object_r:fsck_exec:s0

/sec_storage(/.*)? u:object_r:teecd_data_file:s0
/dev/dsm u:object_r:dmd_device:s0
10 changes: 10 additions & 0 deletions sepolicy/huawei.te
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
allow ueventd proc:file r_file_perms;

type teecd_data_file, file_type;
type dmd_device, file_type;
allow hal_fingerprint_server dmd_device:chr_file rw_file_perms;
allow hal_fingerprint_server sysfs:file rw_file_perms;

type oeminfo_nvm, domain;
type oeminfo_nvm_device, file_type;
allowxperm oeminfo_nvm oeminfo_nvm_device:blk_file ioctl { 0x1260 };
allow ueventd dmd_device:chr_file create_file_perms;
3 changes: 3 additions & 0 deletions vndk.rc
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ on property:sys.boot_completed=1

on property:persist.sys.phh.mainkeys=*
setprop qemu.hw.mainkeys ${persist.sys.phh.mainkeys}

on property:persist.sys.phh.xiaomi.dt2w=*
exec_background u:r:phhsu_daemon:s0 root -- /system/bin/phh-prop-handler.sh "persist.sys.phh.xiaomi.dt2w"