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

Commit cb09e29e authored by cretin45's avatar cretin45
Browse files

Setupwizard: Make sure to advance if GMS is absent

Change-Id: Ia0c4d83c9a9f7c581208d753024f55f48326afc7
parent 1d7988a4
Loading
Loading
Loading
Loading
+22 −20
Original line number Diff line number Diff line
@@ -176,7 +176,7 @@ public class GmsAccountPage extends SetupPage {
    private void launchGmsRestorePage() {
        try {
            // GMS can disable this after logging in sometimes
            SetupWizardUtils.enableGMSSetupWizard(mContext);
            if (SetupWizardUtils.enableGMSSetupWizard(mContext)) {
                Intent intent = new Intent(ACTION_RESTORE);
                intent.putExtra(SetupWizardApp.EXTRA_ALLOW_SKIP, true);
                intent.putExtra(SetupWizardApp.EXTRA_USE_IMMERSIVE, true);
@@ -195,12 +195,14 @@ public class GmsAccountPage extends SetupPage {
                mFragment.startActivityForResult(
                        intent,
                        SetupWizardApp.REQUEST_CODE_RESTORE_GMS, options.toBundle());
                return;
            }
        } catch (Exception e) {
            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 void launchGmsAccountSetup() {
+4 −2
Original line number Diff line number Diff line
@@ -158,7 +158,7 @@ public class SetupWizardUtils {
        }
    }

    public static void enableGMSSetupWizard(Context context) {
    public static boolean enableGMSSetupWizard(Context context) {
        try {
            PackageInfo packageInfo = context.getPackageManager()
                    .getPackageInfo(GOOGLE_SETUPWIZARD_PACKAGE,
@@ -167,8 +167,10 @@ public class SetupWizardUtils {
            enableComponentArray(context, packageInfo.activities);
            enableComponentArray(context, packageInfo.services);
            enableComponentArray(context, packageInfo.receivers);
            return true;
        } catch (PackageManager.NameNotFoundException e) {
            Log.e(TAG, "Unable to disable GMS");
            Log.e(TAG, "Unable to enable GMS");
            return false;
        }
    }