IMms.aidl revision a3dbd1087dfad0cacdb274420ec70505e236ad42
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 17package com.android.internal.telephony; 18 19import android.app.PendingIntent; 20import android.content.ContentValues; 21import android.net.Uri; 22 23/** 24 * Service interface to handle MMS API requests 25 */ 26interface IMms { 27 /** 28 * Send an MMS message 29 * 30 * @param subId the SIM id 31 * @param callingPkg the package name of the calling app 32 * @param pdu the MMS message encoded in standard MMS PDU format 33 * @param locationUrl the optional location url for where this message should be sent to 34 * @param sentIntent if not NULL this <code>PendingIntent</code> is 35 * broadcast when the message is successfully sent, or failed 36 */ 37 void sendMessage(long subId, String callingPkg, in byte[] pdu, String locationUrl, 38 in PendingIntent sentIntent); 39 40 /** 41 * Download an MMS message using known location and transaction id 42 * 43 * @param subId the SIM id 44 * @param callingPkg the package name of the calling app 45 * @param locationUrl the location URL of the MMS message to be downloaded, usually obtained 46 * from the MMS WAP push notification 47 * @param downloadedIntent if not NULL this <code>PendingIntent</code> is 48 * broadcast when the message is downloaded, or the download is failed 49 */ 50 void downloadMessage(long subId, String callingPkg, String locationUrl, 51 in PendingIntent downloadedIntent); 52 53 /** 54 * Update the status of a pending (send-by-IP) MMS message handled by the carrier app. 55 * If the carrier app fails to send this message, it would be resent via carrier network. 56 * 57 * @param messageRef the reference number of the MMS message. 58 * @param success True if and only if the message was sent successfully. If its value is 59 * false, this message should be resent via carrier network 60 */ 61 void updateMmsSendStatus(int messageRef, boolean success); 62 63 /** 64 * Update the status of a pending (download-by-IP) MMS message handled by the carrier app. 65 * If the carrier app fails to download this message, it would be re-downloaded via carrier 66 * network. 67 * 68 * @param messageRef the reference number of the MMS message. 69 * @param pdu non-empty if downloaded successfully, otherwise, it is empty and the message 70 * will be downloaded via carrier network 71 */ 72 void updateMmsDownloadStatus(int messageRef, in byte[] pdu); 73 74 /** 75 * Get carrier-dependent configuration value as boolean. For example, if multipart SMS 76 * is supported. 77 * 78 * @param name the configuration name 79 * @param defaultValue the default value if fail to find the name 80 */ 81 boolean getCarrierConfigBoolean(String name, boolean defaultValue); 82 83 /** 84 * Get carrier-dependent configuration value as int. For example, the MMS message size limit. 85 * 86 * @param name the configuration name 87 * @param defaultValue the default value if fail to find the name 88 */ 89 int getCarrierConfigInt(String name, int defaultValue); 90 91 /** 92 * Get carrier-dependent configuration value as String. For example, extra HTTP headers for 93 * MMS request. 94 * 95 * @param name the configuration name 96 * @param defaultValue the default value if fail to find the name 97 */ 98 String getCarrierConfigString(String name, String defaultValue); 99 100 /** 101 * Set carrier-dependent configuration value as boolean. For example, if multipart SMS 102 * is supported. 103 * 104 * @param name the configuration name 105 * @param value the configuration value 106 */ 107 void setCarrierConfigBoolean(String callingPkg, String name, boolean value); 108 109 /** 110 * Set carrier-dependent configuration value as int. For example, the MMS message size limit. 111 * 112 * @param name the configuration name 113 * @param value the configuration value 114 */ 115 void setCarrierConfigInt(String callingPkg, String name, int value); 116 117 /** 118 * Set carrier-dependent configuration value as String. For example, extra HTTP headers for 119 * MMS request. 120 * 121 * @param name the configuration name 122 * @param value the configuration value 123 */ 124 void setCarrierConfigString(String callingPkg, String name, String value); 125 126 /** 127 * Import a text message into system's SMS store 128 * 129 * @param callingPkg the calling app's package name 130 * @param address the destination address of the message 131 * @param type the type of the message 132 * @param text the message text 133 * @param timestampMillis the message timestamp in milliseconds 134 * @param seen if the message is seen 135 * @param read if the message is read 136 * @return the message URI, null if failed 137 */ 138 Uri importTextMessage(String callingPkg, String address, int type, String text, 139 long timestampMillis, boolean seen, boolean read); 140 141 /** 142 * Import a multimedia message into system's MMS store 143 * 144 * @param callingPkg the package name of the calling app 145 * @param pdu the PDU of the message to import 146 * @param messageId the optional message id 147 * @param timestampSecs the message timestamp in seconds 148 * @param seen if the message is seen 149 * @param read if the message is read 150 * @return the message URI, null if failed 151 */ 152 Uri importMultimediaMessage(String callingPkg, in byte[] pdu, String messageId, 153 long timestampSecs, boolean seen, boolean read); 154 155 /** 156 * Delete a system stored SMS or MMS message 157 * 158 * @param callingPkg the package name of the calling app 159 * @param messageUri the URI of the stored message 160 * @return true if deletion is successful, false otherwise 161 */ 162 boolean deleteStoredMessage(String callingPkg, in Uri messageUri); 163 164 /** 165 * Delete a system stored SMS or MMS thread 166 * 167 * @param callingPkg the package name of the calling app 168 * @param conversationId the ID of the message conversation 169 * @return true if deletion is successful, false otherwise 170 */ 171 boolean deleteStoredConversation(String callingPkg, long conversationId); 172 173 /** 174 * Update the status properties of a system stored SMS or MMS message, e.g. 175 * the read status of a message, etc. 176 * 177 * @param callingPkg the package name of the calling app 178 * @param messageUri the URI of the stored message 179 * @param statusValues a list of status properties in key-value pairs to update 180 * @return true if deletion is successful, false otherwise 181 */ 182 boolean updateStoredMessageStatus(String callingPkg, in Uri messageUri, 183 in ContentValues statusValues); 184 185 /** 186 * Archive or unarchive a stored conversation 187 * 188 * @param callingPkg the package name of the calling app 189 * @param conversationId the ID of the message conversation 190 * @param archived true to archive the conversation, false otherwise 191 * @return true if update is successful, false otherwise 192 */ 193 boolean archiveStoredConversation(String callingPkg, long conversationId, boolean archived); 194 195 /** 196 * Add a text message draft to system SMS store 197 * 198 * @param callingPkg the package name of the calling app 199 * @param address the destination address of message 200 * @param text the body of the message to send 201 * @return the URI of the stored draft message 202 */ 203 Uri addTextMessageDraft(String callingPkg, String address, String text); 204 205 /** 206 * Add a multimedia message draft to system MMS store 207 * 208 * @param callingPkg the package name of the calling app 209 * @param pdu the PDU data of the draft MMS 210 * @return the URI of the stored draft message 211 */ 212 Uri addMultimediaMessageDraft(String callingPkg, in byte[] pdu); 213 214 /** 215 * Send a system stored MMS message 216 * 217 * This is used for sending a previously sent, but failed-to-send, message or 218 * for sending a text message that has been stored as a draft. 219 * 220 * @param subId the SIM id 221 * @param callingPkg the package name of the calling app 222 * @param messageUri the URI of the stored message 223 * @param sentIntent if not NULL this <code>PendingIntent</code> is 224 * broadcast when the message is successfully sent, or failed 225 */ 226 void sendStoredMessage(long subId, String callingPkg, in Uri messageUri, 227 in PendingIntent sentIntent); 228 229 /** 230 * Turns on/off the flag to automatically write sent/received SMS/MMS messages into system 231 * 232 * When this flag is on, all SMS/MMS sent/received are stored by system automatically 233 * When this flag is off, only SMS/MMS sent by non-default SMS apps are stored by system 234 * automatically 235 * 236 * This flag can only be changed by default SMS apps 237 * 238 * @param callingPkg the name of the calling app package 239 * @param enabled Whether to enable message auto persisting 240 */ 241 void setAutoPersisting(String callingPkg, boolean enabled); 242 243 /** 244 * Get the value of the flag to automatically write sent/received SMS/MMS messages into system 245 * 246 * When this flag is on, all SMS/MMS sent/received are stored by system automatically 247 * When this flag is off, only SMS/MMS sent by non-default SMS apps are stored by system 248 * automatically 249 * 250 * @return the current value of the auto persist flag 251 */ 252 boolean getAutoPersisting(); 253} 254