Setupwizard: Make sure to advance if GMS is absent

Change-Id: Ia0c4d83c9a9f7c581208d753024f55f48326afc7
(cherry picked from commit cb09e29e29)
This commit is contained in:
cretin45
2015-04-09 12:08:03 -07:00
committed by Ed Carrigan
parent 714be1a490
commit bfd7ca0545
2 changed files with 26 additions and 22 deletions

View File

@@ -176,7 +176,7 @@ public class GmsAccountPage extends SetupPage {
private void launchGmsRestorePage() { private void launchGmsRestorePage() {
try { try {
// GMS can disable this after logging in sometimes // GMS can disable this after logging in sometimes
SetupWizardUtils.enableGMSSetupWizard(mContext); if (SetupWizardUtils.enableGMSSetupWizard(mContext)) {
Intent intent = new Intent(ACTION_RESTORE); Intent intent = new Intent(ACTION_RESTORE);
intent.putExtra(SetupWizardApp.EXTRA_ALLOW_SKIP, true); intent.putExtra(SetupWizardApp.EXTRA_ALLOW_SKIP, true);
intent.putExtra(SetupWizardApp.EXTRA_USE_IMMERSIVE, true); intent.putExtra(SetupWizardApp.EXTRA_USE_IMMERSIVE, true);
@@ -195,12 +195,14 @@ public class GmsAccountPage extends SetupPage {
mFragment.startActivityForResult( mFragment.startActivityForResult(
intent, intent,
SetupWizardApp.REQUEST_CODE_RESTORE_GMS, options.toBundle()); SetupWizardApp.REQUEST_CODE_RESTORE_GMS, options.toBundle());
return;
}
} catch (Exception e) { } catch (Exception e) {
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 void launchGmsAccountSetup() { private void launchGmsAccountSetup() {

View File

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