am cd118b3b: Add support for launching setup flow via intent action

* commit 'cd118b3b61d2b68593a2da8e3ad9b2149c1f3d08':
  Add support for launching setup flow via intent action
This commit is contained in:
Tony Mantler 2014-07-24 18:02:47 +00:00 committed by Android Git Automerger
commit 7d35f86b12
3 changed files with 12 additions and 13 deletions

View File

@ -266,10 +266,9 @@
android:exported="true" android:exported="true"
> >
<intent-filter> <intent-filter>
<action <action android:name="com.android.email.FORCE_CREATE_ACCOUNT" />
android:name="com.android.email.CREATE_ACCOUNT" /> <action android:name="com.android.email.CREATE_NEW_ACCOUNT" />
<category <category android:name="android.intent.category.DEFAULT" />
android:name="android.intent.category.DEFAULT" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity <activity

View File

@ -796,7 +796,8 @@
<string name="intent_exchange_cert_action" translatable="false">com.android.email.EXCHANGE_REQUEST_CERT</string> <string name="intent_exchange_cert_action" translatable="false">com.android.email.EXCHANGE_REQUEST_CERT</string>
<string name="intent_exchange_package" translatable="false">com.android.exchange</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_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="intent_force_create_email_account" translatable="false">com.android.email.FORCE_CREATE_ACCOUNT</string>
<string name="intent_create_email_account" translatable="false">com.android.email.CREATE_NEW_ACCOUNT</string>
<string name="authority_email_provider" translatable="false">com.android.email.provider</string> <string name="authority_email_provider" translatable="false">com.android.email.provider</string>
<string name="authority_conversation_provider" translatable="false">com.android.email.conversation.provider</string> <string name="authority_conversation_provider" translatable="false">com.android.email.conversation.provider</string>
<string name="authority_account_cache_provider" translatable="false">com.android.email.accountcache</string> <string name="authority_account_cache_provider" translatable="false">com.android.email.accountcache</string>

View File

@ -68,14 +68,14 @@ public class AccountSetupFinal extends AccountSetupActivity
* For use by continuous automated test system (e.g. in conjunction with monkey tests) * For use by continuous automated test system (e.g. in conjunction with monkey tests)
* *
* === Support for automated testing == * === Support for automated testing ==
* This activity can also be launched directly via INTENT_CREATE_ACCOUNT. This is intended * This activity can also be launched directly via INTENT_FORCE_CREATE_ACCOUNT. This is intended
* only for use by continuous test systems, and is currently only available when * only for use by continuous test systems, and is currently only available when
* {@link ActivityManager#isRunningInTestHarness()} is set. To use this mode, you must * {@link ActivityManager#isRunningInTestHarness()} is set. To use this mode, you must
* construct an intent which contains all necessary information to create the account. No * construct an intent which contains all necessary information to create the account. No
* connection checking is done, so the account may or may not actually work. Here is a sample * connection checking is done, so the account may or may not actually work. Here is a sample
* command, for a gmail account "test_account" with a password of "test_password". * command, for a gmail account "test_account" with a password of "test_password".
* *
* $ adb shell am start -a com.android.email.CREATE_ACCOUNT \ * $ adb shell am start -a com.android.email.FORCE_CREATE_ACCOUNT \
* -e EMAIL test_account@gmail.com \ * -e EMAIL test_account@gmail.com \
* -e USER "Test Account Name" \ * -e USER "Test Account Name" \
* -e INCOMING imap+ssl+://test_account:test_password@imap.gmail.com \ * -e INCOMING imap+ssl+://test_account:test_password@imap.gmail.com \
@ -87,13 +87,13 @@ public class AccountSetupFinal extends AccountSetupActivity
* *
* For accounts that correspond to services in providers.xml you can also use the following form * For accounts that correspond to services in providers.xml you can also use the following form
* *
* $adb shell am start -a com.android.email.CREATE_ACCOUNT \ * $adb shell am start -a com.android.email.FORCE_CREATE_ACCOUNT \
* -e EMAIL test_account@gmail.com \ * -e EMAIL test_account@gmail.com \
* -e PASSWORD test_password * -e PASSWORD test_password
* *
* and the appropriate incoming/outgoing information will be filled in automatically. * and the appropriate incoming/outgoing information will be filled in automatically.
*/ */
private static String INTENT_CREATE_ACCOUNT; private static String INTENT_FORCE_CREATE_ACCOUNT;
private static final String EXTRA_FLOW_MODE = "FLOW_MODE"; 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_FLOW_ACCOUNT_TYPE = "FLOW_ACCOUNT_TYPE";
private static final String EXTRA_CREATE_ACCOUNT_EMAIL = "EMAIL"; private static final String EXTRA_CREATE_ACCOUNT_EMAIL = "EMAIL";
@ -204,8 +204,8 @@ public class AccountSetupFinal extends AccountSetupActivity
final Intent intent = getIntent(); final Intent intent = getIntent();
final String action = intent.getAction(); final String action = intent.getAction();
if (INTENT_CREATE_ACCOUNT == null) { if (INTENT_FORCE_CREATE_ACCOUNT == null) {
INTENT_CREATE_ACCOUNT = getString(R.string.intent_create_account); INTENT_FORCE_CREATE_ACCOUNT = getString(R.string.intent_force_create_email_account);
} }
setContentView(R.layout.account_setup_activity); setContentView(R.layout.account_setup_activity);
@ -239,12 +239,11 @@ public class AccountSetupFinal extends AccountSetupActivity
} }
// Initialize the SetupDataFragment // Initialize the SetupDataFragment
if (INTENT_CREATE_ACCOUNT.equals(action)) { if (INTENT_FORCE_CREATE_ACCOUNT.equals(action)) {
mSetupData.setFlowMode(SetupDataFragment.FLOW_MODE_FORCE_CREATE); mSetupData.setFlowMode(SetupDataFragment.FLOW_MODE_FORCE_CREATE);
} else { } else {
final int intentFlowMode = intent.getIntExtra(EXTRA_FLOW_MODE, final int intentFlowMode = intent.getIntExtra(EXTRA_FLOW_MODE,
SetupDataFragment.FLOW_MODE_UNSPECIFIED); SetupDataFragment.FLOW_MODE_UNSPECIFIED);
// TODO: do something with this
final String flowAccountType = intent.getStringExtra(EXTRA_FLOW_ACCOUNT_TYPE); final String flowAccountType = intent.getStringExtra(EXTRA_FLOW_ACCOUNT_TYPE);
mSetupData.setAmProtocol( mSetupData.setAmProtocol(
EmailServiceUtils.getProtocolFromAccountType(this, flowAccountType)); EmailServiceUtils.getProtocolFromAccountType(this, flowAccountType));