GmsAccount: If there's no network and FRP isn't enforcing, skip GMS

The current version of GMS's SuW has the main activity return as
CANCELED when no network is available. This is the same result as
an actual cancellation (by pressing "Back"), and there's no extra
data to distinguish the two, so the user gets stuck in a loop between
the "no network" page and the one preceding it, unless connectivity
is somehow established. Making connectivity mandatory for OOBE isn't
acceptable, so skip GMS entirely if network is absent (and FRP
isn't enforcing). The only thing it was presenting was a "you
have no network" dialog anyway.

RM-290

Change-Id: I2abadc79a0823e94da7d3a875ce6db8eae8f143b
This commit is contained in:
Ricardo Cerqueira
2016-10-25 23:25:38 +01:00
committed by Adrian DC
parent fb137c6ace
commit d7027be15d

View File

@@ -102,7 +102,12 @@ public class GmsAccountPage extends SetupPage {
getCallbacks().onPreviousPage();
} else {
super.doLoadAction(fragmentManager, action);
if (!SetupWizardUtils.accountExists(mContext, SetupWizardApp.ACCOUNT_TYPE_GMS)) {
if (!SetupWizardUtils.isNetworkConnected(mContext) && !SetupWizardUtils.frpEnabled(mContext)) {
if (SetupWizardApp.DEBUG) {
Log.d(TAG, "No network, no FRP enforcement, skip GMS account");
}
getCallbacks().onNextPage();
} else if (!SetupWizardUtils.accountExists(mContext, SetupWizardApp.ACCOUNT_TYPE_GMS)) {
launchGmsAccountSetup();
} else {
// This can happen if the user goes from setup -> restore, but chooses to set