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

Commit 743f183c authored by Sooraj Sasindran's avatar Sooraj Sasindran
Browse files

get smsc with phone identitiy to send message

Get smsc with phone identitiy to send message to
fill sms packet. No need to use caller privileges
here as the intention is to get it if caller
passed null. This will avoid throwing
security exception for apps with only SMS permission
for not having read privileged permission.

Bug: 274708908
Test: NoReceiveSmsPermissionTest
Change-Id: I4ba49166d4872e53fdc6fee0c1a5d7eab1be84c8
parent 73277dbc
Loading
Loading
Loading
Loading
+14 −9
Original line number Diff line number Diff line
@@ -457,13 +457,18 @@ public class SmsDispatchersController extends Handler {
        }
    }

    private String getSmscAddressFromUSIM(String callingPkg) {
    private String getSmscAddressFromUSIMWithPhoneIdentity(String callingPkg) {
        final long identity = Binder.clearCallingIdentity();
        try {
            IccSmsInterfaceManager iccSmsIntMgr = mPhone.getIccSmsInterfaceManager();
            if (iccSmsIntMgr != null) {
                return iccSmsIntMgr.getSmscAddressFromIccEf(callingPkg);
            } else {
                Rlog.d(TAG, "getSmscAddressFromIccEf iccSmsIntMgr is null");
            }
        } finally {
            Binder.restoreCallingIdentity(identity);
        }
        return null;
    }

@@ -1300,7 +1305,7 @@ public class SmsDispatchersController extends Handler {
    protected void sendData(String callingPackage, String destAddr, String scAddr, int destPort,
            byte[] data, PendingIntent sentIntent, PendingIntent deliveryIntent, boolean isForVvm) {
        if (TextUtils.isEmpty(scAddr)) {
            scAddr = getSmscAddressFromUSIM(callingPackage);
            scAddr = getSmscAddressFromUSIMWithPhoneIdentity(callingPackage);
        }

        if (mDomainSelectionResolverProxy.isDomainSelectionSupported()) {
@@ -1539,7 +1544,7 @@ public class SmsDispatchersController extends Handler {
            int priority, boolean expectMore, int validityPeriod, boolean isForVvm,
            long messageId, boolean skipShortCodeCheck) {
        if (TextUtils.isEmpty(scAddr)) {
            scAddr = getSmscAddressFromUSIM(callingPkg);
            scAddr = getSmscAddressFromUSIMWithPhoneIdentity(callingPkg);
        }

        if (mDomainSelectionResolverProxy.isDomainSelectionSupported()) {
@@ -1688,7 +1693,7 @@ public class SmsDispatchersController extends Handler {
            boolean persistMessage, int priority, boolean expectMore, int validityPeriod,
            long messageId) {
        if (TextUtils.isEmpty(scAddr)) {
            scAddr = getSmscAddressFromUSIM(callingPkg);
            scAddr = getSmscAddressFromUSIMWithPhoneIdentity(callingPkg);
        }

        if (mDomainSelectionResolverProxy.isDomainSelectionSupported()) {