Loading src/java/com/android/internal/telephony/IccSmsInterfaceManager.java +16 −13 Original line number Diff line number Diff line Loading @@ -406,10 +406,11 @@ public class IccSmsInterfaceManager { * A permissions check before passing to {@link IccSmsInterfaceManager#sendDataInternal}. * This method checks if the calling package or itself has the permission to send the data sms. */ public void sendDataWithSelfPermissions(String callingPackage, String destAddr, String scAddr, int destPort, byte[] data, PendingIntent sentIntent, PendingIntent deliveryIntent, boolean isForVvm) { if (!mSmsPermissions.checkCallingOrSelfCanSendSms(callingPackage, "Sending SMS message")) { public void sendDataWithSelfPermissions(String callingPackage, String callingAttributionTag, String destAddr, String scAddr, int destPort, byte[] data, PendingIntent sentIntent, PendingIntent deliveryIntent, boolean isForVvm) { if (!mSmsPermissions.checkCallingOrSelfCanSendSms(callingPackage, callingAttributionTag, "Sending SMS message")) { returnUnspecifiedFailure(sentIntent); return; } Loading Loading @@ -489,10 +490,11 @@ public class IccSmsInterfaceManager { * A permissions check before passing to {@link IccSmsInterfaceManager#sendTextInternal}. * This method checks if the calling package or itself has the permission to send the sms. */ public void sendTextWithSelfPermissions(String callingPackage, String destAddr, String scAddr, String text, PendingIntent sentIntent, PendingIntent deliveryIntent, boolean persistMessage, boolean isForVvm) { if (!mSmsPermissions.checkCallingOrSelfCanSendSms(callingPackage, "Sending SMS message")) { public void sendTextWithSelfPermissions(String callingPackage, String callingAttributeTag, String destAddr, String scAddr, String text, PendingIntent sentIntent, PendingIntent deliveryIntent, boolean persistMessage, boolean isForVvm) { if (!mSmsPermissions.checkCallingOrSelfCanSendSms(callingPackage, callingAttributeTag, "Sending SMS message")) { returnUnspecifiedFailure(sentIntent); return; } Loading Loading @@ -610,11 +612,12 @@ public class IccSmsInterfaceManager { * Any Other values including negative considered as Invalid Validity Period of the message. */ public void sendTextWithOptions(String callingPackage, String destAddr, String scAddr, String text, PendingIntent sentIntent, PendingIntent deliveryIntent, boolean persistMessageForNonDefaultSmsApp, int priority, boolean expectMore, int validityPeriod) { if (!mSmsPermissions.checkCallingOrSelfCanSendSms(callingPackage, "Sending SMS message")) { public void sendTextWithOptions(String callingPackage, String callingAttributionTag, String destAddr, String scAddr, String text, PendingIntent sentIntent, PendingIntent deliveryIntent, boolean persistMessageForNonDefaultSmsApp, int priority, boolean expectMore, int validityPeriod) { if (!mSmsPermissions.checkCallingOrSelfCanSendSms(callingPackage, callingAttributionTag, "Sending SMS message")) { returnUnspecifiedFailure(sentIntent); return; } Loading src/java/com/android/internal/telephony/SmsController.java +24 −35 Original line number Diff line number Diff line Loading @@ -146,21 +146,13 @@ public class SmsController extends ISmsImplBase { } } @Override public void sendDataForSubscriberWithSelfPermissions(int subId, String callingPackage, String destAddr, String scAddr, int destPort, byte[] data, PendingIntent sentIntent, PendingIntent deliveryIntent) { sendDataForSubscriberWithSelfPermissionsInternal(subId, callingPackage, destAddr, scAddr, destPort, data, sentIntent, deliveryIntent, false /* isForVvm */); } private void sendDataForSubscriberWithSelfPermissionsInternal(int subId, String callingPackage, String destAddr, String scAddr, int destPort, byte[] data, PendingIntent sentIntent, PendingIntent deliveryIntent, boolean isForVvm) { String callingAttributionTag, String destAddr, String scAddr, int destPort, byte[] data, PendingIntent sentIntent, PendingIntent deliveryIntent, boolean isForVvm) { IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId); if (iccSmsIntMgr != null) { iccSmsIntMgr.sendDataWithSelfPermissions(callingPackage, destAddr, scAddr, destPort, data, sentIntent, deliveryIntent, isForVvm); iccSmsIntMgr.sendDataWithSelfPermissions(callingPackage, callingAttributionTag, destAddr, scAddr, destPort, data, sentIntent, deliveryIntent, isForVvm); } else { Rlog.e(LOG_TAG, "sendText iccSmsIntMgr is null for" + " Subscription: " + subId); Loading Loading @@ -225,21 +217,14 @@ public class SmsController extends ISmsImplBase { } } @Override public void sendTextForSubscriberWithSelfPermissions(int subId, String callingPackage, String destAddr, String scAddr, String text, PendingIntent sentIntent, PendingIntent deliveryIntent, boolean persistMessage) { sendTextForSubscriberWithSelfPermissionsInternal(subId, callingPackage, destAddr, scAddr, text, sentIntent, deliveryIntent, persistMessage, false /* isForVvm */); } private void sendTextForSubscriberWithSelfPermissionsInternal(int subId, String callingPackage, String destAddr, String scAddr, String text, PendingIntent sentIntent, PendingIntent deliveryIntent, boolean persistMessage, boolean isForVvm) { String callingAttributeTag, String destAddr, String scAddr, String text, PendingIntent sentIntent, PendingIntent deliveryIntent, boolean persistMessage, boolean isForVvm) { IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId); if (iccSmsIntMgr != null) { iccSmsIntMgr.sendTextWithSelfPermissions(callingPackage, destAddr, scAddr, text, sentIntent, deliveryIntent, persistMessage, isForVvm); iccSmsIntMgr.sendTextWithSelfPermissions(callingPackage, callingAttributeTag, destAddr, scAddr, text, sentIntent, deliveryIntent, persistMessage, isForVvm); } else { Rlog.e(LOG_TAG, "sendText iccSmsIntMgr is null for" + " Subscription: " + subId); Loading @@ -249,16 +234,17 @@ public class SmsController extends ISmsImplBase { @Override public void sendTextForSubscriberWithOptions(int subId, String callingPackage, String destAddr, String scAddr, String parts, PendingIntent sentIntent, PendingIntent deliveryIntent, boolean persistMessage, int priority, boolean expectMore, int validityPeriod) { String callingAttributionTag, String destAddr, String scAddr, String parts, PendingIntent sentIntent, PendingIntent deliveryIntent, boolean persistMessage, int priority, boolean expectMore, int validityPeriod) { if (callingPackage == null) { callingPackage = getCallingPackage(); } IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId); if (iccSmsIntMgr != null) { iccSmsIntMgr.sendTextWithOptions(callingPackage, destAddr, scAddr, parts, sentIntent, deliveryIntent, persistMessage, priority, expectMore, validityPeriod); iccSmsIntMgr.sendTextWithOptions(callingPackage, callingAttributionTag, destAddr, scAddr, parts, sentIntent, deliveryIntent, persistMessage, priority, expectMore, validityPeriod); } else { Rlog.e(LOG_TAG, "sendTextWithOptions iccSmsIntMgr is null for" + " Subscription: " + subId); Loading Loading @@ -695,15 +681,18 @@ public class SmsController extends ISmsImplBase { * Internal API to send visual voicemail related SMS. This is not exposed outside the phone * process, and should be called only after verifying that the caller is the default VVM app. */ public void sendVisualVoicemailSmsForSubscriber(String callingPackage, int subId, String number, int port, String text, PendingIntent sentIntent) { public void sendVisualVoicemailSmsForSubscriber(String callingPackage, String callingAttributionTag, int subId, String number, int port, String text, PendingIntent sentIntent) { if (port == 0) { sendTextForSubscriberWithSelfPermissionsInternal(subId, callingPackage, number, null, text, sentIntent, null, false, true /* isForVvm */); sendTextForSubscriberWithSelfPermissionsInternal(subId, callingPackage, callingAttributionTag, number, null, text, sentIntent, null, false, true /* isForVvm */); } else { byte[] data = text.getBytes(StandardCharsets.UTF_8); sendDataForSubscriberWithSelfPermissionsInternal(subId, callingPackage, number, null, (short) port, data, sentIntent, null, true /* isForVvm */); sendDataForSubscriberWithSelfPermissionsInternal(subId, callingPackage, callingAttributionTag, number, null, (short) port, data, sentIntent, null, true /* isForVvm */); } } Loading src/java/com/android/internal/telephony/SmsPermissions.java +2 −1 Original line number Diff line number Diff line Loading @@ -121,7 +121,8 @@ public class SmsPermissions { * permission revoked at runtime. * @return whether the caller has the OP_SEND_SMS AppOps bit. */ public boolean checkCallingOrSelfCanSendSms(String callingPackage, String message) { public boolean checkCallingOrSelfCanSendSms(String callingPackage, String callingAttributionTag, String message) { mContext.enforceCallingOrSelfPermission(Manifest.permission.SEND_SMS, message); return mAppOps.noteOp(AppOpsManager.OPSTR_SEND_SMS, Binder.getCallingUid(), callingPackage) == AppOpsManager.MODE_ALLOWED; Loading Loading
src/java/com/android/internal/telephony/IccSmsInterfaceManager.java +16 −13 Original line number Diff line number Diff line Loading @@ -406,10 +406,11 @@ public class IccSmsInterfaceManager { * A permissions check before passing to {@link IccSmsInterfaceManager#sendDataInternal}. * This method checks if the calling package or itself has the permission to send the data sms. */ public void sendDataWithSelfPermissions(String callingPackage, String destAddr, String scAddr, int destPort, byte[] data, PendingIntent sentIntent, PendingIntent deliveryIntent, boolean isForVvm) { if (!mSmsPermissions.checkCallingOrSelfCanSendSms(callingPackage, "Sending SMS message")) { public void sendDataWithSelfPermissions(String callingPackage, String callingAttributionTag, String destAddr, String scAddr, int destPort, byte[] data, PendingIntent sentIntent, PendingIntent deliveryIntent, boolean isForVvm) { if (!mSmsPermissions.checkCallingOrSelfCanSendSms(callingPackage, callingAttributionTag, "Sending SMS message")) { returnUnspecifiedFailure(sentIntent); return; } Loading Loading @@ -489,10 +490,11 @@ public class IccSmsInterfaceManager { * A permissions check before passing to {@link IccSmsInterfaceManager#sendTextInternal}. * This method checks if the calling package or itself has the permission to send the sms. */ public void sendTextWithSelfPermissions(String callingPackage, String destAddr, String scAddr, String text, PendingIntent sentIntent, PendingIntent deliveryIntent, boolean persistMessage, boolean isForVvm) { if (!mSmsPermissions.checkCallingOrSelfCanSendSms(callingPackage, "Sending SMS message")) { public void sendTextWithSelfPermissions(String callingPackage, String callingAttributeTag, String destAddr, String scAddr, String text, PendingIntent sentIntent, PendingIntent deliveryIntent, boolean persistMessage, boolean isForVvm) { if (!mSmsPermissions.checkCallingOrSelfCanSendSms(callingPackage, callingAttributeTag, "Sending SMS message")) { returnUnspecifiedFailure(sentIntent); return; } Loading Loading @@ -610,11 +612,12 @@ public class IccSmsInterfaceManager { * Any Other values including negative considered as Invalid Validity Period of the message. */ public void sendTextWithOptions(String callingPackage, String destAddr, String scAddr, String text, PendingIntent sentIntent, PendingIntent deliveryIntent, boolean persistMessageForNonDefaultSmsApp, int priority, boolean expectMore, int validityPeriod) { if (!mSmsPermissions.checkCallingOrSelfCanSendSms(callingPackage, "Sending SMS message")) { public void sendTextWithOptions(String callingPackage, String callingAttributionTag, String destAddr, String scAddr, String text, PendingIntent sentIntent, PendingIntent deliveryIntent, boolean persistMessageForNonDefaultSmsApp, int priority, boolean expectMore, int validityPeriod) { if (!mSmsPermissions.checkCallingOrSelfCanSendSms(callingPackage, callingAttributionTag, "Sending SMS message")) { returnUnspecifiedFailure(sentIntent); return; } Loading
src/java/com/android/internal/telephony/SmsController.java +24 −35 Original line number Diff line number Diff line Loading @@ -146,21 +146,13 @@ public class SmsController extends ISmsImplBase { } } @Override public void sendDataForSubscriberWithSelfPermissions(int subId, String callingPackage, String destAddr, String scAddr, int destPort, byte[] data, PendingIntent sentIntent, PendingIntent deliveryIntent) { sendDataForSubscriberWithSelfPermissionsInternal(subId, callingPackage, destAddr, scAddr, destPort, data, sentIntent, deliveryIntent, false /* isForVvm */); } private void sendDataForSubscriberWithSelfPermissionsInternal(int subId, String callingPackage, String destAddr, String scAddr, int destPort, byte[] data, PendingIntent sentIntent, PendingIntent deliveryIntent, boolean isForVvm) { String callingAttributionTag, String destAddr, String scAddr, int destPort, byte[] data, PendingIntent sentIntent, PendingIntent deliveryIntent, boolean isForVvm) { IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId); if (iccSmsIntMgr != null) { iccSmsIntMgr.sendDataWithSelfPermissions(callingPackage, destAddr, scAddr, destPort, data, sentIntent, deliveryIntent, isForVvm); iccSmsIntMgr.sendDataWithSelfPermissions(callingPackage, callingAttributionTag, destAddr, scAddr, destPort, data, sentIntent, deliveryIntent, isForVvm); } else { Rlog.e(LOG_TAG, "sendText iccSmsIntMgr is null for" + " Subscription: " + subId); Loading Loading @@ -225,21 +217,14 @@ public class SmsController extends ISmsImplBase { } } @Override public void sendTextForSubscriberWithSelfPermissions(int subId, String callingPackage, String destAddr, String scAddr, String text, PendingIntent sentIntent, PendingIntent deliveryIntent, boolean persistMessage) { sendTextForSubscriberWithSelfPermissionsInternal(subId, callingPackage, destAddr, scAddr, text, sentIntent, deliveryIntent, persistMessage, false /* isForVvm */); } private void sendTextForSubscriberWithSelfPermissionsInternal(int subId, String callingPackage, String destAddr, String scAddr, String text, PendingIntent sentIntent, PendingIntent deliveryIntent, boolean persistMessage, boolean isForVvm) { String callingAttributeTag, String destAddr, String scAddr, String text, PendingIntent sentIntent, PendingIntent deliveryIntent, boolean persistMessage, boolean isForVvm) { IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId); if (iccSmsIntMgr != null) { iccSmsIntMgr.sendTextWithSelfPermissions(callingPackage, destAddr, scAddr, text, sentIntent, deliveryIntent, persistMessage, isForVvm); iccSmsIntMgr.sendTextWithSelfPermissions(callingPackage, callingAttributeTag, destAddr, scAddr, text, sentIntent, deliveryIntent, persistMessage, isForVvm); } else { Rlog.e(LOG_TAG, "sendText iccSmsIntMgr is null for" + " Subscription: " + subId); Loading @@ -249,16 +234,17 @@ public class SmsController extends ISmsImplBase { @Override public void sendTextForSubscriberWithOptions(int subId, String callingPackage, String destAddr, String scAddr, String parts, PendingIntent sentIntent, PendingIntent deliveryIntent, boolean persistMessage, int priority, boolean expectMore, int validityPeriod) { String callingAttributionTag, String destAddr, String scAddr, String parts, PendingIntent sentIntent, PendingIntent deliveryIntent, boolean persistMessage, int priority, boolean expectMore, int validityPeriod) { if (callingPackage == null) { callingPackage = getCallingPackage(); } IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId); if (iccSmsIntMgr != null) { iccSmsIntMgr.sendTextWithOptions(callingPackage, destAddr, scAddr, parts, sentIntent, deliveryIntent, persistMessage, priority, expectMore, validityPeriod); iccSmsIntMgr.sendTextWithOptions(callingPackage, callingAttributionTag, destAddr, scAddr, parts, sentIntent, deliveryIntent, persistMessage, priority, expectMore, validityPeriod); } else { Rlog.e(LOG_TAG, "sendTextWithOptions iccSmsIntMgr is null for" + " Subscription: " + subId); Loading Loading @@ -695,15 +681,18 @@ public class SmsController extends ISmsImplBase { * Internal API to send visual voicemail related SMS. This is not exposed outside the phone * process, and should be called only after verifying that the caller is the default VVM app. */ public void sendVisualVoicemailSmsForSubscriber(String callingPackage, int subId, String number, int port, String text, PendingIntent sentIntent) { public void sendVisualVoicemailSmsForSubscriber(String callingPackage, String callingAttributionTag, int subId, String number, int port, String text, PendingIntent sentIntent) { if (port == 0) { sendTextForSubscriberWithSelfPermissionsInternal(subId, callingPackage, number, null, text, sentIntent, null, false, true /* isForVvm */); sendTextForSubscriberWithSelfPermissionsInternal(subId, callingPackage, callingAttributionTag, number, null, text, sentIntent, null, false, true /* isForVvm */); } else { byte[] data = text.getBytes(StandardCharsets.UTF_8); sendDataForSubscriberWithSelfPermissionsInternal(subId, callingPackage, number, null, (short) port, data, sentIntent, null, true /* isForVvm */); sendDataForSubscriberWithSelfPermissionsInternal(subId, callingPackage, callingAttributionTag, number, null, (short) port, data, sentIntent, null, true /* isForVvm */); } } Loading
src/java/com/android/internal/telephony/SmsPermissions.java +2 −1 Original line number Diff line number Diff line Loading @@ -121,7 +121,8 @@ public class SmsPermissions { * permission revoked at runtime. * @return whether the caller has the OP_SEND_SMS AppOps bit. */ public boolean checkCallingOrSelfCanSendSms(String callingPackage, String message) { public boolean checkCallingOrSelfCanSendSms(String callingPackage, String callingAttributionTag, String message) { mContext.enforceCallingOrSelfPermission(Manifest.permission.SEND_SMS, message); return mAppOps.noteOp(AppOpsManager.OPSTR_SEND_SMS, Binder.getCallingUid(), callingPackage) == AppOpsManager.MODE_ALLOWED; Loading