• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

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

packages/apps/Settings


Commit MetaInfo

Revisioncf74e106b707aa045ab4614eea3c793fdc792ebe (tree)
Time2020-11-13 09:07:27
Authorandroid-build-team Robot <android-build-team-robot@goog...>
Commiterandroid-build-team Robot

Log Message

Snap for 6969817 from 854b1837c9af99cce0db2c1f88ba32938c19895c to rvc-d2-release

Change-Id: I9087d9aa6a474850cba4810bd29693e86f02cecc

Change Summary

Incremental Difference

--- a/src/com/android/settings/deviceinfo/simstatus/SimStatusDialogController.java
+++ b/src/com/android/settings/deviceinfo/simstatus/SimStatusDialogController.java
@@ -140,6 +140,7 @@ public class SimStatusDialogController implements LifecycleObserver, OnResume, O
140140
141141 private SubscriptionInfo mSubscriptionInfo;
142142 private TelephonyDisplayInfo mTelephonyDisplayInfo;
143+ private ServiceState mPreviousServiceState;
143144
144145 private final int mSlotIndex;
145146 private TelephonyManager mTelephonyManager;
@@ -425,6 +426,9 @@ public class SimStatusDialogController implements LifecycleObserver, OnResume, O
425426 final int state = Utils.getCombinedServiceState(serviceState);
426427 if (!Utils.isInService(serviceState)) {
427428 resetSignalStrength();
429+ } else if (!Utils.isInService(mPreviousServiceState)) {
430+ // If ServiceState changed from out of service -> in service, update signal strength.
431+ updateSignalStrength(mTelephonyManager.getSignalStrength());
428432 }
429433
430434 String serviceStateValue;
@@ -472,7 +476,7 @@ public class SimStatusDialogController implements LifecycleObserver, OnResume, O
472476 }
473477
474478 ServiceState serviceState = mTelephonyManager.getServiceState();
475- if (serviceState == null || !Utils.isInService(serviceState)) {
479+ if (!Utils.isInService(serviceState)) {
476480 return;
477481 }
478482
@@ -755,6 +759,7 @@ public class SimStatusDialogController implements LifecycleObserver, OnResume, O
755759 updateNetworkProvider();
756760 updateServiceState(serviceState);
757761 updateRoamingStatus(serviceState);
762+ mPreviousServiceState = serviceState;
758763 }
759764
760765 @Override
--- a/tests/robotests/src/com/android/settings/deviceinfo/simstatus/SimStatusDialogControllerTest.java
+++ b/tests/robotests/src/com/android/settings/deviceinfo/simstatus/SimStatusDialogControllerTest.java
@@ -42,6 +42,7 @@ import static org.mockito.Mockito.doNothing;
4242 import static org.mockito.Mockito.doReturn;
4343 import static org.mockito.Mockito.never;
4444 import static org.mockito.Mockito.spy;
45+import static org.mockito.Mockito.times;
4546 import static org.mockito.Mockito.verify;
4647 import static org.mockito.Mockito.when;
4748 import static org.robolectric.Shadows.shadowOf;
@@ -293,7 +294,7 @@ public class SimStatusDialogControllerTest {
293294
294295 final String signalStrengthString =
295296 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);
297298 }
298299
299300 @Test
@@ -310,7 +311,7 @@ public class SimStatusDialogControllerTest {
310311
311312 final String signalStrengthString =
312313 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);
314315 }
315316
316317 @Test
@@ -330,7 +331,7 @@ public class SimStatusDialogControllerTest {
330331
331332 final String signalStrengthString =
332333 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);
334335 }
335336
336337 @Test
@@ -394,8 +395,8 @@ public class SimStatusDialogControllerTest {
394395
395396 mController.initialize();
396397
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);
399400 }
400401
401402 @Test
@@ -405,7 +406,7 @@ public class SimStatusDialogControllerTest {
405406
406407 mController.initialize();
407408
408- verify(mDialog).setText(eq(SIGNAL_STRENGTH_VALUE_ID), any());
409+ verify(mDialog, times(2)).setText(eq(SIGNAL_STRENGTH_VALUE_ID), any());
409410 verify(mDialog).removeSettingFromScreen(ICCID_INFO_LABEL_ID);
410411 verify(mDialog).removeSettingFromScreen(ICCID_INFO_VALUE_ID);
411412 }