diff --git a/api/current.txt b/api/current.txt index e16876e45c873..8ffbc712e2c4b 100644 --- a/api/current.txt +++ b/api/current.txt @@ -47910,6 +47910,7 @@ package android.telephony { method @NonNull public android.os.Bundle getCarrierConfigValues(); method public static android.telephony.SmsManager getDefault(); method public static int getDefaultSmsSubscriptionId(); + method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public int getSmsCapacityOnIcc(); method public static android.telephony.SmsManager getSmsManagerForSubscriptionId(int); method @RequiresPermission(android.Manifest.permission.SMS_FINANCIAL_TRANSACTIONS) public void getSmsMessagesForFinancialApp(android.os.Bundle, @NonNull java.util.concurrent.Executor, @NonNull android.telephony.SmsManager.FinancialSmsCallback); method @Nullable @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public String getSmscAddress(); diff --git a/api/system-current.txt b/api/system-current.txt index ddf9c4d97e6f2..e163e7d792552 100755 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -11075,7 +11075,6 @@ package android.telephony { 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 getPremiumSmsConsent(@NonNull String); - method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public int getSmsCapacityOnIcc(); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void sendMultipartTextMessageWithoutPersisting(String, String, java.util.List, java.util.List, java.util.List); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setPremiumSmsConsent(@NonNull String, int); field public static final int PREMIUM_SMS_CONSENT_ALWAYS_ALLOW = 3; // 0x3 diff --git a/non-updatable-api/current.txt b/non-updatable-api/current.txt index 8a36837d10d55..e409071c63912 100644 --- a/non-updatable-api/current.txt +++ b/non-updatable-api/current.txt @@ -46078,6 +46078,7 @@ package android.telephony { method @NonNull public android.os.Bundle getCarrierConfigValues(); method public static android.telephony.SmsManager getDefault(); method public static int getDefaultSmsSubscriptionId(); + method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public int getSmsCapacityOnIcc(); method public static android.telephony.SmsManager getSmsManagerForSubscriptionId(int); method @RequiresPermission(android.Manifest.permission.SMS_FINANCIAL_TRANSACTIONS) public void getSmsMessagesForFinancialApp(android.os.Bundle, @NonNull java.util.concurrent.Executor, @NonNull android.telephony.SmsManager.FinancialSmsCallback); method @Nullable @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public String getSmscAddress(); diff --git a/non-updatable-api/system-current.txt b/non-updatable-api/system-current.txt index b67c22c27cb8b..2b3e7815d0609 100644 --- a/non-updatable-api/system-current.txt +++ b/non-updatable-api/system-current.txt @@ -9957,7 +9957,6 @@ package android.telephony { 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 getPremiumSmsConsent(@NonNull String); - method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public int getSmsCapacityOnIcc(); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void sendMultipartTextMessageWithoutPersisting(String, String, java.util.List, java.util.List, java.util.List); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setPremiumSmsConsent(@NonNull String, int); field public static final int PREMIUM_SMS_CONSENT_ALWAYS_ALLOW = 3; // 0x3 diff --git a/telephony/java/android/telephony/SmsManager.java b/telephony/java/android/telephony/SmsManager.java index d6ce40c24b783..af49dc4bb9b3b 100644 --- a/telephony/java/android/telephony/SmsManager.java +++ b/telephony/java/android/telephony/SmsManager.java @@ -2091,17 +2091,25 @@ public final class SmsManager { } /** - * Gets the total capacity of SMS storage on RUIM and SIM cards - *

- * This is the number of 176 byte EF-SMS records which can be stored on the RUIM or SIM card. - *

- * See 3GPP TS 31.102 - 4.2.25 - EF-SMS for more information + * Gets the total capacity of SMS storage on the SIM card. * - * @return the total number of SMS records which can be stored on the RUIM or SIM cards. - * @hide + *

+ * This is the number of 176 byte EF-SMS records which can be stored on the SIM card. + * See 3GPP TS 31.102 - 4.2.25 - EF-SMS for more information. + *

+ * + *

Note: This method will never trigger an SMS disambiguation + * dialog. If this method is called on a device that has multiple active subscriptions, this + * {@link SmsManager} instance has been created with {@link #getDefault()}, and no user-defined + * default subscription is defined, the subscription ID associated with this method will be + * INVALID, which will result in the operation being completed on the subscription associated + * with logical slot 0. Use {@link #getSmsManagerForSubscriptionId(int)} to ensure the operation + * is performed on the correct subscription. + *

+ * + * @return the total number of SMS records which can be stored on the SIM card. */ - @SystemApi - @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) + @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public int getSmsCapacityOnIcc() { int ret = 0; try { @@ -2110,7 +2118,7 @@ public final class SmsManager { ret = iccISms.getSmsCapacityOnIccForSubscriber(getSubscriptionId()); } } catch (RemoteException ex) { - //ignore it + throw new RuntimeException(ex); } return ret; }