Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a3431e4c authored by Android (Google) Code Review's avatar Android (Google) Code Review
Browse files

Merge change I84612ea6 into eclair

* changes:
  Add a delay to wifi driver stop on screen off.
parents 6e58cf21 84612ea6
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -1324,9 +1324,16 @@ public class WifiService extends IWifiManager.Stub {
                if (!shouldWifiStayAwake(stayAwakeConditions, mPluggedType)) {
                    WifiInfo info = mWifiStateTracker.requestConnectionInfo();
                    if (info.getSupplicantState() != SupplicantState.COMPLETED) {
                        // do not keep Wifi awake when screen is off if Wifi is not associated
                        mDeviceIdle = true;
                        updateWifiState();
                        // we used to go to sleep immediately, but this caused some race conditions
                        // we don't have time to track down for this release.  Delay instead, 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
                        Log.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;
                        Log.d(TAG, "setting ACTION_DEVICE_IDLE timer for " + idleMillis + "ms");