summaryrefslogtreecommitdiffstats
path: root/src/com/cyanogenmod/setupwizard/setup
diff options
context:
space:
mode:
authorRoman Birg <roman@cyngn.com>2015-08-07 12:13:32 -0700
committerGerrit Code Review <gerrit@cyanogenmod.org>2015-08-07 15:57:58 -0700
commitd587f56e2e04a11271407a127f92d205a018e078 (patch)
tree8125c9261d321d8ad3df13775b14cca2be1f3021 /src/com/cyanogenmod/setupwizard/setup
parent48115dde4cd1e9f6bfadf08be68eba8d513954db (diff)
downloadpackages_apps_SetupWizard-d587f56e2e04a11271407a127f92d205a018e078.zip
packages_apps_SetupWizard-d587f56e2e04a11271407a127f92d205a018e078.tar.gz
packages_apps_SetupWizard-d587f56e2e04a11271407a127f92d205a018e078.tar.bz2
SetupWizard: don't allow skipping FRP
Change-Id: I7532c0c68418458b921a98e556ee3172b2cf1af3 Signed-off-by: Roman Birg <roman@cyngn.com>
Diffstat (limited to 'src/com/cyanogenmod/setupwizard/setup')
-rw-r--r--src/com/cyanogenmod/setupwizard/setup/CMSetupWizardData.java8
-rw-r--r--src/com/cyanogenmod/setupwizard/setup/GmsAccountPage.java34
2 files changed, 28 insertions, 14 deletions
diff --git a/src/com/cyanogenmod/setupwizard/setup/CMSetupWizardData.java b/src/com/cyanogenmod/setupwizard/setup/CMSetupWizardData.java
index 1acfa3b..2fc5729 100644
--- a/src/com/cyanogenmod/setupwizard/setup/CMSetupWizardData.java
+++ b/src/com/cyanogenmod/setupwizard/setup/CMSetupWizardData.java
@@ -64,7 +64,7 @@ public class CMSetupWizardData extends AbstractSetupData {
.setHidden(!isSimInserted() || mMobileDataEnabled));
}
if (SetupWizardUtils.hasGMS(mContext)) {
- pages.add(new GmsAccountPage(mContext, this).setHidden(true));
+ pages.add(new GmsAccountPage(mContext, this));
}
if (!SetupWizardUtils.hasLeanback(mContext)) {
pages.add(new CyanogenServicesPage(mContext, this).setHidden(true));
@@ -109,11 +109,7 @@ public class CMSetupWizardData extends AbstractSetupData {
private void showHideAccountPages() {
boolean isConnected = SetupWizardUtils.isNetworkConnected(mContext);
- GmsAccountPage gmsAccountPage =
- (GmsAccountPage) getPage(GmsAccountPage.TAG);
- if (gmsAccountPage != null) {
- gmsAccountPage.setHidden(!isConnected);
- }
+
CyanogenServicesPage cyanogenServicesPage =
(CyanogenServicesPage) getPage(CyanogenServicesPage.TAG);
if (cyanogenServicesPage != null) {
diff --git a/src/com/cyanogenmod/setupwizard/setup/GmsAccountPage.java b/src/com/cyanogenmod/setupwizard/setup/GmsAccountPage.java
index 4ea000c..c5c4710 100644
--- a/src/com/cyanogenmod/setupwizard/setup/GmsAccountPage.java
+++ b/src/com/cyanogenmod/setupwizard/setup/GmsAccountPage.java
@@ -32,6 +32,7 @@ import android.content.Intent;
import android.database.Cursor;
import android.os.Bundle;
import android.provider.Settings;
+import android.service.persistentdata.PersistentDataBlockManager;
import android.util.Log;
import com.cyanogenmod.setupwizard.R;
@@ -160,16 +161,21 @@ public class GmsAccountPage extends SetupPage {
SetupStats.Action.EXTERNAL_PAGE_RESULT,
requestCode == SetupWizardApp.REQUEST_CODE_SETUP_GMS ?
SetupStats.Label.GMS_ACCOUNT : SetupStats.Label.RESTORE, "success");
+ getCallbacks().onNextPage();
} else {
- SetupStats.addEvent(SetupStats.Categories.EXTERNAL_PAGE_LOAD,
- SetupStats.Action.EXTERNAL_PAGE_RESULT,
- requestCode == SetupWizardApp.REQUEST_CODE_SETUP_GMS ?
- SetupStats.Label.GMS_ACCOUNT : SetupStats.Label.RESTORE, "skipped");
+ if (canSkip()) {
+ SetupStats.addEvent(SetupStats.Categories.EXTERNAL_PAGE_LOAD,
+ SetupStats.Action.EXTERNAL_PAGE_RESULT,
+ 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)) {
setHidden(true);
}
- getCallbacks().onNextPage();
}
}
@@ -201,14 +207,22 @@ public class GmsAccountPage extends SetupPage {
e.printStackTrace();
// XXX: In open source, we don't know what gms version a user has.
// 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() {
Bundle bundle = new Bundle();
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);
AccountManager
.get(mContext).addAccount(SetupWizardApp.ACCOUNT_TYPE_GMS, null, null,
@@ -239,7 +253,11 @@ public class GmsAccountPage extends SetupPage {
} finally {
if (error && getCallbacks().
isCurrentPage(GmsAccountPage.this)) {
- getCallbacks().onNextPage();
+ if (canSkip()) {
+ getCallbacks().onNextPage();
+ } else {
+ getCallbacks().onPreviousPage();
+ }
}
}
}