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:
@ -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"
|
||||
|
@ -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.
|
||||
|
@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user