Compare commits
46 Commits
android-11
...
android-9.
Author | SHA1 | Date | |
---|---|---|---|
|
09e6efa628 | ||
|
aca15ba77f | ||
|
d5b3121548 | ||
|
7e2b58bf3c | ||
|
58dd99657a | ||
|
ce67941ebf | ||
|
f29508b21c | ||
|
d3b3d20716 | ||
|
0e1cf0877a | ||
|
e60db7365b | ||
|
6a7718a60b | ||
|
c832c77d14 | ||
|
a67704f357 | ||
|
90d64013c2 | ||
|
f7eb2c6c16 | ||
|
93bec7ceaa | ||
|
0639e66ec0 | ||
|
06aaf84236 | ||
|
73b20785b8 | ||
|
656465ab76 | ||
|
4700841132 | ||
|
e975ed9f89 | ||
|
21655a0839 | ||
|
ba9d46f93a | ||
|
344ff91898 | ||
|
f41734ed8f | ||
|
8a6837d774 | ||
|
897f17c554 | ||
|
39b0a00aba | ||
|
7329ffdc22 | ||
|
c0eb03ec69 | ||
|
dc8484b74f | ||
|
7a6d88a308 | ||
|
71eef45e2c | ||
|
4bd3bbdd0b | ||
|
214ee50feb | ||
|
b560c366aa | ||
|
954d2157da | ||
|
5711a57dd4 | ||
|
9212d15274 | ||
|
c325426906 | ||
|
40e7ecc90d | ||
|
d73bb669e2 | ||
|
eff02a1912 | ||
|
64d8b7d900 | ||
|
b8e1d18b51 |
7
base.mk
7
base.mk
@ -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 += \
|
||||
@ -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
|
||||
|
||||
@ -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,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
files/nokia-soc_gpio_keys.kl
Normal file
6
files/nokia-soc_gpio_keys.kl
Normal file
@ -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
phh-prop-handler.sh
Normal file
60
phh-prop-handler.sh
Normal file
@ -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
|
@ -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
|
||||
|
6
privapp-permissions-me.phh.treble.app.xml
Normal file
6
privapp-permissions-me.phh.treble.app.xml
Normal file
@ -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>
|
82
rw-system.sh
82
rw-system.sh
@ -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
|
||||
@ -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
|
||||
@ -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
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
@ -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 / _)"
|
||||
@ -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
|
||||
@ -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 ANE; then
|
||||
if getprop ro.product.model | grep -qF -e ANE; then
|
||||
setprop debug.sf.latch_unsignaled 1
|
||||
fi
|
||||
|
||||
if getprop ro.vendor.product.device | grep -q -e nora -e rhannah; then
|
||||
setprop debug.sf.latch_unsignaled 1
|
||||
fi
|
||||
|
||||
@ -321,7 +342,7 @@ 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
|
||||
@ -349,7 +370,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" ] &&
|
||||
@ -397,8 +418,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
|
||||
@ -414,3 +435,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
|
||||
|
@ -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
|
||||
|
@ -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
vndk.rc
3
vndk.rc
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user