Merge "Make intents more explicit" into ub-mail-master
This commit is contained in:
commit
10a5f9dba0
emailcommon/src/com/android/emailcommon/service
res/values
src/com/android/email/activity/setup
@ -27,6 +27,7 @@ import android.os.IBinder;
|
||||
import android.os.Looper;
|
||||
import android.os.RemoteException;
|
||||
|
||||
import com.android.emailcommon.provider.EmailContent;
|
||||
import com.android.mail.utils.LogUtils;
|
||||
|
||||
/**
|
||||
@ -59,24 +60,9 @@ public abstract class ServiceProxy {
|
||||
private boolean mTaskCompleted = false;
|
||||
|
||||
public static Intent getIntentForEmailPackage(Context context, String actionName) {
|
||||
return new Intent(getIntentStringForEmailPackage(context, actionName));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create Intent action based on the Email package name
|
||||
* Package com.android.email + ACTION -> com.android.email.ACTION
|
||||
* Package com.google.android.email + ACTION -> com.google.android.email.ACTION
|
||||
* Package com.android.exchange + ACTION -> com.android.email.ACTION
|
||||
* Package com.google.exchange + ACTION -> com.google.android.email.ACTION
|
||||
*
|
||||
* @param context the caller's context
|
||||
* @param actionName the Intent action
|
||||
* @return an Intent action based on the package name
|
||||
*/
|
||||
public static String getIntentStringForEmailPackage(Context context, String actionName) {
|
||||
String packageName = context.getPackageName();
|
||||
int lastDot = packageName.lastIndexOf('.');
|
||||
return packageName.substring(0, lastDot + 1) + "email." + actionName;
|
||||
final Intent intent = new Intent(EmailContent.EMAIL_PACKAGE_NAME + "." + actionName);
|
||||
intent.setPackage(EmailContent.EMAIL_PACKAGE_NAME);
|
||||
return intent;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -814,6 +814,7 @@
|
||||
<string name="intent_exchange_action" translatable="false">com.android.email.EXCHANGE_INTENT</string>
|
||||
<string name="intent_exchange_package" translatable="false">com.android.exchange</string>
|
||||
<string name="intent_account_manager_entry" translatable="false">com.android.email.activity.setup.ACCOUNT_MANAGER_ENTRY</string>
|
||||
<string name="intent_create_account" translatable="false">com.android.email.CREATE_ACCOUNT</string>
|
||||
<string name="authority_email_provider" translatable="false">com.android.email.provider</string>
|
||||
<string name="protocol_legacy_imap" translatable="false">imap</string>
|
||||
<string name="protocol_imap" translatable="false">imap</string>
|
||||
|
@ -46,7 +46,6 @@ import com.android.email.provider.EmailProvider;
|
||||
import com.android.emailcommon.Logging;
|
||||
import com.android.emailcommon.provider.Account;
|
||||
import com.android.emailcommon.provider.EmailContent.AccountColumns;
|
||||
import com.android.emailcommon.service.ServiceProxy;
|
||||
import com.android.emailcommon.utility.IntentUtilities;
|
||||
import com.android.emailcommon.utility.Utility;
|
||||
import com.android.mail.providers.Folder;
|
||||
@ -90,7 +89,7 @@ public class AccountSettings extends PreferenceActivity implements FeedbackEnabl
|
||||
|
||||
// Intent extras for launch directly from system account manager
|
||||
// NOTE: This string must match the one in res/xml/account_preferences.xml
|
||||
private static String ACTION_ACCOUNT_MANAGER_ENTRY;
|
||||
private static String INTENT_ACCOUNT_MANAGER_ENTRY;
|
||||
// NOTE: This constant should eventually be defined in android.accounts.Constants
|
||||
private static final String EXTRA_ACCOUNT_MANAGER_ACCOUNT = "account";
|
||||
|
||||
@ -199,12 +198,10 @@ public class AccountSettings extends PreferenceActivity implements FeedbackEnabl
|
||||
// If we are not restarting from a previous instance, we need to
|
||||
// figure out the initial prefs to show. (Otherwise, we want to
|
||||
// continue showing whatever the user last selected.)
|
||||
if (ACTION_ACCOUNT_MANAGER_ENTRY == null) {
|
||||
ACTION_ACCOUNT_MANAGER_ENTRY =
|
||||
ServiceProxy.getIntentStringForEmailPackage(this,
|
||||
getString(R.string.intent_account_manager_entry));
|
||||
if (INTENT_ACCOUNT_MANAGER_ENTRY == null) {
|
||||
INTENT_ACCOUNT_MANAGER_ENTRY = getString(R.string.intent_account_manager_entry);
|
||||
}
|
||||
if (ACTION_ACCOUNT_MANAGER_ENTRY.equals(i.getAction())) {
|
||||
if (INTENT_ACCOUNT_MANAGER_ENTRY.equals(i.getAction())) {
|
||||
// This case occurs if we're changing account settings from Settings -> Accounts
|
||||
mGetAccountIdFromAccountTask =
|
||||
(GetAccountIdFromAccountTask) new GetAccountIdFromAccountTask()
|
||||
|
@ -54,7 +54,6 @@ import com.android.emailcommon.VendorPolicyLoader.Provider;
|
||||
import com.android.emailcommon.provider.Account;
|
||||
import com.android.emailcommon.provider.EmailContent;
|
||||
import com.android.emailcommon.provider.HostAuth;
|
||||
import com.android.emailcommon.service.ServiceProxy;
|
||||
import com.android.emailcommon.utility.Utility;
|
||||
import com.android.mail.utils.LogUtils;
|
||||
|
||||
@ -71,7 +70,7 @@ import java.net.URISyntaxException;
|
||||
* AccountSetupAccountType activity where the user can begin to manually configure the account.
|
||||
*
|
||||
* === Support for automated testing ==
|
||||
* This activity can also be launched directly via ACTION_CREATE_ACCOUNT. This is intended
|
||||
* This activity can also be launched directly via INTENT_CREATE_ACCOUNT. This is intended
|
||||
* only for use by continuous test systems, and is currently only available when
|
||||
* {@link ActivityManager#isRunningInTestHarness()} is set. To use this mode, you must construct
|
||||
* an intent which contains all necessary information to create the account. No connection
|
||||
@ -97,7 +96,7 @@ public class AccountSetupBasics extends AccountSetupActivity
|
||||
* Direct access for forcing account creation
|
||||
* For use by continuous automated test system (e.g. in conjunction with monkey tests)
|
||||
*/
|
||||
private static final String ACTION_CREATE_ACCOUNT = "com.android.email.CREATE_ACCOUNT";
|
||||
private static String INTENT_CREATE_ACCOUNT;
|
||||
private static final String EXTRA_FLOW_MODE = "FLOW_MODE";
|
||||
private static final String EXTRA_FLOW_ACCOUNT_TYPE = "FLOW_ACCOUNT_TYPE";
|
||||
private static final String EXTRA_CREATE_ACCOUNT_EMAIL = "EMAIL";
|
||||
@ -194,8 +193,10 @@ public class AccountSetupBasics extends AccountSetupActivity
|
||||
final Intent intent = getIntent();
|
||||
final String action = intent.getAction();
|
||||
|
||||
if (ServiceProxy.getIntentStringForEmailPackage(
|
||||
this, ACTION_CREATE_ACCOUNT).equals(action)) {
|
||||
if (INTENT_CREATE_ACCOUNT == null) {
|
||||
INTENT_CREATE_ACCOUNT = getString(R.string.intent_create_account);
|
||||
}
|
||||
if (INTENT_CREATE_ACCOUNT.equals(action)) {
|
||||
mSetupData = new SetupData(SetupData.FLOW_MODE_FORCE_CREATE);
|
||||
} else {
|
||||
final int intentFlowMode =
|
||||
|
Loading…
Reference in New Issue
Block a user