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

Commit db15271a authored by Mengjun Leng's avatar Mengjun Leng
Browse files

Telephony: Get SIM card capacity count of SMS

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

Bug:37289947
Change-Id: Ic9383b3605ce450b3dc32ccc0c283789c12fabf7
parent 04872c7b
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -8677,6 +8677,7 @@ package android.telephony {
  public final class SmsManager {
    method public boolean disableCellBroadcastRange(int, int, int);
    method public boolean enableCellBroadcastRange(int, int, int);
    method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public int getSmsCapacityOnIcc();
    method public void sendMultipartTextMessage(@NonNull String, @NonNull String, @NonNull java.util.List<java.lang.String>, @Nullable java.util.List<android.app.PendingIntent>, @Nullable java.util.List<android.app.PendingIntent>, @NonNull String);
    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void sendMultipartTextMessageWithoutPersisting(String, String, java.util.List<java.lang.String>, java.util.List<android.app.PendingIntent>, java.util.List<android.app.PendingIntent>);
  }
+21 −0
Original line number Diff line number Diff line
@@ -2004,6 +2004,27 @@ public final class SmsManager {
        }
    }

    /**
     * Gets the total capacity of SMS storage on RUIM and SIM cards
     *
     * @return the total capacity count of SMS on RUIM and SIM cards
     * @hide
     */
    @SystemApi
    @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
    public int getSmsCapacityOnIcc() {
        int ret = 0;
        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). */
+8 −0
Original line number Diff line number Diff line
@@ -605,4 +605,12 @@ interface ISms {
     * @return true for success, false otherwise.
     */
    boolean setSmscAddressOnIccEfForSubscriber(String smsc, int subId, String callingPackage);

    /**
     * Get the capacity count of sms on Icc card.
     *
     * @param subId for subId which getSmsCapacityOnIcc is queried.
     * @return capacity of ICC
     */
    int getSmsCapacityOnIccForSubscriber(int subId);
}
+5 −0
Original line number Diff line number Diff line
@@ -219,4 +219,9 @@ public class ISmsImplBase extends ISms.Stub {
            String smsc, int subId, String callingPackage) {
        throw new UnsupportedOperationException();
    }

    @Override
    public int getSmsCapacityOnIccForSubscriber(int subId) {
        throw new UnsupportedOperationException();
    }
}