packages/apps/Settings
修訂 | ae6a21427c46d580c74ef0d3442cdaeb534a5e6b (tree) |
---|---|
時間 | 2021-01-29 23:31:02 |
作者 | tom hsu <tomhsu@goog...> |
Commiter | Tom Hsu |
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
@@ -228,7 +228,8 @@ public class SimStatusDialogController implements LifecycleObserver, OnResume, O | ||
228 | 228 | if (mSubscriptionInfo == null) { |
229 | 229 | return; |
230 | 230 | } |
231 | - | |
231 | + mTelephonyManager = | |
232 | + mTelephonyManager.createForSubscriptionId(mSubscriptionInfo.getSubscriptionId()); | |
232 | 233 | mPhoneStateListener = getPhoneStateListener(); |
233 | 234 | updateLatestAreaInfo(); |
234 | 235 | updateSubscriptionStatus(); |
@@ -162,6 +162,8 @@ public class SimStatusDialogControllerTest { | ||
162 | 162 | doReturn(null).when(mSignalStrength).getCellSignalStrengths(); |
163 | 163 | doReturn(mPhoneStateListener).when(mController).getPhoneStateListener(); |
164 | 164 | doReturn(mSubscriptionInfo).when(mSubscriptionManager).getActiveSubscriptionInfo(anyInt()); |
165 | + when(mSubscriptionInfo.getSubscriptionId()) | |
166 | + .thenReturn(SubscriptionManager.DEFAULT_SUBSCRIPTION_ID); | |
165 | 167 | |
166 | 168 | ReflectionHelpers.setField(mController, "mTelephonyManager", mTelephonyManager); |
167 | 169 | ReflectionHelpers.setField(mController, "mCarrierConfigManager", mCarrierConfigManager); |