Fix the NPE issue in the Internet Settings
- Missing to remove the mRemoveLoadingRunnable in the onStop() function, which will cause the callback to run after the fragment is destroyed and encounter this NPE issue. Bug: 193405782 Test: manual test make RunSettingsRoboTests ROBOTEST_FILTER=NetworkProviderSettingsTest Change-Id: I48b85173db1e6689dd056ba71f2fac776ffabbc9
This commit is contained in:
@@ -167,7 +167,8 @@ public class NetworkProviderSettings extends RestrictedSettingsFragment
|
||||
}
|
||||
|
||||
private boolean mIsViewLoading;
|
||||
private final Runnable mRemoveLoadingRunnable = () -> {
|
||||
@VisibleForTesting
|
||||
final Runnable mRemoveLoadingRunnable = () -> {
|
||||
if (mIsViewLoading) {
|
||||
setLoading(false, false);
|
||||
mIsViewLoading = false;
|
||||
@@ -175,11 +176,13 @@ public class NetworkProviderSettings extends RestrictedSettingsFragment
|
||||
};
|
||||
|
||||
private boolean mIsWifiEntryListStale = true;
|
||||
private final Runnable mUpdateWifiEntryPreferencesRunnable = () -> {
|
||||
@VisibleForTesting
|
||||
final Runnable mUpdateWifiEntryPreferencesRunnable = () -> {
|
||||
updateWifiEntryPreferences();
|
||||
getView().postDelayed(mRemoveLoadingRunnable, 10);
|
||||
};
|
||||
private final Runnable mHideProgressBarRunnable = () -> {
|
||||
@VisibleForTesting
|
||||
final Runnable mHideProgressBarRunnable = () -> {
|
||||
setProgressBarVisible(false);
|
||||
};
|
||||
|
||||
@@ -445,6 +448,7 @@ public class NetworkProviderSettings extends RestrictedSettingsFragment
|
||||
@Override
|
||||
public void onStop() {
|
||||
mIsWifiEntryListStale = true;
|
||||
getView().removeCallbacks(mRemoveLoadingRunnable);
|
||||
getView().removeCallbacks(mUpdateWifiEntryPreferencesRunnable);
|
||||
getView().removeCallbacks(mHideProgressBarRunnable);
|
||||
mAirplaneModeEnabler.stop();
|
||||
|
Reference in New Issue
Block a user