summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorIrfan Sheriff <isheriff@google.com>2010-11-03 11:13:10 -0700
committerIrfan Sheriff <isheriff@google.com>2010-11-30 16:07:05 -0800
commitf92b453a58d19531f3735dd90cd4f97a78823ae1 (patch)
tree8f1452ae7450e54b7ecc65d2a7307dfa9b9db36f /services
parent30c818444d876dd868b84adec2416308c90f32e3 (diff)
downloadframeworks_base-f92b453a58d19531f3735dd90cd4f97a78823ae1.zip
frameworks_base-f92b453a58d19531f3735dd90cd4f97a78823ae1.tar.gz
frameworks_base-f92b453a58d19531f3735dd90cd4f97a78823ae1.tar.bz2
DO NOT MERGE Remove wifistatetracker lock access in BroadcastReceiver
The worksource reporting gets blocked by the statetracker lock which can cause system restarts when done from broadcastreceiver thread Bug: 3153787 Change-Id: Ie70687e7453a1c3618bac1424562be44762b2c9d
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;