am e817be13: Specify compose activity with resource.

* commit 'e817be135332c4060b5985ff830e3ce555043a43':
  Specify compose activity with resource.
This commit is contained in:
Paul Westbrook 2014-07-16 19:17:12 +00:00 committed by Android Git Automerger
commit 18ffb4a2c4
2 changed files with 17 additions and 10 deletions

View File

@ -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>

View File

@ -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