Add hasIccCard to IccCard and TelephonyManager.

Expose the presence/absence of IccCards in the system.
This is needed to fix bug 2033811 which needs to show
some SIM menus in the Mms app and Contact apps only if
there is a SIM and on CDMA there is no sims yet.

The current implementation assumes CDMA never has an
IccCard this is true at the moment but needs to change.

Change-Id: I4167368e364623ea68e9b2778556e6d730b1e715
This commit is contained in:
Wink Saville
2009-09-01 15:39:08 -07:00
parent 03a3327bad
commit 65d62c774e
3 changed files with 31 additions and 0 deletions

View File

@ -117394,6 +117394,17 @@
visibility="public"
>
</method>
<method name="hasIccCard"
return="boolean"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
</method>
<method name="isNetworkRoaming"
return="boolean"
abstract="false"

View File

@ -480,6 +480,13 @@ public class TelephonyManager {
/** SIM card state: Ready */
public static final int SIM_STATE_READY = 5;
/**
* @return true if a ICC card is present
*/
public boolean hasIccCard() {
return PhoneFactory.getDefaultPhone().getIccCard().hasIccCard();
}
/**
* Returns a constant indicating the state of the
* device SIM card.

View File

@ -667,6 +667,19 @@ public abstract class IccCard {
return false;
}
/**
* @return true if a ICC card is present
*/
public boolean hasIccCard() {
boolean isIccPresent;
if (mPhone.getPhoneName().equals("GSM")) {
return mIccCardStatus.getCardState().isCardPresent();
} else {
// TODO: Make work with a CDMA device with a RUIM card.
return false;
}
}
private void log(String msg) {
Log.d(mLogTag, "[IccCard] " + msg);
}