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