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

Commit acc6a814 authored by Zhang Fang's avatar Zhang Fang Committed by Linux Build Service Account
Browse files

Telephony: Get SIM card capacity count of SMS.

Add one API:
- getSmsCapacityOnIcc: get the capacity of stored SMS on ICC card.

Change-Id: I63c1431cf02db2dbdee3553afc2448b4ec2cdfa3
CRs-Fixed: 645022
parent b4829884
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -1085,6 +1085,25 @@ public final class SmsManager {
        return SubscriptionManager.getDefaultSmsSubId();
    }

    /**
     * Get the capacity count of sms on Icc card
     *
     * @return the capacity count of sms on Icc card
     * @hide
     */
    public int getSmsCapacityOnIcc() {
        int ret = -1;
        try {
            ISms iccISms = getISmsService();
            if (iccISms != null) {
                ret = iccISms.getSmsCapacityOnIccForSubscriber(getSubId());
            }
        } catch (RemoteException ex) {
            //ignore it
        }
        return ret;
    }

    // see SmsMessage.getStatusOnIcc

    /** Free space (TS 51.011 10.5.3 / 3GPP2 C.S0023 3.4.27). */
+14 −0
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ import com.android.internal.telephony.uicc.IccConstants;
import com.android.internal.telephony.uicc.IccFileHandler;
import com.android.internal.telephony.uicc.UiccController;
import com.android.internal.telephony.SmsNumberUtils;
import com.android.internal.telephony.uicc.IccRecords;
import com.android.internal.util.HexDump;

import java.util.ArrayList;
@@ -1254,4 +1255,17 @@ public class IccSmsInterfaceManager {
        return result != null ? result : destAddr;
    }

    public int getSmsCapacityOnIcc() {
        int numberOnIcc = -1;
        IccRecords ir = mPhone.getIccRecords();

        if (ir != null) {
            numberOnIcc = ir.getSmsCapacityOnIcc();
        } else {
            log("getSmsCapacityOnIcc - aborting, no icc card present.");
        }

        log("getSmsCapacityOnIcc().numberOnIcc = " + numberOnIcc);
        return numberOnIcc;
    }
}
+9 −0
Original line number Diff line number Diff line
@@ -1124,6 +1124,15 @@ public abstract class PhoneBase extends Handler implements Phone {
        return fh;
    }

    /**
     * Retrieves the IccRecords of the Phone instance
     */
    public IccRecords getIccRecords(){
        UiccCardApplication uiccApplication = mUiccApplication.get();
        if (uiccApplication == null) return null;
        return uiccApplication.getIccRecords();
    }

    /*
     * Retrieves the Handler of the Phone instance
     */
+14 −0
Original line number Diff line number Diff line
@@ -395,4 +395,18 @@ public class UiccSmsController extends ISms.Stub {
        }
    }

    /**
     * Get the capacity count of sms on Icc card.
     **/
    public int getSmsCapacityOnIccForSubscriber(long subId)
            throws android.os.RemoteException {
       IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId);

        if (iccSmsIntMgr != null ) {
            return iccSmsIntMgr.getSmsCapacityOnIcc();
        } else {
            Rlog.e(LOG_TAG, "iccSmsIntMgr is null for " + " subId: " + subId);
            return -1;
        }
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -1035,7 +1035,7 @@ public class ImsPhone extends ImsPhoneBase {
        return mDefaultPhone.getSubscriptionInfo();
    }

    private IccRecords getIccRecords() {
    public IccRecords getIccRecords() {
        return mDefaultPhone.mIccRecords.get();
    }

Loading