Loading core/jni/android_net_wifi_Wifi.cpp +26 −0 Original line number Diff line number Diff line Loading @@ -411,6 +411,30 @@ static jint android_net_wifi_getPowerModeCommand(JNIEnv* env, jobject clazz) return (jint)power; } static jboolean android_net_wifi_setBandCommand(JNIEnv* env, jobject clazz, jint band) { char cmdstr[25]; int numWritten = snprintf(cmdstr, sizeof(cmdstr), "DRIVER SETBAND %d", band); int cmdTooLong = numWritten >= (int)sizeof(cmdstr); return (jboolean)!cmdTooLong && doBooleanCommand(cmdstr, "OK"); } static jint android_net_wifi_getBandCommand(JNIEnv* env, jobject clazz) { char reply[25]; int band; if (doCommand("DRIVER GETBAND", reply, sizeof(reply)) != 0) { return (jint)-1; } // reply comes back in the form "Band X" where X is the // number we're interested in. sscanf(reply, "%*s %u", &band); return (jint)band; } static jboolean android_net_wifi_setNumAllowedChannelsCommand(JNIEnv* env, jobject clazz, jint numChannels) { char cmdstr[256]; Loading Loading @@ -561,6 +585,8 @@ static JNINativeMethod gWifiMethods[] = { { "stopPacketFiltering", "()Z", (void*) android_net_wifi_stopPacketFiltering }, { "setPowerModeCommand", "(I)Z", (void*) android_net_wifi_setPowerModeCommand }, { "getPowerModeCommand", "()I", (void*) android_net_wifi_getPowerModeCommand }, { "setBandCommand", "(I)Z", (void*) android_net_wifi_setBandCommand}, { "getBandCommand", "()I", (void*) android_net_wifi_getBandCommand}, { "setNumAllowedChannelsCommand", "(I)Z", (void*) android_net_wifi_setNumAllowedChannelsCommand }, { "getNumAllowedChannelsCommand", "()I", (void*) android_net_wifi_getNumAllowedChannelsCommand }, { "setBluetoothCoexistenceModeCommand", "(I)Z", Loading wifi/java/android/net/wifi/WifiNative.java +4 −0 Original line number Diff line number Diff line Loading @@ -111,6 +111,10 @@ public class WifiNative { public native static boolean setPowerModeCommand(int mode); public native static int getBandCommand(); public native static boolean setBandCommand(int band); public native static int getPowerModeCommand(); public native static boolean setNumAllowedChannelsCommand(int numChannels); Loading wifi/java/android/net/wifi/WifiStateMachine.java +15 −0 Original line number Diff line number Diff line Loading @@ -320,6 +320,13 @@ public class WifiStateMachine extends HierarchicalStateMachine { private static final int SCAN_ACTIVE = 1; private static final int SCAN_PASSIVE = 2; /* Auto allows 802.11A/B/G operation */ private static final int BAND_AUTO = 0; /* 5GHz allows 802.11A operation */ private static final int BAND_5G = 1; /* 2.4GHz allows 802.11B/G operation */ private static final int BAND_2G = 2; /** * The maximum number of times we will retry a connection to an access point * for which we have failed in acquiring an IP address from DHCP. A value of Loading Loading @@ -2179,6 +2186,14 @@ public class WifiStateMachine extends HierarchicalStateMachine { /* Initialize channel count */ setNumAllowedChannels(); /* * STOPSHIP * TODO: We are having 11A issues that Broadcom is looking * to resolve, this is a temporary fix to allow only 11B/G * and help improve GoogleGuest connectivity * We also need to add the UI for band control */ WifiNative.setBandCommand(BAND_2G); if (mIsScanMode) { WifiNative.setScanResultHandlingCommand(SCAN_ONLY_MODE); Loading Loading
core/jni/android_net_wifi_Wifi.cpp +26 −0 Original line number Diff line number Diff line Loading @@ -411,6 +411,30 @@ static jint android_net_wifi_getPowerModeCommand(JNIEnv* env, jobject clazz) return (jint)power; } static jboolean android_net_wifi_setBandCommand(JNIEnv* env, jobject clazz, jint band) { char cmdstr[25]; int numWritten = snprintf(cmdstr, sizeof(cmdstr), "DRIVER SETBAND %d", band); int cmdTooLong = numWritten >= (int)sizeof(cmdstr); return (jboolean)!cmdTooLong && doBooleanCommand(cmdstr, "OK"); } static jint android_net_wifi_getBandCommand(JNIEnv* env, jobject clazz) { char reply[25]; int band; if (doCommand("DRIVER GETBAND", reply, sizeof(reply)) != 0) { return (jint)-1; } // reply comes back in the form "Band X" where X is the // number we're interested in. sscanf(reply, "%*s %u", &band); return (jint)band; } static jboolean android_net_wifi_setNumAllowedChannelsCommand(JNIEnv* env, jobject clazz, jint numChannels) { char cmdstr[256]; Loading Loading @@ -561,6 +585,8 @@ static JNINativeMethod gWifiMethods[] = { { "stopPacketFiltering", "()Z", (void*) android_net_wifi_stopPacketFiltering }, { "setPowerModeCommand", "(I)Z", (void*) android_net_wifi_setPowerModeCommand }, { "getPowerModeCommand", "()I", (void*) android_net_wifi_getPowerModeCommand }, { "setBandCommand", "(I)Z", (void*) android_net_wifi_setBandCommand}, { "getBandCommand", "()I", (void*) android_net_wifi_getBandCommand}, { "setNumAllowedChannelsCommand", "(I)Z", (void*) android_net_wifi_setNumAllowedChannelsCommand }, { "getNumAllowedChannelsCommand", "()I", (void*) android_net_wifi_getNumAllowedChannelsCommand }, { "setBluetoothCoexistenceModeCommand", "(I)Z", Loading
wifi/java/android/net/wifi/WifiNative.java +4 −0 Original line number Diff line number Diff line Loading @@ -111,6 +111,10 @@ public class WifiNative { public native static boolean setPowerModeCommand(int mode); public native static int getBandCommand(); public native static boolean setBandCommand(int band); public native static int getPowerModeCommand(); public native static boolean setNumAllowedChannelsCommand(int numChannels); Loading
wifi/java/android/net/wifi/WifiStateMachine.java +15 −0 Original line number Diff line number Diff line Loading @@ -320,6 +320,13 @@ public class WifiStateMachine extends HierarchicalStateMachine { private static final int SCAN_ACTIVE = 1; private static final int SCAN_PASSIVE = 2; /* Auto allows 802.11A/B/G operation */ private static final int BAND_AUTO = 0; /* 5GHz allows 802.11A operation */ private static final int BAND_5G = 1; /* 2.4GHz allows 802.11B/G operation */ private static final int BAND_2G = 2; /** * The maximum number of times we will retry a connection to an access point * for which we have failed in acquiring an IP address from DHCP. A value of Loading Loading @@ -2179,6 +2186,14 @@ public class WifiStateMachine extends HierarchicalStateMachine { /* Initialize channel count */ setNumAllowedChannels(); /* * STOPSHIP * TODO: We are having 11A issues that Broadcom is looking * to resolve, this is a temporary fix to allow only 11B/G * and help improve GoogleGuest connectivity * We also need to add the UI for band control */ WifiNative.setBandCommand(BAND_2G); if (mIsScanMode) { WifiNative.setScanResultHandlingCommand(SCAN_ONLY_MODE); Loading