2024-09-04 18:12:52 +08:00
|
|
|
MODPATH="${0%/*}"
|
2024-10-25 07:11:18 +08:00
|
|
|
. "$MODPATH"/common_func.sh
|
2024-09-04 18:12:52 +08:00
|
|
|
|
|
|
|
# Conditional sensitive properties
|
|
|
|
|
|
|
|
# Magisk Recovery Mode
|
2024-07-24 19:41:18 +08:00
|
|
|
resetprop_if_match ro.boot.mode recovery unknown
|
2024-09-04 18:12:52 +08:00
|
|
|
resetprop_if_match ro.bootmode recovery unknown
|
2024-07-24 19:35:19 +08:00
|
|
|
resetprop_if_match vendor.boot.mode recovery unknown
|
|
|
|
|
2024-09-04 18:12:52 +08:00
|
|
|
# SELinux
|
2024-07-24 19:35:19 +08:00
|
|
|
resetprop_if_diff ro.boot.selinux enforcing
|
2024-09-04 18:12:52 +08:00
|
|
|
# use toybox to protect stat access time reading
|
|
|
|
if [ "$(toybox cat /sys/fs/selinux/enforce)" = "0" ]; then
|
2024-07-22 00:34:45 +08:00
|
|
|
chmod 640 /sys/fs/selinux/enforce
|
|
|
|
chmod 440 /sys/fs/selinux/policy
|
|
|
|
fi
|
|
|
|
|
2024-09-04 18:12:52 +08:00
|
|
|
# Conditional late sensitive properties
|
|
|
|
|
|
|
|
until [ "$(getprop sys.boot_completed)" = "1" ]; do
|
|
|
|
sleep 1
|
|
|
|
done
|
|
|
|
|
|
|
|
# SafetyNet/Play Integrity + OEM
|
|
|
|
# avoid bootloop on some Xiaomi devices
|
|
|
|
resetprop_if_diff ro.secureboot.lockstate locked
|
|
|
|
# avoid breaking Realme fingerprint scanners
|
|
|
|
resetprop_if_diff ro.boot.flash.locked 1
|
|
|
|
resetprop_if_diff ro.boot.realme.lockstate 1
|
|
|
|
# avoid breaking Oppo fingerprint scanners
|
|
|
|
resetprop_if_diff ro.boot.vbmeta.device_state locked
|
|
|
|
# avoid breaking OnePlus display modes/fingerprint scanners
|
|
|
|
resetprop_if_diff vendor.boot.verifiedbootstate green
|
|
|
|
# avoid breaking OnePlus/Oppo fingerprint scanners on OOS/ColorOS 12+
|
|
|
|
resetprop_if_diff ro.boot.verifiedbootstate green
|
|
|
|
resetprop_if_diff ro.boot.veritymode enforcing
|
|
|
|
resetprop_if_diff vendor.boot.vbmeta.device_state locked
|
|
|
|
|
|
|
|
# Other
|
|
|
|
resetprop_if_diff sys.oem_unlock_allowed 0
|