resolved conflicts for merge of 368fdba4 to master

Change-Id: I42b7b433c86a71a5da5db67109f056a280077c9d
This commit is contained in:
Brad Fitzpatrick
2010-10-21 07:39:10 -07:00
15 changed files with 78 additions and 67 deletions

View File

@@ -889,7 +889,9 @@ public class WifiService extends IWifiManager.Stub {
Settings.System.getInt(mContext.getContentResolver(),
Settings.System.STAY_ON_WHILE_PLUGGED_IN, 0);
if (action.equals(Intent.ACTION_SCREEN_ON)) {
Slog.d(TAG, "ACTION_SCREEN_ON");
if (DBG) {
Slog.d(TAG, "ACTION_SCREEN_ON");
}
mAlarmManager.cancel(mIdleIntent);
mDeviceIdle = false;
mScreenOff = false;
@@ -899,7 +901,9 @@ public class WifiService extends IWifiManager.Stub {
mWifiStateMachine.enableRssiPolling(true);
updateWifiState();
} else if (action.equals(Intent.ACTION_SCREEN_OFF)) {
Slog.d(TAG, "ACTION_SCREEN_OFF");
if (DBG) {
Slog.d(TAG, "ACTION_SCREEN_OFF");
}
mScreenOff = true;
mWifiStateMachine.enableRssiPolling(false);
/*
@@ -916,19 +920,26 @@ public class WifiService extends IWifiManager.Stub {
// but not as long as we would if connected (below)
// TODO - fix the race conditions and switch back to the immediate turn-off
long triggerTime = System.currentTimeMillis() + (2*60*1000); // 2 min
Slog.d(TAG, "setting ACTION_DEVICE_IDLE timer for 120,000 ms");
if (DBG) {
Slog.d(TAG, "setting ACTION_DEVICE_IDLE timer for 120,000 ms");
}
mAlarmManager.set(AlarmManager.RTC_WAKEUP, triggerTime, mIdleIntent);
// // do not keep Wifi awake when screen is off if Wifi is not associated
// mDeviceIdle = true;
// updateWifiState();
} else {
long triggerTime = System.currentTimeMillis() + idleMillis;
Slog.d(TAG, "setting ACTION_DEVICE_IDLE timer for " + idleMillis + "ms");
if (DBG) {
Slog.d(TAG, "setting ACTION_DEVICE_IDLE timer for " + idleMillis
+ "ms");
}
mAlarmManager.set(AlarmManager.RTC_WAKEUP, triggerTime, mIdleIntent);
}
}
} else if (action.equals(ACTION_DEVICE_IDLE)) {
Slog.d(TAG, "got ACTION_DEVICE_IDLE");
if (DBG) {
Slog.d(TAG, "got ACTION_DEVICE_IDLE");
}
mDeviceIdle = true;
reportStartWorkSource();
updateWifiState();
@@ -941,10 +952,15 @@ public class WifiService extends IWifiManager.Stub {
* the already-set timer.
*/
int pluggedType = intent.getIntExtra("plugged", 0);
if (DBG) {
Slog.d(TAG, "ACTION_BATTERY_CHANGED pluggedType: " + pluggedType);
}
if (mScreenOff && shouldWifiStayAwake(stayAwakeConditions, mPluggedType) &&
!shouldWifiStayAwake(stayAwakeConditions, pluggedType)) {
long triggerTime = System.currentTimeMillis() + idleMillis;
Slog.d(TAG, "setting ACTION_DEVICE_IDLE timer for " + idleMillis + "ms");
if (DBG) {
Slog.d(TAG, "setting ACTION_DEVICE_IDLE timer for " + idleMillis + "ms");
}
mAlarmManager.set(AlarmManager.RTC_WAKEUP, triggerTime, mIdleIntent);
}
mPluggedType = pluggedType;