Don't sync account mailbox when master sync is off

Bug: 5908578
Change-Id: I5536f38631c69c6620ae91d0a01c5dcd39e6cf7a
diff --git a/src/com/android/exchange/ExchangeService.java b/src/com/android/exchange/ExchangeService.java
index 2521f3f..aa07c1e 100644
--- a/src/com/android/exchange/ExchangeService.java
+++ b/src/com/android/exchange/ExchangeService.java
@@ -2181,9 +2181,12 @@
     private boolean isMailboxSyncable(Account account, int type) {
         // This 'if' statement performs checks to see whether or not a mailbox is a
         // candidate for syncing based on policies, user settings, & other restrictions
-        if (type == Mailbox.TYPE_OUTBOX || type == Mailbox.TYPE_EAS_ACCOUNT_MAILBOX) {
-            // Outbox and account mailbox are always syncable
+        if (type == Mailbox.TYPE_OUTBOX) {
+            // Outbox is always syncable
             return true;
+        } else if (type == Mailbox.TYPE_EAS_ACCOUNT_MAILBOX) {
+            // Always sync EAS mailbox unless master sync is off
+            return ContentResolver.getMasterSyncAutomatically();
         } else if (type == Mailbox.TYPE_CONTACTS || type == Mailbox.TYPE_CALENDAR) {
             // Contacts/Calendar obey this setting from ContentResolver
             if (!ContentResolver.getMasterSyncAutomatically()) {