[Provider Model] Fixed Internet Settings always showing "Loading"

- The Internet Settings will restart itself if it's launching in lock
screen

- The "Loading" might not be hidden if the activity restarts itself

- Move the postDelayed runnable from onViewCreated() to onStart() to
avoid loss

Bug: 204041345
Test: manual test
make RunSettingsRoboTests ROBOTEST_FILTER=NetworkProviderSettingsTest

Change-Id: I516f1105c74b6c8853a72e71c20d2197495cc0d6
This commit is contained in:
Weng Su
2021-11-09 20:55:27 +08:00
parent e535c2b67c
commit 0d8a53fa0c

View File

@@ -272,8 +272,6 @@ public class NetworkProviderSettings extends RestrictedSettingsFragment
if (mWifiManager != null) {
setLoading(true, false);
mIsViewLoading = true;
getView().postDelayed(mRemoveLoadingRunnable,
mWifiManager.isWifiEnabled() ? 1000 : 100);
}
}
@@ -431,6 +429,10 @@ public class NetworkProviderSettings extends RestrictedSettingsFragment
@Override
public void onStart() {
super.onStart();
if (mIsViewLoading) {
final long delayMillis = mWifiManager.isWifiEnabled() ? 1000 : 100;
getView().postDelayed(mRemoveLoadingRunnable, delayMillis);
}
if (mIsRestricted) {
restrictUi();
return;