Merge "Modify intent names" into jb-ub-mail
This commit is contained in:
commit
a88fb32724
@ -20,6 +20,7 @@
|
||||
<string name="account_manager_type_pop3">com.android.pop3</string>
|
||||
<string name="account_manager_type_imap">com.android.imap</string>
|
||||
<string name="intent_exchange">com.android.email.EXCHANGE_INTENT</string>
|
||||
<string name="intent_account_manager_entry">com.android.email.ACCOUNT_MANAGER_ENTRY_INTENT</string>
|
||||
<string name="authority_email_provider">com.android.email.provider</string>
|
||||
<string name="protocol_imap">imap</string>
|
||||
<string name="protocol_pop3">pop3</string>
|
||||
|
@ -57,13 +57,24 @@ public abstract class ServiceProxy {
|
||||
private boolean mDead = 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('.');
|
||||
String intentString =
|
||||
packageName.substring(0, lastDot + 1) + "email." + actionName;
|
||||
// STOPSHIP Remove logging
|
||||
Log.d("ServiceProxy", actionName + " -> " + intentString);
|
||||
return new Intent(intentString);
|
||||
return packageName.substring(0, lastDot + 1) + "email." + actionName;
|
||||
}
|
||||
|
||||
public abstract void onConnected(IBinder binder);
|
||||
|
@ -25,8 +25,8 @@
|
||||
android:title="@string/account_settings_action"
|
||||
android:summary="@string/account_settings_summary">
|
||||
<intent
|
||||
android:action="com.android.email.activity.setup.ACCOUNT_MANAGER_ENTRY"
|
||||
/>
|
||||
android:action="@string/intent_account_manager_entry"
|
||||
/>
|
||||
</PreferenceScreen>
|
||||
|
||||
</PreferenceScreen>
|
||||
|
@ -49,6 +49,7 @@ 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;
|
||||
@ -88,8 +89,7 @@ public class AccountSettings extends PreferenceActivity {
|
||||
|
||||
// Intent extras for launch directly from system account manager
|
||||
// NOTE: This string must match the one in res/xml/account_preferences.xml
|
||||
private static final String ACTION_ACCOUNT_MANAGER_ENTRY =
|
||||
"com.android.email.activity.setup.ACCOUNT_MANAGER_ENTRY";
|
||||
private static String ACTION_ACCOUNT_MANAGER_ENTRY;
|
||||
// NOTE: This constant should eventually be defined in android.accounts.Constants
|
||||
private static final String EXTRA_ACCOUNT_MANAGER_ACCOUNT = "account";
|
||||
|
||||
@ -177,6 +177,11 @@ public class AccountSettings extends PreferenceActivity {
|
||||
// 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 (ACTION_ACCOUNT_MANAGER_ENTRY.equals(i.getAction())) {
|
||||
// This case occurs if we're changing account settings from Settings -> Accounts
|
||||
mGetAccountIdFromAccountTask =
|
||||
|
@ -51,6 +51,7 @@ 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 java.net.URISyntaxException;
|
||||
@ -202,7 +203,8 @@ public class AccountSetupBasics extends AccountSetupActivity
|
||||
}
|
||||
if (intentData != null) {
|
||||
SetupData.init(intentData);
|
||||
} else if (ACTION_CREATE_ACCOUNT.equals(action)) {
|
||||
} else if (ServiceProxy.getIntentStringForEmailPackage(
|
||||
this, ACTION_CREATE_ACCOUNT).equals(action)) {
|
||||
SetupData.init(SetupData.FLOW_MODE_FORCE_CREATE);
|
||||
} else {
|
||||
int intentFlowMode =
|
||||
|
Loading…
Reference in New Issue
Block a user