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