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

Commit a6c8fe48 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add method to check if SimContacts are available" into ub-contactsdialer-h-dev

parents 1294cadc 1dd62283
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -118,6 +118,18 @@ public class SimCard {
        return mCountryCode;
    }

    /**
     * Returns whether the contacts for this SIM card have been initialized.
     */
    public boolean areContactsAvailable() {
        return mContacts != null;
    }

    /**
     * Returns whether this SIM card has any SIM contacts.
     *
     * A precondition of this method is that the contacts have been initialized.
     */
    public boolean hasContacts() {
        if (mContacts == null) {
            throw new IllegalStateException("Contacts not loaded.");
@@ -125,6 +137,11 @@ public class SimCard {
        return !mContacts.isEmpty();
    }

    /**
     * Returns the number of contacts stored on this SIM card.
     *
     * A precondition of this method is that the contacts have been initialized.
     */
    public int getContactCount() {
        if (mContacts == null) {
            throw new IllegalStateException("Contacts not loaded.");
@@ -148,6 +165,9 @@ public class SimCard {
        return !isDismissed() && !isImported() && hasContacts();
    }

    /**
     * Returns the contacts for this SIM card or null if the contacts have not been initialized.
     */
    public List<SimContact> getContacts() {
        return mContacts;
    }