summaryrefslogtreecommitdiffstats
path: root/telephony
diff options
context:
space:
mode:
authorWink Saville <wink@google.com>2009-09-01 15:39:08 -0700
committerWink Saville <wink@google.com>2009-09-01 15:52:42 -0700
commit65d62c774e42d8bf9a55ef50e153ffc9e277ef37 (patch)
treeaa3a5a47dac22d06c8a736380e2009ee925b1b87 /telephony
parent03a3327badda54728de2ca969b31b53f5ad9ad3a (diff)
downloadframeworks_base-65d62c774e42d8bf9a55ef50e153ffc9e277ef37.zip
frameworks_base-65d62c774e42d8bf9a55ef50e153ffc9e277ef37.tar.gz
frameworks_base-65d62c774e42d8bf9a55ef50e153ffc9e277ef37.tar.bz2
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
Diffstat (limited to 'telephony')
-rw-r--r--telephony/java/android/telephony/TelephonyManager.java7
-rw-r--r--telephony/java/com/android/internal/telephony/IccCard.java13
2 files changed, 20 insertions, 0 deletions
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);
}