Skip to content

Instantly share code, notes, and snippets.

@zpp0196
Last active March 14, 2024 09:27
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save zpp0196/1dee7cc3553000c0d3c7bc8bb9195d67 to your computer and use it in GitHub Desktop.
Save zpp0196/1dee7cc3553000c0d3c7bc8bb9195d67 to your computer and use it in GitHub Desktop.
MIUI 「USB安装」免登录账号
#!/bin/sh
set -e
provider_prefs_xml=/data/data/com.miui.securitycenter/shared_prefs/remote_provider_preferences.xml
provider_prefs_tmp_xml=/data/local/tmp/remote_provider_preferences.xml
sed -e "/security_adb_install_enable/d" $provider_prefs_xml > $provider_prefs_tmp_xml
sed -i "/<\/map>/i\ \ \ \ <boolean name=\"security_adb_install_enable\" value=\"$1\" />" $provider_prefs_tmp_xml
sed -i "/<\/map>/i\ \ \ \ <boolean name=\"permcenter_install_intercept_enabled\" value=\"$2\" />" $provider_prefs_tmp_xml
cp $provider_prefs_tmp_xml $provider_prefs_xml && rm $provider_prefs_tmp_xml
chmod 660 $provider_prefs_xml
chown system:system $provider_prefs_xml
chcon u:object_r:system_app_data_file:s0 $provider_prefs_xml
am force-stop com.miui.securitycenter
@zpp0196
Copy link
Author

zpp0196 commented May 14, 2021

usage

wget https://gist.githubusercontent.com/zpp0196/1dee7cc3553000c0d3c7bc8bb9195d67/raw/8ca52b4def497d71975dccfa04734c197d4779c2/miui_adb_install.sh
adb push miui_adb_install.sh /data/local/tmp/
adb shell
su
chmod +x /data/local/tmp/miui_adb_install.sh
# allow
/data/local/tmp/miui_adb_install.sh true false
# refuse
/data/local/tmp/miui_adb_install.sh false true

@zpp0196
Copy link
Author

zpp0196 commented May 21, 2021

「USB调试(安全设置)」免登录账号

adb shell
su
setprop persist.security.adbinput 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment