packages/apps/Settings
Revision | cf74e106b707aa045ab4614eea3c793fdc792ebe (tree) |
---|---|
Time | 2020-11-13 09:07:27 |
Author | android-build-team Robot <android-build-team-robot@goog...> |
Commiter | android-build-team Robot |
Snap for 6969817 from 854b1837c9af99cce0db2c1f88ba32938c19895c to rvc-d2-release
Change-Id: I9087d9aa6a474850cba4810bd29693e86f02cecc
@@ -140,6 +140,7 @@ public class SimStatusDialogController implements LifecycleObserver, OnResume, O | ||
140 | 140 | |
141 | 141 | private SubscriptionInfo mSubscriptionInfo; |
142 | 142 | private TelephonyDisplayInfo mTelephonyDisplayInfo; |
143 | + private ServiceState mPreviousServiceState; | |
143 | 144 | |
144 | 145 | private final int mSlotIndex; |
145 | 146 | private TelephonyManager mTelephonyManager; |
@@ -425,6 +426,9 @@ public class SimStatusDialogController implements LifecycleObserver, OnResume, O | ||
425 | 426 | final int state = Utils.getCombinedServiceState(serviceState); |
426 | 427 | if (!Utils.isInService(serviceState)) { |
427 | 428 | resetSignalStrength(); |
429 | + } else if (!Utils.isInService(mPreviousServiceState)) { | |
430 | + // If ServiceState changed from out of service -> in service, update signal strength. | |
431 | + updateSignalStrength(mTelephonyManager.getSignalStrength()); | |
428 | 432 | } |
429 | 433 | |
430 | 434 | String serviceStateValue; |
@@ -472,7 +476,7 @@ public class SimStatusDialogController implements LifecycleObserver, OnResume, O | ||
472 | 476 | } |
473 | 477 | |
474 | 478 | ServiceState serviceState = mTelephonyManager.getServiceState(); |
475 | - if (serviceState == null || !Utils.isInService(serviceState)) { | |
479 | + if (!Utils.isInService(serviceState)) { | |
476 | 480 | return; |
477 | 481 | } |
478 | 482 |
@@ -755,6 +759,7 @@ public class SimStatusDialogController implements LifecycleObserver, OnResume, O | ||
755 | 759 | updateNetworkProvider(); |
756 | 760 | updateServiceState(serviceState); |
757 | 761 | updateRoamingStatus(serviceState); |
762 | + mPreviousServiceState = serviceState; | |
758 | 763 | } |
759 | 764 | |
760 | 765 | @Override |
@@ -42,6 +42,7 @@ import static org.mockito.Mockito.doNothing; | ||
42 | 42 | import static org.mockito.Mockito.doReturn; |
43 | 43 | import static org.mockito.Mockito.never; |
44 | 44 | import static org.mockito.Mockito.spy; |
45 | +import static org.mockito.Mockito.times; | |
45 | 46 | import static org.mockito.Mockito.verify; |
46 | 47 | import static org.mockito.Mockito.when; |
47 | 48 | import static org.robolectric.Shadows.shadowOf; |
@@ -293,7 +294,7 @@ public class SimStatusDialogControllerTest { | ||
293 | 294 | |
294 | 295 | final String signalStrengthString = |
295 | 296 | mContext.getString(R.string.sim_signal_strength, lteDbm, lteAsu); |
296 | - verify(mDialog).setText(SIGNAL_STRENGTH_VALUE_ID, signalStrengthString); | |
297 | + verify(mDialog, times(2)).setText(SIGNAL_STRENGTH_VALUE_ID, signalStrengthString); | |
297 | 298 | } |
298 | 299 | |
299 | 300 | @Test |
@@ -310,7 +311,7 @@ public class SimStatusDialogControllerTest { | ||
310 | 311 | |
311 | 312 | final String signalStrengthString = |
312 | 313 | mContext.getString(R.string.sim_signal_strength, lteDbm, lteAsu); |
313 | - verify(mDialog).setText(SIGNAL_STRENGTH_VALUE_ID, signalStrengthString); | |
314 | + verify(mDialog, times(2)).setText(SIGNAL_STRENGTH_VALUE_ID, signalStrengthString); | |
314 | 315 | } |
315 | 316 | |
316 | 317 | @Test |
@@ -330,7 +331,7 @@ public class SimStatusDialogControllerTest { | ||
330 | 331 | |
331 | 332 | final String signalStrengthString = |
332 | 333 | mContext.getString(R.string.sim_signal_strength, lteDbm, lteAsu); |
333 | - verify(mDialog).setText(SIGNAL_STRENGTH_VALUE_ID, signalStrengthString); | |
334 | + verify(mDialog, times(2)).setText(SIGNAL_STRENGTH_VALUE_ID, signalStrengthString); | |
334 | 335 | } |
335 | 336 | |
336 | 337 | @Test |
@@ -394,8 +395,8 @@ public class SimStatusDialogControllerTest { | ||
394 | 395 | |
395 | 396 | mController.initialize(); |
396 | 397 | |
397 | - verify(mDialog).removeSettingFromScreen(SIGNAL_STRENGTH_LABEL_ID); | |
398 | - verify(mDialog).removeSettingFromScreen(SIGNAL_STRENGTH_VALUE_ID); | |
398 | + verify(mDialog, times(2)).removeSettingFromScreen(SIGNAL_STRENGTH_LABEL_ID); | |
399 | + verify(mDialog, times(2)).removeSettingFromScreen(SIGNAL_STRENGTH_VALUE_ID); | |
399 | 400 | } |
400 | 401 | |
401 | 402 | @Test |
@@ -405,7 +406,7 @@ public class SimStatusDialogControllerTest { | ||
405 | 406 | |
406 | 407 | mController.initialize(); |
407 | 408 | |
408 | - verify(mDialog).setText(eq(SIGNAL_STRENGTH_VALUE_ID), any()); | |
409 | + verify(mDialog, times(2)).setText(eq(SIGNAL_STRENGTH_VALUE_ID), any()); | |
409 | 410 | verify(mDialog).removeSettingFromScreen(ICCID_INFO_LABEL_ID); |
410 | 411 | verify(mDialog).removeSettingFromScreen(ICCID_INFO_VALUE_ID); |
411 | 412 | } |