packages/apps/Settings
修訂 | acdb2d29e90c55ed20f16b9609c7709d65a4f8d6 (tree) |
---|---|
時間 | 2021-02-04 13:53:16 |
作者 | changbetty <changbetty@goog...> |
Commiter | SongFerngWang |
[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
Change-Id: Id169353f6dc10306dddd823a904f0803b26a6ddc
Merged-In: Id169353f6dc10306dddd823a904f0803b26a6ddc
@@ -81,7 +81,7 @@ public class MobileNetworkActivity extends SettingsBaseActivity | ||
81 | 81 | mCurSubscriptionId = updateSubscriptionIndex; |
82 | 82 | mFragmentForceReload = (mCurSubscriptionId == oldSubId); |
83 | 83 | final SubscriptionInfo info = getSubscription(); |
84 | - updateSubscriptions(info); | |
84 | + updateSubscriptions(info, null); | |
85 | 85 | |
86 | 86 | // If the subscription has changed or the new intent doesnt contain the opt in action, |
87 | 87 | // remove the old discovery dialog. If the activity is being recreated, we will see |
@@ -132,7 +132,7 @@ public class MobileNetworkActivity extends SettingsBaseActivity | ||
132 | 132 | // perform registration after mCurSubscriptionId been configured. |
133 | 133 | registerActiveSubscriptionsListener(); |
134 | 134 | |
135 | - updateSubscriptions(subscription); | |
135 | + updateSubscriptions(subscription, savedInstanceState); | |
136 | 136 | } |
137 | 137 | |
138 | 138 | @VisibleForTesting |
@@ -154,7 +154,7 @@ public class MobileNetworkActivity extends SettingsBaseActivity | ||
154 | 154 | public void onChanged() { |
155 | 155 | SubscriptionInfo info = getSubscription(); |
156 | 156 | int oldSubIndex = mCurSubscriptionId; |
157 | - updateSubscriptions(info); | |
157 | + updateSubscriptions(info, null); | |
158 | 158 | |
159 | 159 | // Remove the dialog if the subscription associated with this activity changes. |
160 | 160 | if (info == null) { |
@@ -204,14 +204,16 @@ public class MobileNetworkActivity extends SettingsBaseActivity | ||
204 | 204 | } |
205 | 205 | |
206 | 206 | @VisibleForTesting |
207 | - void updateSubscriptions(SubscriptionInfo subscription) { | |
207 | + void updateSubscriptions(SubscriptionInfo subscription, Bundle savedInstanceState) { | |
208 | 208 | if (subscription == null) { |
209 | 209 | return; |
210 | 210 | } |
211 | 211 | final int subscriptionIndex = subscription.getSubscriptionId(); |
212 | 212 | |
213 | 213 | updateTitleAndNavigation(subscription); |
214 | - switchFragment(subscription); | |
214 | + if (savedInstanceState == null) { | |
215 | + switchFragment(subscription); | |
216 | + } | |
215 | 217 | |
216 | 218 | mCurSubscriptionId = subscriptionIndex; |
217 | 219 | mFragmentForceReload = false; |