Skip to content

Commit cc7605c

Browse files
author
Uma Maheswari Ramalingam
committed
Fix for phone app crash in Icc Card.
- Check for active phone in ICC handler before processing messages. - Boundary check for gsm/cdma subscription app index while retrieving the ICC Card App. Change-Id: I3d54447e8d48e3482763e78eeb2a737a34cec321
1 parent 2b858ca commit cc7605c

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

telephony/java/com/android/internal/telephony/IccCard.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,12 @@ public void handleMessage(Message msg){
487487
CommandsInterface.SERVICE_CLASS_DATA +
488488
CommandsInterface.SERVICE_CLASS_FAX;
489489

490+
if (!mPhone.mIsTheCurrentActivePhone) {
491+
Log.e(mLogTag, "Received message " + msg + "[" + msg.what
492+
+ "] while being destroyed. Ignoring.");
493+
return;
494+
}
495+
490496
switch (msg.what) {
491497
case EVENT_RADIO_OFF_OR_NOT_AVAILABLE:
492498
mState = null;
@@ -626,7 +632,13 @@ public State getIccCardState() {
626632
index = mIccCardStatus.getGsmUmtsSubscriptionAppIndex();
627633
}
628634

629-
IccCardApplication app = mIccCardStatus.getApplication(index);
635+
IccCardApplication app;
636+
if (index >= 0 && index < IccCardStatus.CARD_MAX_APPS) {
637+
app = mIccCardStatus.getApplication(index);
638+
} else {
639+
Log.e(mLogTag, "[IccCard] Invalid Subscription Application index:" + index);
640+
return IccCard.State.ABSENT;
641+
}
630642

631643
if (app == null) {
632644
Log.e(mLogTag, "[IccCard] Subscription Application in not present");

0 commit comments

Comments
 (0)