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