Last active
August 29, 2015 14:10
-
-
Save invisiblek/cfb73f265ad18743d225 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/java/com/android/internal/telephony/SubInfoRecordUpdater.java b/src/java/com/android/internal/telephony/SubInfoRecordUpdater.java | |
index e49a962..86e50e1 100644 | |
--- a/src/java/com/android/internal/telephony/SubInfoRecordUpdater.java | |
+++ b/src/java/com/android/internal/telephony/SubInfoRecordUpdater.java | |
@@ -276,15 +276,24 @@ public class SubInfoRecordUpdater extends Handler { | |
for (int slotId = 0; slotId < PROJECT_SIM_NUM; slotId++) { | |
CardState newState = CardState.CARDSTATE_ABSENT; | |
- UiccCard newCard = mUiccController.getUiccCard(slotId); | |
- if (newCard != null) { | |
- newState = newCard.getCardState(); | |
+ UiccCard newCard; | |
+ int triesLeft = 10; | |
+ while (triesLeft > 0) { | |
+ newCard = mUiccController.getUiccCard(slotId); | |
+ if (newCard != null) { | |
+ newState = newCard.getCardState(); | |
+ break; | |
+ } | |
+ logd("updateIccAvailability: no card was found...trying again...tries left: " | |
+ + triesLeft); | |
+ try {Thread.sleep(1000);} catch (Exception e){} | |
+ triesLeft--; | |
} | |
CardState oldState = sCardState[slotId]; | |
sCardState[slotId] = newState; | |
logd("Slot[" + slotId + "]: New Card State = " | |
+ newState + " " + "Old Card State = " + oldState); | |
- if (!newState.isCardPresent()) { | |
+ if (!newState.isCardPresent() && newState != oldState) { | |
//Card moved to ABSENT State | |
if (sIccId[slotId] != null && !sIccId[slotId].equals(ICCID_STRING_FOR_NO_SIM)) { | |
logd("SIM" + (slotId + 1) + " hot plug out"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment