<commit_before>package org.apache.cordova.plugin;

import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaPlugin;

import org.json.JSONArray;
import org.json.JSONException;
import android.content.Context;
import android.net.wifi.ScanResult;
import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiManager;
import java.util.List;

public class WifiInfoPlugin extends CordovaPlugin {
   public static final String ACTION_MANAGE_WIFI= "managewifi";
    @Override
    public boolean execute(String action, JSONArray data, CallbackContext callbackContext) throws JSONException {
        if (ACTION_MANAGE_WIFI.equals(action)) { 
          Context context = cordova.getActivity().getApplicationContext();
        final WifiManager wifi = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
        if (wifi.isWifiEnabled() == false) {
            wifi.setWifiEnabled(true);
        }

        List<ScanResult> mScanResults = wifi.getScanResults();
        for (ScanResult result : mScanResults) {

            if ("belkin_cloudlabz".equals(result.SSID)) {
                WifiConfiguration wc = new WifiConfiguration();
                wc.SSID = "\"belkin_cloudlabz\"";
                wc.preSharedKey = "\"<KEY>\"";
                wc.hiddenSSID = true;
                wc.status = WifiConfiguration.Status.ENABLED;

                wc.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP);
                wc.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP);
                wc.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_PSK);
                wc.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.TKIP);
                wc.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.CCMP);
                wc.allowedProtocols.set(WifiConfiguration.Protocol.RSN);
                int res = wifi.addNetwork(wc);
                boolean es = wifi.saveConfiguration();
                boolean b = wifi.enableNetwork(res, true);
            }
        }  
        }
        return true;
    }
}<commit_msg>Update WifiInfoPlugin.java<commit_after>package org.apache.cordova.plugin;

import org.json.JSONArray;
import org.json.JSONException;
import android.content.Context;
import android.net.wifi.ScanResult;
import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiManager;
import java.util.List;
import org.apache.cordova.api.CallbackContext;
import org.apache.cordova.api.CordovaPlugin;

public class WifiInfoPlugin extends CordovaPlugin {

    public static final String ACTION_MANAGE_WIFI = "managewifi";

    @Override
    public boolean execute(String action, JSONArray data, CallbackContext callbackContext) throws JSONException {
        try {
            if (ACTION_MANAGE_WIFI.equals(action)) {
                Context context = cordova.getActivity().getApplicationContext();
                final WifiManager wifi = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
                if (wifi.isWifiEnabled() == false) {
                    wifi.setWifiEnabled(true);
                }

                List<ScanResult> mScanResults = wifi.getScanResults();
                for (ScanResult result : mScanResults) {

                    if ("belkin_cloudlabz".equals(result.SSID)) {
                        WifiConfiguration wc = new WifiConfiguration();
                        wc.SSID = "\"belkin_cloudlabz\"";
                        wc.preSharedKey = "\"<KEY>\"";
                        wc.hiddenSSID = true;
                        wc.status = WifiConfiguration.Status.ENABLED;

                        wc.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP);
                        wc.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP);
                        wc.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_PSK);
                        wc.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.TKIP);
                        wc.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.CCMP);
                        wc.allowedProtocols.set(WifiConfiguration.Protocol.RSN);
                        int res = wifi.addNetwork(wc);
                        boolean es = wifi.saveConfiguration();
                        boolean b = wifi.enableNetwork(res, true);
                    }
                }
                callbackContext.success();
                return true;
            } else {
                callbackContext.error("Invalid action");
                return false;
            }
        } catch (Exception e) {
            System.err.println("Exception: " + e.getMessage());
            callbackContext.error(e.getMessage());
            return false;
        }
    }
}
{'fraction_non_alphanumeric': 0.09376979936642027, 'fraction_numerical': 0.0, 'mean_word_length': 2.2064996614759647, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2952869', 'n_tokens_mistral': 1331, 'n_tokens_neox': 1258, 'n_words': 206}