Postpone initialization of notification URIs until the EMAIL_PACKAGE_NAME is known

b/10693908

Change-Id: Ia232dda55e03e02db24040b9d17c383addaff0b0
This commit is contained in:
Tony Mantler 2013-09-11 11:48:38 -07:00
parent 2bae64df29
commit de8b97c72e
1 changed files with 36 additions and 22 deletions

View File

@ -708,29 +708,18 @@ public class EmailProvider extends ContentProvider {
// These URIs are used for specific UI notifications. We don't use EmailContent.CONTENT_URI
// as the base because that gets spammed.
private static final String UI_NOTIFICATION_AUTHORITY =
EmailContent.EMAIL_PACKAGE_NAME + ".uinotifications";
private static final Uri UIPROVIDER_CONVERSATION_NOTIFIER =
Uri.parse("content://" + UI_NOTIFICATION_AUTHORITY + "/uimessages");
private static final Uri UIPROVIDER_FOLDER_NOTIFIER =
Uri.parse("content://" + UI_NOTIFICATION_AUTHORITY + "/uifolder");
private static final Uri UIPROVIDER_FOLDERLIST_NOTIFIER =
Uri.parse("content://" + UI_NOTIFICATION_AUTHORITY + "/uifolders");
private static final Uri UIPROVIDER_ACCOUNT_NOTIFIER =
Uri.parse("content://" + UI_NOTIFICATION_AUTHORITY + "/uiaccount");
// These can't be statically initialized because they depend on EmailContent.AUTHORITY
private static Uri UIPROVIDER_CONVERSATION_NOTIFIER;
private static Uri UIPROVIDER_FOLDER_NOTIFIER;
private static Uri UIPROVIDER_FOLDERLIST_NOTIFIER;
private static Uri UIPROVIDER_ACCOUNT_NOTIFIER;
// Not currently used
/*public static final Uri UIPROVIDER_SETTINGS_NOTIFIER =
Uri.parse("content://" + UI_NOTIFICATION_AUTHORITY + "/uisettings");*/
private static final Uri UIPROVIDER_ATTACHMENT_NOTIFIER =
Uri.parse("content://" + UI_NOTIFICATION_AUTHORITY + "/uiattachment");
private static final Uri UIPROVIDER_ATTACHMENTS_NOTIFIER =
Uri.parse("content://" + UI_NOTIFICATION_AUTHORITY + "/uiattachments");
public static final Uri UIPROVIDER_ALL_ACCOUNTS_NOTIFIER =
Uri.parse("content://" + UI_NOTIFICATION_AUTHORITY + "/uiaccts");
private static final Uri UIPROVIDER_MESSAGE_NOTIFIER =
Uri.parse("content://" + UI_NOTIFICATION_AUTHORITY + "/uimessage");
private static final Uri UIPROVIDER_RECENT_FOLDERS_NOTIFIER =
Uri.parse("content://" + UI_NOTIFICATION_AUTHORITY + "/uirecentfolders");
//public static Uri UIPROVIDER_SETTINGS_NOTIFIER;
private static Uri UIPROVIDER_ATTACHMENT_NOTIFIER;
private static Uri UIPROVIDER_ATTACHMENTS_NOTIFIER;
public static Uri UIPROVIDER_ALL_ACCOUNTS_NOTIFIER;
private static Uri UIPROVIDER_MESSAGE_NOTIFIER;
private static Uri UIPROVIDER_RECENT_FOLDERS_NOTIFIER;
@Override
public Uri insert(Uri uri, ContentValues values) {
@ -880,6 +869,31 @@ public class EmailProvider extends ContentProvider {
Uri.parse("content://" + EmailContent.AUTHORITY + "/status");
EMAIL_APP_MIME_TYPE = context.getString(R.string.application_mime_type);
final String uiNotificationAuthority =
EmailContent.EMAIL_PACKAGE_NAME + ".uinotifications";
UIPROVIDER_CONVERSATION_NOTIFIER =
Uri.parse("content://" + uiNotificationAuthority + "/uimessages");
UIPROVIDER_FOLDER_NOTIFIER =
Uri.parse("content://" + uiNotificationAuthority + "/uifolder");
UIPROVIDER_FOLDERLIST_NOTIFIER =
Uri.parse("content://" + uiNotificationAuthority + "/uifolders");
UIPROVIDER_ACCOUNT_NOTIFIER =
Uri.parse("content://" + uiNotificationAuthority + "/uiaccount");
// Not currently used
/* UIPROVIDER_SETTINGS_NOTIFIER =
Uri.parse("content://" + uiNotificationAuthority + "/uisettings");*/
UIPROVIDER_ATTACHMENT_NOTIFIER =
Uri.parse("content://" + uiNotificationAuthority + "/uiattachment");
UIPROVIDER_ATTACHMENTS_NOTIFIER =
Uri.parse("content://" + uiNotificationAuthority + "/uiattachments");
UIPROVIDER_ALL_ACCOUNTS_NOTIFIER =
Uri.parse("content://" + uiNotificationAuthority + "/uiaccts");
UIPROVIDER_MESSAGE_NOTIFIER =
Uri.parse("content://" + uiNotificationAuthority + "/uimessage");
UIPROVIDER_RECENT_FOLDERS_NOTIFIER =
Uri.parse("content://" + uiNotificationAuthority + "/uirecentfolders");
// All accounts
sURIMatcher.addURI(EmailContent.AUTHORITY, "account", ACCOUNT);
// A specific account