diff --git a/res/values/strings.xml b/res/values/strings.xml index 953414cce..00a14ffe6 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -483,6 +483,8 @@ Unable to open connection to server due to security error. Unable to open connection to server. + + Security policies not supported. Please contact your IT department. Edit details diff --git a/src/com/android/email/activity/setup/AccountSetupCheckSettings.java b/src/com/android/email/activity/setup/AccountSetupCheckSettings.java index 9b237730a..21c17d91c 100644 --- a/src/com/android/email/activity/setup/AccountSetupCheckSettings.java +++ b/src/com/android/email/activity/setup/AccountSetupCheckSettings.java @@ -166,6 +166,9 @@ public class AccountSetupCheckSettings extends Activity implements OnClickListen case MessagingException.AUTH_REQUIRED: id = R.string.account_setup_failed_auth_required; break; + case MessagingException.SECURITY_POLICIES_REQUIRED: + id = R.string.account_setup_failed_security_policies_required; + break; case MessagingException.GENERAL_SECURITY: id = R.string.account_setup_failed_security; break; diff --git a/src/com/android/email/mail/MessagingException.java b/src/com/android/email/mail/MessagingException.java index 25d108805..bc27520dd 100644 --- a/src/com/android/email/mail/MessagingException.java +++ b/src/com/android/email/mail/MessagingException.java @@ -43,6 +43,8 @@ public class MessagingException extends Exception { public static final int AUTHENTICATION_FAILED = 5; /** Attempt to create duplicate account */ public static final int DUPLICATE_ACCOUNT = 6; + /** Required security policies not supported */ + public static final int SECURITY_POLICIES_REQUIRED = 7; protected int mExceptionType; diff --git a/src/com/android/exchange/EasSyncService.java b/src/com/android/exchange/EasSyncService.java index f15c18163..ee52bf68d 100644 --- a/src/com/android/exchange/EasSyncService.java +++ b/src/com/android/exchange/EasSyncService.java @@ -214,6 +214,17 @@ public class EasSyncService extends AbstractSyncService { userLog("OPTIONS response without commands or versions; reporting I/O error"); throw new MessagingException(MessagingException.IOERROR); } + + // Run second test here for provisioning failures... + Serializer s = new Serializer(); + userLog("Try folder sync"); + s.start(Tags.FOLDER_FOLDER_SYNC).start(Tags.FOLDER_SYNC_KEY).text("0") + .end().end().done(); + resp = svc.sendHttpClientPost("FolderSync", s.toByteArray()); + code = resp.getStatusLine().getStatusCode(); + if (code == HttpStatus.SC_FORBIDDEN) { + throw new MessagingException(MessagingException.SECURITY_POLICIES_REQUIRED); + } userLog("Validation successful"); return; }