• R/O
  • HTTP
  • SSH
  • HTTPS

提交

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

packages/apps/Settings


Commit MetaInfo

修訂acdb2d29e90c55ed20f16b9609c7709d65a4f8d6 (tree)
時間2021-02-04 13:53:16
作者changbetty <changbetty@goog...>
CommiterSongFerngWang

Log Message

[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

Change Summary

差異

--- a/src/com/android/settings/network/telephony/MobileNetworkActivity.java
+++ b/src/com/android/settings/network/telephony/MobileNetworkActivity.java
@@ -81,7 +81,7 @@ public class MobileNetworkActivity extends SettingsBaseActivity
8181 mCurSubscriptionId = updateSubscriptionIndex;
8282 mFragmentForceReload = (mCurSubscriptionId == oldSubId);
8383 final SubscriptionInfo info = getSubscription();
84- updateSubscriptions(info);
84+ updateSubscriptions(info, null);
8585
8686 // If the subscription has changed or the new intent doesnt contain the opt in action,
8787 // remove the old discovery dialog. If the activity is being recreated, we will see
@@ -132,7 +132,7 @@ public class MobileNetworkActivity extends SettingsBaseActivity
132132 // perform registration after mCurSubscriptionId been configured.
133133 registerActiveSubscriptionsListener();
134134
135- updateSubscriptions(subscription);
135+ updateSubscriptions(subscription, savedInstanceState);
136136 }
137137
138138 @VisibleForTesting
@@ -154,7 +154,7 @@ public class MobileNetworkActivity extends SettingsBaseActivity
154154 public void onChanged() {
155155 SubscriptionInfo info = getSubscription();
156156 int oldSubIndex = mCurSubscriptionId;
157- updateSubscriptions(info);
157+ updateSubscriptions(info, null);
158158
159159 // Remove the dialog if the subscription associated with this activity changes.
160160 if (info == null) {
@@ -204,14 +204,16 @@ public class MobileNetworkActivity extends SettingsBaseActivity
204204 }
205205
206206 @VisibleForTesting
207- void updateSubscriptions(SubscriptionInfo subscription) {
207+ void updateSubscriptions(SubscriptionInfo subscription, Bundle savedInstanceState) {
208208 if (subscription == null) {
209209 return;
210210 }
211211 final int subscriptionIndex = subscription.getSubscriptionId();
212212
213213 updateTitleAndNavigation(subscription);
214- switchFragment(subscription);
214+ if (savedInstanceState == null) {
215+ switchFragment(subscription);
216+ }
215217
216218 mCurSubscriptionId = subscriptionIndex;
217219 mFragmentForceReload = false;