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.SetupWizardApp;
import com.cyanogenmod.setupwizard.ui.LoadingFragment;
import com.cyanogenmod.setupwizard.ui.SetupWizardActivity;
import com.cyanogenmod.setupwizard.util.SetupWizardUtils;
import java.io.IOException;
@ -144,18 +145,25 @@ public class GmsAccountPage extends SetupPage {
}
private static void launchGmsRestorePage(final Activity activity) {
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);
ActivityOptions options =
ActivityOptions.makeCustomAnimation(activity,
android.R.anim.fade_in,
android.R.anim.fade_out);
activity.startActivityForResult(
intent,
SetupWizardApp.REQUEST_CODE_RESTORE_GMS, options.toBundle());
try {
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);
ActivityOptions options =
ActivityOptions.makeCustomAnimation(activity,
android.R.anim.fade_in,
android.R.anim.fade_out);
activity.startActivityForResult(
intent,
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) {