Merge "Keep access point list updated once in short time"
This commit is contained in:
committed by
Android (Google) Code Review
commit
7817a16cf3
@@ -33,6 +33,7 @@ import android.net.wifi.WifiManager;
|
|||||||
import android.net.wifi.WpsInfo;
|
import android.net.wifi.WpsInfo;
|
||||||
import android.nfc.NfcAdapter;
|
import android.nfc.NfcAdapter;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.Handler;
|
||||||
import android.os.PowerManager;
|
import android.os.PowerManager;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.support.annotation.VisibleForTesting;
|
import android.support.annotation.VisibleForTesting;
|
||||||
@@ -687,8 +688,13 @@ public class WifiSettings extends RestrictedSettingsFragment
|
|||||||
private void updateAccessPointsDelayed() {
|
private void updateAccessPointsDelayed() {
|
||||||
// Safeguard from some delayed event handling
|
// Safeguard from some delayed event handling
|
||||||
if (getActivity() != null && !mIsRestricted && mWifiManager.isWifiEnabled()) {
|
if (getActivity() != null && !mIsRestricted && mWifiManager.isWifiEnabled()) {
|
||||||
|
final View view = getView();
|
||||||
|
final Handler handler = view.getHandler();
|
||||||
|
if (handler != null && handler.hasCallbacks(mUpdateAccessPointsRunnable)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
setProgressBarVisible(true);
|
setProgressBarVisible(true);
|
||||||
getView().postDelayed(mUpdateAccessPointsRunnable, 300 /* delay milliseconds */);
|
view.postDelayed(mUpdateAccessPointsRunnable, 300 /* delay milliseconds */);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user