summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorzhujiatai <zhujiatai@xiaomi.com>2021-01-06 13:41:03 +0800
committerWang Han <416810799@qq.com>2021-01-30 16:14:13 +0800
commit1590c968d37b78b8dfcd3cf21a80f380b7613166 (patch)
tree57f25c8b12137b77a6a8b932ba2dadeca6a88246 /service
parente6611b384f35aafd787c471ae048cc2ce5ac4999 (diff)
Fix abnormal wake up caused by WifiConnectivityManager
When wifi is toggled off when disconnected, the Watchdog Timer will still work after at most 20mins, this will wake up the phone from sleep. Signed-off-by: zhujiatai <zhujiatai@xiaomi.com> Change-Id: I73333041932d3240783cd3a2ceb2f6243ccde2d6
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/WifiConnectivityManager.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/service/java/com/android/server/wifi/WifiConnectivityManager.java b/service/java/com/android/server/wifi/WifiConnectivityManager.java
index 77af65400..12c64b542 100644
--- a/service/java/com/android/server/wifi/WifiConnectivityManager.java
+++ b/service/java/com/android/server/wifi/WifiConnectivityManager.java
@@ -175,6 +175,7 @@ public class WifiConnectivityManager {
private boolean mPnoScanStarted = false;
private boolean mPeriodicScanTimerSet = false;
private boolean mDelayedPartialScanTimerSet = false;
+ private boolean mWatchdogScanTimerSet = false;
// Used for Initial Scan metrics
private boolean mFailedInitialPartialScan = false;
@@ -1466,6 +1467,15 @@ public class WifiConnectivityManager {
mClock.getElapsedSinceBootMillis() + WATCHDOG_INTERVAL_MS,
WATCHDOG_TIMER_TAG,
mWatchdogListener, mEventHandler);
+ mWatchdogScanTimerSet = true;
+ }
+
+ // Cancel the watchdog scan timer.
+ private void cancelWatchdogScan() {
+ if (mWatchdogScanTimerSet) {
+ mAlarmManager.cancel(mWatchdogListener);
+ mWatchdogScanTimerSet = false;
+ }
}
// Schedules a delayed partial scan, which will scan the frequencies in mCachedWifiCandidates.
@@ -1893,6 +1903,7 @@ public class WifiConnectivityManager {
if (!mRunning) return;
mRunning = false;
stopConnectivityScan();
+ cancelWatchdogScan();
resetLastPeriodicSingleScanTimeStamp();
mOpenNetworkNotifier.clearPendingNotification(true /* resetRepeatDelay */);
mLastConnectionAttemptBssid = null;