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

Commit 89806527 authored by Brad Ebinger's avatar Brad Ebinger Committed by Android (Google) Code Review
Browse files

Merge "Merge "Don't clear the calling identity until needed for SmsManager"...

Merge "Merge "Don't clear the calling identity until needed for SmsManager" am: 6c99ee7a am: 8c8abf8c" into qt-dev
parents c5051434 eb62e6d8
Loading
Loading
Loading
Loading
+73 −81
Original line number Diff line number Diff line
@@ -690,8 +690,6 @@ public class IccSmsInterfaceManager {
            }
        }

        final long ident = Binder.clearCallingIdentity();
        try {
        destAddr = filterDestAddress(destAddr);

        if (parts.size() > 1 && parts.size() < 10 && !SmsMessage.hasEmsSupport()) {
@@ -702,7 +700,8 @@ public class IccSmsInterfaceManager {
                if (SmsMessage.shouldAppendPageNumberAsPrefix()) {
                    singlePart = String.valueOf(i + 1) + '/' + parts.size() + ' ' + singlePart;
                } else {
                        singlePart = singlePart.concat(' ' + String.valueOf(i + 1) + '/' + parts.size());
                    singlePart = singlePart.concat(' ' + String.valueOf(i + 1) + '/'
                            + parts.size());
                }

                PendingIntent singleSentIntent = null;
@@ -731,9 +730,7 @@ public class IccSmsInterfaceManager {
                                      (ArrayList<PendingIntent>) deliveryIntents,
                                      null, callingPackage, persistMessageForNonDefaultSmsApp,
                                          priority, expectMore, validityPeriod);
        } finally {
            Binder.restoreCallingIdentity(ident);
        }

    }

    @UnsupportedAppUsage
@@ -1183,9 +1180,6 @@ public class IccSmsInterfaceManager {
            returnUnspecifiedFailure(sentIntents);
            return;
        }

        final long ident = Binder.clearCallingIdentity();
        try {
        textAndAddress[1] = filterDestAddress(textAndAddress[1]);

        if (parts.size() > 1 && parts.size() < 10 && !SmsMessage.hasEmsSupport()) {
@@ -1196,7 +1190,8 @@ public class IccSmsInterfaceManager {
                if (SmsMessage.shouldAppendPageNumberAsPrefix()) {
                    singlePart = String.valueOf(i + 1) + '/' + parts.size() + ' ' + singlePart;
                } else {
                        singlePart = singlePart.concat(' ' + String.valueOf(i + 1) + '/' + parts.size());
                    singlePart = singlePart.concat(' ' + String.valueOf(i + 1) + '/'
                            + parts.size());
                }

                PendingIntent singleSentIntent = null;
@@ -1230,9 +1225,6 @@ public class IccSmsInterfaceManager {
                SMS_MESSAGE_PRIORITY_NOT_SPECIFIED,
                false /* expectMore */,
                SMS_MESSAGE_PERIOD_NOT_SPECIFIED);
        } finally {
            Binder.restoreCallingIdentity(ident);
        }
    }

    private boolean isFailedOrDraft(ContentResolver resolver, Uri messageUri) {
+14 −8
Original line number Diff line number Diff line
@@ -2012,6 +2012,9 @@ public abstract class SMSDispatcher extends Handler {
    }

    private boolean isAscii7bitSupportedForLongMessage() {
        //TODO: Do not rely on calling identity here, we should store UID & clear identity earlier.
        long token = Binder.clearCallingIdentity();
        try {
            CarrierConfigManager configManager = (CarrierConfigManager) mContext.getSystemService(
                    Context.CARRIER_CONFIG_SERVICE);
            PersistableBundle pb = null;
@@ -2021,5 +2024,8 @@ public abstract class SMSDispatcher extends Handler {
                        .KEY_ASCII_7_BIT_SUPPORT_FOR_LONG_MESSAGE_BOOL);
            }
            return false;
        } finally {
            Binder.restoreCallingIdentity(token);
        }
    }
}