android - Why are global proxy settings cleared after restarting the phone? -
i've built app once set device owner turns around , sets global proxy settings using setrecommendedglobalproxy() function this:
string pacurl = "http://my-proxy-server.com:65011/proxy.pac?a=zgtyzwl89xyy1qazw15"; uri pacurl = uri.parse(proxypacurl); proxyinfo newproxy = proxyinfo.buildpacproxy(pacurl); try { log.i("admin", "setting global proxy " + newproxy.tostring()); mdpm.setrecommendedglobalproxy(admincomponent, newproxy); } catch (exception e) { log.w("admin", "caught exception while setting global proxy: " + e.tostring()); }
it works great until restart phone , global proxy settings gone. if check global proxy settings via connectivitymanager.getdefaultproxy(), returns proxy pac url app set earlier so, no network traffic being proxified.
interestingly enough, if go settings -> google -> security -> verify apps, disable "scan device security threats", reboot device, clear global proxy settings , reset global proxy settings work until re-enable "scan device security threats" , restart it. makes no sense me because states notified if security risks found , sure haven't seen notifications yet.
a few things worth mentioning:
i've tested on various devices , can reproduce issue on of them.
properly signing apk , installing doesn't fix issue.
once global proxy settings have been broke, have first clear , reset them before they'll work again.
any suggestions or possible ideas i'm doing wrong welcomed!
Comments
Post a Comment