summaryrefslogtreecommitdiffstats
path: root/unified_src
diff options
context:
space:
mode:
authorPaul Westbrook <pwestbro@google.com>2012-02-07 15:23:42 -0800
committerPaul Westbrook <pwestbro@google.com>2012-02-08 10:28:08 -0800
commit77177b171c483d485bdbff0178564394e8f57d0f (patch)
tree516f9c43c4d0ad02d66cd92124aad62603c5eadf /unified_src
parente7a2422ebff93a73340aceab4c006909bccca8a9 (diff)
downloadandroid_packages_apps_UnifiedEmail-77177b171c483d485bdbff0178564394e8f57d0f.tar.gz
android_packages_apps_UnifiedEmail-77177b171c483d485bdbff0178564394e8f57d0f.tar.bz2
android_packages_apps_UnifiedEmail-77177b171c483d485bdbff0178564394e8f57d0f.zip
Start of restructuring to allow overlays include subset of providers
This allows us to build a UnifiedEmail that supports all providers and use this base to build applications that only supports a subset of the providers Made AccountCacheProvider and ConversationProvider abstract. This allows the extending class to specify the authority that should be used (This allows both UnifiedEmail and Gmail to be installed at the same time) Change-Id: I31295f4630906e7182e423fcbb7b47c33ba4cd4f
Diffstat (limited to 'unified_src')
-rw-r--r--unified_src/README9
-rw-r--r--unified_src/com/android/mail/browse/UnifiedConversationProvider.java33
-rw-r--r--unified_src/com/android/mail/providers/UnifiedAccountCacheProvider.java32
-rw-r--r--unified_src/com/android/mail/providers/protos/boot/AccountReceiver.java38
4 files changed, 112 insertions, 0 deletions
diff --git a/unified_src/README b/unified_src/README
new file mode 100644
index 000000000..ea96076c3
--- /dev/null
+++ b/unified_src/README
@@ -0,0 +1,9 @@
+This is a temporary directory that is being used to enable email and Gmail content to be shown
+in the UnifiedEmail application
+
+This code should only be used for development. For shipping, this code (or something similar)
+should go in the Gmail/Email overlay of UnifiedEmail. But for now, this allows us to use a single
+application to test multiple content sources
+
+This code is just a shim to register existing accounts (Gmail and Email) from the device with the
+AccountCacheProvider. All subsequent uris will actually be handled by the appropriate application.
diff --git a/unified_src/com/android/mail/browse/UnifiedConversationProvider.java b/unified_src/com/android/mail/browse/UnifiedConversationProvider.java
new file mode 100644
index 000000000..bde2a209b
--- /dev/null
+++ b/unified_src/com/android/mail/browse/UnifiedConversationProvider.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (C) 2012 Google Inc.
+ * Licensed to The Android Open Source Project.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *******************************************************************************/
+
+package com.android.mail.browse;
+
+import com.android.mail.browse.ConversationCursor.ConversationProvider;
+
+import java.lang.Override;
+
+public class UnifiedConversationProvider extends ConversationProvider {
+ // The authority of our conversation provider (a forwarding provider)
+ // This string must match the declaration in AndroidManifest.xml
+ private static final String sAuthority = "com.android.mail.conversation.provider";
+
+ @Override
+ protected String getAuthority() {
+ return sAuthority;
+ }
+} \ No newline at end of file
diff --git a/unified_src/com/android/mail/providers/UnifiedAccountCacheProvider.java b/unified_src/com/android/mail/providers/UnifiedAccountCacheProvider.java
new file mode 100644
index 000000000..2308e9653
--- /dev/null
+++ b/unified_src/com/android/mail/providers/UnifiedAccountCacheProvider.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (C) 2012 Google Inc.
+ * Licensed to The Android Open Source Project.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *******************************************************************************/
+
+package com.android.mail.providers;
+
+
+import java.lang.Override;
+
+public class UnifiedAccountCacheProvider extends AccountCacheProvider {
+ // The authority of our conversation provider (a forwarding provider)
+ // This string must match the declaration in AndroidManifest.xml
+ private static final String sAuthority = "com.android.mail.accountcache";
+
+ @Override
+ protected String getAuthority() {
+ return sAuthority;
+ }
+} \ No newline at end of file
diff --git a/unified_src/com/android/mail/providers/protos/boot/AccountReceiver.java b/unified_src/com/android/mail/providers/protos/boot/AccountReceiver.java
new file mode 100644
index 000000000..dafc03f5d
--- /dev/null
+++ b/unified_src/com/android/mail/providers/protos/boot/AccountReceiver.java
@@ -0,0 +1,38 @@
+/**
+ * Copyright (c) 2011, Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.android.mail.providers.protos.boot;
+
+import com.android.mail.providers.protos.mock.MockUiProvider;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+
+public class AccountReceiver extends BroadcastReceiver {
+ /**
+ * Intent used to notify interested parties that the Mail provider has been created.
+ */
+ public static final String ACTION_PROVIDER_CREATED
+ = "com.android.mail.providers.protos.boot.intent.ACTION_PROVIDER_CREATED";
+
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ MockUiProvider.initializeMockProvider();
+ intent.setClass(context, GmailAccountService.class);
+ context.startService(intent);
+ intent.setClass(context, EmailAccountService.class);
+ context.startService(intent);
+ }
+}