mirror of
https://github.com/VibedByKaKi/alexandroid.git
synced 2026-11-16 19:07:17 +01:00
57 lines
2.7 KiB
Java
57 lines
2.7 KiB
Java
package androidx.webkit.internal;
|
|
|
|
import androidx.annotation.VisibleForTesting;
|
|
import androidx.webkit.ProxyConfig;
|
|
import androidx.webkit.ProxyController;
|
|
import androidx.webkit.internal.ApiFeature;
|
|
import java.lang.reflect.Array;
|
|
import java.util.List;
|
|
import java.util.concurrent.Executor;
|
|
import org.chromium.support_lib_boundary.ProxyControllerBoundaryInterface;
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
/* loaded from: classes14.dex */
|
|
public class ProxyControllerImpl extends ProxyController {
|
|
private ProxyControllerBoundaryInterface mBoundaryInterface;
|
|
|
|
private ProxyControllerBoundaryInterface getBoundaryInterface() {
|
|
if (this.mBoundaryInterface == null) {
|
|
this.mBoundaryInterface = WebViewGlueCommunicator.getFactory().getProxyController();
|
|
}
|
|
return this.mBoundaryInterface;
|
|
}
|
|
|
|
@VisibleForTesting
|
|
public static String[][] proxyRulesToStringArray(List<ProxyConfig.ProxyRule> list) {
|
|
String[][] strArr = (String[][]) Array.newInstance((Class<?>) String.class, list.size(), 2);
|
|
for (int i = 0; i < list.size(); i++) {
|
|
strArr[i][0] = list.get(i).getSchemeFilter();
|
|
strArr[i][1] = list.get(i).getUrl();
|
|
}
|
|
return strArr;
|
|
}
|
|
|
|
@Override // androidx.webkit.ProxyController
|
|
public void clearProxyOverride(Executor executor, Runnable runnable) {
|
|
if (!WebViewFeatureInternal.PROXY_OVERRIDE.isSupportedByWebView()) {
|
|
throw WebViewFeatureInternal.getUnsupportedOperationException();
|
|
}
|
|
getBoundaryInterface().clearProxyOverride(runnable, executor);
|
|
}
|
|
|
|
@Override // androidx.webkit.ProxyController
|
|
public void setProxyOverride(ProxyConfig proxyConfig, Executor executor, Runnable runnable) {
|
|
ApiFeature.NoFramework noFramework = WebViewFeatureInternal.PROXY_OVERRIDE;
|
|
ApiFeature.NoFramework noFramework2 = WebViewFeatureInternal.PROXY_OVERRIDE_REVERSE_BYPASS;
|
|
String[][] proxyRulesToStringArray = proxyRulesToStringArray(proxyConfig.getProxyRules());
|
|
String[] strArr = (String[]) proxyConfig.getBypassRules().toArray(new String[0]);
|
|
if (noFramework.isSupportedByWebView() && !proxyConfig.isReverseBypassEnabled()) {
|
|
getBoundaryInterface().setProxyOverride(proxyRulesToStringArray, strArr, runnable, executor);
|
|
} else {
|
|
if (!noFramework.isSupportedByWebView() || !noFramework2.isSupportedByWebView()) {
|
|
throw WebViewFeatureInternal.getUnsupportedOperationException();
|
|
}
|
|
getBoundaryInterface().setProxyOverride(proxyRulesToStringArray, strArr, runnable, executor, proxyConfig.isReverseBypassEnabled());
|
|
}
|
|
}
|
|
}
|