Replace actionId and scriptUri extras with wizardBundle

https://cs.android.com/android/platform/superproject/main/+/main:frameworks/opt/setupwizard/library/test/robotest/src/com/android/setupwizardlib/util/WizardManagerHelperTest.java;l=307;drc=93689222672ea2da9e3948785ab3c8d53d771c84

Change-Id: I084fee70a4fcd4617d788eb6e609e0d00c9ee103
diff --git a/src/org/lineageos/setupwizard/SetupWizardActivity.java b/src/org/lineageos/setupwizard/SetupWizardActivity.java
index 8e061d0..f50fb8a 100644
--- a/src/org/lineageos/setupwizard/SetupWizardActivity.java
+++ b/src/org/lineageos/setupwizard/SetupWizardActivity.java
@@ -10,6 +10,7 @@
 
 import static org.lineageos.setupwizard.SetupWizardApp.ACTION_LOAD;
 import static org.lineageos.setupwizard.SetupWizardApp.EXTRA_SCRIPT_URI;
+import static org.lineageos.setupwizard.SetupWizardApp.EXTRA_WIZARD_BUNDLE;
 import static org.lineageos.setupwizard.SetupWizardApp.LOGV;
 
 import android.annotation.Nullable;
@@ -37,15 +38,17 @@
         }
         SetupWizardUtils.enableComponent(this, WizardManager.class);
         Intent intent = new Intent(ACTION_LOAD);
+        Bundle wizardBundle = new Bundle();
         if (SetupWizardUtils.isOwner()) {
-            intent.putExtra(EXTRA_SCRIPT_URI, getString(R.string.lineage_wizard_script_uri));
+            wizardBundle.putString(EXTRA_SCRIPT_URI, getString(R.string.lineage_wizard_script_uri));
         } else if (SetupWizardUtils.isManagedProfile(this)) {
-            intent.putExtra(EXTRA_SCRIPT_URI, getString(
-                    R.string.lineage_wizard_script_managed_profile_uri));
+            wizardBundle.putString(EXTRA_SCRIPT_URI,
+                    getString(R.string.lineage_wizard_script_managed_profile_uri));
         } else {
-            intent.putExtra(EXTRA_SCRIPT_URI,
+            wizardBundle.putString(EXTRA_SCRIPT_URI,
                     getString(R.string.lineage_wizard_script_user_uri));
         }
+        intent.putExtra(EXTRA_WIZARD_BUNDLE, wizardBundle);
         intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | FLAG_GRANT_READ_URI_PERMISSION);
         intent.setPackage(getPackageName());
         startActivity(intent);
diff --git a/src/org/lineageos/setupwizard/SetupWizardApp.java b/src/org/lineageos/setupwizard/SetupWizardApp.java
index 34b8b1b..fee369d 100644
--- a/src/org/lineageos/setupwizard/SetupWizardApp.java
+++ b/src/org/lineageos/setupwizard/SetupWizardApp.java
@@ -27,6 +27,7 @@
     public static final String ACTION_EMERGENCY_DIAL = "com.android.phone.EmergencyDialer.DIAL";
     public static final String ACTION_LOAD = "com.android.wizard.LOAD";
 
+    public static final String EXTRA_WIZARD_BUNDLE = "wizardBundle";
     public static final String EXTRA_SCRIPT_URI = "scriptUri";
     public static final String EXTRA_ACTION_ID = "actionId";
     public static final String EXTRA_RESULT_CODE = "com.android.setupwizard.ResultCode";
diff --git a/src/org/lineageos/setupwizard/SubBaseActivity.java b/src/org/lineageos/setupwizard/SubBaseActivity.java
index 9379d5e..d5f8664 100644
--- a/src/org/lineageos/setupwizard/SubBaseActivity.java
+++ b/src/org/lineageos/setupwizard/SubBaseActivity.java
@@ -7,8 +7,8 @@
 
 import static com.google.android.setupcompat.util.ResultCodes.RESULT_ACTIVITY_NOT_FOUND;
 
-import static org.lineageos.setupwizard.SetupWizardApp.EXTRA_ACTION_ID;
 import static org.lineageos.setupwizard.SetupWizardApp.EXTRA_SCRIPT_URI;
+import static org.lineageos.setupwizard.SetupWizardApp.EXTRA_WIZARD_BUNDLE;
 import static org.lineageos.setupwizard.SetupWizardApp.LOGV;
 
 import android.annotation.NonNull;
@@ -58,9 +58,9 @@
 
     protected void startSubactivity(Intent subactivityIntent) {
         Intent intent = getIntent();
-        if (intent.hasExtra(EXTRA_SCRIPT_URI)) {
-            subactivityIntent.putExtra(EXTRA_SCRIPT_URI, intent.getStringExtra(EXTRA_SCRIPT_URI));
-            subactivityIntent.putExtra(EXTRA_ACTION_ID, intent.getStringExtra(EXTRA_ACTION_ID));
+        Bundle wizardBundle = intent.getBundleExtra(EXTRA_WIZARD_BUNDLE);
+        if (wizardBundle.containsKey(EXTRA_SCRIPT_URI)) {
+            subactivityIntent.putExtra(EXTRA_WIZARD_BUNDLE, wizardBundle);
         }
         try {
             startActivityForResult(subactivityIntent);
diff --git a/src/org/lineageos/setupwizard/wizardmanager/WizardManager.java b/src/org/lineageos/setupwizard/wizardmanager/WizardManager.java
index b1d3848..d947fe4 100644
--- a/src/org/lineageos/setupwizard/wizardmanager/WizardManager.java
+++ b/src/org/lineageos/setupwizard/wizardmanager/WizardManager.java
@@ -12,6 +12,7 @@
 import static org.lineageos.setupwizard.SetupWizardApp.EXTRA_ACTION_ID;
 import static org.lineageos.setupwizard.SetupWizardApp.EXTRA_RESULT_CODE;
 import static org.lineageos.setupwizard.SetupWizardApp.EXTRA_SCRIPT_URI;
+import static org.lineageos.setupwizard.SetupWizardApp.EXTRA_WIZARD_BUNDLE;
 import static org.lineageos.setupwizard.SetupWizardApp.LOGV;
 
 import android.annotation.Nullable;
@@ -44,8 +45,9 @@
         if (intent != null) {
             String action = intent.getAction();
             int resultCode = intent.getIntExtra(EXTRA_RESULT_CODE, 0);
-            String scriptUri = intent.getStringExtra(EXTRA_SCRIPT_URI);
-            String actionId = intent.getStringExtra(EXTRA_ACTION_ID);
+            Bundle wizardBundle = intent.getBundleExtra(EXTRA_WIZARD_BUNDLE);
+            String scriptUri = wizardBundle.getString(EXTRA_SCRIPT_URI);
+            String actionId = wizardBundle.getString(EXTRA_ACTION_ID);
             if (LOGV) {
                 Log.v(TAG, "  action=" + action + " resultCode=" + resultCode + " scriptUri="
                         + scriptUri + " actionId=" + actionId + " extras=" + intent.getExtras());
@@ -82,8 +84,10 @@
             intent.putExtras(extras);
         }
 
-        intent.putExtra(EXTRA_SCRIPT_URI, scriptUri);
-        intent.putExtra(EXTRA_ACTION_ID, action.getId());
+        Bundle wizardBundle = new Bundle();
+        wizardBundle.putString(EXTRA_SCRIPT_URI, scriptUri);
+        wizardBundle.putString(EXTRA_ACTION_ID, action.getId());
+        intent.putExtra(EXTRA_WIZARD_BUNDLE, wizardBundle);
         intent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
         startActivity(intent);
     }