1 /*
2  * Copyright (C) 2008-2010 Marc Blank
3  * Licensed to The Android Open Source Project.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 package com.android.emailcommon.service;
19 
20 import com.android.emailcommon.service.HostAuthCompat;
21 import com.android.emailcommon.service.IEmailServiceCallback;
22 import com.android.emailcommon.service.SearchParams;
23 
24 import android.os.Bundle;
25 
26 interface IEmailService {
27     // Core email operations.
28     // Many of these functions return status codes. The valid status codes are defined in
29     // EmailServiceStatus.java
loadAttachment(IEmailServiceCallback cb, long accountId, long attachmentId, boolean background)30     oneway void loadAttachment(IEmailServiceCallback cb, long accountId, long attachmentId,
31             boolean background);
32 
updateFolderList(long accountId)33     void updateFolderList(long accountId);
34 
35     // TODO: For Eas, sync() will also sync the outbox. We should make IMAP and POP work the same
36     // way and get rid of sendMail().
sendMail(long accountId)37     void sendMail(long accountId);
38 
sync(long accountId, inout Bundle syncExtras)39     int sync(long accountId, inout Bundle syncExtras);
40 
41     // Push-related functionality.
42 
43     // Notify the service that the push configuration has changed for an account.
pushModify(long accountId)44     void pushModify(long accountId);
45 
46     // Other email operations.
validate(in HostAuthCompat hostauth)47     Bundle validate(in HostAuthCompat hostauth);
48 
searchMessages(long accountId, in SearchParams params, long destMailboxId)49     int searchMessages(long accountId, in SearchParams params, long destMailboxId);
50 
51     // PIM functionality (not strictly EAS specific).
sendMeetingResponse(long messageId, int response)52     oneway void sendMeetingResponse(long messageId, int response);
53 
54     // Specific to EAS protocol.
55     // TODO: this passes a HostAuth back in the bundle. We should be using a HostAuthCom for that.
autoDiscover(String userName, String password)56     Bundle autoDiscover(String userName, String password);
57 
58     // Service control operations (i.e. does not generate a client-server message).
59     // TODO: We should store the logging flags in the contentProvider, and this call should just
60     // trigger the service to reload the flags.
setLogging(int flags)61     oneway void setLogging(int flags);
62 
deleteExternalAccountPIMData(String emailAddress)63     void deleteExternalAccountPIMData(String emailAddress);
64 
getApiVersion()65     int getApiVersion();
66 }
67