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

Commit d5093c71 authored by changbetty's avatar changbetty
Browse files

[Telephony Mainline] Add new SystemApi method and SystemApi annotation for mainline

   SmsManager - add SystemApi and RequiresPermission
    - deleteMessageFromIcc
    - getMessagesFromIcc

   SmsMessage - make as public API
    - getRecipientAddress

Bug: 144478274
Test: make
Change-Id: I6b875142bc8308e582ea874e9c69d8bed11ae554
parent 344c5447
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -45490,6 +45490,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();
+3 −0
Original line number Diff line number Diff line
@@ -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";
@@ -9607,8 +9608,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>);
+5 −0
Original line number Diff line number Diff line
@@ -721,6 +721,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"
+23 −5
Original line number Diff line number Diff line
@@ -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
+1 −1
Original line number Diff line number Diff line
@@ -1032,10 +1032,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();
    }