Fix force close for updating UI after activity destroyed.
If activity is finishing or destroyed, getting activity context will return null results in settings app force close. Do not call scan callback if network select activity is finishing or destroyed. Test: build pass and run NetworkSelectSettingsTest unit test pass. Bug: 372123288 Change-Id: I28307490c75fe04d54dcf1637f33f4b9ba1fe635
This commit is contained in:
@@ -219,7 +219,7 @@ public class NetworkSelectSettings extends DashboardFragment {
|
||||
setProgressBarVisible(true);
|
||||
mNetworkScanJob = mNetworkScanRepository.launchNetworkScan(getViewLifecycleOwner(),
|
||||
(networkScanResult) -> {
|
||||
if (isPreferenceScreenEnabled()) {
|
||||
if (isPreferenceScreenEnabled() && !isFinishingOrDestroyed()) {
|
||||
scanResultHandler(networkScanResult);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user