From bb9b5163c19449efab72746351479d193be5e122 Mon Sep 17 00:00:00 2001 From: Makoto Onuki Date: Fri, 29 Jan 2010 10:25:43 -0800 Subject: Move non-exchange specific classes to com.android.email.service. --- Android.mk | 4 +- src/com/android/email/Controller.java | 6 +- src/com/android/email/activity/MessageView.java | 2 +- .../email/service/EmailServiceConstants.java | 23 ++++++++ .../android/email/service/EmailServiceProxy.java | 2 - .../android/email/service/EmailServiceStatus.java | 37 ++++++++++++ src/com/android/email/service/IEmailService.aidl | 47 +++++++++++++++ .../email/service/IEmailServiceCallback.aidl | 68 ++++++++++++++++++++++ src/com/android/exchange/EasOutboxService.java | 1 + src/com/android/exchange/EasSyncService.java | 1 + .../android/exchange/EmailServiceConstants.java | 23 -------- src/com/android/exchange/EmailServiceStatus.java | 37 ------------ src/com/android/exchange/IEmailService.aidl | 48 --------------- .../android/exchange/IEmailServiceCallback.aidl | 68 ---------------------- src/com/android/exchange/SyncManager.java | 2 + 15 files changed, 185 insertions(+), 184 deletions(-) create mode 100644 src/com/android/email/service/EmailServiceConstants.java create mode 100644 src/com/android/email/service/EmailServiceStatus.java create mode 100644 src/com/android/email/service/IEmailService.aidl create mode 100644 src/com/android/email/service/IEmailServiceCallback.aidl delete mode 100644 src/com/android/exchange/EmailServiceConstants.java delete mode 100644 src/com/android/exchange/EmailServiceStatus.java delete mode 100644 src/com/android/exchange/IEmailService.aidl delete mode 100644 src/com/android/exchange/IEmailServiceCallback.aidl diff --git a/Android.mk b/Android.mk index 1fd0799b6..357d17e35 100644 --- a/Android.mk +++ b/Android.mk @@ -19,8 +19,8 @@ LOCAL_MODULE_TAGS := optional LOCAL_SRC_FILES := $(call all-java-files-under, src) LOCAL_SRC_FILES += \ - src/com/android/exchange/IEmailService.aidl \ - src/com/android/exchange/IEmailServiceCallback.aidl + src/com/android/email/service/IEmailService.aidl \ + src/com/android/email/service/IEmailServiceCallback.aidl LOCAL_PACKAGE_NAME := Email diff --git a/src/com/android/email/Controller.java b/src/com/android/email/Controller.java index 1180912bd..9fcdd80a9 100644 --- a/src/com/android/email/Controller.java +++ b/src/com/android/email/Controller.java @@ -28,9 +28,9 @@ import com.android.email.provider.EmailContent.MailboxColumns; import com.android.email.provider.EmailContent.Message; import com.android.email.provider.EmailContent.MessageColumns; import com.android.email.service.EmailServiceProxy; -import com.android.exchange.EmailServiceStatus; -import com.android.exchange.IEmailService; -import com.android.exchange.IEmailServiceCallback; +import com.android.email.service.EmailServiceStatus; +import com.android.email.service.IEmailService; +import com.android.email.service.IEmailServiceCallback; import com.android.exchange.SyncManager; import android.content.ContentResolver; diff --git a/src/com/android/email/activity/MessageView.java b/src/com/android/email/activity/MessageView.java index 9a4e25bf7..757ba5dc6 100644 --- a/src/com/android/email/activity/MessageView.java +++ b/src/com/android/email/activity/MessageView.java @@ -31,7 +31,7 @@ import com.android.email.provider.EmailContent.Attachment; import com.android.email.provider.EmailContent.Body; import com.android.email.provider.EmailContent.BodyColumns; import com.android.email.provider.EmailContent.Message; -import com.android.exchange.EmailServiceConstants; +import com.android.email.service.EmailServiceConstants; import org.apache.commons.io.IOUtils; diff --git a/src/com/android/email/service/EmailServiceConstants.java b/src/com/android/email/service/EmailServiceConstants.java new file mode 100644 index 000000000..8a5238f28 --- /dev/null +++ b/src/com/android/email/service/EmailServiceConstants.java @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2010 The Android Open Source Project. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.email.service; + +public class EmailServiceConstants { + public static final int MEETING_REQUEST_ACCEPTED = 1; + public static final int MEETING_REQUEST_TENTATIVE = 2; + public static final int MEETING_REQUEST_DECLINED = 3; +} diff --git a/src/com/android/email/service/EmailServiceProxy.java b/src/com/android/email/service/EmailServiceProxy.java index d5174fdac..98186cfd3 100644 --- a/src/com/android/email/service/EmailServiceProxy.java +++ b/src/com/android/email/service/EmailServiceProxy.java @@ -17,8 +17,6 @@ package com.android.email.service; import com.android.email.mail.MessagingException; -import com.android.exchange.IEmailService; -import com.android.exchange.IEmailServiceCallback; import android.content.ComponentName; import android.content.Context; diff --git a/src/com/android/email/service/EmailServiceStatus.java b/src/com/android/email/service/EmailServiceStatus.java new file mode 100644 index 000000000..adfda254c --- /dev/null +++ b/src/com/android/email/service/EmailServiceStatus.java @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2008-2009 Marc Blank + * Licensed to The Android Open Source Project. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.email.service; + +/** + * Definitions of service status codes returned to IEmailServiceCallback's status method + */ +public interface EmailServiceStatus { + public static final int SUCCESS = 0; + public static final int IN_PROGRESS = 1; + + public static final int MESSAGE_NOT_FOUND = 0x10; + public static final int ATTACHMENT_NOT_FOUND = 0x11; + public static final int FOLDER_NOT_DELETED = 0x12; + public static final int FOLDER_NOT_RENAMED = 0x13; + public static final int FOLDER_NOT_CREATED = 0x14; + public static final int REMOTE_EXCEPTION = 0x15; + public static final int LOGIN_FAILED = 0x16; + + // Maybe we should automatically retry these? + public static final int CONNECTION_ERROR = 0x20; +} diff --git a/src/com/android/email/service/IEmailService.aidl b/src/com/android/email/service/IEmailService.aidl new file mode 100644 index 000000000..545783b13 --- /dev/null +++ b/src/com/android/email/service/IEmailService.aidl @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2008-2009 Marc Blank + * Licensed to The Android Open Source Project. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.android.email.service; + +import com.android.email.service.IEmailServiceCallback; +import android.os.Bundle; + +interface IEmailService { + int validate(in String protocol, in String host, in String userName, in String password, + int port, boolean ssl, boolean trustCertificates) ; + + void startSync(long mailboxId); + void stopSync(long mailboxId); + + void loadMore(long messageId); + void loadAttachment(long attachmentId, String destinationFile, String contentUriString); + + void updateFolderList(long accountId); + + boolean createFolder(long accountId, String name); + boolean deleteFolder(long accountId, String name); + boolean renameFolder(long accountId, String oldName, String newName); + + void setCallback(IEmailServiceCallback cb); + + void setLogging(int on); + + void hostChanged(long accountId); + + Bundle autoDiscover(String userName, String password); + + void sendMeetingResponse(long messageId, int response); +} \ No newline at end of file diff --git a/src/com/android/email/service/IEmailServiceCallback.aidl b/src/com/android/email/service/IEmailServiceCallback.aidl new file mode 100644 index 000000000..ac2cb419e --- /dev/null +++ b/src/com/android/email/service/IEmailServiceCallback.aidl @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2008-2009 Marc Blank + * Licensed to The Android Open Source Project. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.email.service; + +oneway interface IEmailServiceCallback { + /* + * Ordinary results: + * statuscode = 1, progress = 0: "starting" + * statuscode = 0, progress = n/a: "finished" + * + * If there is an error, it must be reported as follows: + * statuscode = err, progress = n/a: "stopping due to error" + * + * *Optionally* a callback can also include intermediate values from 1..99 e.g. + * statuscode = 1, progress = 0: "starting" + * statuscode = 1, progress = 30: "working" + * statuscode = 1, progress = 60: "working" + * statuscode = 0, progress = n/a: "finished" + */ + + /** + * Callback to indicate that an account is being synced (updating folder list) + * accountId = the account being synced + * statusCode = 0 for OK, 1 for progress, other codes for error + * progress = 0 for "start", 1..100 for optional progress reports + */ + void syncMailboxListStatus(long accountId, int statusCode, int progress); + + /** + * Callback to indicate that a mailbox is being synced + * mailboxId = the mailbox being synced + * statusCode = 0 for OK, 1 for progress, other codes for error + * progress = 0 for "start", 1..100 for optional progress reports + */ + void syncMailboxStatus(long mailboxId, int statusCode, int progress); + + /** + * Callback to indicate that a particular attachment is being synced + * messageId = the message that owns the attachment + * attachmentId = the attachment being synced + * statusCode = 0 for OK, 1 for progress, other codes for error + * progress = 0 for "start", 1..100 for optional progress reports + */ + void loadAttachmentStatus(long messageId, long attachmentId, int statusCode, int progress); + + /** + * Callback to indicate that a particular message is being sent + * messageId = the message being sent + * statusCode = 0 for OK, 1 for progress, other codes for error + * progress = 0 for "start", 1..100 for optional progress reports + */ + void sendMessageStatus(long messageId, String subject, int statusCode, int progress); +} diff --git a/src/com/android/exchange/EasOutboxService.java b/src/com/android/exchange/EasOutboxService.java index 38c96030e..d827d51b7 100644 --- a/src/com/android/exchange/EasOutboxService.java +++ b/src/com/android/exchange/EasOutboxService.java @@ -26,6 +26,7 @@ import com.android.email.provider.EmailContent.MailboxColumns; import com.android.email.provider.EmailContent.Message; import com.android.email.provider.EmailContent.MessageColumns; import com.android.email.provider.EmailContent.SyncColumns; +import com.android.email.service.EmailServiceStatus; import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; diff --git a/src/com/android/exchange/EasSyncService.java b/src/com/android/exchange/EasSyncService.java index 63f1587f9..544a82fa5 100644 --- a/src/com/android/exchange/EasSyncService.java +++ b/src/com/android/exchange/EasSyncService.java @@ -29,6 +29,7 @@ import com.android.email.provider.EmailContent.Mailbox; import com.android.email.provider.EmailContent.MailboxColumns; import com.android.email.provider.EmailContent.Message; import com.android.email.service.EmailServiceProxy; +import com.android.email.service.EmailServiceStatus; import com.android.exchange.adapter.AbstractSyncAdapter; import com.android.exchange.adapter.AccountSyncAdapter; import com.android.exchange.adapter.CalendarSyncAdapter; diff --git a/src/com/android/exchange/EmailServiceConstants.java b/src/com/android/exchange/EmailServiceConstants.java deleted file mode 100644 index 80d310faa..000000000 --- a/src/com/android/exchange/EmailServiceConstants.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2010 The Android Open Source Project. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.exchange; - -public class EmailServiceConstants { - public static final int MEETING_REQUEST_ACCEPTED = 1; - public static final int MEETING_REQUEST_TENTATIVE = 2; - public static final int MEETING_REQUEST_DECLINED = 3; -} diff --git a/src/com/android/exchange/EmailServiceStatus.java b/src/com/android/exchange/EmailServiceStatus.java deleted file mode 100644 index 697548cf2..000000000 --- a/src/com/android/exchange/EmailServiceStatus.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (C) 2008-2009 Marc Blank - * Licensed to The Android Open Source Project. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.exchange; - -/** - * Definitions of service status codes returned to IEmailServiceCallback's status method - */ -public interface EmailServiceStatus { - public static final int SUCCESS = 0; - public static final int IN_PROGRESS = 1; - - public static final int MESSAGE_NOT_FOUND = 0x10; - public static final int ATTACHMENT_NOT_FOUND = 0x11; - public static final int FOLDER_NOT_DELETED = 0x12; - public static final int FOLDER_NOT_RENAMED = 0x13; - public static final int FOLDER_NOT_CREATED = 0x14; - public static final int REMOTE_EXCEPTION = 0x15; - public static final int LOGIN_FAILED = 0x16; - - // Maybe we should automatically retry these? - public static final int CONNECTION_ERROR = 0x20; -} diff --git a/src/com/android/exchange/IEmailService.aidl b/src/com/android/exchange/IEmailService.aidl deleted file mode 100644 index a790645d2..000000000 --- a/src/com/android/exchange/IEmailService.aidl +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2008-2009 Marc Blank - * Licensed to The Android Open Source Project. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.android.exchange; - -import com.android.exchange.IEmailServiceCallback; -import com.android.email.provider.EmailContent; -import android.os.Bundle; - -interface IEmailService { - int validate(in String protocol, in String host, in String userName, in String password, - int port, boolean ssl, boolean trustCertificates) ; - - void startSync(long mailboxId); - void stopSync(long mailboxId); - - void loadMore(long messageId); - void loadAttachment(long attachmentId, String destinationFile, String contentUriString); - - void updateFolderList(long accountId); - - boolean createFolder(long accountId, String name); - boolean deleteFolder(long accountId, String name); - boolean renameFolder(long accountId, String oldName, String newName); - - void setCallback(IEmailServiceCallback cb); - - void setLogging(int on); - - void hostChanged(long accountId); - - Bundle autoDiscover(String userName, String password); - - void sendMeetingResponse(long messageId, int response); -} \ No newline at end of file diff --git a/src/com/android/exchange/IEmailServiceCallback.aidl b/src/com/android/exchange/IEmailServiceCallback.aidl deleted file mode 100644 index a789c4a02..000000000 --- a/src/com/android/exchange/IEmailServiceCallback.aidl +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (C) 2008-2009 Marc Blank - * Licensed to The Android Open Source Project. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.exchange; - -oneway interface IEmailServiceCallback { - /* - * Ordinary results: - * statuscode = 1, progress = 0: "starting" - * statuscode = 0, progress = n/a: "finished" - * - * If there is an error, it must be reported as follows: - * statuscode = err, progress = n/a: "stopping due to error" - * - * *Optionally* a callback can also include intermediate values from 1..99 e.g. - * statuscode = 1, progress = 0: "starting" - * statuscode = 1, progress = 30: "working" - * statuscode = 1, progress = 60: "working" - * statuscode = 0, progress = n/a: "finished" - */ - - /** - * Callback to indicate that an account is being synced (updating folder list) - * accountId = the account being synced - * statusCode = 0 for OK, 1 for progress, other codes for error - * progress = 0 for "start", 1..100 for optional progress reports - */ - void syncMailboxListStatus(long accountId, int statusCode, int progress); - - /** - * Callback to indicate that a mailbox is being synced - * mailboxId = the mailbox being synced - * statusCode = 0 for OK, 1 for progress, other codes for error - * progress = 0 for "start", 1..100 for optional progress reports - */ - void syncMailboxStatus(long mailboxId, int statusCode, int progress); - - /** - * Callback to indicate that a particular attachment is being synced - * messageId = the message that owns the attachment - * attachmentId = the attachment being synced - * statusCode = 0 for OK, 1 for progress, other codes for error - * progress = 0 for "start", 1..100 for optional progress reports - */ - void loadAttachmentStatus(long messageId, long attachmentId, int statusCode, int progress); - - /** - * Callback to indicate that a particular message is being sent - * messageId = the message being sent - * statusCode = 0 for OK, 1 for progress, other codes for error - * progress = 0 for "start", 1..100 for optional progress reports - */ - void sendMessageStatus(long messageId, String subject, int statusCode, int progress); -} diff --git a/src/com/android/exchange/SyncManager.java b/src/com/android/exchange/SyncManager.java index 648fc8006..5ed0047ad 100644 --- a/src/com/android/exchange/SyncManager.java +++ b/src/com/android/exchange/SyncManager.java @@ -29,6 +29,8 @@ import com.android.email.provider.EmailContent.Mailbox; import com.android.email.provider.EmailContent.MailboxColumns; import com.android.email.provider.EmailContent.Message; import com.android.email.provider.EmailContent.SyncColumns; +import com.android.email.service.IEmailService; +import com.android.email.service.IEmailServiceCallback; import com.android.exchange.utility.FileLogger; import org.apache.http.conn.ClientConnectionManager; -- cgit v1.2.3