DO NOT MERGE: Keep access point list updated once in short time
The function onAccessPointsChanged will be called many times
and access points will be updated many times in 300ms. So check
if the same event exists before calling postDelayed.
Bug: 68230819
Test: Manual test
Change-Id: Id098e1b77c28b62a5495c3369ed950531e59dba2
diff --git a/src/com/android/settings/wifi/WifiSettings.java b/src/com/android/settings/wifi/WifiSettings.java
index 190af4d..d61b71c 100644
--- a/src/com/android/settings/wifi/WifiSettings.java
+++ b/src/com/android/settings/wifi/WifiSettings.java
@@ -37,6 +37,7 @@
import android.net.wifi.WpsInfo;
import android.nfc.NfcAdapter;
import android.os.Bundle;
+import android.os.Handler;
import android.os.HandlerThread;
import android.os.PowerManager;
import android.os.Process;
@@ -703,6 +704,10 @@
private void updateAccessPointsDelayed() {
// Safeguard from some delayed event handling
if (getActivity() != null && !mIsRestricted && mWifiManager.isWifiEnabled()) {
+ Handler handler = getView().getHandler();
+ if (handler != null && handler.hasCallbacks(mUpdateAccessPointsRunnable)) {
+ return;
+ }
setProgressBarVisible(true);
getView().postDelayed(mUpdateAccessPointsRunnable, 300 /* delay milliseconds */);
}