Hello everyone!


I've built an app that once set as device owner turns around and sets the 
global proxy settings using the setRecommendedGlobalProxy() function like 
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 to " + newProxy.toString());
    mDPM.setRecommendedGlobalProxy(adminComponent, newProxy);

} catch (Exception e) {

    Log.w("ADMIN", "Caught exception while setting global proxy: " + 
e.toString());
}

It all works great until I restart the phone and then the global proxy 
settings are gone. If I check for the global proxy settings via 
ConnectivityManager.getDefaultProxy() 
<https://developer.android.com/reference/android/net/ConnectivityManager.html#getDefaultProxy%28%29>,
 
it returns the proxy pac url that the app set earlier but even so, no 
network traffic is being proxified.


Interestingly enough, if I go to Settings -> Google -> Security -> Verify 
Apps, disable "Scan device for security threats", reboot the device, clear 
the global proxy settings and then reset the global proxy settings they 
will work until I re-enable "Scan device for security threats" and restart 
it. This makes no sense to me because it clearly states that I will be 
notified if any security risks are found and I sure haven't seen any 
notifications yet.


A few things worth mentioning:

   1. 
   
   I've tested on various devices and can reproduce the issue on all of 
   them.
   2. 
   
   Properly signing the apk and then installing it doesn't fix the issue.
   3. 
   
   Once the global proxy settings have been broke, I have to first clear 
   and then reset them before they'll properly work again.
   
Any suggestions or possible ideas as to what I'm doing wrong would be 
greatly welcomed!

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
To post to this group, send email to android-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/c9ed28e6-8a55-41ef-b835-babb209b89fa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to