Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3e84ea8a authored by Ricardo Cerqueira's avatar Ricardo Cerqueira Committed by Ricardo Cerqueira
Browse files

SetupWizard: Adjust FRP-enforcing logic

 * Always pass ALLOW_SKIP to GMS, it's smart enough to know when it
   can't be applied.
 * Don't bring up the authentication screen if no-network and canSkip

Still CYNGNOS-707

Change-Id: Ia1a81c4443cfd5bc3c3e5fd84758ff0ba2a2a140
(cherry picked from commit 649a5ec1)
parent 12ebb293
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -64,7 +64,7 @@ public class CMSetupWizardData extends AbstractSetupData {
                    .setHidden(!isSimInserted() || mMobileDataEnabled));
        }
        if (SetupWizardUtils.hasGMS(mContext)) {
            pages.add(new GmsAccountPage(mContext, this));
            pages.add(new GmsAccountPage(mContext, this).setHidden(true));
        }
        if (!SetupWizardUtils.hasLeanback(mContext)) {
            pages.add(new CyanogenServicesPage(mContext, this).setHidden(true));
@@ -109,7 +109,11 @@ 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 && gmsAccountPage.canSkip());
        }
        CyanogenServicesPage cyanogenServicesPage =
                (CyanogenServicesPage) getPage(CyanogenServicesPage.TAG);
        if (cyanogenServicesPage != null) {
+3 −2
Original line number Diff line number Diff line
@@ -211,9 +211,10 @@ public class GmsAccountPage extends SetupPage {
        }
    }

    private boolean canSkip() {
    public boolean canSkip() {
        final PersistentDataBlockManager pdbManager = (PersistentDataBlockManager)
                mContext.getSystemService(Context.PERSISTENT_DATA_BLOCK_SERVICE);
        Log.d(TAG,"GMS skip: OEM unlock is enabled: " + pdbManager.getOemUnlockEnabled() + " and amount of PST blocks is " + pdbManager.getDataBlockSize());
        return pdbManager == null
                || pdbManager.getDataBlockSize() == 0
                || pdbManager.getOemUnlockEnabled();
@@ -222,7 +223,7 @@ public class GmsAccountPage extends SetupPage {
    private void launchGmsAccountSetup() {
        Bundle bundle = new Bundle();
        bundle.putBoolean(SetupWizardApp.EXTRA_FIRST_RUN, true);
        bundle.putBoolean(SetupWizardApp.EXTRA_ALLOW_SKIP, canSkip());
        bundle.putBoolean(SetupWizardApp.EXTRA_ALLOW_SKIP, true);
        bundle.putBoolean(SetupWizardApp.EXTRA_USE_IMMERSIVE, true);
        AccountManager
                .get(mContext).addAccount(SetupWizardApp.ACCOUNT_TYPE_GMS, null, null,