1 /*
2 ** Copyright 2007, The Android Open Source Project
3 **
4 ** Licensed under the Apache License, Version 2.0 (the "License");
5 ** you may not use this file except in compliance with the License.
6 ** You may obtain a copy of the License at
7 **
8 **     http://www.apache.org/licenses/LICENSE-2.0
9 **
10 ** Unless required by applicable law or agreed to in writing, software
11 ** distributed under the License is distributed on an "AS IS" BASIS,
12 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 ** See the License for the specific language governing permissions and
14 ** limitations under the License.
15 */
16 
17 package com.android.internal.telephony;
18 
19 import android.app.PendingIntent;
20 import android.net.Uri;
21 import android.os.Bundle;
22 import android.telephony.IFinancialSmsCallback;
23 import com.android.internal.telephony.SmsRawData;
24 
25 /** Interface for applications to access the ICC phone book.
26  *
27  * <p>The following code snippet demonstrates a static method to
28  * retrieve the ISms interface from Android:</p>
29  * <pre>private static ISms getSmsInterface()
30             throws DeadObjectException {
31     IServiceManager sm = ServiceManagerNative.getDefault();
32     ISms ss;
33     ss = ISms.Stub.asInterface(sm.getService("isms"));
34     return ss;
35 }
36  * </pre>
37  */
38 
39 interface ISms {
40     /**
41      * Retrieves all messages currently stored on ICC.
42      * @param subId the subId id.
43      * @return list of SmsRawData of all sms on ICC
44      */
getAllMessagesFromIccEfForSubscriber(in int subId, String callingPkg)45     List<SmsRawData> getAllMessagesFromIccEfForSubscriber(in int subId, String callingPkg);
46 
47     /**
48      * Update the specified message on the ICC.
49      *
50      * @param messageIndex record index of message to update
51      * @param newStatus new message status (STATUS_ON_ICC_READ,
52      *                  STATUS_ON_ICC_UNREAD, STATUS_ON_ICC_SENT,
53      *                  STATUS_ON_ICC_UNSENT, STATUS_ON_ICC_FREE)
54      * @param pdu the raw PDU to store
55      * @param subId the subId id.
56      * @return success or not
57      *
58      */
updateMessageOnIccEfForSubscriber(in int subId, String callingPkg, int messageIndex, int newStatus, in byte[] pdu)59      boolean updateMessageOnIccEfForSubscriber(in int subId, String callingPkg,
60              int messageIndex, int newStatus, in byte[] pdu);
61 
62     /**
63      * Copy a raw SMS PDU to the ICC.
64      *
65      * @param pdu the raw PDU to store
66      * @param status message status (STATUS_ON_ICC_READ, STATUS_ON_ICC_UNREAD,
67      *               STATUS_ON_ICC_SENT, STATUS_ON_ICC_UNSENT)
68      * @param subId the subId id.
69      * @return success or not
70      *
71      */
copyMessageToIccEfForSubscriber(in int subId, String callingPkg, int status, in byte[] pdu, in byte[] smsc)72     boolean copyMessageToIccEfForSubscriber(in int subId, String callingPkg, int status,
73             in byte[] pdu, in byte[] smsc);
74 
75     /**
76      * Send a data SMS.
77      *
78      * @param smsc the SMSC to send the message through, or NULL for the
79      *  default SMSC
80      * @param data the body of the message to send
81      * @param sentIntent if not NULL this <code>PendingIntent</code> is
82      *  broadcast when the message is sucessfully sent, or failed.
83      *  The result code will be <code>Activity.RESULT_OK<code> for success,
84      *  or one of these errors:<br>
85      *  <code>RESULT_ERROR_GENERIC_FAILURE</code><br>
86      *  <code>RESULT_ERROR_RADIO_OFF</code><br>
87      *  <code>RESULT_ERROR_NULL_PDU</code><br>
88      *  For <code>RESULT_ERROR_GENERIC_FAILURE</code> the sentIntent may include
89      *  the extra "errorCode" containing a radio technology specific value,
90      *  generally only useful for troubleshooting.<br>
91      *  The per-application based SMS control checks sentIntent. If sentIntent
92      *  is NULL the caller will be checked against all unknown applicaitons,
93      *  which cause smaller number of SMS to be sent in checking period.
94      * @param deliveryIntent if not NULL this <code>PendingIntent</code> is
95      *  broadcast when the message is delivered to the recipient.  The
96      *  raw pdu of the status report is in the extended data ("pdu").
97      * @param subId the subId id.
98      */
sendDataForSubscriber(int subId, String callingPkg, in String destAddr, in String scAddr, in int destPort, in byte[] data, in PendingIntent sentIntent, in PendingIntent deliveryIntent)99     void sendDataForSubscriber(int subId, String callingPkg, in String destAddr,
100             in String scAddr, in int destPort, in byte[] data, in PendingIntent sentIntent,
101             in PendingIntent deliveryIntent);
102 
103     /**
104      * Send a data SMS. Only for use internally.
105      *
106      * @param smsc the SMSC to send the message through, or NULL for the
107      *  default SMSC
108      * @param data the body of the message to send
109      * @param sentIntent if not NULL this <code>PendingIntent</code> is
110      *  broadcast when the message is sucessfully sent, or failed.
111      *  The result code will be <code>Activity.RESULT_OK<code> for success,
112      *  or one of these errors:<br>
113      *  <code>RESULT_ERROR_GENERIC_FAILURE</code><br>
114      *  <code>RESULT_ERROR_RADIO_OFF</code><br>
115      *  <code>RESULT_ERROR_NULL_PDU</code><br>
116      *  For <code>RESULT_ERROR_GENERIC_FAILURE</code> the sentIntent may include
117      *  the extra "errorCode" containing a radio technology specific value,
118      *  generally only useful for troubleshooting.<br>
119      *  The per-application based SMS control checks sentIntent. If sentIntent
120      *  is NULL the caller will be checked against all unknown applicaitons,
121      *  which cause smaller number of SMS to be sent in checking period.
122      * @param deliveryIntent if not NULL this <code>PendingIntent</code> is
123      *  broadcast when the message is delivered to the recipient.  The
124      *  raw pdu of the status report is in the extended data ("pdu").
125      * @param subId the subId id.
126      */
sendDataForSubscriberWithSelfPermissions(int subId, String callingPkg, in String destAddr, in String scAddr, in int destPort, in byte[] data, in PendingIntent sentIntent, in PendingIntent deliveryIntent)127     void sendDataForSubscriberWithSelfPermissions(int subId, String callingPkg, in String destAddr,
128             in String scAddr, in int destPort, in byte[] data, in PendingIntent sentIntent,
129             in PendingIntent deliveryIntent);
130 
131     /**
132      * Send an SMS.
133      *
134      * @param smsc the SMSC to send the message through, or NULL for the
135      *  default SMSC
136      * @param text the body of the message to send
137      * @param sentIntent if not NULL this <code>PendingIntent</code> is
138      *  broadcast when the message is sucessfully sent, or failed.
139      *  The result code will be <code>Activity.RESULT_OK<code> for success,
140      *  or one of these errors:<br>
141      *  <code>RESULT_ERROR_GENERIC_FAILURE</code><br>
142      *  <code>RESULT_ERROR_RADIO_OFF</code><br>
143      *  <code>RESULT_ERROR_NULL_PDU</code><br>
144      *  For <code>RESULT_ERROR_GENERIC_FAILURE</code> the sentIntent may include
145      *  the extra "errorCode" containing a radio technology specific value,
146      *  generally only useful for troubleshooting.<br>
147      *  The per-application based SMS control checks sentIntent. If sentIntent
148      *  is NULL the caller will be checked against all unknown applications,
149      *  which cause smaller number of SMS to be sent in checking period.
150      * @param deliveryIntent if not NULL this <code>PendingIntent</code> is
151      *  broadcast when the message is delivered to the recipient.  The
152      *  raw pdu of the status report is in the extended data ("pdu").
153      * @param subId the subId on which the SMS has to be sent.
154      * @param persistMessageForNonDefaultSmsApp whether the sent message should
155      *   be automatically persisted in the SMS db. It only affects messages sent
156      *   by a non-default SMS app. Currently only the carrier app can set this
157      *   parameter to false to skip auto message persistence.
158      */
sendTextForSubscriber(in int subId, String callingPkg, in String destAddr, in String scAddr, in String text, in PendingIntent sentIntent, in PendingIntent deliveryIntent, in boolean persistMessageForNonDefaultSmsApp)159     void sendTextForSubscriber(in int subId, String callingPkg, in String destAddr,
160             in String scAddr, in String text, in PendingIntent sentIntent,
161             in PendingIntent deliveryIntent, in boolean persistMessageForNonDefaultSmsApp);
162 
163     /**
164      * Send an SMS. Internal use only.
165      *
166      * @param smsc the SMSC to send the message through, or NULL for the
167      *  default SMSC
168      * @param text the body of the message to send
169      * @param sentIntent if not NULL this <code>PendingIntent</code> is
170      *  broadcast when the message is sucessfully sent, or failed.
171      *  The result code will be <code>Activity.RESULT_OK<code> for success,
172      *  or one of these errors:<br>
173      *  <code>RESULT_ERROR_GENERIC_FAILURE</code><br>
174      *  <code>RESULT_ERROR_RADIO_OFF</code><br>
175      *  <code>RESULT_ERROR_NULL_PDU</code><br>
176      *  For <code>RESULT_ERROR_GENERIC_FAILURE</code> the sentIntent may include
177      *  the extra "errorCode" containing a radio technology specific value,
178      *  generally only useful for troubleshooting.<br>
179      *  The per-application based SMS control checks sentIntent. If sentIntent
180      *  is NULL the caller will be checked against all unknown applications,
181      *  which cause smaller number of SMS to be sent in checking period.
182      * @param deliveryIntent if not NULL this <code>PendingIntent</code> is
183      *  broadcast when the message is delivered to the recipient.  The
184      *  raw pdu of the status report is in the extended data ("pdu").
185      * @param subId the subId on which the SMS has to be sent.
186      */
sendTextForSubscriberWithSelfPermissions(in int subId, String callingPkg, in String destAddr, in String scAddr, in String text, in PendingIntent sentIntent, in PendingIntent deliveryIntent, in boolean persistMessage)187     void sendTextForSubscriberWithSelfPermissions(in int subId, String callingPkg,
188             in String destAddr, in String scAddr, in String text, in PendingIntent sentIntent,
189             in PendingIntent deliveryIntent, in boolean persistMessage);
190 
191     /**
192      * Send an SMS with options using Subscription Id.
193      *
194      * @param subId the subId on which the SMS has to be sent.
195      * @param destAddr the address to send the message to
196      * @param scAddr the SMSC to send the message through, or NULL for the
197      *  default SMSC
198      * @param text the body of the message to send
199      * @param sentIntent if not NULL this <code>PendingIntent</code> is
200      *  broadcast when the message is sucessfully sent, or failed.
201      *  The result code will be <code>Activity.RESULT_OK<code> for success,
202      *  or one of these errors:<br>
203      *  <code>RESULT_ERROR_GENERIC_FAILURE</code><br>
204      *  <code>RESULT_ERROR_RADIO_OFF</code><br>
205      *  <code>RESULT_ERROR_NULL_PDU</code><br>
206      *  For <code>RESULT_ERROR_GENERIC_FAILURE</code> the sentIntent may include
207      *  the extra "errorCode" containing a radio technology specific value,
208      *  generally only useful for troubleshooting.<br>
209      *  The per-application based SMS control checks sentIntent. If sentIntent
210      *  is NULL the caller will be checked against all unknown applications,
211      *  which cause smaller number of SMS to be sent in checking period.
212      * @param deliveryIntent if not NULL this <code>PendingIntent</code> is
213      *  broadcast when the message is delivered to the recipient.  The
214      *  raw pdu of the status report is in the extended data ("pdu").
215      * @param persistMessageForNonDefaultSmsApp whether the sent message should
216      *   be automatically persisted in the SMS db. It only affects messages sent
217      *   by a non-default SMS app. Currently only the carrier app can set this
218      *   parameter to false to skip auto message persistence.
219      * @param priority Priority level of the message
220      *  Refer specification See 3GPP2 C.S0015-B, v2.0, table 4.5.9-1
221      *  ---------------------------------
222      *  PRIORITY      | Level of Priority
223      *  ---------------------------------
224      *      '00'      |     Normal
225      *      '01'      |     Interactive
226      *      '10'      |     Urgent
227      *      '11'      |     Emergency
228      *  ----------------------------------
229      *  Any Other values included Negative considered as Invalid Priority Indicator of the message.
230      * @param expectMore is a boolean to indicate the sending message is multi segmented or not.
231      * @param validityPeriod Validity Period of the message in mins.
232      *  Refer specification 3GPP TS 23.040 V6.8.1 section 9.2.3.12.1.
233      *  Validity Period(Minimum) -> 5 mins
234      *  Validity Period(Maximum) -> 635040 mins(i.e.63 weeks).
235      *  Any Other values included Negative considered as Invalid Validity Period of the message.
236      */
sendTextForSubscriberWithOptions(in int subId, String callingPkg, in String destAddr, in String scAddr, in String text, in PendingIntent sentIntent, in PendingIntent deliveryIntent, in boolean persistMessageForNonDefaultSmsApp, in int priority, in boolean expectMore, in int validityPeriod)237     void sendTextForSubscriberWithOptions(in int subId, String callingPkg, in String destAddr,
238             in String scAddr, in String text, in PendingIntent sentIntent,
239             in PendingIntent deliveryIntent, in boolean persistMessageForNonDefaultSmsApp,
240             in int priority, in boolean expectMore, in int validityPeriod);
241 
242     /**
243      * Inject an SMS PDU into the android platform.
244      *
245      * @param subId the subId on which the SMS has to be injected.
246      * @param pdu is the byte array of pdu to be injected into android application framework
247      * @param format is the format of SMS pdu (android.telephony.SmsMessage.FORMAT_3GPP or
248      * android.telephony.SmsMessage.FORMAT_3GPP2)
249      * @param receivedIntent if not NULL this <code>PendingIntent</code> is
250      *  broadcast when the message is successfully received by the
251      *  android application framework. This intent is broadcasted at
252      *  the same time an SMS received from radio is acknowledged back.
253      */
injectSmsPduForSubscriber( int subId, in byte[] pdu, String format, in PendingIntent receivedIntent)254     void injectSmsPduForSubscriber(
255             int subId, in byte[] pdu, String format, in PendingIntent receivedIntent);
256 
257     /**
258      * Send a multi-part text based SMS.
259      *
260      * @param destinationAddress the address to send the message to
261      * @param scAddress is the service center address or null to use
262      *   the current default SMSC
263      * @param parts an <code>ArrayList</code> of strings that, in order,
264      *   comprise the original message
265      * @param sentIntents if not null, an <code>ArrayList</code> of
266      *   <code>PendingIntent</code>s (one for each message part) that is
267      *   broadcast when the corresponding message part has been sent.
268      *   The result code will be <code>Activity.RESULT_OK<code> for success,
269      *   or one of these errors:
270      *   <code>RESULT_ERROR_GENERIC_FAILURE</code>
271      *   <code>RESULT_ERROR_RADIO_OFF</code>
272      *   <code>RESULT_ERROR_NULL_PDU</code>.
273      * @param deliveryIntents if not null, an <code>ArrayList</code> of
274      *   <code>PendingIntent</code>s (one for each message part) that is
275      *   broadcast when the corresponding message part has been delivered
276      *   to the recipient.  The raw pdu of the status report is in the
277      *   extended data ("pdu").
278      * @param subId the subId on which the SMS has to be sent.
279      * @param persistMessageForNonDefaultSmsApp whether the sent message should
280      *   be automatically persisted in the SMS db. It only affects messages sent
281      *   by a non-default SMS app. Currently only the carrier app can set this
282      *   parameter to false to skip auto message persistence.
283      */
sendMultipartTextForSubscriber(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)284     void sendMultipartTextForSubscriber(in int subId, String callingPkg,
285             in String destinationAddress, in String scAddress,
286             in List<String> parts, in List<PendingIntent> sentIntents,
287             in List<PendingIntent> deliveryIntents, in boolean persistMessageForNonDefaultSmsApp);
288 
289     /**
290      * Send a multi-part text based SMS with options using Subscription Id.
291      *
292      * @param subId the subId on which the SMS has to be sent.
293      * @param destinationAddress the address to send the message to
294      * @param scAddress is the service center address or null to use
295      *   the current default SMSC
296      * @param parts an <code>ArrayList</code> of strings that, in order,
297      *   comprise the original message
298      * @param sentIntents if not null, an <code>ArrayList</code> of
299      *   <code>PendingIntent</code>s (one for each message part) that is
300      *   broadcast when the corresponding message part has been sent.
301      *   The result code will be <code>Activity.RESULT_OK<code> for success,
302      *   or one of these errors:
303      *   <code>RESULT_ERROR_GENERIC_FAILURE</code>
304      *   <code>RESULT_ERROR_RADIO_OFF</code>
305      *   <code>RESULT_ERROR_NULL_PDU</code>.
306      * @param deliveryIntents if not null, an <code>ArrayList</code> of
307      *   <code>PendingIntent</code>s (one for each message part) that is
308      *   broadcast when the corresponding message part has been delivered
309      *   to the recipient.  The raw pdu of the status report is in the
310      *   extended data ("pdu").
311      * @param persistMessageForNonDefaultSmsApp whether the sent message should
312      *   be automatically persisted in the SMS db. It only affects messages sent
313      *   by a non-default SMS app. Currently only the carrier app can set this
314      *   parameter to false to skip auto message persistence.
315      * @param priority Priority level of the message
316      *  Refer specification See 3GPP2 C.S0015-B, v2.0, table 4.5.9-1
317      *  ---------------------------------
318      *  PRIORITY      | Level of Priority
319      *  ---------------------------------
320      *      '00'      |     Normal
321      *      '01'      |     Interactive
322      *      '10'      |     Urgent
323      *      '11'      |     Emergency
324      *  ----------------------------------
325      *  Any Other values included Negative considered as Invalid Priority Indicator of the message.
326      * @param expectMore is a boolean to indicate the sending message is multi segmented or not.
327      * @param validityPeriod Validity Period of the message in mins.
328      *  Refer specification 3GPP TS 23.040 V6.8.1 section 9.2.3.12.1.
329      *  Validity Period(Minimum) -> 5 mins
330      *  Validity Period(Maximum) -> 635040 mins(i.e.63 weeks).
331      *  Any Other values included Negative considered as Invalid Validity Period of the message.
332      */
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)333     void sendMultipartTextForSubscriberWithOptions(in int subId, String callingPkg,
334             in String destinationAddress, in String scAddress, in List<String> parts,
335             in List<PendingIntent> sentIntents, in List<PendingIntent> deliveryIntents,
336             in boolean persistMessageForNonDefaultSmsApp, in int priority, in boolean expectMore,
337             in int validityPeriod);
338 
339     /**
340      * Enable reception of cell broadcast (SMS-CB) messages with the given
341      * message identifier and RAN type. The RAN type specify this message ID
342      * belong to 3GPP (GSM) or 3GPP2(CDMA). Note that if two different clients
343      * enable the same message identifier, they must both disable it for the
344      * device to stop receiving those messages.
345      *
346      * @param messageIdentifier Message identifier as specified in TS 23.041 (3GPP) or
347      *   C.R1001-G (3GPP2)
348      * @param subId for which the broadcast has to be enabled
349      * @param ranType as defined in class SmsManager, the value can be one of these:
350      *    android.telephony.SmsMessage.CELL_BROADCAST_RAN_TYPE_GSM
351      *    android.telephony.SmsMessage.CELL_BROADCAST_RAN_TYPE_CDMA
352      * @return true if successful, false otherwise
353      *
354      * @see #disableCellBroadcastForSubscriber(int, int, int)
355      */
enableCellBroadcastForSubscriber(int subId, int messageIdentifier, int ranType)356     boolean enableCellBroadcastForSubscriber(int subId, int messageIdentifier, int ranType);
357 
358     /**
359      * Disable reception of cell broadcast (SMS-CB) messages with the given
360      * message identifier and RAN type. The RAN type specify this message ID
361      * belong to 3GPP (GSM) or 3GPP2(CDMA). Note that if two different clients
362      * enable the same message identifier, they must both disable it for the
363      * device to stop receiving those messages.
364      *
365      * @param messageIdentifier Message identifier as specified in TS 23.041 (3GPP) or
366      *   C.R1001-G (3GPP2)
367      * @param subId for which the broadcast has to be disabled
368      * @param ranType as defined in class SmsManager, the value can be one of these:
369      *    android.telephony.SmsMessage.CELL_BROADCAST_RAN_TYPE_GSM
370      *    android.telephony.SmsMessage.CELL_BROADCAST_RAN_TYPE_CDMA
371      * @return true if successful, false otherwise
372      *
373      * @see #enableCellBroadcastForSubscriber(int, int, int)
374      */
disableCellBroadcastForSubscriber(int subId, int messageIdentifier, int ranType)375     boolean disableCellBroadcastForSubscriber(int subId, int messageIdentifier, int ranType);
376 
377     /*
378      * Enable reception of cell broadcast (SMS-CB) messages with the given
379      * message identifier range and RAN type. The RAN type specify this message ID range
380      * belong to 3GPP (GSM) or 3GPP2(CDMA). Note that if two different clients enable
381      * a message identifier range, they must both disable it for the device
382      * to stop receiving those messages.
383      *
384      * @param startMessageId first message identifier as specified in TS 23.041 (3GPP) or
385      *   C.R1001-G (3GPP2)
386      * @param endMessageId last message identifier as specified in TS 23.041 (3GPP) or
387      *   C.R1001-G (3GPP2)
388      * @param subId for which the broadcast has to be enabled
389      * @param ranType as defined in class SmsManager, the value can be one of these:
390      *    android.telephony.SmsMessage.CELL_BROADCAST_RAN_TYPE_GSM
391      *    android.telephony.SmsMessage.CELL_BROADCAST_RAN_TYPE_CDMA
392      * @return true if successful, false otherwise
393      *
394      * @see #disableCellBroadcastRangeForSubscriber(int, int, int, int)
395      */
enableCellBroadcastRangeForSubscriber(int subId, int startMessageId, int endMessageId, int ranType)396     boolean enableCellBroadcastRangeForSubscriber(int subId, int startMessageId, int endMessageId,
397             int ranType);
398 
399     /**
400      * Disable reception of cell broadcast (SMS-CB) messages with the given
401      * message identifier range and RAN type. The RAN type specify this message ID range
402      * belong to 3GPP (GSM) or 3GPP2(CDMA). Note that if two different clients enable
403      * a message identifier range, they must both disable it for the device
404      * to stop receiving those messages.
405      *
406      * @param startMessageId first message identifier as specified in TS 23.041 (3GPP) or
407      *   C.R1001-G (3GPP2)
408      * @param endMessageId last message identifier as specified in TS 23.041 (3GPP) or
409      *   C.R1001-G (3GPP2)
410      * @param subId for which the broadcast has to be disabled
411      * @param ranType as defined in class SmsManager, the value can be one of these:
412      *    android.telephony.SmsMessage.CELL_BROADCAST_RAN_TYPE_GSM
413      *    android.telephony.SmsMessage.CELL_BROADCAST_RAN_TYPE_CDMA
414      * @return true if successful, false otherwise
415      *
416      * @see #enableCellBroadcastRangeForSubscriber(int, int, int, int)
417      */
disableCellBroadcastRangeForSubscriber(int subId, int startMessageId, int endMessageId, int ranType)418     boolean disableCellBroadcastRangeForSubscriber(int subId, int startMessageId,
419             int endMessageId, int ranType);
420 
421     /**
422      * Returns the premium SMS send permission for the specified package.
423      * Requires system permission.
424      */
getPremiumSmsPermission(String packageName)425     int getPremiumSmsPermission(String packageName);
426 
427     /**
428      * Returns the premium SMS send permission for the specified package.
429      * Requires system permission.
430      */
getPremiumSmsPermissionForSubscriber(int subId, String packageName)431     int getPremiumSmsPermissionForSubscriber(int subId, String packageName);
432 
433     /**
434      * Set the SMS send permission for the specified package.
435      * Requires system permission.
436      */
setPremiumSmsPermission(String packageName, int permission)437     void setPremiumSmsPermission(String packageName, int permission);
438 
439      /**
440      * Set the SMS send permission for the specified package.
441      * Requires system permission.
442      */
setPremiumSmsPermissionForSubscriber(int subId, String packageName, int permission)443     void setPremiumSmsPermissionForSubscriber(int subId, String packageName, int permission);
444 
445     /**
446      * SMS over IMS is supported if IMS is registered and SMS is supported
447      * on IMS.
448      * @param subId for subId which isImsSmsSupported is queried
449      * @return true if SMS over IMS is supported, false otherwise
450      *
451      * @see #getImsSmsFormatForSubscriber(int)
452      */
isImsSmsSupportedForSubscriber(int subId)453     boolean isImsSmsSupportedForSubscriber(int subId);
454 
455     /**
456      * User needs to pick SIM for SMS if multiple SIMs present and if current subId passed in is not
457      * active/valid.
458      * @param subId current subId for sending SMS
459      * @return true if SIM for SMS sending needs to be chosen
460      */
isSmsSimPickActivityNeeded(int subId)461     boolean isSmsSimPickActivityNeeded(int subId);
462 
463     /*
464      * get user prefered SMS subId
465      * @return subId id
466      */
getPreferredSmsSubscription()467     int getPreferredSmsSubscription();
468 
469     /**
470      * Gets SMS format supported on IMS.  SMS over IMS format is
471      * either 3GPP or 3GPP2.
472      * @param subId for subId which getImsSmsFormat is queried
473      * @return android.telephony.SmsMessage.FORMAT_3GPP,
474      *         android.telephony.SmsMessage.FORMAT_3GPP2
475      *      or android.telephony.SmsMessage.FORMAT_UNKNOWN
476      *
477      * @see #isImsSmsSupportedForSubscriber(int)
478      */
getImsSmsFormatForSubscriber(int subId)479     String getImsSmsFormatForSubscriber(int subId);
480 
481     /*
482      * Get SMS prompt property,  enabled or not
483      * @return true if enabled, false otherwise
484      */
isSMSPromptEnabled()485     boolean isSMSPromptEnabled();
486 
487     /**
488      * Send a system stored text message.
489      *
490      * This is used for sending a previously sent, but failed-to-send, message or
491      * for sending a text message that has been stored as a draft.
492      *
493      * @param subId the SIM id.
494      * @param callingPkg the package name of the calling app
495      * @param messageUri the URI of the stored message
496      * @param scAddress is the service center address or null to use the current default SMSC
497      * @param sentIntent if not NULL this <code>PendingIntent</code> is
498      *  broadcast when the message is successfully sent, or failed.
499      *  The result code will be <code>Activity.RESULT_OK</code> for success,
500      *  or one of these errors:<br>
501      *  <code>RESULT_ERROR_GENERIC_FAILURE</code><br>
502      *  <code>RESULT_ERROR_RADIO_OFF</code><br>
503      *  <code>RESULT_ERROR_NULL_PDU</code><br>
504      *  For <code>RESULT_ERROR_GENERIC_FAILURE</code> the sentIntent may include
505      *  the extra "errorCode" containing a radio technology specific value,
506      *  generally only useful for troubleshooting.<br>
507      *  The per-application based SMS control checks sentIntent. If sentIntent
508      *  is NULL the caller will be checked against all unknown applications,
509      *  which cause smaller number of SMS to be sent in checking period.
510      * @param deliveryIntent if not NULL this <code>PendingIntent</code> is
511      *  broadcast when the message is delivered to the recipient.  The
512      *  raw pdu of the status report is in the extended data ("pdu").
513      */
sendStoredText(int subId, String callingPkg, in Uri messageUri, String scAddress, in PendingIntent sentIntent, in PendingIntent deliveryIntent)514     void sendStoredText(int subId, String callingPkg, in Uri messageUri, String scAddress,
515             in PendingIntent sentIntent, in PendingIntent deliveryIntent);
516 
517     /**
518      * Send a system stored multi-part text message.
519      *
520      * This is used for sending a previously sent, but failed-to-send, message or
521      * for sending a text message that has been stored as a draft.
522      * The provided <code>PendingIntent</code> lists should match the part number of the
523      * divided text of the stored message by using <code>divideMessage</code>
524      *
525      * @param subId the SIM id.
526      * @param callingPkg the package name of the calling app
527      * @param messageUri the URI of the stored message
528      * @param scAddress is the service center address or null to use
529      *   the current default SMSC
530      * @param sentIntents if not null, an <code>ArrayList</code> of
531      *   <code>PendingIntent</code>s (one for each message part) that is
532      *   broadcast when the corresponding message part has been sent.
533      *   The result code will be <code>Activity.RESULT_OK</code> for success,
534      *   or one of these errors:<br>
535      *   <code>RESULT_ERROR_GENERIC_FAILURE</code><br>
536      *   <code>RESULT_ERROR_RADIO_OFF</code><br>
537      *   <code>RESULT_ERROR_NULL_PDU</code><br>
538      *   For <code>RESULT_ERROR_GENERIC_FAILURE</code> each sentIntent may include
539      *   the extra "errorCode" containing a radio technology specific value,
540      *   generally only useful for troubleshooting.<br>
541      *   The per-application based SMS control checks sentIntent. If sentIntent
542      *   is NULL the caller will be checked against all unknown applications,
543      *   which cause smaller number of SMS to be sent in checking period.
544      * @param deliveryIntents if not null, an <code>ArrayList</code> of
545      *   <code>PendingIntent</code>s (one for each message part) that is
546      *   broadcast when the corresponding message part has been delivered
547      *   to the recipient.  The raw pdu of the status report is in the
548      *   extended data ("pdu").
549      */
sendStoredMultipartText(int subId, String callingPkg, in Uri messageUri, String scAddress, in List<PendingIntent> sentIntents, in List<PendingIntent> deliveryIntents)550     void sendStoredMultipartText(int subId, String callingPkg, in Uri messageUri,
551                 String scAddress, in List<PendingIntent> sentIntents,
552                 in List<PendingIntent> deliveryIntents);
553 
554     /**
555      * Create an app-only incoming SMS request for the calling package.
556      *
557      * If an incoming text contains the token returned by this method the provided
558      * <code>PendingIntent</code> will be sent containing the SMS data.
559      *
560      * @param subId the SIM id.
561      * @param callingPkg the package name of the calling app.
562      * @param intent PendingIntent to be sent when an SMS is received containing the token.
563      */
createAppSpecificSmsToken(int subId, String callingPkg, in PendingIntent intent)564     String createAppSpecificSmsToken(int subId, String callingPkg, in PendingIntent intent);
565 
566     /**
567      * Create an app-only incoming SMS request for the calling package.
568      *
569      * If an incoming text contains the token returned by this method the provided
570      * <code>PendingIntent</code> will be sent containing the SMS data.
571      *
572      * @param subId the SIM id.
573      * @param callingPkg the package name of the calling app.
574      * @param prefixes the caller provided prefixes
575      * @param intent PendingIntent to be sent when a SMS is received containing the token and one
576      *   of the prefixes
577      */
createAppSpecificSmsTokenWithPackageInfo( int subId, String callingPkg, String prefixes, in PendingIntent intent)578     String createAppSpecificSmsTokenWithPackageInfo(
579             int subId, String callingPkg, String prefixes, in PendingIntent intent);
580 
581     /**
582      * Get sms inbox messages for the calling financial app.
583      *
584      * @param subId the SIM id.
585      * @param callingPkg the package name of the calling app.
586      * @param params parameters to filter the sms messages.
587      * @param callback the callback interface to deliver the result.
588      */
getSmsMessagesForFinancialApp( int subId, String callingPkg, in Bundle params, in IFinancialSmsCallback callback)589     void getSmsMessagesForFinancialApp(
590         int subId, String callingPkg, in Bundle params, in IFinancialSmsCallback callback);
591 
592     /**
593      * Check if the destination is a possible premium short code.
594      *
595      * @param destAddress the destination address to test for possible short code
596      */
checkSmsShortCodeDestination(int subId, String callingApk, String destAddress, String countryIso)597     int checkSmsShortCodeDestination(int subId, String callingApk, String destAddress, String countryIso);
598 }
599