@Test public void testCopyWizardManagerIntent() { Bundle wizardBundle = new Bundle(); wizardBundle.putString("foo", "bar"); Intent originalIntent = new Intent() .putExtra(WizardManagerHelper.EXTRA_THEME, "test_theme") .putExtra(WizardManagerHelper.EXTRA_WIZARD_BUNDLE, wizardBundle) .putExtra(WizardManagerHelper.EXTRA_IS_FIRST_RUN, true) .putExtra(WizardManagerHelper.EXTRA_IS_DEFERRED_SETUP, true) .putExtra(WizardManagerHelper.EXTRA_IS_PRE_DEFERRED_SETUP, true) .putExtra(WizardManagerHelper.EXTRA_SCRIPT_URI, "test_script_uri") .putExtra(WizardManagerHelper.EXTRA_ACTION_ID, "test_action_id"); Intent intent = new Intent("test.intent.action"); WizardManagerHelper.copyWizardManagerExtras(originalIntent, intent); assertEquals("Intent action should be kept", "test.intent.action", intent.getAction()); assertEquals("EXTRA_THEME should be copied", "test_theme", intent.getStringExtra(WizardManagerHelper.EXTRA_THEME)); Bundle copiedWizardBundle = intent.getParcelableExtra(WizardManagerHelper.EXTRA_WIZARD_BUNDLE); assertEquals("Wizard bundle should be copied", "bar", copiedWizardBundle.getString("foo")); assertTrue("EXTRA_IS_FIRST_RUN should be copied", intent.getBooleanExtra(WizardManagerHelper.EXTRA_IS_FIRST_RUN, false)); assertTrue("EXTRA_IS_DEFERRED_SETUP should be copied", intent.getBooleanExtra(WizardManagerHelper.EXTRA_IS_DEFERRED_SETUP, false)); assertTrue("EXTRA_IS_PRE_DEFERRED_SETUP should be copied", intent.getBooleanExtra(WizardManagerHelper.EXTRA_IS_PRE_DEFERRED_SETUP, false)); assertEquals("EXTRA_SCRIPT_URI should be copied", "test_script_uri", intent.getStringExtra(WizardManagerHelper.EXTRA_SCRIPT_URI)); assertEquals("EXTRA_ACTION_ID should be copied", "test_action_id", intent.getStringExtra(WizardManagerHelper.EXTRA_ACTION_ID)); }
public static void copyWizardManagerExtras(Intent srcIntent, Intent dstIntent) { dstIntent.putExtra(EXTRA_WIZARD_BUNDLE, srcIntent.getBundleExtra(EXTRA_WIZARD_BUNDLE)); for (String key : Arrays.asList( EXTRA_IS_FIRST_RUN, EXTRA_IS_DEFERRED_SETUP, EXTRA_IS_PRE_DEFERRED_SETUP)) { dstIntent.putExtra(key, srcIntent.getBooleanExtra(key, false)); } for (String key : Arrays.asList(EXTRA_THEME, EXTRA_SCRIPT_URI, EXTRA_ACTION_ID)) { dstIntent.putExtra(key, srcIntent.getStringExtra(key)); } }
WizardManagerHelper { public static void copyWizardManagerExtras(Intent srcIntent, Intent dstIntent) { dstIntent.putExtra(EXTRA_WIZARD_BUNDLE, srcIntent.getBundleExtra(EXTRA_WIZARD_BUNDLE)); for (String key : Arrays.asList( EXTRA_IS_FIRST_RUN, EXTRA_IS_DEFERRED_SETUP, EXTRA_IS_PRE_DEFERRED_SETUP)) { dstIntent.putExtra(key, srcIntent.getBooleanExtra(key, false)); } for (String key : Arrays.asList(EXTRA_THEME, EXTRA_SCRIPT_URI, EXTRA_ACTION_ID)) { dstIntent.putExtra(key, srcIntent.getStringExtra(key)); } } }
WizardManagerHelper { public static void copyWizardManagerExtras(Intent srcIntent, Intent dstIntent) { dstIntent.putExtra(EXTRA_WIZARD_BUNDLE, srcIntent.getBundleExtra(EXTRA_WIZARD_BUNDLE)); for (String key : Arrays.asList( EXTRA_IS_FIRST_RUN, EXTRA_IS_DEFERRED_SETUP, EXTRA_IS_PRE_DEFERRED_SETUP)) { dstIntent.putExtra(key, srcIntent.getBooleanExtra(key, false)); } for (String key : Arrays.asList(EXTRA_THEME, EXTRA_SCRIPT_URI, EXTRA_ACTION_ID)) { dstIntent.putExtra(key, srcIntent.getStringExtra(key)); } }  }
WizardManagerHelper { public static void copyWizardManagerExtras(Intent srcIntent, Intent dstIntent) { dstIntent.putExtra(EXTRA_WIZARD_BUNDLE, srcIntent.getBundleExtra(EXTRA_WIZARD_BUNDLE)); for (String key : Arrays.asList( EXTRA_IS_FIRST_RUN, EXTRA_IS_DEFERRED_SETUP, EXTRA_IS_PRE_DEFERRED_SETUP)) { dstIntent.putExtra(key, srcIntent.getBooleanExtra(key, false)); } for (String key : Arrays.asList(EXTRA_THEME, EXTRA_SCRIPT_URI, EXTRA_ACTION_ID)) { dstIntent.putExtra(key, srcIntent.getStringExtra(key)); } }  static Intent getNextIntent(Intent originalIntent, int resultCode); static Intent getNextIntent(Intent originalIntent, int resultCode, Intent data); static void copyWizardManagerExtras(Intent srcIntent, Intent dstIntent); static boolean isSetupWizardIntent(Intent intent); static boolean isUserSetupComplete(Context context); static boolean isDeviceProvisioned(Context context); static boolean isDeferredSetupWizard(Intent originalIntent); static boolean isPreDeferredSetupWizard(Intent originalIntent); static boolean isLightTheme(Intent intent, boolean def); static boolean isLightTheme(String theme, boolean def); static @StyleRes int getThemeRes(Intent intent, @StyleRes int defaultTheme); static @StyleRes int getThemeRes(String theme, @StyleRes int defaultTheme); }
WizardManagerHelper { public static void copyWizardManagerExtras(Intent srcIntent, Intent dstIntent) { dstIntent.putExtra(EXTRA_WIZARD_BUNDLE, srcIntent.getBundleExtra(EXTRA_WIZARD_BUNDLE)); for (String key : Arrays.asList( EXTRA_IS_FIRST_RUN, EXTRA_IS_DEFERRED_SETUP, EXTRA_IS_PRE_DEFERRED_SETUP)) { dstIntent.putExtra(key, srcIntent.getBooleanExtra(key, false)); } for (String key : Arrays.asList(EXTRA_THEME, EXTRA_SCRIPT_URI, EXTRA_ACTION_ID)) { dstIntent.putExtra(key, srcIntent.getStringExtra(key)); } }  static Intent getNextIntent(Intent originalIntent, int resultCode); static Intent getNextIntent(Intent originalIntent, int resultCode, Intent data); static void copyWizardManagerExtras(Intent srcIntent, Intent dstIntent); static boolean isSetupWizardIntent(Intent intent); static boolean isUserSetupComplete(Context context); static boolean isDeviceProvisioned(Context context); static boolean isDeferredSetupWizard(Intent originalIntent); static boolean isPreDeferredSetupWizard(Intent originalIntent); static boolean isLightTheme(Intent intent, boolean def); static boolean isLightTheme(String theme, boolean def); static @StyleRes int getThemeRes(Intent intent, @StyleRes int defaultTheme); static @StyleRes int getThemeRes(String theme, @StyleRes int defaultTheme); static final String EXTRA_THEME; static final String EXTRA_USE_IMMERSIVE_MODE; static final String SETTINGS_GLOBAL_DEVICE_PROVISIONED; static final String SETTINGS_SECURE_USER_SETUP_COMPLETE; static final String THEME_HOLO; static final String THEME_HOLO_LIGHT; static final String THEME_MATERIAL; static final String THEME_MATERIAL_LIGHT; static final String THEME_GLIF; static final String THEME_GLIF_LIGHT; static final String THEME_GLIF_V2; static final String THEME_GLIF_V2_LIGHT; static final String THEME_GLIF_V3; static final String THEME_GLIF_V3_LIGHT; }