summaryrefslogtreecommitdiffstats
path: root/src/com/cyanogenmod/setupwizard/setup/GmsAccountPage.java
diff options
context:
space:
mode:
authorcretin45 <cretin45@gmail.com>2015-01-23 11:46:39 -0800
committercretin45 <cretin45@gmail.com>2015-01-23 11:46:39 -0800
commitb990a954a8e9b040257dff377eb233f807537b37 (patch)
tree5b6af21b1a69bf44b7fdcc70e3e63069a4fdeb58 /src/com/cyanogenmod/setupwizard/setup/GmsAccountPage.java
parent61a331f403816183d7618f85828c26d25fd48b90 (diff)
downloadpackages_apps_SetupWizard-b990a954a8e9b040257dff377eb233f807537b37.zip
packages_apps_SetupWizard-b990a954a8e9b040257dff377eb233f807537b37.tar.gz
packages_apps_SetupWizard-b990a954a8e9b040257dff377eb233f807537b37.tar.bz2
SetupWizard: Use GMS AccountManager as intended
Change-Id: I1c2bac11745d0d6b9a9378e483d1b64b01f5df44
Diffstat (limited to 'src/com/cyanogenmod/setupwizard/setup/GmsAccountPage.java')
-rw-r--r--src/com/cyanogenmod/setupwizard/setup/GmsAccountPage.java58
1 files changed, 20 insertions, 38 deletions
diff --git a/src/com/cyanogenmod/setupwizard/setup/GmsAccountPage.java b/src/com/cyanogenmod/setupwizard/setup/GmsAccountPage.java
index d242727..3e45ed4 100644
--- a/src/com/cyanogenmod/setupwizard/setup/GmsAccountPage.java
+++ b/src/com/cyanogenmod/setupwizard/setup/GmsAccountPage.java
@@ -80,44 +80,26 @@ public class GmsAccountPage extends SetupPage {
}
public void launchGmsAccountSetup(final Activity activity) {
- /*
- * XXX: The AccountIntro intent is now public and therefore likely to change.
- * The only way to catch whether the user pressed skip of back if via
- * startActivityForResult.
- *
- * If this fails, fall back to the old method, but it is not ideal because only a
- * OperationCanceledException is thrown regardless of skipping or pressing back.
- */
- try {
- Intent intent = new Intent("com.google.android.accounts.AccountIntro");
- intent.putExtra(SetupWizardApp.EXTRA_FIRST_RUN, true);
- intent.putExtra(SetupWizardApp.EXTRA_ALLOW_SKIP, true);
- intent.putExtra(SetupWizardApp.EXTRA_USE_IMMERSIVE, true);
- activity.startActivityForResult(intent, SetupWizardApp.REQUEST_CODE_SETUP_GMS);
- } catch (Exception e) {
- Bundle bundle = new Bundle();
- bundle.putBoolean(SetupWizardApp.EXTRA_FIRST_RUN, true);
- bundle.putBoolean(SetupWizardApp.EXTRA_ALLOW_SKIP, true);
- bundle.putBoolean(SetupWizardApp.EXTRA_USE_IMMERSIVE, true);
- AccountManager
- .get(activity).addAccount(SetupWizardApp.ACCOUNT_TYPE_GMS, null, null,
- bundle, activity, new AccountManagerCallback<Bundle>() {
- @Override
- public void run(AccountManagerFuture<Bundle> bundleAccountManagerFuture) {
- try {
- if (bundleAccountManagerFuture.getResult()
- .getString(AccountManager.KEY_AUTHTOKEN) != null) {
- setCompleted(true);
- }
- } catch (OperationCanceledException e) {
- if (activity != null && activity.isResumed()) {
- getCallbacks().onNextPage();
- }
- } catch (IOException e) {
- } catch (AuthenticatorException e) {
- }
+ Bundle bundle = new Bundle();
+ bundle.putBoolean(SetupWizardApp.EXTRA_FIRST_RUN, true);
+ bundle.putBoolean(SetupWizardApp.EXTRA_ALLOW_SKIP, true);
+ bundle.putBoolean(SetupWizardApp.EXTRA_USE_IMMERSIVE, true);
+ AccountManager
+ .get(activity).addAccount(SetupWizardApp.ACCOUNT_TYPE_GMS, null, null,
+ bundle, null, new AccountManagerCallback<Bundle>() {
+ @Override
+ public void run(AccountManagerFuture<Bundle> future) {
+ try {
+ Bundle result = future.getResult();
+ Intent intent = result
+ .getParcelable(AccountManager.KEY_INTENT);
+ activity.startActivityForResult(intent,
+ SetupWizardApp.REQUEST_CODE_SETUP_GMS);
+ } catch (OperationCanceledException e) {
+ } catch (IOException e) {
+ } catch (AuthenticatorException e) {
}
- }, null);
- }
+ }
+ }, null);
}
}