From d2fd1252d504fa61db9eb8362442cf20f1198e0f Mon Sep 17 00:00:00 2001 From: Marc Blank Date: Fri, 22 Apr 2011 11:27:30 -0700 Subject: [PATCH] Add status code(s) for disabled sync (needed for EAS 14.0) Change-Id: Ie65141c4d83412274dbbc39dffed7c3be394bb84 --- .../src/com/android/emailcommon/mail/MessagingException.java | 2 ++ .../com/android/emailcommon/service/EmailServiceStatus.java | 1 + res/values/strings.xml | 5 +++++ src/com/android/email/Controller.java | 4 +++- src/com/android/email/MessagingExceptionStrings.java | 2 ++ .../email/activity/setup/AccountCheckSettingsFragment.java | 3 +++ 6 files changed, 16 insertions(+), 1 deletion(-) diff --git a/emailcommon/src/com/android/emailcommon/mail/MessagingException.java b/emailcommon/src/com/android/emailcommon/mail/MessagingException.java index ba3cf2383..4a0530372 100644 --- a/emailcommon/src/com/android/emailcommon/mail/MessagingException.java +++ b/emailcommon/src/com/android/emailcommon/mail/MessagingException.java @@ -58,6 +58,8 @@ public class MessagingException extends Exception { public static final int AUTODISCOVER_AUTHENTICATION_RESULT = 12; /** Ambiguous failure; server error or bad credentials */ public static final int AUTHENTICATION_FAILED_OR_SERVER_ERROR = 13; + /** The server refused access */ + public static final int ACCESS_DENIED = 14; protected int mExceptionType; diff --git a/emailcommon/src/com/android/emailcommon/service/EmailServiceStatus.java b/emailcommon/src/com/android/emailcommon/service/EmailServiceStatus.java index 055f79a33..23df3aa16 100644 --- a/emailcommon/src/com/android/emailcommon/service/EmailServiceStatus.java +++ b/emailcommon/src/com/android/emailcommon/service/EmailServiceStatus.java @@ -33,6 +33,7 @@ public interface EmailServiceStatus { public static final int LOGIN_FAILED = 0x16; public static final int SECURITY_FAILURE = 0x17; public static final int ACCOUNT_UNINITIALIZED = 0x18; + public static final int ACCESS_DENIED = 0x19; // Maybe we should automatically retry these? public static final int CONNECTION_ERROR = 0x20; diff --git a/res/values/strings.xml b/res/values/strings.xml index 80bdde883..b2cdd878a 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -776,6 +776,11 @@ save attachment. You entered an incorrect server address or the server requires a protocol version that Email does not support. + + + You do not have permission to sync with this server. Please contact your server\'s + administrator for more information. diff --git a/src/com/android/email/Controller.java b/src/com/android/email/Controller.java index af18efe40..be9d5b249 100644 --- a/src/com/android/email/Controller.java +++ b/src/com/android/email/Controller.java @@ -50,7 +50,6 @@ import android.os.Bundle; import android.os.IBinder; import android.os.RemoteCallbackList; import android.os.RemoteException; -import android.text.TextUtils; import android.util.Log; import java.io.FileNotFoundException; @@ -1579,6 +1578,9 @@ public class Controller { case EmailServiceStatus.SECURITY_FAILURE: return new MessagingException(MessagingException.SECURITY_POLICIES_REQUIRED); + case EmailServiceStatus.ACCESS_DENIED: + return new MessagingException(MessagingException.ACCESS_DENIED); + case EmailServiceStatus.MESSAGE_NOT_FOUND: case EmailServiceStatus.ATTACHMENT_NOT_FOUND: case EmailServiceStatus.FOLDER_NOT_DELETED: diff --git a/src/com/android/email/MessagingExceptionStrings.java b/src/com/android/email/MessagingExceptionStrings.java index 481f5d4f8..1696b92b2 100644 --- a/src/com/android/email/MessagingExceptionStrings.java +++ b/src/com/android/email/MessagingExceptionStrings.java @@ -45,6 +45,8 @@ public class MessagingExceptionStrings { // where the security policy needs to be updated. case MessagingException.SECURITY_POLICIES_REQUIRED: return R.string.account_setup_failed_security; + case MessagingException.ACCESS_DENIED: + return R.string.account_setup_failed_access_denied; } return R.string.status_network_error; // default } diff --git a/src/com/android/email/activity/setup/AccountCheckSettingsFragment.java b/src/com/android/email/activity/setup/AccountCheckSettingsFragment.java index 2ca214b50..f2f53d7d0 100644 --- a/src/com/android/email/activity/setup/AccountCheckSettingsFragment.java +++ b/src/com/android/email/activity/setup/AccountCheckSettingsFragment.java @@ -617,6 +617,9 @@ public class AccountCheckSettingsFragment extends Fragment { case MessagingException.SECURITY_POLICIES_UNSUPPORTED: id = R.string.account_setup_failed_security_policies_unsupported; break; + case MessagingException.ACCESS_DENIED: + id = R.string.account_setup_failed_access_denied; + break; case MessagingException.PROTOCOL_VERSION_UNSUPPORTED: id = R.string.account_setup_failed_protocol_unsupported; break;