Loading core/jni/android_net_wifi_Wifi.cpp +15 −2 Original line number Diff line number Diff line Loading @@ -307,14 +307,15 @@ static jboolean android_net_wifi_stopPacketFiltering(JNIEnv* env, jobject clazz) return result; } static jint android_net_wifi_getRssiCommand(JNIEnv* env, jobject clazz) static jint android_net_wifi_getRssiHelper(const char *cmd) { char reply[256]; int rssi = -200; if (doCommand("DRIVER RSSI", reply, sizeof(reply)) != 0) { if (doCommand(cmd, reply, sizeof(reply)) != 0) { return (jint)-1; } // reply comes back in the form "<SSID> rssi XX" where XX is the // number we're interested in. if we're associating, it returns "OK". // beware - <SSID> can contain spaces. Loading @@ -328,6 +329,16 @@ static jint android_net_wifi_getRssiCommand(JNIEnv* env, jobject clazz) return (jint)rssi; } static jint android_net_wifi_getRssiCommand(JNIEnv* env, jobject clazz) { return android_net_wifi_getRssiHelper("DRIVER RSSI"); } static jint android_net_wifi_getRssiApproxCommand(JNIEnv* env, jobject clazz) { return android_net_wifi_getRssiHelper("DRIVER RSSI-APPROX"); } static jint android_net_wifi_getLinkSpeedCommand(JNIEnv* env, jobject clazz) { char reply[256]; Loading Loading @@ -523,6 +534,8 @@ static JNINativeMethod gWifiMethods[] = { { "setBluetoothCoexistenceScanModeCommand", "(Z)Z", (void*) android_net_wifi_setBluetoothCoexistenceScanModeCommand }, { "getRssiCommand", "()I", (void*) android_net_wifi_getRssiCommand }, { "getRssiApproxCommand", "()I", (void*) android_net_wifi_getRssiApproxCommand}, { "getLinkSpeedCommand", "()I", (void*) android_net_wifi_getLinkSpeedCommand }, { "getMacAddressCommand", "()Ljava/lang/String;", (void*) android_net_wifi_getMacAddressCommand }, { "saveConfigCommand", "()Z", (void*) android_net_wifi_saveConfigCommand }, Loading wifi/java/android/net/wifi/WifiNative.java +2 −0 Original line number Diff line number Diff line Loading @@ -79,6 +79,8 @@ public class WifiNative { public native static int getRssiCommand(); public native static int getRssiApproxCommand(); public native static int getLinkSpeedCommand(); public native static String getMacAddressCommand(); Loading wifi/java/android/net/wifi/WifiStateTracker.java +5 −4 Original line number Diff line number Diff line Loading @@ -1029,7 +1029,7 @@ public class WifiStateTracker extends NetworkStateTracker { case EVENT_POLL_INTERVAL: if (mWifiInfo.getSupplicantState() != SupplicantState.UNINITIALIZED) { requestPolledInfo(mWifiInfo); requestPolledInfo(mWifiInfo, true); if (mWifiInfo.getSupplicantState() == SupplicantState.COMPLETED) { setPollTimer(); } Loading Loading @@ -1276,7 +1276,7 @@ public class WifiStateTracker extends NetworkStateTracker { */ public WifiInfo requestConnectionInfo() { requestConnectionStatus(mWifiInfo); requestPolledInfo(mWifiInfo); requestPolledInfo(mWifiInfo, false); return mWifiInfo; } Loading Loading @@ -1331,9 +1331,10 @@ public class WifiStateTracker extends NetworkStateTracker { * Get the dynamic information that is not reported via events. * @param info the object into which the information should be captured. */ private synchronized void requestPolledInfo(WifiInfo info) private synchronized void requestPolledInfo(WifiInfo info, boolean polling) { int newRssi = WifiNative.getRssiCommand(); int newRssi = (polling ? WifiNative.getRssiApproxCommand(): WifiNative.getRssiCommand()); if (newRssi != -1 && -200 < newRssi && newRssi < 100) { // screen out invalid values info.setRssi(newRssi); /* Loading Loading
core/jni/android_net_wifi_Wifi.cpp +15 −2 Original line number Diff line number Diff line Loading @@ -307,14 +307,15 @@ static jboolean android_net_wifi_stopPacketFiltering(JNIEnv* env, jobject clazz) return result; } static jint android_net_wifi_getRssiCommand(JNIEnv* env, jobject clazz) static jint android_net_wifi_getRssiHelper(const char *cmd) { char reply[256]; int rssi = -200; if (doCommand("DRIVER RSSI", reply, sizeof(reply)) != 0) { if (doCommand(cmd, reply, sizeof(reply)) != 0) { return (jint)-1; } // reply comes back in the form "<SSID> rssi XX" where XX is the // number we're interested in. if we're associating, it returns "OK". // beware - <SSID> can contain spaces. Loading @@ -328,6 +329,16 @@ static jint android_net_wifi_getRssiCommand(JNIEnv* env, jobject clazz) return (jint)rssi; } static jint android_net_wifi_getRssiCommand(JNIEnv* env, jobject clazz) { return android_net_wifi_getRssiHelper("DRIVER RSSI"); } static jint android_net_wifi_getRssiApproxCommand(JNIEnv* env, jobject clazz) { return android_net_wifi_getRssiHelper("DRIVER RSSI-APPROX"); } static jint android_net_wifi_getLinkSpeedCommand(JNIEnv* env, jobject clazz) { char reply[256]; Loading Loading @@ -523,6 +534,8 @@ static JNINativeMethod gWifiMethods[] = { { "setBluetoothCoexistenceScanModeCommand", "(Z)Z", (void*) android_net_wifi_setBluetoothCoexistenceScanModeCommand }, { "getRssiCommand", "()I", (void*) android_net_wifi_getRssiCommand }, { "getRssiApproxCommand", "()I", (void*) android_net_wifi_getRssiApproxCommand}, { "getLinkSpeedCommand", "()I", (void*) android_net_wifi_getLinkSpeedCommand }, { "getMacAddressCommand", "()Ljava/lang/String;", (void*) android_net_wifi_getMacAddressCommand }, { "saveConfigCommand", "()Z", (void*) android_net_wifi_saveConfigCommand }, Loading
wifi/java/android/net/wifi/WifiNative.java +2 −0 Original line number Diff line number Diff line Loading @@ -79,6 +79,8 @@ public class WifiNative { public native static int getRssiCommand(); public native static int getRssiApproxCommand(); public native static int getLinkSpeedCommand(); public native static String getMacAddressCommand(); Loading
wifi/java/android/net/wifi/WifiStateTracker.java +5 −4 Original line number Diff line number Diff line Loading @@ -1029,7 +1029,7 @@ public class WifiStateTracker extends NetworkStateTracker { case EVENT_POLL_INTERVAL: if (mWifiInfo.getSupplicantState() != SupplicantState.UNINITIALIZED) { requestPolledInfo(mWifiInfo); requestPolledInfo(mWifiInfo, true); if (mWifiInfo.getSupplicantState() == SupplicantState.COMPLETED) { setPollTimer(); } Loading Loading @@ -1276,7 +1276,7 @@ public class WifiStateTracker extends NetworkStateTracker { */ public WifiInfo requestConnectionInfo() { requestConnectionStatus(mWifiInfo); requestPolledInfo(mWifiInfo); requestPolledInfo(mWifiInfo, false); return mWifiInfo; } Loading Loading @@ -1331,9 +1331,10 @@ public class WifiStateTracker extends NetworkStateTracker { * Get the dynamic information that is not reported via events. * @param info the object into which the information should be captured. */ private synchronized void requestPolledInfo(WifiInfo info) private synchronized void requestPolledInfo(WifiInfo info, boolean polling) { int newRssi = WifiNative.getRssiCommand(); int newRssi = (polling ? WifiNative.getRssiApproxCommand(): WifiNative.getRssiCommand()); if (newRssi != -1 && -200 < newRssi && newRssi < 100) { // screen out invalid values info.setRssi(newRssi); /* Loading