Add flags for server-side search support

* Also, a convenience method to test the base flag
* Follow-up CL will add these flags for Exchange

Change-Id: I38dc1d19e89805989e674c17919db238b4913a1c
This commit is contained in:
Marc Blank 2011-06-13 16:47:29 -07:00
parent f5418f1f93
commit e57a83d39a
1 changed files with 14 additions and 3 deletions

View File

@ -14,9 +14,6 @@ import android.os.Parcelable;
import android.os.RemoteException;
import com.android.emailcommon.provider.EmailContent.AccountColumns;
import com.android.emailcommon.provider.EmailContent.MailboxColumns;
import com.android.emailcommon.provider.EmailContent.Message;
import com.android.emailcommon.provider.EmailContent.MessageColumns;
import com.android.emailcommon.utility.Utility;
import java.util.ArrayList;
@ -78,6 +75,11 @@ public final class Account extends EmailContent implements AccountColumns, Parce
// sync mailboxes in this account automatically. A manual sync request to sync a mailbox
// with sync disabled SHOULD try to sync and report any failure result via the UI.
public static final int FLAGS_SYNC_DISABLED = 1<<10;
// Whether or not server-side search is supported by this account
public static final int FLAGS_SUPPORTS_SEARCH = 1<<11;
// Whether or not server-side search supports global search (i.e. all mailboxes); only valid
// if FLAGS_SUPPORTS_SEARCH is true
public static final int FLAGS_SUPPORTS_GLOBAL_SEARCH = 1<<12;
// Deletion policy (see FLAGS_DELETE_POLICY_MASK, above)
public static final int DELETE_POLICY_NEVER = 0;
@ -450,6 +452,15 @@ public final class Account extends EmailContent implements AccountColumns, Parce
return "eas".equals(protocol) || "imap".equals(protocol);
}
/**
* @return true if the account supports "search".
*/
public static boolean supportsServerSearch(Context context, long accountId) {
Account account = Account.restoreAccountWithId(context, accountId);
if (account == null) return false;
return (account.mFlags & Account.FLAGS_SUPPORTS_SEARCH) != 0;
}
/**
* Set the account to be the default account. If this is set to "true", when the account
* is saved, all other accounts will have the same value set to "false".