Ye Wen | 369a107 | 2014-06-18 18:17:52 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2014 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; |
Ye Wen | 295f219 | 2014-07-09 16:51:49 -0700 | [diff] [blame] | 20 | import android.content.ContentValues; |
| 21 | import android.net.Uri; |
Shri Borde | 7237972 | 2014-09-02 09:48:49 -0700 | [diff] [blame] | 22 | import android.os.Bundle; |
Ye Wen | 369a107 | 2014-06-18 18:17:52 -0700 | [diff] [blame] | 23 | |
| 24 | /** |
| 25 | * Service interface to handle MMS API requests |
| 26 | */ |
| 27 | interface IMms { |
| 28 | /** |
| 29 | * Send an MMS message |
| 30 | * |
Ye Wen | 295f219 | 2014-07-09 16:51:49 -0700 | [diff] [blame] | 31 | * @param subId the SIM id |
Ye Wen | 369a107 | 2014-06-18 18:17:52 -0700 | [diff] [blame] | 32 | * @param callingPkg the package name of the calling app |
Julian Odell | 31ef14d | 2014-08-25 17:53:52 -0700 | [diff] [blame] | 33 | * @param contentUri the content uri from which to read MMS message encoded in standard MMS |
| 34 | * PDU format |
Ye Wen | 369a107 | 2014-06-18 18:17:52 -0700 | [diff] [blame] | 35 | * @param locationUrl the optional location url for where this message should be sent to |
Ye Wen | 63c00c4 | 2014-08-01 13:38:58 -0700 | [diff] [blame] | 36 | * @param configOverrides the carrier-specific messaging configuration values to override for |
Jonathan Basseri | 6694f2a | 2015-06-10 09:11:49 -0700 | [diff] [blame] | 37 | * sending the message. See {@link android.telephony.SmsManager} for the value names and types. |
Ye Wen | 369a107 | 2014-06-18 18:17:52 -0700 | [diff] [blame] | 38 | * @param sentIntent if not NULL this <code>PendingIntent</code> is |
| 39 | * broadcast when the message is successfully sent, or failed |
Tom Taylor | 03079ec | 2020-01-24 10:21:50 -0800 | [diff] [blame] | 40 | * @param messageId An id that uniquely identifies the message requested to be sent. |
Ye Wen | 369a107 | 2014-06-18 18:17:52 -0700 | [diff] [blame] | 41 | */ |
Wink Saville | 63f03dd | 2014-10-23 10:44:45 -0700 | [diff] [blame] | 42 | void sendMessage(int subId, String callingPkg, in Uri contentUri, |
Tom Taylor | 03079ec | 2020-01-24 10:21:50 -0800 | [diff] [blame] | 43 | String locationUrl, in Bundle configOverrides, in PendingIntent sentIntent, |
| 44 | in long messageId); |
Ye Wen | 369a107 | 2014-06-18 18:17:52 -0700 | [diff] [blame] | 45 | |
| 46 | /** |
| 47 | * Download an MMS message using known location and transaction id |
| 48 | * |
Ye Wen | 295f219 | 2014-07-09 16:51:49 -0700 | [diff] [blame] | 49 | * @param subId the SIM id |
Ye Wen | 369a107 | 2014-06-18 18:17:52 -0700 | [diff] [blame] | 50 | * @param callingPkg the package name of the calling app |
| 51 | * @param locationUrl the location URL of the MMS message to be downloaded, usually obtained |
| 52 | * from the MMS WAP push notification |
Julian Odell | 31ef14d | 2014-08-25 17:53:52 -0700 | [diff] [blame] | 53 | * @param contentUri a contentUri to which the downloaded MMS message will be written |
Ye Wen | 63c00c4 | 2014-08-01 13:38:58 -0700 | [diff] [blame] | 54 | * @param configOverrides the carrier-specific messaging configuration values to override for |
Jonathan Basseri | 6694f2a | 2015-06-10 09:11:49 -0700 | [diff] [blame] | 55 | * downloading the message. See {@link android.telephony.SmsManager} for the value names and |
| 56 | * types. |
Ye Wen | 369a107 | 2014-06-18 18:17:52 -0700 | [diff] [blame] | 57 | * @param downloadedIntent if not NULL this <code>PendingIntent</code> is |
| 58 | * broadcast when the message is downloaded, or the download is failed |
Tom Taylor | 03079ec | 2020-01-24 10:21:50 -0800 | [diff] [blame] | 59 | * @param messageId An id that uniquely identifies the message requested to be downloaded. |
| 60 | */ |
Wink Saville | 63f03dd | 2014-10-23 10:44:45 -0700 | [diff] [blame] | 61 | void downloadMessage(int subId, String callingPkg, String locationUrl, |
Ye Wen | 8179c2a | 2014-09-04 15:36:11 -0700 | [diff] [blame] | 62 | in Uri contentUri, in Bundle configOverrides, |
Tom Taylor | 03079ec | 2020-01-24 10:21:50 -0800 | [diff] [blame] | 63 | in PendingIntent downloadedIntent, in long messageId); |
Ye Wen | 9974690 | 2014-07-03 14:04:34 -0700 | [diff] [blame] | 64 | |
| 65 | /** |
Ye Wen | 295f219 | 2014-07-09 16:51:49 -0700 | [diff] [blame] | 66 | * Import a text message into system's SMS store |
| 67 | * |
| 68 | * @param callingPkg the calling app's package name |
| 69 | * @param address the destination address of the message |
| 70 | * @param type the type of the message |
| 71 | * @param text the message text |
| 72 | * @param timestampMillis the message timestamp in milliseconds |
| 73 | * @param seen if the message is seen |
| 74 | * @param read if the message is read |
| 75 | * @return the message URI, null if failed |
| 76 | */ |
| 77 | Uri importTextMessage(String callingPkg, String address, int type, String text, |
| 78 | long timestampMillis, boolean seen, boolean read); |
| 79 | |
| 80 | /** |
| 81 | * Import a multimedia message into system's MMS store |
| 82 | * |
| 83 | * @param callingPkg the package name of the calling app |
Julian Odell | 31ef14d | 2014-08-25 17:53:52 -0700 | [diff] [blame] | 84 | * @param contentUri the content uri from which to read PDU of the message to import |
Ye Wen | 295f219 | 2014-07-09 16:51:49 -0700 | [diff] [blame] | 85 | * @param messageId the optional message id |
| 86 | * @param timestampSecs the message timestamp in seconds |
| 87 | * @param seen if the message is seen |
| 88 | * @param read if the message is read |
| 89 | * @return the message URI, null if failed |
| 90 | */ |
Julian Odell | 31ef14d | 2014-08-25 17:53:52 -0700 | [diff] [blame] | 91 | Uri importMultimediaMessage(String callingPkg, in Uri contentUri, String messageId, |
Ye Wen | 295f219 | 2014-07-09 16:51:49 -0700 | [diff] [blame] | 92 | long timestampSecs, boolean seen, boolean read); |
| 93 | |
| 94 | /** |
| 95 | * Delete a system stored SMS or MMS message |
| 96 | * |
| 97 | * @param callingPkg the package name of the calling app |
| 98 | * @param messageUri the URI of the stored message |
| 99 | * @return true if deletion is successful, false otherwise |
| 100 | */ |
| 101 | boolean deleteStoredMessage(String callingPkg, in Uri messageUri); |
| 102 | |
| 103 | /** |
| 104 | * Delete a system stored SMS or MMS thread |
| 105 | * |
| 106 | * @param callingPkg the package name of the calling app |
| 107 | * @param conversationId the ID of the message conversation |
| 108 | * @return true if deletion is successful, false otherwise |
| 109 | */ |
| 110 | boolean deleteStoredConversation(String callingPkg, long conversationId); |
| 111 | |
| 112 | /** |
| 113 | * Update the status properties of a system stored SMS or MMS message, e.g. |
| 114 | * the read status of a message, etc. |
| 115 | * |
| 116 | * @param callingPkg the package name of the calling app |
| 117 | * @param messageUri the URI of the stored message |
| 118 | * @param statusValues a list of status properties in key-value pairs to update |
| 119 | * @return true if deletion is successful, false otherwise |
| 120 | */ |
| 121 | boolean updateStoredMessageStatus(String callingPkg, in Uri messageUri, |
| 122 | in ContentValues statusValues); |
| 123 | |
| 124 | /** |
Ye Wen | a3dbd10 | 2014-07-29 10:42:25 -0700 | [diff] [blame] | 125 | * Archive or unarchive a stored conversation |
| 126 | * |
| 127 | * @param callingPkg the package name of the calling app |
| 128 | * @param conversationId the ID of the message conversation |
| 129 | * @param archived true to archive the conversation, false otherwise |
| 130 | * @return true if update is successful, false otherwise |
| 131 | */ |
| 132 | boolean archiveStoredConversation(String callingPkg, long conversationId, boolean archived); |
| 133 | |
| 134 | /** |
Ye Wen | 295f219 | 2014-07-09 16:51:49 -0700 | [diff] [blame] | 135 | * Add a text message draft to system SMS store |
| 136 | * |
| 137 | * @param callingPkg the package name of the calling app |
| 138 | * @param address the destination address of message |
| 139 | * @param text the body of the message to send |
| 140 | * @return the URI of the stored draft message |
| 141 | */ |
| 142 | Uri addTextMessageDraft(String callingPkg, String address, String text); |
| 143 | |
| 144 | /** |
| 145 | * Add a multimedia message draft to system MMS store |
| 146 | * |
| 147 | * @param callingPkg the package name of the calling app |
Julian Odell | 31ef14d | 2014-08-25 17:53:52 -0700 | [diff] [blame] | 148 | * @param contentUri the content Uri from which to read PDU data of the draft MMS |
Ye Wen | 295f219 | 2014-07-09 16:51:49 -0700 | [diff] [blame] | 149 | * @return the URI of the stored draft message |
| 150 | */ |
Julian Odell | 31ef14d | 2014-08-25 17:53:52 -0700 | [diff] [blame] | 151 | Uri addMultimediaMessageDraft(String callingPkg, in Uri contentUri); |
Ye Wen | 295f219 | 2014-07-09 16:51:49 -0700 | [diff] [blame] | 152 | |
| 153 | /** |
| 154 | * Send a system stored MMS message |
| 155 | * |
| 156 | * This is used for sending a previously sent, but failed-to-send, message or |
| 157 | * for sending a text message that has been stored as a draft. |
| 158 | * |
| 159 | * @param subId the SIM id |
| 160 | * @param callingPkg the package name of the calling app |
| 161 | * @param messageUri the URI of the stored message |
Ye Wen | 63c00c4 | 2014-08-01 13:38:58 -0700 | [diff] [blame] | 162 | * @param configOverrides the carrier-specific messaging configuration values to override for |
Jonathan Basseri | 6694f2a | 2015-06-10 09:11:49 -0700 | [diff] [blame] | 163 | * sending the message. See {@link android.telephony.SmsManager} for the value names and types. |
Ye Wen | 295f219 | 2014-07-09 16:51:49 -0700 | [diff] [blame] | 164 | * @param sentIntent if not NULL this <code>PendingIntent</code> is |
| 165 | * broadcast when the message is successfully sent, or failed |
| 166 | */ |
Wink Saville | 63f03dd | 2014-10-23 10:44:45 -0700 | [diff] [blame] | 167 | void sendStoredMessage(int subId, String callingPkg, in Uri messageUri, |
Ye Wen | 8179c2a | 2014-09-04 15:36:11 -0700 | [diff] [blame] | 168 | in Bundle configOverrides, in PendingIntent sentIntent); |
Ye Wen | 9966429 | 2014-07-14 16:19:04 -0700 | [diff] [blame] | 169 | |
| 170 | /** |
| 171 | * Turns on/off the flag to automatically write sent/received SMS/MMS messages into system |
| 172 | * |
| 173 | * When this flag is on, all SMS/MMS sent/received are stored by system automatically |
| 174 | * When this flag is off, only SMS/MMS sent by non-default SMS apps are stored by system |
| 175 | * automatically |
| 176 | * |
| 177 | * This flag can only be changed by default SMS apps |
| 178 | * |
| 179 | * @param callingPkg the name of the calling app package |
| 180 | * @param enabled Whether to enable message auto persisting |
| 181 | */ |
| 182 | void setAutoPersisting(String callingPkg, boolean enabled); |
| 183 | |
| 184 | /** |
| 185 | * Get the value of the flag to automatically write sent/received SMS/MMS messages into system |
| 186 | * |
| 187 | * When this flag is on, all SMS/MMS sent/received are stored by system automatically |
| 188 | * When this flag is off, only SMS/MMS sent by non-default SMS apps are stored by system |
| 189 | * automatically |
| 190 | * |
| 191 | * @return the current value of the auto persist flag |
| 192 | */ |
| 193 | boolean getAutoPersisting(); |
Ye Wen | 369a107 | 2014-06-18 18:17:52 -0700 | [diff] [blame] | 194 | } |