Loading src/java/android/telephony/SmsManager.java +57 −0 Original line number Diff line number Diff line Loading @@ -275,6 +275,34 @@ public final class SmsManager { } } /** * A variant of {@link SmsManager#sendTextMessage} that allows self to be the caller. This is * for internal use only. * * @hide */ public void sendTextMessageWithSelfPermissions( String destinationAddress, String scAddress, String text, PendingIntent sentIntent, PendingIntent deliveryIntent) { if (TextUtils.isEmpty(destinationAddress)) { throw new IllegalArgumentException("Invalid destinationAddress"); } if (TextUtils.isEmpty(text)) { throw new IllegalArgumentException("Invalid message body"); } try { ISms iccISms = getISmsServiceOrThrow(); iccISms.sendTextForSubscriberWithSelfPermissions(getSubscriptionId(), ActivityThread.currentPackageName(), destinationAddress, scAddress, text, sentIntent, deliveryIntent); } catch (RemoteException ex) { // ignore it } } /** * Inject an SMS PDU into the android application framework. * Loading Loading @@ -451,6 +479,35 @@ public final class SmsManager { } } /** * A variant of {@link SmsManager#sendDataMessage} that allows self to be the caller. This is * for internal use only. * * @hide */ public void sendDataMessageWithSelfPermissions( String destinationAddress, String scAddress, short destinationPort, byte[] data, PendingIntent sentIntent, PendingIntent deliveryIntent) { if (TextUtils.isEmpty(destinationAddress)) { throw new IllegalArgumentException("Invalid destinationAddress"); } if (data == null || data.length == 0) { throw new IllegalArgumentException("Invalid message data"); } try { ISms iccISms = getISmsServiceOrThrow(); iccISms.sendDataForSubscriberWithSelfPermissions(getSubscriptionId(), ActivityThread.currentPackageName(), destinationAddress, scAddress, destinationPort & 0xFFFF, data, sentIntent, deliveryIntent); } catch (RemoteException ex) { // ignore it } } /** * Get the SmsManager associated with the default subscription id. The instance will always be * associated with the default subscription id, even if the default subscription id is changed. Loading src/java/com/android/internal/telephony/IccSmsInterfaceManager.java +54 −9 Original line number Diff line number Diff line Loading @@ -316,6 +316,32 @@ public class IccSmsInterfaceManager { return mSms; } /** * 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) { mPhone.getContext().enforceCallingOrSelfPermission( Manifest.permission.SEND_SMS, "Sending SMS message"); sendDataInternal(callingPackage, destAddr, scAddr, destPort, data, sentIntent, deliveryIntent); } /** * A permissions check before passing to {@link IccSmsInterfaceManager#sendDataInternal}. * This method checks only if the calling package has the permission to send the data sms. */ public void sendData(String callingPackage, String destAddr, String scAddr, int destPort, byte[] data, PendingIntent sentIntent, PendingIntent deliveryIntent) { mPhone.getContext().enforceCallingPermission( Manifest.permission.SEND_SMS, "Sending SMS message"); sendDataInternal(callingPackage, destAddr, scAddr, destPort, data, sentIntent, deliveryIntent); } /** * Send a data based SMS to a specific application port. * Loading @@ -342,11 +368,8 @@ public class IccSmsInterfaceManager { * raw pdu of the status report is in the extended data ("pdu"). */ public void sendData(String callingPackage, String destAddr, String scAddr, int destPort, byte[] data, PendingIntent sentIntent, PendingIntent deliveryIntent) { mPhone.getContext().enforceCallingPermission( Manifest.permission.SEND_SMS, "Sending SMS message"); private void sendDataInternal(String callingPackage, String destAddr, String scAddr, int destPort, byte[] data, PendingIntent sentIntent, PendingIntent deliveryIntent) { if (Rlog.isLoggable("SMS", Log.VERBOSE)) { log("sendData: destAddr=" + destAddr + " scAddr=" + scAddr + " destPort=" + destPort + " data='"+ HexDump.toHexString(data) + "' sentIntent=" + Loading @@ -360,6 +383,30 @@ public class IccSmsInterfaceManager { mDispatcher.sendData(destAddr, scAddr, destPort, data, sentIntent, deliveryIntent); } /** * A permissions check before passing to {@link IccSmsInterfaceManager#sendTextInternal}. * This method checks only if the calling package has the permission to send the sms. */ public void sendText(String callingPackage, String destAddr, String scAddr, String text, PendingIntent sentIntent, PendingIntent deliveryIntent) { mPhone.getContext().enforceCallingPermission( Manifest.permission.SEND_SMS, "Sending SMS message"); sendTextInternal(callingPackage, destAddr, scAddr, text, sentIntent, deliveryIntent); } /** * 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) { mPhone.getContext().enforceCallingOrSelfPermission( Manifest.permission.SEND_SMS, "Sending SMS message"); sendTextInternal(callingPackage, destAddr, scAddr, text, sentIntent, deliveryIntent); } /** * Send a text based SMS. * Loading @@ -385,11 +432,9 @@ public class IccSmsInterfaceManager { * raw pdu of the status report is in the extended data ("pdu"). */ public void sendText(String callingPackage, String destAddr, String scAddr, private void sendTextInternal(String callingPackage, String destAddr, String scAddr, String text, PendingIntent sentIntent, PendingIntent deliveryIntent) { mPhone.getContext().enforceCallingPermission( Manifest.permission.SEND_SMS, "Sending SMS message"); if (Rlog.isLoggable("SMS", Log.VERBOSE)) { log("sendText: destAddr=" + destAddr + " scAddr=" + scAddr + " text='"+ text + "' sentIntent=" + Loading src/java/com/android/internal/telephony/UiccSmsController.java +26 −0 Original line number Diff line number Diff line Loading @@ -123,6 +123,19 @@ public class UiccSmsController extends ISms.Stub { } } public void sendDataForSubscriberWithSelfPermissions(int subId, String callingPackage, String destAddr, String scAddr, int destPort, byte[] data, PendingIntent sentIntent, PendingIntent deliveryIntent) { IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId); if (iccSmsIntMgr != null) { iccSmsIntMgr.sendDataWithSelfPermissions(callingPackage, destAddr, scAddr, destPort, data, sentIntent, deliveryIntent); } else { Rlog.e(LOG_TAG,"sendText iccSmsIntMgr is null for" + " Subscription: " + subId); } } public void sendText(String callingPackage, String destAddr, String scAddr, String text, PendingIntent sentIntent, PendingIntent deliveryIntent) { sendTextForSubscriber(getPreferredSmsSubscription(), callingPackage, destAddr, scAddr, Loading @@ -141,6 +154,19 @@ public class UiccSmsController extends ISms.Stub { } } public void sendTextForSubscriberWithSelfPermissions(int subId, String callingPackage, String destAddr, String scAddr, String text, PendingIntent sentIntent, PendingIntent deliveryIntent) { IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId); if (iccSmsIntMgr != null) { iccSmsIntMgr.sendTextWithSelfPermissions(callingPackage, destAddr, scAddr, text, sentIntent, deliveryIntent); } else { Rlog.e(LOG_TAG,"sendText iccSmsIntMgr is null for" + " Subscription: " + subId); } } public void sendMultipartText(String callingPackage, String destAddr, String scAddr, List<String> parts, List<PendingIntent> sentIntents, List<PendingIntent> deliveryIntents) throws android.os.RemoteException { Loading Loading
src/java/android/telephony/SmsManager.java +57 −0 Original line number Diff line number Diff line Loading @@ -275,6 +275,34 @@ public final class SmsManager { } } /** * A variant of {@link SmsManager#sendTextMessage} that allows self to be the caller. This is * for internal use only. * * @hide */ public void sendTextMessageWithSelfPermissions( String destinationAddress, String scAddress, String text, PendingIntent sentIntent, PendingIntent deliveryIntent) { if (TextUtils.isEmpty(destinationAddress)) { throw new IllegalArgumentException("Invalid destinationAddress"); } if (TextUtils.isEmpty(text)) { throw new IllegalArgumentException("Invalid message body"); } try { ISms iccISms = getISmsServiceOrThrow(); iccISms.sendTextForSubscriberWithSelfPermissions(getSubscriptionId(), ActivityThread.currentPackageName(), destinationAddress, scAddress, text, sentIntent, deliveryIntent); } catch (RemoteException ex) { // ignore it } } /** * Inject an SMS PDU into the android application framework. * Loading Loading @@ -451,6 +479,35 @@ public final class SmsManager { } } /** * A variant of {@link SmsManager#sendDataMessage} that allows self to be the caller. This is * for internal use only. * * @hide */ public void sendDataMessageWithSelfPermissions( String destinationAddress, String scAddress, short destinationPort, byte[] data, PendingIntent sentIntent, PendingIntent deliveryIntent) { if (TextUtils.isEmpty(destinationAddress)) { throw new IllegalArgumentException("Invalid destinationAddress"); } if (data == null || data.length == 0) { throw new IllegalArgumentException("Invalid message data"); } try { ISms iccISms = getISmsServiceOrThrow(); iccISms.sendDataForSubscriberWithSelfPermissions(getSubscriptionId(), ActivityThread.currentPackageName(), destinationAddress, scAddress, destinationPort & 0xFFFF, data, sentIntent, deliveryIntent); } catch (RemoteException ex) { // ignore it } } /** * Get the SmsManager associated with the default subscription id. The instance will always be * associated with the default subscription id, even if the default subscription id is changed. Loading
src/java/com/android/internal/telephony/IccSmsInterfaceManager.java +54 −9 Original line number Diff line number Diff line Loading @@ -316,6 +316,32 @@ public class IccSmsInterfaceManager { return mSms; } /** * 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) { mPhone.getContext().enforceCallingOrSelfPermission( Manifest.permission.SEND_SMS, "Sending SMS message"); sendDataInternal(callingPackage, destAddr, scAddr, destPort, data, sentIntent, deliveryIntent); } /** * A permissions check before passing to {@link IccSmsInterfaceManager#sendDataInternal}. * This method checks only if the calling package has the permission to send the data sms. */ public void sendData(String callingPackage, String destAddr, String scAddr, int destPort, byte[] data, PendingIntent sentIntent, PendingIntent deliveryIntent) { mPhone.getContext().enforceCallingPermission( Manifest.permission.SEND_SMS, "Sending SMS message"); sendDataInternal(callingPackage, destAddr, scAddr, destPort, data, sentIntent, deliveryIntent); } /** * Send a data based SMS to a specific application port. * Loading @@ -342,11 +368,8 @@ public class IccSmsInterfaceManager { * raw pdu of the status report is in the extended data ("pdu"). */ public void sendData(String callingPackage, String destAddr, String scAddr, int destPort, byte[] data, PendingIntent sentIntent, PendingIntent deliveryIntent) { mPhone.getContext().enforceCallingPermission( Manifest.permission.SEND_SMS, "Sending SMS message"); private void sendDataInternal(String callingPackage, String destAddr, String scAddr, int destPort, byte[] data, PendingIntent sentIntent, PendingIntent deliveryIntent) { if (Rlog.isLoggable("SMS", Log.VERBOSE)) { log("sendData: destAddr=" + destAddr + " scAddr=" + scAddr + " destPort=" + destPort + " data='"+ HexDump.toHexString(data) + "' sentIntent=" + Loading @@ -360,6 +383,30 @@ public class IccSmsInterfaceManager { mDispatcher.sendData(destAddr, scAddr, destPort, data, sentIntent, deliveryIntent); } /** * A permissions check before passing to {@link IccSmsInterfaceManager#sendTextInternal}. * This method checks only if the calling package has the permission to send the sms. */ public void sendText(String callingPackage, String destAddr, String scAddr, String text, PendingIntent sentIntent, PendingIntent deliveryIntent) { mPhone.getContext().enforceCallingPermission( Manifest.permission.SEND_SMS, "Sending SMS message"); sendTextInternal(callingPackage, destAddr, scAddr, text, sentIntent, deliveryIntent); } /** * 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) { mPhone.getContext().enforceCallingOrSelfPermission( Manifest.permission.SEND_SMS, "Sending SMS message"); sendTextInternal(callingPackage, destAddr, scAddr, text, sentIntent, deliveryIntent); } /** * Send a text based SMS. * Loading @@ -385,11 +432,9 @@ public class IccSmsInterfaceManager { * raw pdu of the status report is in the extended data ("pdu"). */ public void sendText(String callingPackage, String destAddr, String scAddr, private void sendTextInternal(String callingPackage, String destAddr, String scAddr, String text, PendingIntent sentIntent, PendingIntent deliveryIntent) { mPhone.getContext().enforceCallingPermission( Manifest.permission.SEND_SMS, "Sending SMS message"); if (Rlog.isLoggable("SMS", Log.VERBOSE)) { log("sendText: destAddr=" + destAddr + " scAddr=" + scAddr + " text='"+ text + "' sentIntent=" + Loading
src/java/com/android/internal/telephony/UiccSmsController.java +26 −0 Original line number Diff line number Diff line Loading @@ -123,6 +123,19 @@ public class UiccSmsController extends ISms.Stub { } } public void sendDataForSubscriberWithSelfPermissions(int subId, String callingPackage, String destAddr, String scAddr, int destPort, byte[] data, PendingIntent sentIntent, PendingIntent deliveryIntent) { IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId); if (iccSmsIntMgr != null) { iccSmsIntMgr.sendDataWithSelfPermissions(callingPackage, destAddr, scAddr, destPort, data, sentIntent, deliveryIntent); } else { Rlog.e(LOG_TAG,"sendText iccSmsIntMgr is null for" + " Subscription: " + subId); } } public void sendText(String callingPackage, String destAddr, String scAddr, String text, PendingIntent sentIntent, PendingIntent deliveryIntent) { sendTextForSubscriber(getPreferredSmsSubscription(), callingPackage, destAddr, scAddr, Loading @@ -141,6 +154,19 @@ public class UiccSmsController extends ISms.Stub { } } public void sendTextForSubscriberWithSelfPermissions(int subId, String callingPackage, String destAddr, String scAddr, String text, PendingIntent sentIntent, PendingIntent deliveryIntent) { IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId); if (iccSmsIntMgr != null) { iccSmsIntMgr.sendTextWithSelfPermissions(callingPackage, destAddr, scAddr, text, sentIntent, deliveryIntent); } else { Rlog.e(LOG_TAG,"sendText iccSmsIntMgr is null for" + " Subscription: " + subId); } } public void sendMultipartText(String callingPackage, String destAddr, String scAddr, List<String> parts, List<PendingIntent> sentIntents, List<PendingIntent> deliveryIntents) throws android.os.RemoteException { Loading