Projects >> frameworks_base_disabled >>9c25dc78403416e123b3450b60b21a45c874ed39

Chunk
Conflicting content
            Log.v(TAG, "endElement: " + tagName);
            if (tagName.equalsIgnoreCase("accesspoint")) {
                networks.add(config);
<<<<<<< HEAD
=======
                if (mDhcpInfo != null) {
                    ssidToDhcpInfoHM.put(config.SSID, mDhcpInfo);
                    mDhcpInfo = null;
                }
>>>>>>> 5343f5a84e66cc0806d20c16b96e612e80131ac2
            }
        }
Solution content
            Log.v(TAG, "endElement: " + tagName);
            if (tagName.equalsIgnoreCase("accesspoint")) {
                networks.add(config);
            }
        }
File
AccessPointParserHelper.java
Developer's decision
Version 1
Kind of conflict
If statement
Chunk
Conflicting content
import android.util.Log;

import java.util.ArrayList;
<<<<<<< HEAD
=======
import java.util.HashMap;
import java.util.HashSet;
>>>>>>> 5343f5a84e66cc0806d20c16b96e612e80131ac2
import java.util.List;

/**
Solution content
import android.util.Log;

import java.util.ArrayList;
import java.util.List;

/**
File
WifiConnectionTest.java
Developer's decision
Version 1
Kind of conflict
Import
Chunk
Conflicting content
    private static final boolean DEBUG = false;
    private List networks = new ArrayList();
    private ConnectivityManagerTestActivity mAct;
<<<<<<< HEAD
=======
    private HashMap hm = null;
    private ConnectivityManagerTestRunner mRunner;
    private ContentResolver cr;
    private Set enabledNetworks = null;
    private WifiManager mWifiManager = null;
>>>>>>> 5343f5a84e66cc0806d20c16b96e612e80131ac2

    public WifiConnectionTest() {
        super(PKG_NAME, ConnectivityManagerTestActivity.class);
Solution content
    private List networks = new ArrayList();
    private ConnectivityManagerTestActivity mAct;

    public WifiConnectionTest() {
        super(PKG_NAME, ConnectivityManagerTestActivity.class);
File
WifiConnectionTest.java
Developer's decision
Version 1
Kind of conflict
Attribute
Chunk
Conflicting content
    @Override
    public void setUp() throws Exception {
        super.setUp();
<<<<<<< HEAD
        mAct = getActivity();
=======
        log("before we launch the test activity, we preserve all the configured networks.");
        mRunner = ((ConnectivityManagerTestRunner)getInstrumentation());
        mWifiManager = (WifiManager) mRunner.getContext().getSystemService(Context.WIFI_SERVICE);
        enabledNetworks = getEnabledNetworks(mWifiManager.getConfiguredNetworks());

        mAct = getActivity();
        cr = mRunner.getContext().getContentResolver();
>>>>>>> 5343f5a84e66cc0806d20c16b96e612e80131ac2
        networks = mAct.loadNetworkConfigurations();
        if (DEBUG) {
            printNetworkConfigurations();
Solution content
    @Override
    public void setUp() throws Exception {
        super.setUp();
        mAct = getActivity();
        networks = mAct.loadNetworkConfigurations();
        if (DEBUG) {
            printNetworkConfigurations();
File
WifiConnectionTest.java
Developer's decision
Version 1
Kind of conflict
Attribute
Cast expression
Method invocation
Chunk
Conflicting content
        }
    }

<<<<<<< HEAD
=======
    private void printDhcpInfo() {
        if (hm == null) {
            return;
        } else {
            Set> set = hm.entrySet();
            for (Entry me: set) {
               log("SSID: " + me.getKey());
               DhcpInfo dhcp = me.getValue();
               log("IP: " + intToIpString(dhcp.ipAddress));
               log("gateway: " + intToIpString(dhcp.gateway));
               log("Netmask: " + intToIpString(dhcp.netmask));
               log("DNS1: " + intToIpString(dhcp.dns1));
               log("DNS2: " + intToIpString(dhcp.dns2));
            }
        }
    }

>>>>>>> 5343f5a84e66cc0806d20c16b96e612e80131ac2
    @Override
    public void tearDown() throws Exception {
        log("tear down");
Solution content
        }
    }

    @Override
    public void tearDown() throws Exception {
File
WifiConnectionTest.java
Developer's decision
Version 1
Kind of conflict
Method declaration
Chunk
Conflicting content
        }
    }
        super.tearDown();
    }

<<<<<<< HEAD
=======
    private Set getEnabledNetworks(List configuredNetworks) {
        Set networks = new HashSet();
        for (WifiConfiguration wifiConfig : configuredNetworks) {
            if (wifiConfig.status == Status.ENABLED || wifiConfig.status == Status.CURRENT) {
                networks.add(wifiConfig);
                log("remembering enabled network " + wifiConfig.SSID +
                        " status is " + wifiConfig.status);
            }
        }
        return networks;
    }

    private void reEnableNetworks(Set enabledWifiConfig) {
        if (!mWifiManager.isWifiEnabled()) {
            log("reEnableNetworks: enable Wifi");
            mWifiManager.setWifiEnabled(true);
            sleep(ConnectivityManagerTestActivity.SHORT_TIMEOUT,
                    "interruped while waiting for wifi to be enabled");
        }
        for (WifiConfiguration wifiConfig : enabledWifiConfig) {
            log("recover wifi configuration: " + wifiConfig.toString());
            int netId = mWifiManager.addNetwork(wifiConfig);
            if (wifiConfig.status == Status.CURRENT) {
                mWifiManager.enableNetwork(netId, true);
                mWifiManager.reconnect();
                sleep(ConnectivityManagerTestActivity.SHORT_TIMEOUT,
                        String.format("interruped while connecting to %s", wifiConfig.SSID));
                log("re-connecting to network " + wifiConfig.SSID);
            }
        }
        List wifiConfigurations = mWifiManager.getConfiguredNetworks();
        for (WifiConfiguration wifiConfig: wifiConfigurations) {
            if (wifiConfig.status == Status.DISABLED) {
                mWifiManager.enableNetwork(wifiConfig.networkId, false);
            }

    private String intToIpString(int i) {
        return ((i & 0xFF) + "." +
                ((i >> 8) & 0xFF) + "." +
                ((i >> 16) & 0xFF) + "." +
                ((i >> 24) & 0xFF));
    }

    private void sleep(long sometime, String errorMsg) {
        try {
            Thread.sleep(sometime);
        } catch (InterruptedException e) {
            fail(errorMsg);
        }
    }

    private void log(String message) {
        Log.v(TAG, message);
    }
>>>>>>> 5343f5a84e66cc0806d20c16b96e612e80131ac2
    /**
     * Connect to the provided Wi-Fi network
     * @param config is the network configuration
Solution content
        super.tearDown();
    }

    /**
     * Connect to the provided Wi-Fi network
     * @param config is the network configuration
File
WifiConnectionTest.java
Developer's decision
Version 1
Kind of conflict
Method declaration
Chunk
Conflicting content
                    mAct.mWifiManager.getConnectionInfo().getSSID());
        }
        assertTrue(config.SSID.contains(mAct.mWifiManager.getConnectionInfo().getSSID()));
<<<<<<< HEAD

        // Maintain the connection for 50 seconds before switching
        try {
            Thread.sleep(50*1000);
        } catch (Exception e) {
            fail("interrupted while waiting for WPA_SUPPLICANT to start");
=======
        if (isStaticIP) {
            Settings.System.putInt(cr, Settings.System.WIFI_USE_STATIC_IP, 0);
            Settings.System.putString(cr, Settings.System.WIFI_STATIC_IP, "");
            Settings.System.putString(cr, Settings.System.WIFI_STATIC_GATEWAY, "");
            Settings.System.putString(cr, Settings.System.WIFI_STATIC_NETMASK, "");
            Settings.System.putString(cr, Settings.System.WIFI_STATIC_DNS1, "");
            Settings.System.putString(cr, Settings.System.WIFI_STATIC_DNS2, "");
>>>>>>> 5343f5a84e66cc0806d20c16b96e612e80131ac2
        }
    }
Solution content
                    mAct.mWifiManager.getConnectionInfo().getSSID());
        }
        assertTrue(config.SSID.contains(mAct.mWifiManager.getConnectionInfo().getSSID()));

        // Maintain the connection for 50 seconds before switching
        try {
            Thread.sleep(50*1000);
        } catch (Exception e) {
            fail("interrupted while waiting for WPA_SUPPLICANT to start");
        }
    }
File
WifiConnectionTest.java
Developer's decision
Version 1
Kind of conflict
Catch clause
Comment
If statement
Method invocation
Try statement
Chunk
Conflicting content
    @LargeTest
    public void testWifiConnections() {
        for (int i = 0; i < networks.size(); i++) {
<<<<<<< HEAD
            connectToWifi(networks.get(i));
            mAct.removeConfiguredNetworksAndDisableWifi();
=======
            String ssid = networks.get(i).SSID;
            log("-- START Wi-Fi connection test for SSID: " + ssid + " --");
            connectToWifi(networks.get(i));
            sleep(2 * ConnectivityManagerTestActivity.SHORT_TIMEOUT,
                    String.format("Interrupted while connecting to ", ssid));
            log("-- END Wi-Fi connection test for SSID: " + ssid + " --");
>>>>>>> 5343f5a84e66cc0806d20c16b96e612e80131ac2
        }
    }
}
Solution content
    @LargeTest
    public void testWifiConnections() {
        for (int i = 0; i < networks.size(); i++) {
            connectToWifi(networks.get(i));
            mAct.removeConfiguredNetworksAndDisableWifi();
        }
    }
}
File
WifiConnectionTest.java
Developer's decision
Version 1
Kind of conflict
Method invocation
Variable