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

Commit 9437d916 authored by Kristian Monsen's avatar Kristian Monsen
Browse files

Only register one ProxyReceiver

Change-Id: I0a86a0149fd944faca775cca4360774d9cba250d
parent 6b91b45e
Loading
Loading
Loading
Loading
+12 −2
Original line number 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();
        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) {
            handleProxyBroadcast(currentProxy);
        }