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

Commit 18122752 authored by Philip P. Moltmann's avatar Philip P. Moltmann Committed by Android (Google) Code Review
Browse files

Merge "Pipe through attributeTag for one SMS permission check" into rvc-dev

parents 4d2c4a2b 83083305
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -47790,7 +47790,7 @@ package android.telephony {
    method @Deprecated public void sendMultimediaMessage(android.content.Context, android.net.Uri, String, android.os.Bundle, android.app.PendingIntent);
    method public void sendMultipartTextMessage(String, String, java.util.ArrayList<java.lang.String>, java.util.ArrayList<android.app.PendingIntent>, java.util.ArrayList<android.app.PendingIntent>);
    method public void sendMultipartTextMessage(@NonNull String, @Nullable String, @NonNull java.util.List<java.lang.String>, @Nullable java.util.List<android.app.PendingIntent>, @Nullable java.util.List<android.app.PendingIntent>, long);
    method public void sendMultipartTextMessage(@NonNull String, @Nullable 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 public void sendMultipartTextMessage(@NonNull String, @Nullable String, @NonNull java.util.List<java.lang.String>, @Nullable java.util.List<android.app.PendingIntent>, @Nullable java.util.List<android.app.PendingIntent>, @NonNull String, @Nullable String);
    method public void sendTextMessage(String, String, String, android.app.PendingIntent, android.app.PendingIntent);
    method public void sendTextMessage(@NonNull String, @Nullable String, @NonNull String, @Nullable android.app.PendingIntent, @Nullable android.app.PendingIntent, long);
    method @RequiresPermission(allOf={android.Manifest.permission.MODIFY_PHONE_STATE, android.Manifest.permission.SEND_SMS}) public void sendTextMessageWithoutPersisting(String, String, String, android.app.PendingIntent, android.app.PendingIntent);
+24 −22
Original line number Diff line number Diff line
@@ -424,7 +424,7 @@ public final class SmsManager {
            String destinationAddress, String scAddress, String text,
            PendingIntent sentIntent, PendingIntent deliveryIntent) {
        sendTextMessageInternal(destinationAddress, scAddress, text, sentIntent, deliveryIntent,
                true /* persistMessage*/, null, 0L /* messageId */);
                true /* persistMessage*/, null, null, 0L /* messageId */);
    }


@@ -443,7 +443,7 @@ public final class SmsManager {
            @Nullable PendingIntent sentIntent, @Nullable PendingIntent deliveryIntent,
            long messageId) {
        sendTextMessageInternal(destinationAddress, scAddress, text, sentIntent, deliveryIntent,
                true /* persistMessage*/, null, messageId);
                true /* persistMessage*/, null, null, messageId);
    }

    /**
@@ -561,7 +561,7 @@ public final class SmsManager {

    private void sendTextMessageInternal(String destinationAddress, String scAddress,
            String text, PendingIntent sentIntent, PendingIntent deliveryIntent,
            boolean persistMessage, String packageName, long messageId) {
            boolean persistMessage, String packageName, String attributionTag, long messageId) {
        if (TextUtils.isEmpty(destinationAddress)) {
            throw new IllegalArgumentException("Invalid destinationAddress");
        }
@@ -586,7 +586,7 @@ public final class SmsManager {
                public void onSuccess(int subId) {
                    ISms iSms = getISmsServiceOrThrow();
                    try {
                        iSms.sendTextForSubscriber(subId, packageName,
                        iSms.sendTextForSubscriber(subId, packageName, attributionTag,
                                destinationAddress, scAddress, text, sentIntent, deliveryIntent,
                                persistMessage, messageId);
                    } catch (RemoteException e) {
@@ -606,7 +606,7 @@ public final class SmsManager {
            // visible to the user.
            ISms iSms = getISmsServiceOrThrow();
            try {
                iSms.sendTextForSubscriber(getSubscriptionId(), packageName,
                iSms.sendTextForSubscriber(getSubscriptionId(), packageName, attributionTag,
                        destinationAddress, scAddress, text, sentIntent, deliveryIntent,
                        persistMessage, messageId);
            } catch (RemoteException e) {
@@ -653,7 +653,7 @@ public final class SmsManager {
            String destinationAddress, String scAddress, String text,
            PendingIntent sentIntent, PendingIntent deliveryIntent) {
        sendTextMessageInternal(destinationAddress, scAddress, text, sentIntent, deliveryIntent,
                false /* persistMessage */, null,
                false /* persistMessage */, null, null,
                0L /* messageId */);
    }

