Using ACTION_SIM_CARD_STATE_CHANGED to detect simSlotMapping is complete

Sometime modem can't return the GET_SIM_STATUS immediately, so that the settings send the sim switching too early after simSlotMapping.

Bug: 291733084
Change-Id: If547c8b02020bc86c83915334e29945176a4ee9f
Test: tester will test it manually.
This commit is contained in:
SongFerng Wang
2023-12-20 11:38:47 +00:00
parent 72d638e681
commit ba2a86ad9f
2 changed files with 20 additions and 10 deletions

View File

@@ -752,11 +752,14 @@ public class UiccSlotUtilTest {
}
@Test
public void onReceiveSimSlotChangeReceiver_receiveAction_timerCountDown() {
public void onReceiveSimCardStateChangeReceiver_receiveAction_timerCountDown() {
CountDownLatch latch = spy(new CountDownLatch(1));
UiccSlotUtil.SimSlotChangeReceiver receive = new UiccSlotUtil.SimSlotChangeReceiver(latch);
UiccSlotUtil.SimCardStateChangeReceiver receive =
new UiccSlotUtil.SimCardStateChangeReceiver(latch);
Intent intent = new Intent(TelephonyManager.ACTION_SIM_SLOT_STATUS_CHANGED);
intent.putExtra(TelephonyManager.EXTRA_SIM_STATE, TelephonyManager.SIM_STATE_PRESENT);
receive.onReceive(mContext, new Intent(TelephonyManager.ACTION_SIM_SLOT_STATUS_CHANGED));
receive.onReceive(mContext, intent);
verify(latch).countDown();
}