SetupWizard: Catch case where restore activity not found

Change-Id: I4acd9c2779fc41f087942e37647f90b47d3f3d9a
This commit is contained in:
cretin45 2015-02-06 13:26:16 -08:00 committed by Gerrit Code Review
parent 7970c9b351
commit 6f1d19f572

View File

@ -36,6 +36,7 @@ import android.provider.Settings;
import com.cyanogenmod.setupwizard.R; import com.cyanogenmod.setupwizard.R;
import com.cyanogenmod.setupwizard.SetupWizardApp; import com.cyanogenmod.setupwizard.SetupWizardApp;
import com.cyanogenmod.setupwizard.ui.LoadingFragment; import com.cyanogenmod.setupwizard.ui.LoadingFragment;
import com.cyanogenmod.setupwizard.ui.SetupWizardActivity;
import com.cyanogenmod.setupwizard.util.SetupWizardUtils; import com.cyanogenmod.setupwizard.util.SetupWizardUtils;
import java.io.IOException; import java.io.IOException;
@ -144,6 +145,7 @@ public class GmsAccountPage extends SetupPage {
} }
private static void launchGmsRestorePage(final Activity activity) { private static void launchGmsRestorePage(final Activity activity) {
try {
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);
@ -156,6 +158,12 @@ public class GmsAccountPage extends SetupPage {
activity.startActivityForResult( activity.startActivityForResult(
intent, intent,
SetupWizardApp.REQUEST_CODE_RESTORE_GMS, options.toBundle()); SetupWizardApp.REQUEST_CODE_RESTORE_GMS, options.toBundle());
} 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.
((SetupWizardActivity)activity).onNextPage();
}
} }
private void launchGmsAccountSetup(final Activity activity) { private void launchGmsAccountSetup(final Activity activity) {