diff options
author | Robert Greenwalt <robdroid@android.com> | 2009-06-08 18:15:21 -0700 |
---|---|---|
committer | Robert Greenwalt <robdroid@android.com> | 2009-06-08 18:33:24 -0700 |
commit | 91f22f901bee5d52d81ca4070a1b187ac8b90dad (patch) | |
tree | 1aab1a46b5f00cdc0220a06bb1aaef1e8352e5a8 /wifi/java/android/net | |
parent | 5519185292a3733744794bd3c31ce1a2fdf817e4 (diff) | |
download | frameworks_base-91f22f901bee5d52d81ca4070a1b187ac8b90dad.zip frameworks_base-91f22f901bee5d52d81ca4070a1b187ac8b90dad.tar.gz frameworks_base-91f22f901bee5d52d81ca4070a1b187ac8b90dad.tar.bz2 |
Use new wifi cmd rssi-approx when polling.
Cheaper approx call should be used when polling every 3 sec for
wifi signal strength. Fixes bug 1903653.
Diffstat (limited to 'wifi/java/android/net')
-rw-r--r-- | wifi/java/android/net/wifi/WifiNative.java | 2 | ||||
-rw-r--r-- | wifi/java/android/net/wifi/WifiStateTracker.java | 9 |
2 files changed, 7 insertions, 4 deletions
diff --git a/wifi/java/android/net/wifi/WifiNative.java b/wifi/java/android/net/wifi/WifiNative.java index 3851ac0..0920567 100644 --- a/wifi/java/android/net/wifi/WifiNative.java +++ b/wifi/java/android/net/wifi/WifiNative.java @@ -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(); diff --git a/wifi/java/android/net/wifi/WifiStateTracker.java b/wifi/java/android/net/wifi/WifiStateTracker.java index e6f4130..7e95f79 100644 --- a/wifi/java/android/net/wifi/WifiStateTracker.java +++ b/wifi/java/android/net/wifi/WifiStateTracker.java @@ -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(); } @@ -1276,7 +1276,7 @@ public class WifiStateTracker extends NetworkStateTracker { */ public WifiInfo requestConnectionInfo() { requestConnectionStatus(mWifiInfo); - requestPolledInfo(mWifiInfo); + requestPolledInfo(mWifiInfo, false); return mWifiInfo; } @@ -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); /* |