• 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

修訂ae6a21427c46d580c74ef0d3442cdaeb534a5e6b (tree)
時間2021-01-29 23:31:02
作者tom hsu <tomhsu@goog...>
CommiterTom Hsu

Log Message

Avoid wrong telephonymanager with wrong sub id.

When initialized SimStatusDialogController, also create TelephonyManager
with sub id.

Bug: 174171839
Test: Manual test passed, see b/174171839#25
Test: make RunSettingsRoboTests ROBOTEST_FILTER=SimStatusDialogControllerTest passed
Change-Id: I6bd6975e39c75884252b9d0bcd9d5548dbdfe6d5
Merged-In: I6bd6975e39c75884252b9d0bcd9d5548dbdfe6d5

Change Summary

差異

--- a/src/com/android/settings/deviceinfo/simstatus/SimStatusDialogController.java
+++ b/src/com/android/settings/deviceinfo/simstatus/SimStatusDialogController.java
@@ -228,7 +228,8 @@ public class SimStatusDialogController implements LifecycleObserver, OnResume, O
228228 if (mSubscriptionInfo == null) {
229229 return;
230230 }
231-
231+ mTelephonyManager =
232+ mTelephonyManager.createForSubscriptionId(mSubscriptionInfo.getSubscriptionId());
232233 mPhoneStateListener = getPhoneStateListener();
233234 updateLatestAreaInfo();
234235 updateSubscriptionStatus();
--- a/tests/robotests/src/com/android/settings/deviceinfo/simstatus/SimStatusDialogControllerTest.java
+++ b/tests/robotests/src/com/android/settings/deviceinfo/simstatus/SimStatusDialogControllerTest.java
@@ -162,6 +162,8 @@ public class SimStatusDialogControllerTest {
162162 doReturn(null).when(mSignalStrength).getCellSignalStrengths();
163163 doReturn(mPhoneStateListener).when(mController).getPhoneStateListener();
164164 doReturn(mSubscriptionInfo).when(mSubscriptionManager).getActiveSubscriptionInfo(anyInt());
165+ when(mSubscriptionInfo.getSubscriptionId())
166+ .thenReturn(SubscriptionManager.DEFAULT_SUBSCRIPTION_ID);
165167
166168 ReflectionHelpers.setField(mController, "mTelephonyManager", mTelephonyManager);
167169 ReflectionHelpers.setField(mController, "mCarrierConfigManager", mCarrierConfigManager);