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