Loading src/java/com/android/internal/telephony/SubscriptionInfoUpdater.java +11 −7 Original line number Diff line number Diff line Loading @@ -76,7 +76,7 @@ public class SubscriptionInfoUpdater extends Handler { private static final int EVENT_SIM_LOCKED_QUERY_ICCID_DONE = 1; private static final int EVENT_GET_NETWORK_SELECTION_MODE_DONE = 2; private static final int EVENT_SIM_LOADED = 3; private static final int EVENT_SIM_ABSENT = 4; private static final int EVENT_SIM_ABSENT_OR_NOT_READY = 4; private static final int EVENT_SIM_LOCKED = 5; private static final int EVENT_SIM_IO_ERROR = 6; private static final int EVENT_SIM_UNKNOWN = 7; Loading Loading @@ -217,10 +217,14 @@ public class SubscriptionInfoUpdater extends Handler { String simStatus = intent.getStringExtra(IccCardConstants.INTENT_KEY_ICC_STATE); logd("simStatus: " + simStatus); // TODO: All of the below should be converted to ACTION_INTERNAL_SIM_STATE_CHANGED to // ensure that the SubscriptionInfo is updated before the broadcasts are sent out. if (action.equals(TelephonyIntents.ACTION_SIM_STATE_CHANGED)) { rebroadcastIntentsOnUnlock.put(slotIndex, intent); if (IccCardConstants.INTENT_VALUE_ICC_ABSENT.equals(simStatus)) { sendMessage(obtainMessage(EVENT_SIM_ABSENT, slotIndex, -1)); if (IccCardConstants.INTENT_VALUE_ICC_ABSENT.equals(simStatus) || IccCardConstants.INTENT_VALUE_ICC_NOT_READY.equals(simStatus)) { sendMessage(obtainMessage(EVENT_SIM_ABSENT_OR_NOT_READY, slotIndex, -1, simStatus)); } else if (IccCardConstants.INTENT_VALUE_ICC_UNKNOWN.equals(simStatus)) { sendMessage(obtainMessage(EVENT_SIM_UNKNOWN, slotIndex, -1)); } else if (IccCardConstants.INTENT_VALUE_ICC_CARD_IO_ERROR.equals(simStatus)) { Loading Loading @@ -329,8 +333,8 @@ public class SubscriptionInfoUpdater extends Handler { handleSimLoaded(msg.arg1); break; case EVENT_SIM_ABSENT: handleSimAbsent(msg.arg1); case EVENT_SIM_ABSENT_OR_NOT_READY: handleSimAbsentOrNotReady(msg.arg1, (String) msg.obj); break; case EVENT_SIM_LOCKED: Loading Loading @@ -514,7 +518,7 @@ public class SubscriptionInfoUpdater extends Handler { mCarrierServiceBindHelper.updateForPhoneId(slotId, simState); } private void handleSimAbsent(int slotId) { private void handleSimAbsentOrNotReady(int slotId, String simState) { if (mIccId[slotId] != null && !mIccId[slotId].equals(ICCID_STRING_FOR_NO_SIM)) { logd("SIM" + (slotId + 1) + " hot plug out"); } Loading @@ -522,7 +526,7 @@ public class SubscriptionInfoUpdater extends Handler { if (isAllIccIdQueryDone()) { updateSubscriptionInfoByIccId(); } updateCarrierServices(slotId, IccCardConstants.INTENT_VALUE_ICC_ABSENT); updateCarrierServices(slotId, simState); } private void handleSimError(int slotId) { Loading tests/telephonytests/src/com/android/internal/telephony/SubscriptionInfoUpdaterTest.java +24 −1 Original line number Diff line number Diff line Loading @@ -182,6 +182,29 @@ public class SubscriptionInfoUpdaterTest extends TelephonyTest { verify(mSubscriptionController, times(1)).notifySubscriptionInfoChanged(); } @Test @SmallTest public void testSimNotReady() throws Exception { doReturn(Arrays.asList(mSubInfo)).when(mSubscriptionController) .getSubInfoUsingSlotIndexWithCheck(eq(FAKE_SUB_ID_1), anyBoolean(), anyString()); Intent mIntent = new Intent(TelephonyIntents.ACTION_SIM_STATE_CHANGED); mIntent.putExtra(IccCardConstants.INTENT_KEY_ICC_STATE, IccCardConstants.INTENT_VALUE_ICC_NOT_READY); mIntent.putExtra(PhoneConstants.PHONE_KEY, FAKE_SUB_ID_1); mContext.sendBroadcast(mIntent); waitForMs(100); verify(mSubscriptionContent).put(eq(SubscriptionManager.SIM_SLOT_INDEX), eq(SubscriptionManager.INVALID_SIM_SLOT_INDEX)); CarrierConfigManager mConfigManager = (CarrierConfigManager) mContext.getSystemService(Context.CARRIER_CONFIG_SERVICE); verify(mConfigManager).updateConfigForPhoneId(eq(FAKE_SUB_ID_1), eq(IccCardConstants.INTENT_VALUE_ICC_NOT_READY)); verify(mSubscriptionController, times(1)).notifySubscriptionInfoChanged(); } @Test @SmallTest public void testSimUnknown() throws Exception { Loading Loading
src/java/com/android/internal/telephony/SubscriptionInfoUpdater.java +11 −7 Original line number Diff line number Diff line Loading @@ -76,7 +76,7 @@ public class SubscriptionInfoUpdater extends Handler { private static final int EVENT_SIM_LOCKED_QUERY_ICCID_DONE = 1; private static final int EVENT_GET_NETWORK_SELECTION_MODE_DONE = 2; private static final int EVENT_SIM_LOADED = 3; private static final int EVENT_SIM_ABSENT = 4; private static final int EVENT_SIM_ABSENT_OR_NOT_READY = 4; private static final int EVENT_SIM_LOCKED = 5; private static final int EVENT_SIM_IO_ERROR = 6; private static final int EVENT_SIM_UNKNOWN = 7; Loading Loading @@ -217,10 +217,14 @@ public class SubscriptionInfoUpdater extends Handler { String simStatus = intent.getStringExtra(IccCardConstants.INTENT_KEY_ICC_STATE); logd("simStatus: " + simStatus); // TODO: All of the below should be converted to ACTION_INTERNAL_SIM_STATE_CHANGED to // ensure that the SubscriptionInfo is updated before the broadcasts are sent out. if (action.equals(TelephonyIntents.ACTION_SIM_STATE_CHANGED)) { rebroadcastIntentsOnUnlock.put(slotIndex, intent); if (IccCardConstants.INTENT_VALUE_ICC_ABSENT.equals(simStatus)) { sendMessage(obtainMessage(EVENT_SIM_ABSENT, slotIndex, -1)); if (IccCardConstants.INTENT_VALUE_ICC_ABSENT.equals(simStatus) || IccCardConstants.INTENT_VALUE_ICC_NOT_READY.equals(simStatus)) { sendMessage(obtainMessage(EVENT_SIM_ABSENT_OR_NOT_READY, slotIndex, -1, simStatus)); } else if (IccCardConstants.INTENT_VALUE_ICC_UNKNOWN.equals(simStatus)) { sendMessage(obtainMessage(EVENT_SIM_UNKNOWN, slotIndex, -1)); } else if (IccCardConstants.INTENT_VALUE_ICC_CARD_IO_ERROR.equals(simStatus)) { Loading Loading @@ -329,8 +333,8 @@ public class SubscriptionInfoUpdater extends Handler { handleSimLoaded(msg.arg1); break; case EVENT_SIM_ABSENT: handleSimAbsent(msg.arg1); case EVENT_SIM_ABSENT_OR_NOT_READY: handleSimAbsentOrNotReady(msg.arg1, (String) msg.obj); break; case EVENT_SIM_LOCKED: Loading Loading @@ -514,7 +518,7 @@ public class SubscriptionInfoUpdater extends Handler { mCarrierServiceBindHelper.updateForPhoneId(slotId, simState); } private void handleSimAbsent(int slotId) { private void handleSimAbsentOrNotReady(int slotId, String simState) { if (mIccId[slotId] != null && !mIccId[slotId].equals(ICCID_STRING_FOR_NO_SIM)) { logd("SIM" + (slotId + 1) + " hot plug out"); } Loading @@ -522,7 +526,7 @@ public class SubscriptionInfoUpdater extends Handler { if (isAllIccIdQueryDone()) { updateSubscriptionInfoByIccId(); } updateCarrierServices(slotId, IccCardConstants.INTENT_VALUE_ICC_ABSENT); updateCarrierServices(slotId, simState); } private void handleSimError(int slotId) { Loading
tests/telephonytests/src/com/android/internal/telephony/SubscriptionInfoUpdaterTest.java +24 −1 Original line number Diff line number Diff line Loading @@ -182,6 +182,29 @@ public class SubscriptionInfoUpdaterTest extends TelephonyTest { verify(mSubscriptionController, times(1)).notifySubscriptionInfoChanged(); } @Test @SmallTest public void testSimNotReady() throws Exception { doReturn(Arrays.asList(mSubInfo)).when(mSubscriptionController) .getSubInfoUsingSlotIndexWithCheck(eq(FAKE_SUB_ID_1), anyBoolean(), anyString()); Intent mIntent = new Intent(TelephonyIntents.ACTION_SIM_STATE_CHANGED); mIntent.putExtra(IccCardConstants.INTENT_KEY_ICC_STATE, IccCardConstants.INTENT_VALUE_ICC_NOT_READY); mIntent.putExtra(PhoneConstants.PHONE_KEY, FAKE_SUB_ID_1); mContext.sendBroadcast(mIntent); waitForMs(100); verify(mSubscriptionContent).put(eq(SubscriptionManager.SIM_SLOT_INDEX), eq(SubscriptionManager.INVALID_SIM_SLOT_INDEX)); CarrierConfigManager mConfigManager = (CarrierConfigManager) mContext.getSystemService(Context.CARRIER_CONFIG_SERVICE); verify(mConfigManager).updateConfigForPhoneId(eq(FAKE_SUB_ID_1), eq(IccCardConstants.INTENT_VALUE_ICC_NOT_READY)); verify(mSubscriptionController, times(1)).notifySubscriptionInfoChanged(); } @Test @SmallTest public void testSimUnknown() throws Exception { Loading