Navigation that depends on a WebView proxy override should start after the override's completion listener runs. Setting it and immediately loading a page leaves the operation racing an asynchronous update.

  1. Check WebViewFeature.isFeatureSupported(WebViewFeature.PROXY_OVERRIDE). Support depends on the WebView implementation and AndroidX WebKit library as well as Android's API level. Define what happens when it is absent; silently going direct may defeat the feature.
  2. Build the intended ProxyConfig using its documented proxy rules, endpoint syntax and bypass behavior. For permitted public-site navigation, choose a candidate from the free proxy list whose protocol matches a rule supported by that WebView implementation. A PAC URL, SOCKS URI and bare host are different inputs.
  3. Call ProxyController.setProxyOverride() with that configuration, an executor and a completion listener. Begin dependent navigation from the completion path.
  4. When the temporary override ends, clear it with clearProxyOverride() and handle its asynchronous completion too.

Give that lifecycle one owner. The setting applies to WebViews throughout the application process; repeatedly changing it cannot give two simultaneous views independent exits. Other processes and HTTP libraries have their own routes.

This supported interface avoids reliance on private proxy-change listeners that vary between Android releases. It selects routing; proxy credentials and certificate trust still use their supported mechanisms. An authentication or TLS failure after selection needs to be diagnosed at that stage.

Mikanda mikatakata