Merge "Additional work on new Event upload to EAS server"
diff --git a/Android.mk b/Android.mk
index 1fd0799..357d17e 100644
--- a/Android.mk
+++ b/Android.mk
@@ -19,8 +19,8 @@
 
 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/exchange/EasOutboxService.java b/src/com/android/exchange/EasOutboxService.java
index 38c9603..d827d51 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.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 63f1587..544a82f 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.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 80d310f..0000000
--- 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 697548c..0000000
--- 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 a790645..0000000
--- 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 a789c4a..0000000
--- 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 648fc80..5ed0047 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.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;