Add a "not synced" state on account

Changed ComposeActivity to only show accounts that have been
initialized

Bug: 6270010
Change-Id: Ia85ee0a1fb3baeab8b7e87599347cfc4027e3a61
diff --git a/src/com/android/mail/providers/UIProvider.java b/src/com/android/mail/providers/UIProvider.java
index 2b5e745..2433814 100644
--- a/src/com/android/mail/providers/UIProvider.java
+++ b/src/com/android/mail/providers/UIProvider.java
@@ -50,6 +50,8 @@
         public static final int USER_MORE_RESULTS = 1<<2;
         // A background sync is in progress
         public static final int BACKGROUND_SYNC = 1<<3;
+        // An initial sync is needed for this Account/Folder to be used
+        public static final int INITIAL_SYNC_NEEDED = 1<<4;
     }
 
     /**
diff --git a/src/com/android/mail/utils/AccountUtils.java b/src/com/android/mail/utils/AccountUtils.java
index b6e6d43..1f7b159 100644
--- a/src/com/android/mail/utils/AccountUtils.java
+++ b/src/com/android/mail/utils/AccountUtils.java
@@ -18,6 +18,7 @@
 import com.android.mail.providers.Account;
 import com.android.mail.providers.MailAppProvider;
 import com.android.mail.providers.UIProvider;
+import com.android.mail.providers.UIProvider.SyncStatus;
 
 import android.accounts.AccountManagerCallback;
 
@@ -80,9 +81,9 @@
             if (accountsCursor != null) {
                 while (accountsCursor.moveToNext()) {
                     account = new Account(accountsCursor);
-                    // TODO: this may need to look at the state of the account if the caller
-                    // is only interested in accounts that are syncing.
-                    accounts.add(account);
+                    if ((account.syncStatus & SyncStatus.INITIAL_SYNC_NEEDED) == 0) {
+                        accounts.add(account);
+                    }
                 }
             }
         } finally {