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

Commit 6ce1ab0e authored by Zhang Fang's avatar Zhang Fang Committed by Ethan Chen
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 227db104
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -802,6 +802,26 @@ public class MSimSmsManager {
            return false;
        }
    }

    /**
     * Get the capacity count of sms on Icc card
     *
     * @return the capacity count of sms on Icc card
     * @hide
     */
    public static int getSmsCapacityOnIcc(int subscription) {
        int ret = -1;
        try {
            ISmsMSim iccISms = ISmsMSim.Stub.asInterface(ServiceManager.getService("isms_msim"));
            if (iccISms != null) {
                ret = iccISms.getSmsCapacityOnIcc(subscription);
            }
        } catch (RemoteException ex) {
            //ignore it
        }
        return ret;
    }

    // see SmsMessage.getStatusOnIcc

    /** Free space (TS 51.011 10.5.3 / 3GPP2 C.S0023 3.4.27). */
+19 −0
Original line number Diff line number Diff line
@@ -787,6 +787,25 @@ public final class SmsManager {
        return format;
    }

    /**
     * Get the capacity count of sms on Icc card
     *
     * @return the capacity count of sms on Icc card
     * @hide
     */
    public static int getSmsCapacityOnIcc() {
        int ret = -1;
        try {
            ISms iccISms = ISms.Stub.asInterface(ServiceManager.getService("isms"));
            if (iccISms != null) {
                ret = iccISms.getSmsCapacityOnIcc();
            }
        } catch (RemoteException ex) {
            //ignore it
        }
        return ret;
    }

    // see SmsMessage.getStatusOnIcc

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

import java.util.ArrayList;
@@ -1005,4 +1006,18 @@ public class IccSmsInterfaceManager extends ISms.Stub {

        return true;
    }

    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;
    }
}
+5 −0
Original line number Diff line number Diff line
@@ -298,6 +298,11 @@ public class IccSmsInterfaceManagerProxy extends ISms.Stub {
        return mIccSmsInterfaceManager.getImsSmsFormat();
    }

    @Override
    public int getSmsCapacityOnIcc() {
        return mIccSmsInterfaceManager.getSmsCapacityOnIcc();
    }

    private void broadcastOutgoingSms(String callingPackage, String destAddr, String scAddr,
            boolean multipart, ArrayList<String> parts,
            ArrayList<PendingIntent> sentIntents, ArrayList<PendingIntent> deliveryIntents,
+9 −0
Original line number Diff line number Diff line
@@ -792,6 +792,15 @@ public abstract class PhoneBase extends Handler implements Phone {
        return uiccApplication.getIccFileHandler();
    }

    /**
     * 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
     */
Loading