[Provider Model] Fix settings crash issue
- The GlobalSettingsChangeListener needs to be closed after the life cycle is destroyed Bug: 185756174 Bug: 186404332 Bug: 186591527 Test: manual test atest -c InternetUpdaterTest Change-Id: I9fbad3b303055c6c7a61ccad8efe69cefef56c58
This commit is contained in:
@@ -20,6 +20,7 @@ import static android.net.NetworkCapabilities.TRANSPORT_CELLULAR;
|
||||
import static android.net.NetworkCapabilities.TRANSPORT_ETHERNET;
|
||||
import static android.net.NetworkCapabilities.TRANSPORT_WIFI;
|
||||
|
||||
import static androidx.lifecycle.Lifecycle.Event.ON_DESTROY;
|
||||
import static androidx.lifecycle.Lifecycle.Event.ON_PAUSE;
|
||||
import static androidx.lifecycle.Lifecycle.Event.ON_RESUME;
|
||||
|
||||
@@ -191,6 +192,12 @@ public class InternetUpdater implements AirplaneModeEnabler.OnAirplaneModeChange
|
||||
mContext.unregisterReceiver(mWifiStateReceiver);
|
||||
}
|
||||
|
||||
/** @OnLifecycleEvent(ON_DESTROY) */
|
||||
@OnLifecycleEvent(ON_DESTROY)
|
||||
public void onDestroy() {
|
||||
mAirplaneModeEnabler.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAirplaneModeChanged(boolean isAirplaneModeOn) {
|
||||
fetchActiveNetwork();
|
||||
|
Reference in New Issue
Block a user