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
This commit is contained in:
parent
c8c765c2b5
commit
fe7ac15220
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user