2021-10-31 00:49:46 +00:00
|
|
|
#!/system/bin/sh
|
|
|
|
# Conditional MagiskHide properties
|
|
|
|
|
|
|
|
maybe_set_prop() {
|
|
|
|
local prop="$1"
|
|
|
|
local contains="$2"
|
|
|
|
local value="$3"
|
|
|
|
|
|
|
|
if [[ "$(getprop "$prop")" == *"$contains"* ]]; then
|
|
|
|
resetprop "$prop" "$value"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
# Magisk recovery mode
|
|
|
|
maybe_set_prop ro.bootmode recovery unknown
|
|
|
|
maybe_set_prop ro.boot.mode recovery unknown
|
|
|
|
maybe_set_prop vendor.boot.mode recovery unknown
|
|
|
|
|
|
|
|
# MIUI cross-region flash
|
|
|
|
maybe_set_prop ro.boot.hwc CN GLOBAL
|
|
|
|
maybe_set_prop ro.boot.hwcountry China GLOBAL
|
|
|
|
|
|
|
|
resetprop --delete ro.build.selinux
|
|
|
|
|
|
|
|
# SELinux permissive
|
|
|
|
if [[ "$(cat /sys/fs/selinux/enforce)" == "0" ]]; then
|
|
|
|
chmod 640 /sys/fs/selinux/enforce
|
|
|
|
chmod 440 /sys/fs/selinux/policy
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Late props which must be set after boot_completed
|
|
|
|
{
|
|
|
|
until [[ "$(getprop sys.boot_completed)" == "1" ]]; do
|
|
|
|
sleep 1
|
|
|
|
done
|
|
|
|
|
2023-01-01 14:17:19 +00:00
|
|
|
# Avoid breaking Realme fingerprint scanners
|
2021-12-21 02:08:55 +00:00
|
|
|
resetprop ro.boot.flash.locked 1
|
|
|
|
|
2023-01-01 14:17:19 +00:00
|
|
|
# Avoid breaking Oppo fingerprint scanners
|
2022-03-08 09:33:48 +00:00
|
|
|
resetprop ro.boot.vbmeta.device_state locked
|
|
|
|
|
2023-01-01 14:17:19 +00:00
|
|
|
# Avoid breaking OnePlus display modes/fingerprint scanners
|
2021-10-31 00:49:46 +00:00
|
|
|
resetprop vendor.boot.verifiedbootstate green
|
2022-10-15 09:58:05 +00:00
|
|
|
|
2023-01-01 14:17:19 +00:00
|
|
|
# Safetynet (avoid breaking OnePlus display modes/fingerprint scanners on OOS 12)
|
|
|
|
resetprop ro.boot.verifiedbootstate green
|
|
|
|
resetprop ro.boot.veritymode enforcing
|
|
|
|
resetprop vendor.boot.vbmeta.device_state locked
|
|
|
|
|
|
|
|
# Avoid breaking encryption, set shipping level to 32 for devices >=33 to allow for software attestation
|
2022-10-15 09:58:05 +00:00
|
|
|
if [[ "$(getprop ro.product.first_api_level)" -ge 33 ]]; then
|
|
|
|
resetprop ro.product.first_api_level 32
|
|
|
|
fi
|
2021-10-31 00:49:46 +00:00
|
|
|
}&
|