Enable supression of combined account

This enables the client of the provider to suppress the email combined
account.  Later, the UI can enable a combined account that spans all of
the account types

Change-Id: I77e201f751019240af2274a1f74e2124b9889aab
This commit is contained in:
Paul Westbrook 2014-06-20 00:09:07 -07:00
parent b63b39d03e
commit 4038f464de
2 changed files with 12 additions and 3 deletions

View File

@ -144,6 +144,11 @@ public abstract class EmailContent {
public static String NOTIFIER_AUTHORITY;
public static Uri CONTENT_URI;
public static final String PARAMETER_LIMIT = "limit";
/**
* Query parameter for the UI accounts query to enable suppression of the combined account.
*/
public static final String SUPPRESS_COMBINED_ACCOUNT_PARAM = "suppress_combined";
public static Uri CONTENT_NOTIFIER_URI;
public static Uri PICK_TRASH_FOLDER_URI;
public static Uri PICK_SENT_FOLDER_URI;

View File

@ -1289,7 +1289,11 @@ public class EmailProvider extends ContentProvider
c = uiSearch(uri, projection);
return c;
case UI_ACCTS:
c = uiAccounts(projection);
final String suppressParam =
uri.getQueryParameter(EmailContent.SUPPRESS_COMBINED_ACCOUNT_PARAM);
final boolean suppressCombined =
suppressParam != null && Boolean.parseBoolean(suppressParam);
c = uiAccounts(projection, suppressCombined);
return c;
case UI_UNDO:
return uiUndo(projection);
@ -3801,7 +3805,7 @@ public class EmailProvider extends ContentProvider
return values;
}
private Cursor uiAccounts(String[] uiProjection) {
private Cursor uiAccounts(String[] uiProjection, boolean suppressCombined) {
final Context context = getContext();
final SQLiteDatabase db = getDatabase(context);
final Cursor accountIdCursor =
@ -3809,7 +3813,7 @@ public class EmailProvider extends ContentProvider
final MatrixCursor mc;
try {
boolean combinedAccount = false;
if (accountIdCursor.getCount() > 1) {
if (!suppressCombined && accountIdCursor.getCount() > 1) {
combinedAccount = true;
}
final Bundle extras = new Bundle();