summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--api/current.txt1
-rwxr-xr-xapi/system-current.txt3
-rw-r--r--core/res/AndroidManifest.xml5
-rw-r--r--telephony/java/android/telephony/SmsManager.java28
-rw-r--r--telephony/java/android/telephony/SmsMessage.java2
5 files changed, 33 insertions, 6 deletions
diff --git a/api/current.txt b/api/current.txt
index cce1957fd5be..18e0043aebb1 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -45283,6 +45283,7 @@ package android.telephony {
method public byte[] getPdu();
method public int getProtocolIdentifier();
method public String getPseudoSubject();
+ method @Nullable public String getRecipientAddress();
method public String getServiceCenterAddress();
method public int getStatus();
method public int getStatusOnIcc();
diff --git a/api/system-current.txt b/api/system-current.txt
index 6d64c105c153..dbbe3ebb3c35 100755
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -8,6 +8,7 @@ package android {
field public static final String ACCESS_DRM_CERTIFICATES = "android.permission.ACCESS_DRM_CERTIFICATES";
field @Deprecated public static final String ACCESS_FM_RADIO = "android.permission.ACCESS_FM_RADIO";
field public static final String ACCESS_INSTANT_APPS = "android.permission.ACCESS_INSTANT_APPS";
+ field public static final String ACCESS_MESSAGES_ON_ICC = "android.permission.ACCESS_MESSAGES_ON_ICC";
field public static final String ACCESS_MOCK_LOCATION = "android.permission.ACCESS_MOCK_LOCATION";
field public static final String ACCESS_MTP = "android.permission.ACCESS_MTP";
field public static final String ACCESS_NETWORK_CONDITIONS = "android.permission.ACCESS_NETWORK_CONDITIONS";
@@ -9084,8 +9085,10 @@ package android.telephony {
}
public final class SmsManager {
+ method @RequiresPermission(android.Manifest.permission.ACCESS_MESSAGES_ON_ICC) public boolean deleteMessageFromIcc(int);
method public boolean disableCellBroadcastRange(int, int, int);
method public boolean enableCellBroadcastRange(int, int, int);
+ method @NonNull @RequiresPermission(android.Manifest.permission.ACCESS_MESSAGES_ON_ICC) public java.util.List<android.telephony.SmsMessage> getMessagesFromIcc();
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>);
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index 5a4fc9b39ec9..5cd717a9058d 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -716,6 +716,11 @@
<!-- ====================================================================== -->
<eat-comment />
+ <!-- @SystemApi Allows accessing the messages on ICC
+ @hide Used internally. -->
+ <permission android:name="android.permission.ACCESS_MESSAGES_ON_ICC"
+ android:protectionLevel="signature|telephony" />
+
<!-- Used for runtime permissions related to user's SMS messages. -->
<permission-group android:name="android.permission-group.SMS"
android:icon="@drawable/perm_group_sms"
diff --git a/telephony/java/android/telephony/SmsManager.java b/telephony/java/android/telephony/SmsManager.java
index 5b6649532e33..db90550c5331 100644
--- a/telephony/java/android/telephony/SmsManager.java
+++ b/telephony/java/android/telephony/SmsManager.java
@@ -16,6 +16,7 @@
package android.telephony;
+import android.Manifest;
import android.annotation.CallbackExecutor;
import android.annotation.IntDef;
import android.annotation.NonNull;
@@ -1635,14 +1636,16 @@ public final class SmsManager {
* operation is performed on the correct subscription.
* </p>
*
- * @param messageIndex is the record index of the message on ICC
- * @return true for success
+ * @param messageIndex This is the same index used to access a message
+ * from {@link #getMessagesFromIcc()}.
+ * @return true for success, false if the operation fails. Failure can be due to IPC failure,
+ * RIL/modem error which results in SMS failed to be deleted on SIM
*
* {@hide}
*/
- @UnsupportedAppUsage
- public boolean
- deleteMessageFromIcc(int messageIndex) {
+ @SystemApi
+ @RequiresPermission(Manifest.permission.ACCESS_MESSAGES_ON_ICC)
+ public boolean deleteMessageFromIcc(int messageIndex) {
boolean success = false;
try {
@@ -1684,6 +1687,7 @@ public final class SmsManager {
* {@hide}
*/
@UnsupportedAppUsage
+ @RequiresPermission(Manifest.permission.ACCESS_MESSAGES_ON_ICC)
public boolean updateMessageOnIcc(int messageIndex, int newStatus, byte[] pdu) {
boolean success = false;
@@ -1716,8 +1720,22 @@ public final class SmsManager {
* operation is performed on the correct subscription.
* </p>
*
+ * @return <code>List</code> of <code>SmsMessage</code> objects
+ *
+ * {@hide}
+ */
+ @SystemApi
+ @RequiresPermission(Manifest.permission.ACCESS_MESSAGES_ON_ICC)
+ public @NonNull List<SmsMessage> getMessagesFromIcc() {
+ return getAllMessagesFromIcc();
+ }
+
+ /**
* @return <code>ArrayList</code> of <code>SmsMessage</code> objects
*
+ * This is similar to {@link #getMessagesFromIcc} except that it will return ArrayList.
+ * Suggested to use {@link #getMessagesFromIcc} instead.
+ *
* {@hide}
*/
@UnsupportedAppUsage
diff --git a/telephony/java/android/telephony/SmsMessage.java b/telephony/java/android/telephony/SmsMessage.java
index d8df9a9a2c96..c0bc29d26c6c 100644
--- a/telephony/java/android/telephony/SmsMessage.java
+++ b/telephony/java/android/telephony/SmsMessage.java
@@ -1038,10 +1038,10 @@ public class SmsMessage {
}
/**
- * {@hide}
* Returns the recipient address(receiver) of this SMS message in String form or null if
* unavailable.
*/
+ @Nullable
public String getRecipientAddress() {
return mWrappedSmsMessage.getRecipientAddress();
}