[Telephony settings] Settings crashes when rotate screen in Preferred network type
When activity is recreated, fragments are automatically reattached. Need to check the savedInstanceState is null or not when we want to add framgment in MobileNetworkActivity. (lost to check in ag/9667137) Bug: 154087690 Test: Manual make RunSettingsRoboTests -j ROBOTEST_FILTER=MobileNetworkActivityTest Change-Id: Id169353f6dc10306dddd823a904f0803b26a6ddc Merged-In: Id169353f6dc10306dddd823a904f0803b26a6ddc
This commit is contained in:
committed by
SongFerngWang
parent
6dc9f825ec
commit
acdb2d29e9
@@ -81,7 +81,7 @@ public class MobileNetworkActivity extends SettingsBaseActivity
|
||||
mCurSubscriptionId = updateSubscriptionIndex;
|
||||
mFragmentForceReload = (mCurSubscriptionId == oldSubId);
|
||||
final SubscriptionInfo info = getSubscription();
|
||||
updateSubscriptions(info);
|
||||
updateSubscriptions(info, null);
|
||||
|
||||
// If the subscription has changed or the new intent doesnt contain the opt in action,
|
||||
// remove the old discovery dialog. If the activity is being recreated, we will see
|
||||
@@ -132,7 +132,7 @@ public class MobileNetworkActivity extends SettingsBaseActivity
|
||||
// perform registration after mCurSubscriptionId been configured.
|
||||
registerActiveSubscriptionsListener();
|
||||
|
||||
updateSubscriptions(subscription);
|
||||
updateSubscriptions(subscription, savedInstanceState);
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
@@ -154,7 +154,7 @@ public class MobileNetworkActivity extends SettingsBaseActivity
|
||||
public void onChanged() {
|
||||
SubscriptionInfo info = getSubscription();
|
||||
int oldSubIndex = mCurSubscriptionId;
|
||||
updateSubscriptions(info);
|
||||
updateSubscriptions(info, null);
|
||||
|
||||
// Remove the dialog if the subscription associated with this activity changes.
|
||||
if (info == null) {
|
||||
@@ -204,14 +204,16 @@ public class MobileNetworkActivity extends SettingsBaseActivity
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
void updateSubscriptions(SubscriptionInfo subscription) {
|
||||
void updateSubscriptions(SubscriptionInfo subscription, Bundle savedInstanceState) {
|
||||
if (subscription == null) {
|
||||
return;
|
||||
}
|
||||
final int subscriptionIndex = subscription.getSubscriptionId();
|
||||
|
||||
updateTitleAndNavigation(subscription);
|
||||
switchFragment(subscription);
|
||||
if (savedInstanceState == null) {
|
||||
switchFragment(subscription);
|
||||
}
|
||||
|
||||
mCurSubscriptionId = subscriptionIndex;
|
||||
mFragmentForceReload = false;
|
||||
|
Reference in New Issue
Block a user