diff options
author | Android (Google) Code Review <android-gerrit@google.com> | 2009-07-14 16:43:00 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2009-07-14 16:43:00 -0700 |
commit | f77035193152a0edba5abeb33d9c1a5f446c7dd8 (patch) | |
tree | df7820642061d68b6e017e596dd37e2884f9bedf /wifi/java/android/net | |
parent | a2694c998c85a438c7d3fefd79bbeb751d594134 (diff) | |
parent | f32be166d56302b59c242a1296a6b03862f3c061 (diff) | |
download | frameworks_base-f77035193152a0edba5abeb33d9c1a5f446c7dd8.zip frameworks_base-f77035193152a0edba5abeb33d9c1a5f446c7dd8.tar.gz frameworks_base-f77035193152a0edba5abeb33d9c1a5f446c7dd8.tar.bz2 |
Merge change 7145 into donut
* changes:
wifi: Disable RSSI polling when the screen is off.
Diffstat (limited to 'wifi/java/android/net')
-rw-r--r-- | wifi/java/android/net/wifi/WifiStateTracker.java | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/wifi/java/android/net/wifi/WifiStateTracker.java b/wifi/java/android/net/wifi/WifiStateTracker.java index 63687b3..3aa31bf 100644 --- a/wifi/java/android/net/wifi/WifiStateTracker.java +++ b/wifi/java/android/net/wifi/WifiStateTracker.java @@ -239,6 +239,7 @@ public class WifiStateTracker extends NetworkStateTracker { private boolean mIsScanModeActive; private boolean mIsScanModeSetDueToAHiddenNetwork; + private boolean mEnableRssiPolling; // Wi-Fi run states: private static final int RUN_STATE_STARTING = 1; @@ -338,6 +339,7 @@ public class WifiStateTracker extends NetworkStateTracker { private void setSupplicantState(SupplicantState state) { mWifiInfo.setSupplicantState(state); updateNetworkInfo(); + checkPollTimer(); } public SupplicantState getSupplicantState() { @@ -352,6 +354,7 @@ public class WifiStateTracker extends NetworkStateTracker { private void setSupplicantState(String stateName) { mWifiInfo.setSupplicantState(stateName); updateNetworkInfo(); + checkPollTimer(); } /** @@ -540,8 +543,10 @@ public class WifiStateTracker extends NetworkStateTracker { * Set the interval timer for polling connection information * that is not delivered asynchronously. */ - private synchronized void setPollTimer () { - if (!hasMessages(EVENT_POLL_INTERVAL)) { + private synchronized void checkPollTimer() { + if (mEnableRssiPolling && + mWifiInfo.getSupplicantState() == SupplicantState.COMPLETED && + !hasMessages(EVENT_POLL_INTERVAL)) { sendEmptyMessageDelayed(EVENT_POLL_INTERVAL, POLL_STATUS_INTERVAL_MSECS); } } @@ -637,6 +642,13 @@ public class WifiStateTracker extends NetworkStateTracker { setBluetoothScanMode(isBluetoothPlaying); } + public void enableRssiPolling(boolean enable) { + if (mEnableRssiPolling != enable) { + mEnableRssiPolling = enable; + checkPollTimer(); + } + } + @Override public void releaseWakeLock() { if (mReleaseWakeLockCallback != null) { @@ -1022,9 +1034,7 @@ public class WifiStateTracker extends NetworkStateTracker { case EVENT_POLL_INTERVAL: if (mWifiInfo.getSupplicantState() != SupplicantState.UNINITIALIZED) { requestPolledInfo(mWifiInfo); - if (mWifiInfo.getSupplicantState() == SupplicantState.COMPLETED) { - setPollTimer(); - } + checkPollTimer(); } break; @@ -1163,7 +1173,7 @@ public class WifiStateTracker extends NetworkStateTracker { } private void configureInterface() { - setPollTimer(); + checkPollTimer(); mLastSignalLevel = -1; if (!mUseStaticIp) { if (!mHaveIpAddress && !mObtainingIpAddress) { |