Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 65d62c77 authored by Wink Saville's avatar Wink Saville
Browse files

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
parent 03a3327b
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -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"
+7 −0
Original line number Diff line number Diff line
@@ -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.
+13 −0
Original line number Diff line number Diff line
@@ -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);
    }