summaryrefslogtreecommitdiffstats
path: root/src/com/cyanogenmod/setupwizard/setup/CyanogenServicesPage.java
diff options
context:
space:
mode:
authorcretin45 <cretin45@gmail.com>2015-03-17 15:18:16 -0700
committerGerrit Code Review <gerrit@cyanogenmod.org>2015-04-01 01:59:25 +0000
commitdbc1ceb8ca97143a0067c2b97ca14a68fb789f69 (patch)
tree386c0e08cce81bed07d24c1dc2e2affa7654871a /src/com/cyanogenmod/setupwizard/setup/CyanogenServicesPage.java
parent88aba00aa3bf65f992115e5334f0f8713254deec (diff)
downloadpackages_apps_SetupWizard-dbc1ceb8ca97143a0067c2b97ca14a68fb789f69.zip
packages_apps_SetupWizard-dbc1ceb8ca97143a0067c2b97ca14a68fb789f69.tar.gz
packages_apps_SetupWizard-dbc1ceb8ca97143a0067c2b97ca14a68fb789f69.tar.bz2
SetupWizard: Better handling of launching into other activities
Change-Id: I4d8dc4a1b25e45c6ff35042239a0adf4c16458f1 (cherry picked from commit ed5d46703ea6aac1c912be114523688f3f8219e8)
Diffstat (limited to 'src/com/cyanogenmod/setupwizard/setup/CyanogenServicesPage.java')
-rw-r--r--src/com/cyanogenmod/setupwizard/setup/CyanogenServicesPage.java40
1 files changed, 20 insertions, 20 deletions
diff --git a/src/com/cyanogenmod/setupwizard/setup/CyanogenServicesPage.java b/src/com/cyanogenmod/setupwizard/setup/CyanogenServicesPage.java
index f446967..479f2be 100644
--- a/src/com/cyanogenmod/setupwizard/setup/CyanogenServicesPage.java
+++ b/src/com/cyanogenmod/setupwizard/setup/CyanogenServicesPage.java
@@ -28,6 +28,7 @@ import android.app.FragmentManager;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
+import android.util.Log;
import com.cyanogenmod.setupwizard.R;
import com.cyanogenmod.setupwizard.SetupWizardApp;
@@ -83,6 +84,7 @@ public class CyanogenServicesPage extends SetupPage {
if (!SetupWizardUtils.accountExists(mContext,
mContext.getString(R.string.cm_account_type))) {
super.doLoadAction(fragmentManager, action);
+ launchCyanogenAccountSetup();
} else {
getCallbacks().onNextPage();
}
@@ -90,11 +92,6 @@ public class CyanogenServicesPage extends SetupPage {
}
@Override
- public void onFragmentReady() {
- launchCyanogenAccountSetup();
- }
-
- @Override
public boolean onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == SetupWizardApp.REQUEST_CODE_SETUP_CYANOGEN) {
if (resultCode == Activity.RESULT_OK || resultCode == Activity.RESULT_FIRST_USER) {
@@ -127,6 +124,7 @@ public class CyanogenServicesPage extends SetupPage {
null, new AccountManagerCallback<Bundle>() {
@Override
public void run(AccountManagerFuture<Bundle> future) {
+ boolean error = false;
try {
Bundle result = future.getResult();
Intent intent = result
@@ -135,24 +133,26 @@ public class CyanogenServicesPage 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.CYANOGEN_ACCOUNT);
- mFragment.startActivityForResult(intent,
- SetupWizardApp.REQUEST_CODE_SETUP_CYANOGEN,
- options.toBundle());
- } else {
- if (getCallbacks().
- isCurrentPage(CyanogenServicesPage.this)) {
- getCallbacks().onNextPage();
- }
- }
+ SetupStats
+ .addEvent(SetupStats.Categories.EXTERNAL_PAGE_LOAD,
+ SetupStats.Action.EXTERNAL_PAGE_LAUNCH,
+ SetupStats.Label.PAGE,
+ SetupStats.Label.CYANOGEN_ACCOUNT);
+ mFragment.startActivityForResult(intent,
+ SetupWizardApp.REQUEST_CODE_SETUP_CYANOGEN,
+ options.toBundle());
} catch (OperationCanceledException e) {
+ error = true;
} catch (IOException e) {
+ error = true;
} catch (AuthenticatorException e) {
+ Log.e(TAG, "Error launching cm account", e);
+ error = true;
+ } finally {
+ if (error && getCallbacks().
+ isCurrentPage(CyanogenServicesPage.this)) {
+ getCallbacks().onNextPage();
+ }
}
}
}, null);