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