summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorIrfan Sheriff <isheriff@google.com>2010-12-01 09:53:17 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2010-12-01 09:53:17 -0800
commitf38b709e470849943befbe88a0daeb7324f5114b (patch)
tree94989c573797041e65af3cb088ce5fce2c5aa214 /services
parent7e5cd7968356ea111988a372095e352d76476994 (diff)
parentaf2d3c7ccebb009f31a92c1a87b0925a2891e1c4 (diff)
downloadframeworks_base-f38b709e470849943befbe88a0daeb7324f5114b.zip
frameworks_base-f38b709e470849943befbe88a0daeb7324f5114b.tar.gz
frameworks_base-f38b709e470849943befbe88a0daeb7324f5114b.tar.bz2
am af2d3c7c: Merge "DO NOT MERGE Remove wifistatetracker lock access in BroadcastReceiver" into gingerbread
* commit 'af2d3c7ccebb009f31a92c1a87b0925a2891e1c4': DO NOT MERGE Remove wifistatetracker lock access in BroadcastReceiver
Diffstat (limited to 'services')
-rw-r--r--services/java/com/android/server/WifiService.java27
1 files changed, 22 insertions, 5 deletions
diff --git a/services/java/com/android/server/WifiService.java b/services/java/com/android/server/WifiService.java
index c1e9965..5aa0111 100644
--- a/services/java/com/android/server/WifiService.java
+++ b/services/java/com/android/server/WifiService.java
@@ -174,6 +174,8 @@ public class WifiService extends IWifiManager.Stub {
private static final int MESSAGE_SET_CHANNELS = 8;
private static final int MESSAGE_ENABLE_NETWORKS = 9;
private static final int MESSAGE_START_SCAN = 10;
+ private static final int MESSAGE_REPORT_WORKSOURCE = 11;
+ private static final int MESSAGE_ENABLE_RSSI_POLLING = 12;
private final WifiHandler mWifiHandler;
@@ -1664,8 +1666,8 @@ public class WifiService extends IWifiManager.Stub {
mScreenOff = false;
// Once the screen is on, we are not keeping WIFI running
// because of any locks so clear that tracking immediately.
- reportStartWorkSource();
- mWifiStateTracker.enableRssiPolling(true);
+ sendReportWorkSourceMessage();
+ sendEnableRssiPollingMessage(true);
/* DHCP or other temporary failures in the past can prevent
* a disabled network from being connected to, enable on screen on
*/
@@ -1677,7 +1679,7 @@ public class WifiService extends IWifiManager.Stub {
Slog.d(TAG, "ACTION_SCREEN_OFF");
}
mScreenOff = true;
- mWifiStateTracker.enableRssiPolling(false);
+ sendEnableRssiPollingMessage(false);
/*
* Set a timer to put Wi-Fi to sleep, but only if the screen is off
* AND the "stay on while plugged in" setting doesn't match the
@@ -1715,7 +1717,7 @@ public class WifiService extends IWifiManager.Stub {
Slog.d(TAG, "got ACTION_DEVICE_IDLE");
}
mDeviceIdle = true;
- reportStartWorkSource();
+ sendReportWorkSourceMessage();
} else if (action.equals(Intent.ACTION_BATTERY_CHANGED)) {
/*
* Set a timer to put Wi-Fi to sleep, but only if the screen is off
@@ -1821,6 +1823,15 @@ public class WifiService extends IWifiManager.Stub {
Message.obtain(mWifiHandler, MESSAGE_ENABLE_NETWORKS).sendToTarget();
}
+ private void sendReportWorkSourceMessage() {
+ Message.obtain(mWifiHandler, MESSAGE_REPORT_WORKSOURCE).sendToTarget();
+ }
+
+ private void sendEnableRssiPollingMessage(boolean enable) {
+ Message.obtain(mWifiHandler, MESSAGE_ENABLE_RSSI_POLLING, enable ? 1 : 0, 0).sendToTarget();
+ }
+
+
private void reportStartWorkSource() {
synchronized (mWifiStateTracker) {
mTmpWorkSource.clear();
@@ -2021,6 +2032,12 @@ public class WifiService extends IWifiManager.Stub {
}
mWifiStateTracker.scan(forceActive);
break;
+ case MESSAGE_REPORT_WORKSOURCE:
+ reportStartWorkSource();
+ break;
+ case MESSAGE_ENABLE_RSSI_POLLING:
+ mWifiStateTracker.enableRssiPolling(msg.arg1 == 1);
+ break;
}
}
}
@@ -2245,7 +2262,7 @@ public class WifiService extends IWifiManager.Stub {
// Be aggressive about adding new locks into the accounted state...
// we want to over-report rather than under-report.
- reportStartWorkSource();
+ sendReportWorkSourceMessage();
updateWifiState();
return true;