summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Westbrook <pwestbro@google.com>2014-06-17 03:18:11 -0700
committerGreg Bullock <gregbullock@google.com>2014-06-17 15:47:33 +0200
commite817be135332c4060b5985ff830e3ce555043a43 (patch)
tree63260b1376888ad2a4b8c438d567dc5c6797cdba
parent57dbc3bf028008f9d23c2caa7908bcf4f4bfb3f7 (diff)
downloadandroid_packages_apps_Email-e817be135332c4060b5985ff830e3ce555043a43.tar.gz
android_packages_apps_Email-e817be135332c4060b5985ff830e3ce555043a43.tar.bz2
android_packages_apps_Email-e817be135332c4060b5985ff830e3ce555043a43.zip
Specify compose activity with resource.
Allow the compose activity, that the account reconciler attempts to enabled/disable, to be able to be specified via resources. This allows the various build targets to change the activity that is enabled/disabled, or to not attempt to do this at all Change-Id: I7c91c2c179316a3aac910a38d7dd0025076b085a
-rw-r--r--res/values/strings.xml3
-rw-r--r--src/com/android/email/provider/AccountReconciler.java24
2 files changed, 17 insertions, 10 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 0717759c0..0c7709861 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -824,4 +824,7 @@
<!-- This message indicates no quick responses exist to choose from -->
<string name="no_quick_responses">None available</string>
+ <!-- Activity name of the compose activity that should be reconciled -->
+ <string name="reconciliation_compose_activity_name" translatable="false">com.android.email.activity.ComposeActivityEmail</string>
+
</resources>
diff --git a/src/com/android/email/provider/AccountReconciler.java b/src/com/android/email/provider/AccountReconciler.java
index bcfb675c7..67e3c3b08 100644
--- a/src/com/android/email/provider/AccountReconciler.java
+++ b/src/com/android/email/provider/AccountReconciler.java
@@ -244,16 +244,20 @@ public class AccountReconciler {
}
}
- // If there are no accounts remaining after reconciliation, disable the compose activity
- final boolean enableCompose = emailProviderAccounts.size() - accountsDeleted > 0;
- final ComponentName componentName =
- new ComponentName(context, ComposeActivityEmail.class.getName());
- context.getPackageManager().setComponentEnabledSetting(componentName,
- enableCompose ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED :
- PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
- PackageManager.DONT_KILL_APP);
- LogUtils.d(LogUtils.TAG, "Setting compose activity to "
- + (enableCompose ? "enabled" : "disabled"));
+ final String composeActivityName =
+ context.getString(R.string.reconciliation_compose_activity_name);
+ if (!TextUtils.isEmpty(composeActivityName)) {
+ // If there are no accounts remaining after reconciliation, disable the compose activity
+ final boolean enableCompose = emailProviderAccounts.size() - accountsDeleted > 0;
+ final ComponentName componentName = new ComponentName(context, composeActivityName);
+ context.getPackageManager().setComponentEnabledSetting(componentName,
+ enableCompose ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED :
+ PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
+ PackageManager.DONT_KILL_APP);
+ LogUtils.d(LogUtils.TAG, "Setting compose activity to "
+ + (enableCompose ? "enabled" : "disabled"));
+ }
+
// If an account has been deleted, the simplest thing is just to kill our process.
// Otherwise we might have a service running trying to do something for the account