summaryrefslogtreecommitdiffstats
path: root/src/com/cyanogenmod
diff options
context:
space:
mode:
authorcretin45 <cretin45@gmail.com>2015-04-09 12:08:03 -0700
committerEd Carrigan <cretin45@gmail.com>2015-04-09 20:36:04 +0000
commitbfd7ca05454c6f555e228896f1e59223e26eca70 (patch)
tree9c1d9ebfb3c146a1f188588473543ebc6e9b6135 /src/com/cyanogenmod
parent714be1a4909abd4464f0eb56875c26caa3ed1d9f (diff)
downloadpackages_apps_SetupWizard-bfd7ca05454c6f555e228896f1e59223e26eca70.zip
packages_apps_SetupWizard-bfd7ca05454c6f555e228896f1e59223e26eca70.tar.gz
packages_apps_SetupWizard-bfd7ca05454c6f555e228896f1e59223e26eca70.tar.bz2
Setupwizard: Make sure to advance if GMS is absent
Change-Id: Ia0c4d83c9a9f7c581208d753024f55f48326afc7 (cherry picked from commit cb09e29e29e64032fba5cfd47e71c4db38b32f20)
Diffstat (limited to 'src/com/cyanogenmod')
-rw-r--r--src/com/cyanogenmod/setupwizard/setup/GmsAccountPage.java42
-rw-r--r--src/com/cyanogenmod/setupwizard/util/SetupWizardUtils.java6
2 files changed, 26 insertions, 22 deletions
diff --git a/src/com/cyanogenmod/setupwizard/setup/GmsAccountPage.java b/src/com/cyanogenmod/setupwizard/setup/GmsAccountPage.java
index f2df085..4ea000c 100644
--- a/src/com/cyanogenmod/setupwizard/setup/GmsAccountPage.java
+++ b/src/com/cyanogenmod/setupwizard/setup/GmsAccountPage.java
@@ -176,31 +176,33 @@ public class GmsAccountPage extends SetupPage {
private void launchGmsRestorePage() {
try {
// GMS can disable this after logging in sometimes
- SetupWizardUtils.enableGMSSetupWizard(mContext);
- Intent intent = new Intent(ACTION_RESTORE);
- intent.putExtra(SetupWizardApp.EXTRA_ALLOW_SKIP, true);
- intent.putExtra(SetupWizardApp.EXTRA_USE_IMMERSIVE, true);
- intent.putExtra(SetupWizardApp.EXTRA_FIRST_RUN, true);
- intent.putExtra(SetupWizardApp.EXTRA_THEME, SetupWizardApp.EXTRA_MATERIAL_LIGHT);
- // XXX: Fool G's setup wizard into thinking it is their setup wizard.
- // This is necessary to get the material theme on the restore page.
- intent.putExtra("scriptUri", RESTORE_WIZARD_SCRIPT);
- ActivityOptions options =
- ActivityOptions.makeCustomAnimation(mContext,
- android.R.anim.fade_in,
- android.R.anim.fade_out);
- SetupStats.addEvent(SetupStats.Categories.EXTERNAL_PAGE_LOAD,
- SetupStats.Action.EXTERNAL_PAGE_LAUNCH,
- SetupStats.Label.PAGE, SetupStats.Label.RESTORE);
- mFragment.startActivityForResult(
- intent,
- SetupWizardApp.REQUEST_CODE_RESTORE_GMS, options.toBundle());
+ if (SetupWizardUtils.enableGMSSetupWizard(mContext)) {
+ Intent intent = new Intent(ACTION_RESTORE);
+ intent.putExtra(SetupWizardApp.EXTRA_ALLOW_SKIP, true);
+ intent.putExtra(SetupWizardApp.EXTRA_USE_IMMERSIVE, true);
+ intent.putExtra(SetupWizardApp.EXTRA_FIRST_RUN, true);
+ intent.putExtra(SetupWizardApp.EXTRA_THEME, SetupWizardApp.EXTRA_MATERIAL_LIGHT);
+ // XXX: Fool G's setup wizard into thinking it is their setup wizard.
+ // This is necessary to get the material theme on the restore page.
+ intent.putExtra("scriptUri", RESTORE_WIZARD_SCRIPT);
+ ActivityOptions options =
+ ActivityOptions.makeCustomAnimation(mContext,
+ android.R.anim.fade_in,
+ android.R.anim.fade_out);
+ SetupStats.addEvent(SetupStats.Categories.EXTERNAL_PAGE_LOAD,
+ SetupStats.Action.EXTERNAL_PAGE_LAUNCH,
+ SetupStats.Label.PAGE, SetupStats.Label.RESTORE);
+ 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() {
diff --git a/src/com/cyanogenmod/setupwizard/util/SetupWizardUtils.java b/src/com/cyanogenmod/setupwizard/util/SetupWizardUtils.java
index 37d60a0..3ea2ee8 100644
--- a/src/com/cyanogenmod/setupwizard/util/SetupWizardUtils.java
+++ b/src/com/cyanogenmod/setupwizard/util/SetupWizardUtils.java
@@ -163,7 +163,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,
@@ -172,8 +172,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;
}
}