Don't update preference list when there's no Activity for it.
Phone account setting will crash due to NullPointerException if
PhoneAccountSettingsFragment not recycled immediately after dialer's
main activity started.
Bug: 197199688
Test: Manually start phone account setting activity and open dialer
in lockscreen and make sure there's no crash.
Change-Id: Ic72ba80fd699f19f55aab00dafd3510fdb966720
diff --git a/src/com/android/phone/settings/PhoneAccountSettingsFragment.java b/src/com/android/phone/settings/PhoneAccountSettingsFragment.java
index 224a1f9..6bc71dc 100644
--- a/src/com/android/phone/settings/PhoneAccountSettingsFragment.java
+++ b/src/com/android/phone/settings/PhoneAccountSettingsFragment.java
@@ -78,6 +78,9 @@
new SubscriptionManager.OnSubscriptionsChangedListener() {
@Override
public void onSubscriptionsChanged() {
+ if (getActivity() == null) {
+ return;
+ }
updateAccounts();
}
};