From 65d62c774e42d8bf9a55ef50e153ffc9e277ef37 Mon Sep 17 00:00:00 2001 From: Wink Saville Date: Tue, 1 Sep 2009 15:39:08 -0700 Subject: 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 --- telephony/java/android/telephony/TelephonyManager.java | 7 +++++++ telephony/java/com/android/internal/telephony/IccCard.java | 13 +++++++++++++ 2 files changed, 20 insertions(+) (limited to 'telephony') diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index f3304a3..a690e3c 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -481,6 +481,13 @@ public class TelephonyManager { 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. * diff --git a/telephony/java/com/android/internal/telephony/IccCard.java b/telephony/java/com/android/internal/telephony/IccCard.java index 6657060..200340e 100644 --- a/telephony/java/com/android/internal/telephony/IccCard.java +++ b/telephony/java/com/android/internal/telephony/IccCard.java @@ -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); } -- cgit v1.1