@@ -937,7 +937,7 @@ public final class SmsManager {
            String destinationAddress, String scAddress, ArrayList<String> parts,
            ArrayList<PendingIntent> sentIntents, ArrayList<PendingIntent> deliveryIntents) {
        sendMultipartTextMessageInternal(destinationAddress, scAddress, parts, sentIntents,
                deliveryIntents, true /* persistMessage*/, null,
                deliveryIntents, true /* persistMessage*/, null, null,
                0L /* messageId */);
    }

@@ -955,7 +955,7 @@ public final class SmsManager {
            @NonNull List<String> parts, @Nullable List<PendingIntent> sentIntents,
            @Nullable List<PendingIntent> deliveryIntents, long messageId) {
        sendMultipartTextMessageInternal(destinationAddress, scAddress, parts, sentIntents,
                deliveryIntents, true /* persistMessage*/, null,
                deliveryIntents, true /* persistMessage*/, null, null,
                messageId);
    }

@@ -979,15 +979,18 @@ public final class SmsManager {
    public void sendMultipartTextMessage(
            @NonNull String destinationAddress, @Nullable String scAddress,
            @NonNull List<String> parts, @Nullable List<PendingIntent> sentIntents,
            @Nullable List<PendingIntent> deliveryIntents, @NonNull String packageName) {
            @Nullable List<PendingIntent> deliveryIntents, @NonNull String packageName,
            @Nullable String attributionTag) {
        sendMultipartTextMessageInternal(destinationAddress, scAddress, parts, sentIntents,
                deliveryIntents, true /* persistMessage*/, packageName, 0L /* messageId */);
                deliveryIntents, true /* persistMessage*/, packageName, attributionTag,
                0L /* messageId */);
    }

    private void sendMultipartTextMessageInternal(
            String destinationAddress, String scAddress, List<String> parts,
            List<PendingIntent> sentIntents, List<PendingIntent> deliveryIntents,
            boolean persistMessage, String packageName, long messageId) {
            boolean persistMessage, String packageName, @Nullable String attributionTag,
            long messageId) {
        if (TextUtils.isEmpty(destinationAddress)) {
            throw new IllegalArgumentException("Invalid destinationAddress");
        }
@@ -1012,7 +1015,7 @@ public final class SmsManager {
                    public void onSuccess(int subId) {
                        try {
                            ISms iSms = getISmsServiceOrThrow();
                            iSms.sendMultipartTextForSubscriber(subId, packageName,
                            iSms.sendMultipartTextForSubscriber(subId, packageName, attributionTag,
                                    destinationAddress, scAddress, parts, sentIntents,
                                    deliveryIntents, persistMessage, messageId);
                        } catch (RemoteException e) {
@@ -1034,8 +1037,8 @@ public final class SmsManager {
                    ISms iSms = getISmsServiceOrThrow();
                    if (iSms != null) {
                        iSms.sendMultipartTextForSubscriber(getSubscriptionId(), packageName,
                                destinationAddress, scAddress, parts, sentIntents, deliveryIntents,
                                persistMessage, messageId);
                                attributionTag, destinationAddress, scAddress, parts, sentIntents,
                                deliveryIntents, persistMessage, messageId);
                    }
                } catch (RemoteException e) {
                    Log.e(TAG, "sendMultipartTextMessageInternal: Couldn't send SMS - "
@@ -1053,7 +1056,7 @@ public final class SmsManager {
                deliveryIntent = deliveryIntents.get(0);
            }
            sendTextMessageInternal(destinationAddress, scAddress, parts.get(0),
                    sentIntent, deliveryIntent, true, packageName, messageId);
                    sentIntent, deliveryIntent, true, packageName, attributionTag, messageId);
        }
    }

@@ -1083,7 +1086,7 @@ public final class SmsManager {
            String destinationAddress, String scAddress, List<String> parts,
            List<PendingIntent> sentIntents, List<PendingIntent> deliveryIntents) {
        sendMultipartTextMessageInternal(destinationAddress, scAddress, parts, sentIntents,
                deliveryIntents, false /* persistMessage*/, null,
                deliveryIntents, false /* persistMessage*/, null, null,
                0L /* messageId */);
    }

@@ -1246,7 +1249,7 @@ public final class SmsManager {
                            ISms iSms = getISmsServiceOrThrow();
                            if (iSms != null) {
                                iSms.sendMultipartTextForSubscriberWithOptions(subId,
                                        null, destinationAddress,
                                        null, null, destinationAddress,
                                        scAddress, parts, sentIntents, deliveryIntents,
                                        persistMessage, finalPriority, expectMore, finalValidity);
                            }
@@ -1268,7 +1271,7 @@ public final class SmsManager {
                    ISms iSms = getISmsServiceOrThrow();
                    if (iSms != null) {
                        iSms.sendMultipartTextForSubscriberWithOptions(getSubscriptionId(),
                                null, destinationAddress,
                                null, null, destinationAddress,
                                scAddress, parts, sentIntents, deliveryIntents,
                                persistMessage, finalPriority, expectMore, finalValidity);
                    }
@@ -1399,9 +1402,8 @@ public final class SmsManager {
            public void onSuccess(int subId) {
                try {
                    ISms iSms = getISmsServiceOrThrow();
                    iSms.sendDataForSubscriber(subId, null,
                            destinationAddress, scAddress, destinationPort & 0xFFFF, data,
                            sentIntent, deliveryIntent);
                    iSms.sendDataForSubscriber(subId, null, null, destinationAddress, scAddress,
                            destinationPort & 0xFFFF, data, sentIntent, deliveryIntent);
                } catch (RemoteException e) {
                    Log.e(TAG, "sendDataMessage: Couldn't send SMS - Exception: " + e.getMessage());
                    notifySmsError(sentIntent, RESULT_REMOTE_EXCEPTION);
@@ -1553,7 +1555,7 @@ public final class SmsManager {
            // it here because we do not have access to the activity context that is performing this
            // operation.
            // Requires that the calling process has the SEND_SMS permission.
            getITelephony().enqueueSmsPickResult(null,
            getITelephony().enqueueSmsPickResult(null, null,
                    new IIntegerConsumer.Stub() {
                        @Override
                        public void accept(int subId) {
+17 −14
Original line number Diff line number Diff line
@@ -86,9 +86,9 @@ interface ISms {
     *  raw pdu of the status report is in the extended data ("pdu").
     * @param subId the subId id.
     */
    void sendDataForSubscriber(int subId, String callingPkg, in String destAddr,
            in String scAddr, in int destPort, in byte[] data, in PendingIntent sentIntent,
            in PendingIntent deliveryIntent);
    void sendDataForSubscriber(int subId, String callingPkg, String callingattributionTag,
            in String destAddr, in String scAddr, in int destPort,in byte[] data,
            in PendingIntent sentIntent, in PendingIntent deliveryIntent);

    /**
     * Send an SMS.
@@ -120,8 +120,8 @@ interface ISms {
     * @param messageId An id that uniquely identifies the message requested to be sent.
     *   Used for logging and diagnostics purposes. The id may be 0.
     */
    void sendTextForSubscriber(in int subId, String callingPkg, in String destAddr,
            in String scAddr, in String text, in PendingIntent sentIntent,
    void sendTextForSubscriber(in int subId, String callingPkg, String callingAttributionTag,
            in String destAddr, in String scAddr, in String text, in PendingIntent sentIntent,
            in PendingIntent deliveryIntent, in boolean persistMessageForNonDefaultSmsApp,
            in long messageId);

@@ -222,7 +222,7 @@ interface ISms {
     *   Used for logging and diagnostics purposes. The id may be 0.
     */
    void sendMultipartTextForSubscriber(in int subId, String callingPkg,
            in String destinationAddress, in String scAddress,
            String callingAttributionTag, in String destinationAddress, in String scAddress,
            in List<String> parts, in List<PendingIntent> sentIntents,
            in List<PendingIntent> deliveryIntents, in boolean persistMessageForNonDefaultSmsApp,
            in long messageId);
@@ -272,10 +272,10 @@ interface ISms {
     *  Any Other values included Negative considered as Invalid Validity Period of the message.
     */
    void sendMultipartTextForSubscriberWithOptions(in int subId, String callingPkg,
            in String destinationAddress, in String scAddress, in List<String> parts,
            in List<PendingIntent> sentIntents, in List<PendingIntent> deliveryIntents,
            in boolean persistMessageForNonDefaultSmsApp, in int priority, in boolean expectMore,
            in int validityPeriod);
            String callingAttributionTag, in String destinationAddress, in String scAddress,
            in List<String> parts, in List<PendingIntent> sentIntents,
            in List<PendingIntent> deliveryIntents, in boolean persistMessageForNonDefaultSmsApp,
            in int priority, in boolean expectMore, in int validityPeriod);

    /**
     * Enable reception of cell broadcast (SMS-CB) messages with the given
@@ -433,6 +433,7 @@ interface ISms {
     *
     * @param subId the SIM id.
     * @param callingPkg the package name of the calling app
     * @param callingAttributionTag the attribution tag of calling context
     * @param messageUri the URI of the stored message
     * @param scAddress is the service center address or null to use the current default SMSC
     * @param sentIntent if not NULL this <code>PendingIntent</code> is
@@ -452,8 +453,9 @@ interface ISms {
     *  broadcast when the message is delivered to the recipient.  The
     *  raw pdu of the status report is in the extended data ("pdu").
     */
    void sendStoredText(int subId, String callingPkg, in Uri messageUri, String scAddress,
            in PendingIntent sentIntent, in PendingIntent deliveryIntent);
    void sendStoredText(int subId, String callingPkg, String callingAttributionTag,
            in Uri messageUri, String scAddress, in PendingIntent sentIntent,
            in PendingIntent deliveryIntent);

    /**
     * Send a system stored multi-part text message.
@@ -465,6 +467,7 @@ interface ISms {
     *
     * @param subId the SIM id.
     * @param callingPkg the package name of the calling app
     * @param callingAttributeTag the attribute tag of the calling context
     * @param messageUri the URI of the stored message
     * @param scAddress is the service center address or null to use
     *   the current default SMSC
@@ -488,8 +491,8 @@ interface ISms {
     *   to the recipient.  The raw pdu of the status report is in the
     *   extended data ("pdu").
     */
    void sendStoredMultipartText(int subId, String callingPkg, in Uri messageUri,
                String scAddress, in List<PendingIntent> sentIntents,
    void sendStoredMultipartText(int subId, String callingPkg, String callingAttributeTag,
                in Uri messageUri, String scAddress, in List<PendingIntent> sentIntents,
                in List<PendingIntent> deliveryIntents);

    /**
+11 −10
Original line number Diff line number Diff line
@@ -45,15 +45,15 @@ public class ISmsImplBase extends ISms.Stub {
    }

    @Override
    public void sendDataForSubscriber(int subId, String callingPkg, String destAddr,
            String scAddr, int destPort, byte[] data, PendingIntent sentIntent,
    public void sendDataForSubscriber(int subId, String callingPkg, String callingAttributionTag,
            String destAddr, String scAddr, int destPort, byte[] data, PendingIntent sentIntent,
            PendingIntent deliveryIntent) {
        throw new UnsupportedOperationException();
    }

    @Override
    public void sendTextForSubscriber(int subId, String callingPkg, String destAddr,
            String scAddr, String text, PendingIntent sentIntent,
    public void sendTextForSubscriber(int subId, String callingPkg, String callingAttributionTag,
            String destAddr, String scAddr, String text, PendingIntent sentIntent,
            PendingIntent deliveryIntent, boolean persistMessageForNonDefaultSmsApp,
            long messageId) {
        throw new UnsupportedOperationException();
@@ -76,7 +76,7 @@ public class ISmsImplBase extends ISms.Stub {

    @Override
    public void sendMultipartTextForSubscriber(int subId, String callingPkg,
            String destinationAddress, String scAddress,
            String callingAttributionTag, String destinationAddress, String scAddress,
            List<String> parts, List<PendingIntent> sentIntents,
            List<PendingIntent> deliveryIntents, boolean persistMessageForNonDefaultSmsApp,
            long messageId) {
@@ -85,7 +85,7 @@ public class ISmsImplBase extends ISms.Stub {

    @Override
    public void sendMultipartTextForSubscriberWithOptions(int subId, String callingPkg,
            String destinationAddress, String scAddress,
            String callingAttributionTag, String destinationAddress, String scAddress,
            List<String> parts, List<PendingIntent> sentIntents,
            List<PendingIntent> deliveryIntents, boolean persistMessageForNonDefaultSmsApp,
            int priority, boolean expectMore, int validityPeriod) {
@@ -162,14 +162,15 @@ public class ISmsImplBase extends ISms.Stub {
    }

    @Override
    public void sendStoredText(int subId, String callingPkg, Uri messageUri, String scAddress,
            PendingIntent sentIntent, PendingIntent deliveryIntent) {
    public void sendStoredText(int subId, String callingPkg, String callingAttributionTag,
            Uri messageUri, String scAddress, PendingIntent sentIntent,
            PendingIntent deliveryIntent) {
        throw new UnsupportedOperationException();
    }

    @Override
    public void sendStoredMultipartText(int subId, String callingPkg, Uri messageUri,
            String scAddress, List<PendingIntent> sentIntents,
    public void sendStoredMultipartText(int subId, String callingPkg, String callingAttributionTag,
            Uri messageUri, String scAddress, List<PendingIntent> sentIntents,
            List<PendingIntent> deliveryIntents) {
        throw new UnsupportedOperationException();
    }
+2 −1
Original line number Diff line number Diff line
@@ -2204,7 +2204,8 @@ interface ITelephony {
     * Enqueue a pending sms Consumer, which will answer with the user specified selection for an
     * outgoing SmsManager operation.
     */
    oneway void enqueueSmsPickResult(String callingPackage, IIntegerConsumer subIdResult);
    oneway void enqueueSmsPickResult(String callingPackage, String callingAttributeTag,
        IIntegerConsumer subIdResult);

    /**
     * Returns the MMS user agent.