SetupWizard: don't allow skipping FRP
Change-Id: I7532c0c68418458b921a98e556ee3172b2cf1af3 Signed-off-by: Roman Birg <roman@cyngn.com>
This commit is contained in:
parent
48115dde4c
commit
d587f56e2e
|
@ -64,7 +64,7 @@ public class CMSetupWizardData extends AbstractSetupData {
|
||||||
.setHidden(!isSimInserted() || mMobileDataEnabled));
|
.setHidden(!isSimInserted() || mMobileDataEnabled));
|
||||||
}
|
}
|
||||||
if (SetupWizardUtils.hasGMS(mContext)) {
|
if (SetupWizardUtils.hasGMS(mContext)) {
|
||||||
pages.add(new GmsAccountPage(mContext, this).setHidden(true));
|
pages.add(new GmsAccountPage(mContext, this));
|
||||||
}
|
}
|
||||||
if (!SetupWizardUtils.hasLeanback(mContext)) {
|
if (!SetupWizardUtils.hasLeanback(mContext)) {
|
||||||
pages.add(new CyanogenServicesPage(mContext, this).setHidden(true));
|
pages.add(new CyanogenServicesPage(mContext, this).setHidden(true));
|
||||||
|
@ -109,11 +109,7 @@ public class CMSetupWizardData extends AbstractSetupData {
|
||||||
|
|
||||||
private void showHideAccountPages() {
|
private void showHideAccountPages() {
|
||||||
boolean isConnected = SetupWizardUtils.isNetworkConnected(mContext);
|
boolean isConnected = SetupWizardUtils.isNetworkConnected(mContext);
|
||||||
GmsAccountPage gmsAccountPage =
|
|
||||||
(GmsAccountPage) getPage(GmsAccountPage.TAG);
|
|
||||||
if (gmsAccountPage != null) {
|
|
||||||
gmsAccountPage.setHidden(!isConnected);
|
|
||||||
}
|
|
||||||
CyanogenServicesPage cyanogenServicesPage =
|
CyanogenServicesPage cyanogenServicesPage =
|
||||||
(CyanogenServicesPage) getPage(CyanogenServicesPage.TAG);
|
(CyanogenServicesPage) getPage(CyanogenServicesPage.TAG);
|
||||||
if (cyanogenServicesPage != null) {
|
if (cyanogenServicesPage != null) {
|
||||||
|
|
|
@ -32,6 +32,7 @@ import android.content.Intent;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
|
import android.service.persistentdata.PersistentDataBlockManager;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.cyanogenmod.setupwizard.R;
|
import com.cyanogenmod.setupwizard.R;
|
||||||
|
@ -160,16 +161,21 @@ public class GmsAccountPage extends SetupPage {
|
||||||
SetupStats.Action.EXTERNAL_PAGE_RESULT,
|
SetupStats.Action.EXTERNAL_PAGE_RESULT,
|
||||||
requestCode == SetupWizardApp.REQUEST_CODE_SETUP_GMS ?
|
requestCode == SetupWizardApp.REQUEST_CODE_SETUP_GMS ?
|
||||||
SetupStats.Label.GMS_ACCOUNT : SetupStats.Label.RESTORE, "success");
|
SetupStats.Label.GMS_ACCOUNT : SetupStats.Label.RESTORE, "success");
|
||||||
|
getCallbacks().onNextPage();
|
||||||
} else {
|
} else {
|
||||||
SetupStats.addEvent(SetupStats.Categories.EXTERNAL_PAGE_LOAD,
|
if (canSkip()) {
|
||||||
SetupStats.Action.EXTERNAL_PAGE_RESULT,
|
SetupStats.addEvent(SetupStats.Categories.EXTERNAL_PAGE_LOAD,
|
||||||
requestCode == SetupWizardApp.REQUEST_CODE_SETUP_GMS ?
|
SetupStats.Action.EXTERNAL_PAGE_RESULT,
|
||||||
SetupStats.Label.GMS_ACCOUNT : SetupStats.Label.RESTORE, "skipped");
|
requestCode == SetupWizardApp.REQUEST_CODE_SETUP_GMS ?
|
||||||
|
SetupStats.Label.GMS_ACCOUNT : SetupStats.Label.RESTORE, "skipped");
|
||||||
|
getCallbacks().onNextPage();
|
||||||
|
} else {
|
||||||
|
getCallbacks().onPreviousPage();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (SetupWizardUtils.accountExists(mContext, SetupWizardApp.ACCOUNT_TYPE_GMS)) {
|
if (SetupWizardUtils.accountExists(mContext, SetupWizardApp.ACCOUNT_TYPE_GMS)) {
|
||||||
setHidden(true);
|
setHidden(true);
|
||||||
}
|
}
|
||||||
getCallbacks().onNextPage();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -201,14 +207,22 @@ public class GmsAccountPage extends SetupPage {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
// XXX: In open source, we don't know what gms version a user has.
|
// XXX: In open source, we don't know what gms version a user has.
|
||||||
// Bail if the restore activity is not found.
|
// Bail if the restore activity is not found.
|
||||||
|
getCallbacks().onNextPage();
|
||||||
}
|
}
|
||||||
getCallbacks().onNextPage();
|
}
|
||||||
|
|
||||||
|
private boolean canSkip() {
|
||||||
|
final PersistentDataBlockManager pdbManager = (PersistentDataBlockManager)
|
||||||
|
mContext.getSystemService(Context.PERSISTENT_DATA_BLOCK_SERVICE);
|
||||||
|
return pdbManager == null
|
||||||
|
|| pdbManager.getDataBlockSize() == 0
|
||||||
|
|| pdbManager.getOemUnlockEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void launchGmsAccountSetup() {
|
private void launchGmsAccountSetup() {
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putBoolean(SetupWizardApp.EXTRA_FIRST_RUN, true);
|
bundle.putBoolean(SetupWizardApp.EXTRA_FIRST_RUN, true);
|
||||||
bundle.putBoolean(SetupWizardApp.EXTRA_ALLOW_SKIP, true);
|
bundle.putBoolean(SetupWizardApp.EXTRA_ALLOW_SKIP, canSkip());
|
||||||
bundle.putBoolean(SetupWizardApp.EXTRA_USE_IMMERSIVE, true);
|
bundle.putBoolean(SetupWizardApp.EXTRA_USE_IMMERSIVE, true);
|
||||||
AccountManager
|
AccountManager
|
||||||
.get(mContext).addAccount(SetupWizardApp.ACCOUNT_TYPE_GMS, null, null,
|
.get(mContext).addAccount(SetupWizardApp.ACCOUNT_TYPE_GMS, null, null,
|
||||||
|
@ -239,7 +253,11 @@ public class GmsAccountPage extends SetupPage {
|
||||||
} finally {
|
} finally {
|
||||||
if (error && getCallbacks().
|
if (error && getCallbacks().
|
||||||
isCurrentPage(GmsAccountPage.this)) {
|
isCurrentPage(GmsAccountPage.this)) {
|
||||||
getCallbacks().onNextPage();
|
if (canSkip()) {
|
||||||
|
getCallbacks().onNextPage();
|
||||||
|
} else {
|
||||||
|
getCallbacks().onPreviousPage();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue