blob: e0e0a4a812e4d79887a486fd13e6ba95466ac1f9 [file] [log] [blame]
Ye Wen369a1072014-06-18 18:17:52 -07001/*
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;
Ye Wen295f2192014-07-09 16:51:49 -070020import android.content.ContentValues;
21import android.net.Uri;
Shri Borde72379722014-09-02 09:48:49 -070022import android.os.Bundle;
Ye Wen369a1072014-06-18 18:17:52 -070023
24/**
25 * Service interface to handle MMS API requests
26 */
27interface IMms {
28 /**
29 * Send an MMS message
30 *
Ye Wen295f2192014-07-09 16:51:49 -070031 * @param subId the SIM id
Ye Wen369a1072014-06-18 18:17:52 -070032 * @param callingPkg the package name of the calling app
Julian Odell31ef14d2014-08-25 17:53:52 -070033 * @param contentUri the content uri from which to read MMS message encoded in standard MMS
34 * PDU format
Ye Wen369a1072014-06-18 18:17:52 -070035 * @param locationUrl the optional location url for where this message should be sent to
Ye Wen63c00c42014-08-01 13:38:58 -070036 * @param configOverrides the carrier-specific messaging configuration values to override for
Jonathan Basseri6694f2a2015-06-10 09:11:49 -070037 * sending the message. See {@link android.telephony.SmsManager} for the value names and types.
Ye Wen369a1072014-06-18 18:17:52 -070038 * @param sentIntent if not NULL this <code>PendingIntent</code> is
39 * broadcast when the message is successfully sent, or failed
Tom Taylor03079ec2020-01-24 10:21:50 -080040 * @param messageId An id that uniquely identifies the message requested to be sent.
Ye Wen369a1072014-06-18 18:17:52 -070041 */
Wink Saville63f03dd2014-10-23 10:44:45 -070042 void sendMessage(int subId, String callingPkg, in Uri contentUri,
Tom Taylor03079ec2020-01-24 10:21:50 -080043 String locationUrl, in Bundle configOverrides, in PendingIntent sentIntent,
44 in long messageId);
Ye Wen369a1072014-06-18 18:17:52 -070045
46 /**
47 * Download an MMS message using known location and transaction id
48 *
Ye Wen295f2192014-07-09 16:51:49 -070049 * @param subId the SIM id
Ye Wen369a1072014-06-18 18:17:52 -070050 * @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 Odell31ef14d2014-08-25 17:53:52 -070053 * @param contentUri a contentUri to which the downloaded MMS message will be written
Ye Wen63c00c42014-08-01 13:38:58 -070054 * @param configOverrides the carrier-specific messaging configuration values to override for
Jonathan Basseri6694f2a2015-06-10 09:11:49 -070055 * downloading the message. See {@link android.telephony.SmsManager} for the value names and
56 * types.
Ye Wen369a1072014-06-18 18:17:52 -070057 * @param downloadedIntent if not NULL this <code>PendingIntent</code> is
58 * broadcast when the message is downloaded, or the download is failed
Tom Taylor03079ec2020-01-24 10:21:50 -080059 * @param messageId An id that uniquely identifies the message requested to be downloaded.
60 */
Wink Saville63f03dd2014-10-23 10:44:45 -070061 void downloadMessage(int subId, String callingPkg, String locationUrl,
Ye Wen8179c2a2014-09-04 15:36:11 -070062 in Uri contentUri, in Bundle configOverrides,
Tom Taylor03079ec2020-01-24 10:21:50 -080063 in PendingIntent downloadedIntent, in long messageId);
Ye Wen99746902014-07-03 14:04:34 -070064
65 /**
Ye Wen295f2192014-07-09 16:51:49 -070066 * 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 Odell31ef14d2014-08-25 17:53:52 -070084 * @param contentUri the content uri from which to read PDU of the message to import
Ye Wen295f2192014-07-09 16:51:49 -070085 * @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 Odell31ef14d2014-08-25 17:53:52 -070091 Uri importMultimediaMessage(String callingPkg, in Uri contentUri, String messageId,
Ye Wen295f2192014-07-09 16:51:49 -070092 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 Wena3dbd102014-07-29 10:42:25 -0700125 * 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 Wen295f2192014-07-09 16:51:49 -0700135 * 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 Odell31ef14d2014-08-25 17:53:52 -0700148 * @param contentUri the content Uri from which to read PDU data of the draft MMS
Ye Wen295f2192014-07-09 16:51:49 -0700149 * @return the URI of the stored draft message
150 */
Julian Odell31ef14d2014-08-25 17:53:52 -0700151 Uri addMultimediaMessageDraft(String callingPkg, in Uri contentUri);
Ye Wen295f2192014-07-09 16:51:49 -0700152
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 Wen63c00c42014-08-01 13:38:58 -0700162 * @param configOverrides the carrier-specific messaging configuration values to override for
Jonathan Basseri6694f2a2015-06-10 09:11:49 -0700163 * sending the message. See {@link android.telephony.SmsManager} for the value names and types.
Ye Wen295f2192014-07-09 16:51:49 -0700164 * @param sentIntent if not NULL this <code>PendingIntent</code> is
165 * broadcast when the message is successfully sent, or failed
166 */
Wink Saville63f03dd2014-10-23 10:44:45 -0700167 void sendStoredMessage(int subId, String callingPkg, in Uri messageUri,
Ye Wen8179c2a2014-09-04 15:36:11 -0700168 in Bundle configOverrides, in PendingIntent sentIntent);
Ye Wen99664292014-07-14 16:19:04 -0700169
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 Wen369a1072014-06-18 18:17:52 -0700194}