• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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      * Inject an SMS PDU into the android platform.
191      *
192      * @param subId the subId on which the SMS has to be injected.
193      * @param pdu is the byte array of pdu to be injected into android application framework
194      * @param format is the format of SMS pdu (android.telephony.SmsMessage.FORMAT_3GPP or
195      * android.telephony.SmsMessage.FORMAT_3GPP2)
196      * @param receivedIntent if not NULL this <code>PendingIntent</code> is
197      *  broadcast when the message is successfully received by the
198      *  android application framework. This intent is broadcasted at
199      *  the same time an SMS received from radio is acknowledged back.
200      */
injectSmsPduForSubscriber( int subId, in byte[] pdu, String format, in PendingIntent receivedIntent)201     void injectSmsPduForSubscriber(
202             int subId, in byte[] pdu, String format, in PendingIntent receivedIntent);
203 
204     /**
205      * Send a multi-part text based SMS.
206      *
207      * @param destinationAddress the address to send the message to
208      * @param scAddress is the service center address or null to use
209      *   the current default SMSC
210      * @param parts an <code>ArrayList</code> of strings that, in order,
211      *   comprise the original message
212      * @param sentIntents if not null, an <code>ArrayList</code> of
213      *   <code>PendingIntent</code>s (one for each message part) that is
214      *   broadcast when the corresponding message part has been sent.
215      *   The result code will be <code>Activity.RESULT_OK<code> for success,
216      *   or one of these errors:
217      *   <code>RESULT_ERROR_GENERIC_FAILURE</code>
218      *   <code>RESULT_ERROR_RADIO_OFF</code>
219      *   <code>RESULT_ERROR_NULL_PDU</code>.
220      * @param deliveryIntents if not null, an <code>ArrayList</code> of
221      *   <code>PendingIntent</code>s (one for each message part) that is
222      *   broadcast when the corresponding message part has been delivered
223      *   to the recipient.  The raw pdu of the status report is in the
224      *   extended data ("pdu").
225      * @param subId the subId on which the SMS has to be sent.
226      * @param persistMessageForNonDefaultSmsApp whether the sent message should
227      *   be automatically persisted in the SMS db. It only affects messages sent
228      *   by a non-default SMS app. Currently only the carrier app can set this
229      *   parameter to false to skip auto message persistence.
230      */
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)231     void sendMultipartTextForSubscriber(in int subId, String callingPkg,
232             in String destinationAddress, in String scAddress,
233             in List<String> parts, in List<PendingIntent> sentIntents,
234             in List<PendingIntent> deliveryIntents, in boolean persistMessageForNonDefaultSmsApp);
235 
236     /**
237      * Enable reception of cell broadcast (SMS-CB) messages with the given
238      * message identifier and RAN type. The RAN type specify this message ID
239      * belong to 3GPP (GSM) or 3GPP2(CDMA). Note that if two different clients
240      * enable the same message identifier, they must both disable it for the
241      * device to stop receiving those messages.
242      *
243      * @param messageIdentifier Message identifier as specified in TS 23.041 (3GPP) or
244      *   C.R1001-G (3GPP2)
245      * @param subId for which the broadcast has to be enabled
246      * @param ranType as defined in class SmsManager, the value can be one of these:
247      *    android.telephony.SmsMessage.CELL_BROADCAST_RAN_TYPE_GSM
248      *    android.telephony.SmsMessage.CELL_BROADCAST_RAN_TYPE_CDMA
249      * @return true if successful, false otherwise
250      *
251      * @see #disableCellBroadcastForSubscriber(int, int, int)
252      */
enableCellBroadcastForSubscriber(int subId, int messageIdentifier, int ranType)253     boolean enableCellBroadcastForSubscriber(int subId, int messageIdentifier, int ranType);
254 
255     /**
256      * Disable reception of cell broadcast (SMS-CB) messages with the given
257      * message identifier and RAN type. The RAN type specify this message ID
258      * belong to 3GPP (GSM) or 3GPP2(CDMA). Note that if two different clients
259      * enable the same message identifier, they must both disable it for the
260      * device to stop receiving those messages.
261      *
262      * @param messageIdentifier Message identifier as specified in TS 23.041 (3GPP) or
263      *   C.R1001-G (3GPP2)
264      * @param subId for which the broadcast has to be disabled
265      * @param ranType as defined in class SmsManager, the value can be one of these:
266      *    android.telephony.SmsMessage.CELL_BROADCAST_RAN_TYPE_GSM
267      *    android.telephony.SmsMessage.CELL_BROADCAST_RAN_TYPE_CDMA
268      * @return true if successful, false otherwise
269      *
270      * @see #enableCellBroadcastForSubscriber(int, int, int)
271      */
disableCellBroadcastForSubscriber(int subId, int messageIdentifier, int ranType)272     boolean disableCellBroadcastForSubscriber(int subId, int messageIdentifier, int ranType);
273 
274     /*
275      * Enable reception of cell broadcast (SMS-CB) messages with the given
276      * message identifier range and RAN type. The RAN type specify this message ID range
277      * belong to 3GPP (GSM) or 3GPP2(CDMA). Note that if two different clients enable
278      * a message identifier range, they must both disable it for the device
279      * to stop receiving those messages.
280      *
281      * @param startMessageId first message identifier as specified in TS 23.041 (3GPP) or
282      *   C.R1001-G (3GPP2)
283      * @param endMessageId last message identifier as specified in TS 23.041 (3GPP) or
284      *   C.R1001-G (3GPP2)
285      * @param subId for which the broadcast has to be enabled
286      * @param ranType as defined in class SmsManager, the value can be one of these:
287      *    android.telephony.SmsMessage.CELL_BROADCAST_RAN_TYPE_GSM
288      *    android.telephony.SmsMessage.CELL_BROADCAST_RAN_TYPE_CDMA
289      * @return true if successful, false otherwise
290      *
291      * @see #disableCellBroadcastRangeForSubscriber(int, int, int, int)
292      */
enableCellBroadcastRangeForSubscriber(int subId, int startMessageId, int endMessageId, int ranType)293     boolean enableCellBroadcastRangeForSubscriber(int subId, int startMessageId, int endMessageId,
294             int ranType);
295 
296     /**
297      * Disable reception of cell broadcast (SMS-CB) messages with the given
298      * message identifier range and RAN type. The RAN type specify this message ID range
299      * belong to 3GPP (GSM) or 3GPP2(CDMA). Note that if two different clients enable
300      * a message identifier range, they must both disable it for the device
301      * to stop receiving those messages.
302      *
303      * @param startMessageId first message identifier as specified in TS 23.041 (3GPP) or
304      *   C.R1001-G (3GPP2)
305      * @param endMessageId last message identifier as specified in TS 23.041 (3GPP) or
306      *   C.R1001-G (3GPP2)
307      * @param subId for which the broadcast has to be disabled
308      * @param ranType as defined in class SmsManager, the value can be one of these:
309      *    android.telephony.SmsMessage.CELL_BROADCAST_RAN_TYPE_GSM
310      *    android.telephony.SmsMessage.CELL_BROADCAST_RAN_TYPE_CDMA
311      * @return true if successful, false otherwise
312      *
313      * @see #enableCellBroadcastRangeForSubscriber(int, int, int, int)
314      */
disableCellBroadcastRangeForSubscriber(int subId, int startMessageId, int endMessageId, int ranType)315     boolean disableCellBroadcastRangeForSubscriber(int subId, int startMessageId,
316             int endMessageId, int ranType);
317 
318     /**
319      * Returns the premium SMS send permission for the specified package.
320      * Requires system permission.
321      */
getPremiumSmsPermission(String packageName)322     int getPremiumSmsPermission(String packageName);
323 
324     /**
325      * Returns the premium SMS send permission for the specified package.
326      * Requires system permission.
327      */
getPremiumSmsPermissionForSubscriber(int subId, String packageName)328     int getPremiumSmsPermissionForSubscriber(int subId, String packageName);
329 
330     /**
331      * Set the SMS send permission for the specified package.
332      * Requires system permission.
333      */
setPremiumSmsPermission(String packageName, int permission)334     void setPremiumSmsPermission(String packageName, int permission);
335 
336      /**
337      * Set the SMS send permission for the specified package.
338      * Requires system permission.
339      */
setPremiumSmsPermissionForSubscriber(int subId, String packageName, int permission)340     void setPremiumSmsPermissionForSubscriber(int subId, String packageName, int permission);
341 
342     /**
343      * SMS over IMS is supported if IMS is registered and SMS is supported
344      * on IMS.
345      * @param subId for subId which isImsSmsSupported is queried
346      * @return true if SMS over IMS is supported, false otherwise
347      *
348      * @see #getImsSmsFormatForSubscriber(int)
349      */
isImsSmsSupportedForSubscriber(int subId)350     boolean isImsSmsSupportedForSubscriber(int subId);
351 
352     /**
353      * User needs to pick SIM for SMS if multiple SIMs present and if current subId passed in is not
354      * active/valid.
355      * @param subId current subId for sending SMS
356      * @return true if SIM for SMS sending needs to be chosen
357      */
isSmsSimPickActivityNeeded(int subId)358     boolean isSmsSimPickActivityNeeded(int subId);
359 
360     /*
361      * get user prefered SMS subId
362      * @return subId id
363      */
getPreferredSmsSubscription()364     int getPreferredSmsSubscription();
365 
366     /**
367      * Gets SMS format supported on IMS.  SMS over IMS format is
368      * either 3GPP or 3GPP2.
369      * @param subId for subId which getImsSmsFormat is queried
370      * @return android.telephony.SmsMessage.FORMAT_3GPP,
371      *         android.telephony.SmsMessage.FORMAT_3GPP2
372      *      or android.telephony.SmsMessage.FORMAT_UNKNOWN
373      *
374      * @see #isImsSmsSupportedForSubscriber(int)
375      */
getImsSmsFormatForSubscriber(int subId)376     String getImsSmsFormatForSubscriber(int subId);
377 
378     /*
379      * Get SMS prompt property,  enabled or not
380      * @return true if enabled, false otherwise
381      */
isSMSPromptEnabled()382     boolean isSMSPromptEnabled();
383 
384     /**
385      * Send a system stored text message.
386      *
387      * This is used for sending a previously sent, but failed-to-send, message or
388      * for sending a text message that has been stored as a draft.
389      *
390      * @param subId the SIM id.
391      * @param callingPkg the package name of the calling app
392      * @param messageUri the URI of the stored message
393      * @param scAddress is the service center address or null to use the current default SMSC
394      * @param sentIntent if not NULL this <code>PendingIntent</code> is
395      *  broadcast when the message is successfully sent, or failed.
396      *  The result code will be <code>Activity.RESULT_OK</code> for success,
397      *  or one of these errors:<br>
398      *  <code>RESULT_ERROR_GENERIC_FAILURE</code><br>
399      *  <code>RESULT_ERROR_RADIO_OFF</code><br>
400      *  <code>RESULT_ERROR_NULL_PDU</code><br>
401      *  For <code>RESULT_ERROR_GENERIC_FAILURE</code> the sentIntent may include
402      *  the extra "errorCode" containing a radio technology specific value,
403      *  generally only useful for troubleshooting.<br>
404      *  The per-application based SMS control checks sentIntent. If sentIntent
405      *  is NULL the caller will be checked against all unknown applications,
406      *  which cause smaller number of SMS to be sent in checking period.
407      * @param deliveryIntent if not NULL this <code>PendingIntent</code> is
408      *  broadcast when the message is delivered to the recipient.  The
409      *  raw pdu of the status report is in the extended data ("pdu").
410      */
sendStoredText(int subId, String callingPkg, in Uri messageUri, String scAddress, in PendingIntent sentIntent, in PendingIntent deliveryIntent)411     void sendStoredText(int subId, String callingPkg, in Uri messageUri, String scAddress,
412             in PendingIntent sentIntent, in PendingIntent deliveryIntent);
413 
414     /**
415      * Send a system stored multi-part text message.
416      *
417      * This is used for sending a previously sent, but failed-to-send, message or
418      * for sending a text message that has been stored as a draft.
419      * The provided <code>PendingIntent</code> lists should match the part number of the
420      * divided text of the stored message by using <code>divideMessage</code>
421      *
422      * @param subId the SIM id.
423      * @param callingPkg the package name of the calling app
424      * @param messageUri the URI of the stored message
425      * @param scAddress is the service center address or null to use
426      *   the current default SMSC
427      * @param sentIntents if not null, an <code>ArrayList</code> of
428      *   <code>PendingIntent</code>s (one for each message part) that is
429      *   broadcast when the corresponding message part has been sent.
430      *   The result code will be <code>Activity.RESULT_OK</code> for success,
431      *   or one of these errors:<br>
432      *   <code>RESULT_ERROR_GENERIC_FAILURE</code><br>
433      *   <code>RESULT_ERROR_RADIO_OFF</code><br>
434      *   <code>RESULT_ERROR_NULL_PDU</code><br>
435      *   For <code>RESULT_ERROR_GENERIC_FAILURE</code> each sentIntent may include
436      *   the extra "errorCode" containing a radio technology specific value,
437      *   generally only useful for troubleshooting.<br>
438      *   The per-application based SMS control checks sentIntent. If sentIntent
439      *   is NULL the caller will be checked against all unknown applications,
440      *   which cause smaller number of SMS to be sent in checking period.
441      * @param deliveryIntents if not null, an <code>ArrayList</code> of
442      *   <code>PendingIntent</code>s (one for each message part) that is
443      *   broadcast when the corresponding message part has been delivered
444      *   to the recipient.  The raw pdu of the status report is in the
445      *   extended data ("pdu").
446      */
sendStoredMultipartText(int subId, String callingPkg, in Uri messageUri, String scAddress, in List<PendingIntent> sentIntents, in List<PendingIntent> deliveryIntents)447     void sendStoredMultipartText(int subId, String callingPkg, in Uri messageUri,
448                 String scAddress, in List<PendingIntent> sentIntents,
449                 in List<PendingIntent> deliveryIntents);
450 }
451