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
This commit is contained in:
parent
57dbc3bf02
commit
e817be1353
@ -824,4 +824,7 @@
|
|||||||
<!-- This message indicates no quick responses exist to choose from -->
|
<!-- This message indicates no quick responses exist to choose from -->
|
||||||
<string name="no_quick_responses">None available</string>
|
<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>
|
</resources>
|
||||||
|
@ -244,16 +244,20 @@ public class AccountReconciler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If there are no accounts remaining after reconciliation, disable the compose activity
|
final String composeActivityName =
|
||||||
final boolean enableCompose = emailProviderAccounts.size() - accountsDeleted > 0;
|
context.getString(R.string.reconciliation_compose_activity_name);
|
||||||
final ComponentName componentName =
|
if (!TextUtils.isEmpty(composeActivityName)) {
|
||||||
new ComponentName(context, ComposeActivityEmail.class.getName());
|
// If there are no accounts remaining after reconciliation, disable the compose activity
|
||||||
context.getPackageManager().setComponentEnabledSetting(componentName,
|
final boolean enableCompose = emailProviderAccounts.size() - accountsDeleted > 0;
|
||||||
enableCompose ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED :
|
final ComponentName componentName = new ComponentName(context, composeActivityName);
|
||||||
PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
|
context.getPackageManager().setComponentEnabledSetting(componentName,
|
||||||
PackageManager.DONT_KILL_APP);
|
enableCompose ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED :
|
||||||
LogUtils.d(LogUtils.TAG, "Setting compose activity to "
|
PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
|
||||||
+ (enableCompose ? "enabled" : "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.
|
// 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
|
// Otherwise we might have a service running trying to do something for the account
|
||||||
|
Loading…
Reference in New Issue
Block a user