Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 13e8ba70 authored by Kristian Monsen's avatar Kristian Monsen Committed by Android (Google) Code Review
Browse files

Merge "Only register one ProxyReceiver"

parents b44b43b1 9437d916
Loading
Loading
Loading
Loading
+12 −2
Original line number Original line Diff line number Diff line
@@ -1002,10 +1002,20 @@ public class WebView extends AbsoluteLayout
        }
        }
    }
    }


    private static void setupProxyListener(Context context) {
    /*
     * A variable to track if there is a receiver added for PROXY_CHANGE_ACTION
     */
    private static boolean sProxyReceiverAdded;

    private static synchronized void setupProxyListener(Context context) {
        if (sProxyReceiverAdded) {
            return;
        }
        IntentFilter filter = new IntentFilter();
        IntentFilter filter = new IntentFilter();
        filter.addAction(Proxy.PROXY_CHANGE_ACTION);
        filter.addAction(Proxy.PROXY_CHANGE_ACTION);
        Intent currentProxy = context.getApplicationContext().registerReceiver(new ProxyReceiver(), filter);
        Intent currentProxy = context.getApplicationContext().registerReceiver(
                new ProxyReceiver(), filter);
        sProxyReceiverAdded = true;
        if (currentProxy != null) {
        if (currentProxy != null) {
            handleProxyBroadcast(currentProxy);
            handleProxyBroadcast(currentProxy);
        }
        }