diff options
Diffstat (limited to 'src/com/cyanogenmod/setupwizard/setup/GmsAccountPage.java')
-rw-r--r-- | src/com/cyanogenmod/setupwizard/setup/GmsAccountPage.java | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/com/cyanogenmod/setupwizard/setup/GmsAccountPage.java b/src/com/cyanogenmod/setupwizard/setup/GmsAccountPage.java index a9c50d1..f2df085 100644 --- a/src/com/cyanogenmod/setupwizard/setup/GmsAccountPage.java +++ b/src/com/cyanogenmod/setupwizard/setup/GmsAccountPage.java @@ -114,15 +114,11 @@ public class GmsAccountPage extends SetupPage { getCallbacks().onPreviousPage(); } else { super.doLoadAction(fragmentManager, action); + launchGmsAccountSetup(); } } @Override - public void onFragmentReady() { - launchGmsAccountSetup(); - } - - @Override public boolean onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == SetupWizardApp.REQUEST_CODE_SETUP_GMS) { if (!mBackupEnabled && SetupWizardUtils.isOwner() && resultCode == Activity.RESULT_OK) { @@ -217,6 +213,7 @@ public class GmsAccountPage extends SetupPage { bundle, null, new AccountManagerCallback<Bundle>() { @Override public void run(AccountManagerFuture<Bundle> future) { + boolean error = false; try { Bundle result = future.getResult(); Intent intent = result @@ -225,20 +222,23 @@ public class GmsAccountPage extends SetupPage { ActivityOptions.makeCustomAnimation(mContext, android.R.anim.fade_in, android.R.anim.fade_out); - if (!mFragment.isDetached()) { - SetupStats.addEvent(SetupStats.Categories.EXTERNAL_PAGE_LOAD, - SetupStats.Action.EXTERNAL_PAGE_LAUNCH, - SetupStats.Label.PAGE, SetupStats.Label.GMS_ACCOUNT); - mFragment.startActivityForResult(intent, - SetupWizardApp.REQUEST_CODE_SETUP_GMS, options.toBundle()); - } else { - if (getCallbacks().isCurrentPage(GmsAccountPage.this)) { - getCallbacks().onNextPage(); - } - } + SetupStats.addEvent(SetupStats.Categories.EXTERNAL_PAGE_LOAD, + SetupStats.Action.EXTERNAL_PAGE_LAUNCH, + SetupStats.Label.PAGE, SetupStats.Label.GMS_ACCOUNT); + mFragment.startActivityForResult(intent, + SetupWizardApp.REQUEST_CODE_SETUP_GMS, options.toBundle()); } catch (OperationCanceledException e) { + error = true; } catch (IOException e) { + error = true; } catch (AuthenticatorException e) { + Log.e(TAG, "Error launching gms account", e); + error = true; + } finally { + if (error && getCallbacks(). + isCurrentPage(GmsAccountPage.this)) { + getCallbacks().onNextPage(); + } } } }, null); |