2023-11-29 12:19:14 +08:00
|
|
|
# Conditional sensitive properties
|
2023-11-25 03:58:30 +08:00
|
|
|
|
2023-11-29 12:19:14 +08:00
|
|
|
resetprop_if_diff() {
|
|
|
|
local NAME=$1
|
|
|
|
local EXPECTED=$2
|
|
|
|
local CURRENT=$(resetprop $NAME)
|
2023-11-25 03:58:30 +08:00
|
|
|
|
2023-11-29 12:19:14 +08:00
|
|
|
[ -z "$CURRENT" ] || [ "$CURRENT" == "$EXPECTED" ] || resetprop $NAME $EXPECTED
|
2023-11-25 03:58:30 +08:00
|
|
|
}
|
2023-11-29 12:19:14 +08:00
|
|
|
resetprop_if_match() {
|
|
|
|
local NAME=$1
|
|
|
|
local CONTAINS=$2
|
|
|
|
local VALUE=$3
|
|
|
|
|
|
|
|
[[ "$(resetprop $NAME)" == *"$CONTAINS"* ]] && resetprop $NAME $VALUE
|
|
|
|
}
|
|
|
|
|
|
|
|
# RootBeer, Microsoft
|
|
|
|
resetprop_if_diff ro.build.tags release-keys
|
|
|
|
|
|
|
|
# Samsung
|
|
|
|
resetprop_if_diff ro.boot.warranty_bit 0
|
|
|
|
resetprop_if_diff ro.vendor.boot.warranty_bit 0
|
|
|
|
resetprop_if_diff ro.vendor.warranty_bit 0
|
|
|
|
resetprop_if_diff ro.warranty_bit 0
|
|
|
|
|
|
|
|
# OnePlus
|
|
|
|
resetprop_if_diff ro.is_ever_orange 0
|
|
|
|
|
|
|
|
# Other
|
|
|
|
resetprop_if_diff ro.build.type user
|
|
|
|
resetprop_if_diff ro.debuggable 0
|
|
|
|
resetprop_if_diff ro.secure 1
|
2023-11-25 03:58:30 +08:00
|
|
|
|
|
|
|
# Magisk recovery mode
|
2023-11-29 12:19:14 +08:00
|
|
|
resetprop_if_match ro.bootmode recovery unknown
|
|
|
|
resetprop_if_match ro.boot.mode recovery unknown
|
|
|
|
resetprop_if_match vendor.boot.mode recovery unknown
|
2023-11-25 03:58:30 +08:00
|
|
|
|
2023-11-29 12:19:14 +08:00
|
|
|
# SELinux
|
2023-11-29 17:10:07 +08:00
|
|
|
if [ -n "$(getprop ro.build.selinux)" ]; then
|
|
|
|
resetprop --delete ro.build.selinux
|
|
|
|
fi
|
|
|
|
|
2023-11-29 12:19:14 +08:00
|
|
|
# use toybox to protect *stat* access time reading
|
|
|
|
if [ "$(toybox cat /sys/fs/selinux/enforce)" == "0" ]; then
|
2023-11-25 09:13:22 +08:00
|
|
|
chmod 640 /sys/fs/selinux/enforce
|
|
|
|
chmod 440 /sys/fs/selinux/policy
|
|
|
|
fi
|
|
|
|
|
2023-11-29 12:19:14 +08:00
|
|
|
# SafetyNet/Play Integrity
|
2023-11-25 03:58:30 +08:00
|
|
|
{
|
2023-11-29 12:19:14 +08:00
|
|
|
# late props which must be set after boot_completed for various OEMs
|
|
|
|
until [ "$(getprop sys.boot_completed)" == "1" ]; do
|
2023-11-25 03:58:30 +08:00
|
|
|
sleep 1
|
|
|
|
done
|
|
|
|
|
2023-11-29 12:19:14 +08:00
|
|
|
# Avoid breaking Realme fingerprint scanners
|
|
|
|
resetprop_if_diff ro.boot.flash.locked 1
|
2023-11-25 03:58:30 +08:00
|
|
|
|
2023-11-29 12:19:14 +08:00
|
|
|
# Avoid breaking Oppo fingerprint scanners
|
|
|
|
resetprop_if_diff ro.boot.vbmeta.device_state locked
|
2023-11-25 03:58:30 +08:00
|
|
|
|
2023-11-29 12:19:14 +08:00
|
|
|
# Avoid breaking OnePlus display modes/fingerprint scanners
|
|
|
|
resetprop_if_diff vendor.boot.verifiedbootstate green
|
2023-11-25 03:58:30 +08:00
|
|
|
|
2023-11-29 12:19:14 +08:00
|
|
|
# Avoid breaking OnePlus/Oppo display 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
|
2023-11-29 17:10:07 +08:00
|
|
|
}&
|