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

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

Telephony: Get SIM card capacity of SMS

Add implementation to get the capacity of stored
SMS on ICC card.

CRs-Fixed: 645022, 755175

Change-Id: I63c1431cf02db2dbdee3553afc2448b4ec2cdfa3

Change-Id: I349381bb52c34ebae2655f54049acc613bcc9b0d
parent 725ca8df
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -1072,6 +1072,25 @@ public final class SmsManager {
        }
    }

    /**
     * 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(getSubscriptionId());
            }
        } 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;
@@ -1127,4 +1128,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;
    }
}
+7 −0
Original line number Diff line number Diff line
@@ -1309,6 +1309,13 @@ public abstract class PhoneBase extends Handler implements Phone {
        return fh;
    }

    /**
     * Retrieves the IccRecords of the Phone instance
     */
    public IccRecords getIccRecords() {
        return mIccRecords.get();
    }

    /*
     * Retrieves the Handler of the Phone instance
     */
+16 −0
Original line number Diff line number Diff line
@@ -413,4 +413,20 @@ public class UiccSmsController extends ISms.Stub {
            sendErrorInPendingIntent(intent, errorCode);
        }
    }

    /**
     * Get the capacity count of sms on Icc card.
     **/
    @Override
    public int getSmsCapacityOnIccForSubscriber(int 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
@@ -1141,7 +1141,7 @@ public class ImsPhone extends ImsPhoneBase {
        return mDefaultPhone.getPhoneId();
    }

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

Loading