an app that can set and reset proxy on your phone
reference here : https://github.com/theappbusiness/android-proxy-toggle
solution: use
adbto grant higher level permission to let app modify proxy setting
adb install -r -g Proxier3.debug.apk
programmatic solution here but it needs
android.permission.INTERACT_ACROSS_USERSwhich CAN'T be granted to 3rd apps
# in adb shell
settings put global http_proxy $IP:$PORT# in adb shell
settings put global http_proxy :0
settings delete global http_proxy
settings delete global global_http_proxy_host
settings delete global global_http_proxy_portcommand from @bytedance/CodeLocator Code Here