summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartynas Petuška <petuska@google.com>2023-11-20 10:51:45 -0800
committerCopybara-Service <copybara-worker@google.com>2023-11-20 10:52:33 -0800
commit7a27179d4d887dddaa52e527ce85434562c804df (patch)
tree5e2cf9e86e494d5431407c5f4913e62212b82b5e
parent82305e38d6e4f60f3e5d1a88d52fb9abdbacc19d (diff)
downloadandroid_onboarding-7a27179d4d887dddaa52e527ce85434562c804df.tar.gz
Copybara ❤️: Document and enforce SuW extras
CL: cl/584071900 Bug: 309442833 PiperOrigin-RevId: 584071900 Change-Id: I2156d07d792cffb8b04fa4635ec1015bbd503ea1
-rw-r--r--src/com/android/onboarding/contracts/setupwizard/SuwArguments.kt40
-rw-r--r--src/com/android/onboarding/contracts/setupwizard/SuwArgumentsSerializer.kt28
2 files changed, 39 insertions, 29 deletions
diff --git a/src/com/android/onboarding/contracts/setupwizard/SuwArguments.kt b/src/com/android/onboarding/contracts/setupwizard/SuwArguments.kt
index da3bf87..7237b0b 100644
--- a/src/com/android/onboarding/contracts/setupwizard/SuwArguments.kt
+++ b/src/com/android/onboarding/contracts/setupwizard/SuwArguments.kt
@@ -1,6 +1,5 @@
package com.android.onboarding.contracts.setupwizard
-import android.net.Uri
import android.os.Bundle
/**
@@ -19,18 +18,33 @@ interface WithOptionalSuwArguments {
val suwArguments: SuwArguments?
}
-/** A set of common arguments unused by provisioning but still passed around to other processes. */
+/**
+ * A set of common arguments passed around to other processes during setup.
+ *
+ * @property isSuwSuggestedActionFlow Notifying an activity that was called from suggested action
+ * activity.
+ * @property isSetupFlow Notifying an Activity that it is inside the any setup flow
+ * @property preDeferredSetup Notifying an Activity that it is inside the "Pre-Deferred Setup" flow
+ * @property deferredSetup Notifying an Activity that it is inside the Deferred SetupWizard flow or
+ * not
+ * @property firstRun Notifying an Activity that it is inside the first SetupWizard flow or not
+ * @property portalSetup Notifying an Activity that it is inside the "Portal Setup" flow
+ * @property wizardBundle Parcelable extra containing the internal reference for an intent
+ * dispatched by Wizard Manager
+ * @property theme Decide which theme should be used in the onboarding flow
+ * @property hasMultipleUsers show additional info regarding the use of a device with multiple users
+ * @property isSubactivityFirstLaunched Return true if the ActivityWrapper is Created and not start
+ * SubActivity yet
+ */
data class SuwArguments(
- val isSuwSuggestedActionFlow: Boolean?,
+ val isSuwSuggestedActionFlow: Boolean,
val isSetupFlow: Boolean,
- val preDeferredSetup: Boolean?,
- val deferredSetup: Boolean?,
- val firstRun: Boolean?,
- val portalSetup: Boolean?,
- val wizardBundle: Bundle?,
- val actionId: Int?,
- val isSubactivityFirstLaunched: Boolean?,
- val scriptUri: Uri?,
- val hasMultipleUsers: Boolean?,
- val theme: String?,
+ val preDeferredSetup: Boolean,
+ val deferredSetup: Boolean,
+ val firstRun: Boolean,
+ val portalSetup: Boolean,
+ val wizardBundle: Bundle,
+ val theme: String,
+ val hasMultipleUsers: Boolean? = null,
+ val isSubactivityFirstLaunched: Boolean? = null,
)
diff --git a/src/com/android/onboarding/contracts/setupwizard/SuwArgumentsSerializer.kt b/src/com/android/onboarding/contracts/setupwizard/SuwArgumentsSerializer.kt
index d169e4f..e9dc22e 100644
--- a/src/com/android/onboarding/contracts/setupwizard/SuwArgumentsSerializer.kt
+++ b/src/com/android/onboarding/contracts/setupwizard/SuwArgumentsSerializer.kt
@@ -7,33 +7,29 @@ import javax.inject.Inject
class SuwArgumentsSerializer @Inject constructor() : ScopedIntentSerializer<SuwArguments> {
override fun IntentScope.write(value: SuwArguments) {
- intent["actionId"] = value.actionId
- intent["isSubactivityFirstLaunched"] = value.isSubactivityFirstLaunched
intent[WizardManagerHelper.EXTRA_IS_SUW_SUGGESTED_ACTION_FLOW] = value.isSuwSuggestedActionFlow
intent[WizardManagerHelper.EXTRA_IS_SETUP_FLOW] = value.isSetupFlow
intent[WizardManagerHelper.EXTRA_IS_PRE_DEFERRED_SETUP] = value.preDeferredSetup
intent[WizardManagerHelper.EXTRA_IS_DEFERRED_SETUP] = value.deferredSetup
intent[WizardManagerHelper.EXTRA_IS_FIRST_RUN] = value.firstRun
intent[WizardManagerHelper.EXTRA_IS_PORTAL_SETUP] = value.portalSetup
- intent["scriptUri"] = value.scriptUri
- intent["hasMultipleUsers"] = value.hasMultipleUsers
- intent[WizardManagerHelper.EXTRA_THEME] = value.theme
intent["wizardBundle"] = value.wizardBundle
+ intent[WizardManagerHelper.EXTRA_THEME] = value.theme
+ intent["hasMultipleUsers"] = value.hasMultipleUsers
+ intent["isSubactivityFirstLaunched"] = value.isSubactivityFirstLaunched
}
override fun IntentScope.read(): SuwArguments =
SuwArguments(
- actionId = intExtraOrNull("actionId"),
- isSubactivityFirstLaunched = booleanExtraOrNull("isSubactivityFirstLaunched"),
- isSuwSuggestedActionFlow = booleanExtraOrNull("isSuwSuggestedActionFlow"),
- isSetupFlow = booleanExtraOrNull("isSetupFlow") ?: false,
- preDeferredSetup = booleanExtraOrNull("preDeferredSetup"),
- deferredSetup = booleanExtraOrNull("deferredSetup"),
- firstRun = booleanExtraOrNull("firstRun"),
- portalSetup = booleanExtraOrNull("portalSetup"),
- scriptUri = parcelableExtraOrNull("scriptUri"),
+ isSuwSuggestedActionFlow = booleanExtra("isSuwSuggestedActionFlow"),
+ isSetupFlow = booleanExtra("isSetupFlow"),
+ preDeferredSetup = booleanExtra("preDeferredSetup"),
+ deferredSetup = booleanExtra("deferredSetup"),
+ firstRun = booleanExtra("firstRun"),
+ portalSetup = booleanExtra("portalSetup"),
+ wizardBundle = bundleExtra("wizardBundle"),
+ theme = stringExtra("theme"),
hasMultipleUsers = booleanExtraOrNull("hasMultipleUsers"),
- theme = stringExtraOrNull("theme"),
- wizardBundle = bundleExtraOrNull("wizardBundle"),
+ isSubactivityFirstLaunched = booleanExtraOrNull("isSubactivityFirstLaunched"),
)
}