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