diff options
author | Adnan Begovic <adnan@cyngn.com> | 2016-04-14 12:53:15 -0700 |
---|---|---|
committer | Adnan Begovic <adnan@cyngn.com> | 2016-04-14 12:59:25 -0700 |
commit | fe7ac15220a85795164ce846ecf4cb546ce38121 (patch) | |
tree | db4d59f81f54253fcc5964dcbd03201f675c4cd4 /src/com/cyanogenmod/setupwizard/setup | |
parent | c8c765c2b5b8b09330ec0f74c78337f56ee15790 (diff) | |
download | packages_apps_SetupWizard-fe7ac15220a85795164ce846ecf4cb546ce38121.zip packages_apps_SetupWizard-fe7ac15220a85795164ce846ecf4cb546ce38121.tar.gz packages_apps_SetupWizard-fe7ac15220a85795164ce846ecf4cb546ce38121.tar.bz2 |
SetupWizard: Don't reprompt setup if account already exists.
If a user goes through the gms flow, logging in, disabling
backup, getting kicked over to restore, and deciding to
set the device up as new, the existing logic would reprompt
since the flow causes the load action to happen again.
Now check for account existance, and skip the setup if true.
Change-Id: I3502294d54fcb4e202dca37ff7c6165da4401808
TICKET: CYNGNOS-2459
Diffstat (limited to 'src/com/cyanogenmod/setupwizard/setup')
-rw-r--r-- | src/com/cyanogenmod/setupwizard/setup/GmsAccountPage.java | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/src/com/cyanogenmod/setupwizard/setup/GmsAccountPage.java b/src/com/cyanogenmod/setupwizard/setup/GmsAccountPage.java index 9bcce42..1be40da 100644 --- a/src/com/cyanogenmod/setupwizard/setup/GmsAccountPage.java +++ b/src/com/cyanogenmod/setupwizard/setup/GmsAccountPage.java @@ -100,12 +100,34 @@ public class GmsAccountPage extends SetupPage { getCallbacks().onPreviousPage(); } else { super.doLoadAction(fragmentManager, action); - launchGmsAccountSetup(); + if (!SetupWizardUtils.accountExists(mContext, SetupWizardApp.ACCOUNT_TYPE_GMS)) { + launchGmsAccountSetup(); + } else { + // This can happen if the user goes from setup -> restore, but chooses to set + // their device up as "new". Thus we need to not re-prompt this entire flow, + // skip ahead. CYNGNOS-2459 + if (SetupWizardApp.DEBUG) { + Log.d(TAG, "Google account already setup, skip gms setup"); + } + setHidden(true); + getCallbacks().onNextPage(); + } } } @Override public boolean onActivityResult(int requestCode, int resultCode, Intent data) { + if (SetupWizardApp.DEBUG) { + Log.d(TAG, "Received activity result from requestCode " + requestCode + + " with a resultCode of " + resultCode); + if (data != null) { + Bundle extras = data.getExtras(); + Log.d(TAG, "Within the activity result there were extras:"); + for (String extra : extras.keySet()) { + Log.d(TAG, "The key " + extra + " has a value of " + extras.get(extra)); + } + } + } if (requestCode == SetupWizardApp.REQUEST_CODE_SETUP_GMS && data != null) { if (SetupWizardUtils.isOwner() && resultCode == Activity.RESULT_OK) { @@ -170,6 +192,9 @@ public class GmsAccountPage extends SetupPage { } private void launchGmsRestorePage(boolean restorePicker) { + if (SetupWizardApp.DEBUG) { + Log.d(TAG, "Launching gms restore page with restorePicker " + restorePicker); + } try { // GMS can disable this after logging in sometimes if (SetupWizardUtils.enableGMSSetupWizard(mContext)) { @@ -219,6 +244,9 @@ public class GmsAccountPage extends SetupPage { } private void launchGmsAccountSetup() { + if (SetupWizardApp.DEBUG) { + Log.d(TAG, "Launching gms account page"); + } Bundle bundle = new Bundle(); bundle.putBoolean(SetupWizardApp.EXTRA_FIRST_RUN, true); bundle.putBoolean(SetupWizardApp.EXTRA_ALLOW_SKIP, true); |