summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Scott <scottjonathan@google.com>2023-12-06 06:06:38 -0800
committerCopybara-Service <copybara-worker@google.com>2023-12-06 06:09:52 -0800
commitdfa0ef792c7714d00ae8dd25d73dec428720c568 (patch)
tree93320d7a0fda392625c5a42220603cc55c1f6b42
parent1a8b6eb047261b255221a654968d1d9d4bbe106f (diff)
downloadandroid_onboarding-dfa0ef792c7714d00ae8dd25d73dec428720c568.tar.gz
Copybara ❤️: Refactor hasUi to uiType. This allows us to track the purpose of the screen from the user's point of view.
CL: cl/588399940 PiperOrigin-RevId: 588399940 Change-Id: Iff3c7a9bb674a0eeefc7418cb271182cdfb55c45
-rw-r--r--src/com/android/onboarding/contracts/annotations/OnboardingNode.kt35
-rw-r--r--src/com/android/onboarding/contracts/authmanaged/EmmContract.kt2
-rw-r--r--src/com/android/onboarding/nodes/testing/testapp/MainActivity.kt6
3 files changed, 33 insertions, 10 deletions
diff --git a/src/com/android/onboarding/contracts/annotations/OnboardingNode.kt b/src/com/android/onboarding/contracts/annotations/OnboardingNode.kt
index 17c9645..dd3859a 100644
--- a/src/com/android/onboarding/contracts/annotations/OnboardingNode.kt
+++ b/src/com/android/onboarding/contracts/annotations/OnboardingNode.kt
@@ -13,16 +13,39 @@ annotation class OnboardingNode(
*/
val name: String,
- /** True if this is a node which presents a UI to the user. */
- val hasUi: HasUi,
+ /** The type of UI shown as part of this node. */
+ val uiType: UiType,
/** The type of specification given for this node. */
val specificationType: SpecificationType = SpecificationType.LIGHT
) {
- enum class HasUi {
- NO,
- YES,
- YES_TEMPORARILY
+ enum class UiType {
+ /** This node shows no UI. */
+ NONE,
+
+ /** This node shows UI which does not fit any other type. */
+ OTHER,
+
+ /**
+ * This node does not actually show UI but makes use of UI controls as a way of passing control.
+ * This will be replaced by some other mechanism in future.
+ */
+ INVISIBLE,
+
+ /**
+ * This node shows a loading screen. The primary purpose is to control the screen while some
+ * background work executes.
+ */
+ LOADING,
+
+ /**
+ * This node shows an education screen. The primary purpose is to educate the user about their
+ * device, privacy, etc.
+ */
+ EDUCATION,
+
+ /** This node's primary purpose is to input a decision or some data from the user. */
+ INPUT
}
enum class SpecificationType {
diff --git a/src/com/android/onboarding/contracts/authmanaged/EmmContract.kt b/src/com/android/onboarding/contracts/authmanaged/EmmContract.kt
index 45f844a..6c49e4d 100644
--- a/src/com/android/onboarding/contracts/authmanaged/EmmContract.kt
+++ b/src/com/android/onboarding/contracts/authmanaged/EmmContract.kt
@@ -100,7 +100,7 @@ sealed interface EmmResult {
@OnboardingNode(
component = AUTH_MANAGED,
name = "Emm",
- hasUi = OnboardingNode.HasUi.YES_TEMPORARILY,
+ uiType = OnboardingNode.UiType.INVISIBLE,
)
@RequiresApi(Build.VERSION_CODES.Q)
class EmmContract @Inject constructor(val suwArgumentsSerializer: SuwArgumentsSerializer) :
diff --git a/src/com/android/onboarding/nodes/testing/testapp/MainActivity.kt b/src/com/android/onboarding/nodes/testing/testapp/MainActivity.kt
index 3a12441..d2711dc 100644
--- a/src/com/android/onboarding/nodes/testing/testapp/MainActivity.kt
+++ b/src/com/android/onboarding/nodes/testing/testapp/MainActivity.kt
@@ -174,13 +174,13 @@ abstract class ColourContract(val colour: Int, private val name: String) :
ContractResult.Success(1, Intent().apply { putExtra("KEY", result) })
}
-@OnboardingNode(component = TEST_APP, name = "Red", hasUi = OnboardingNode.HasUi.YES)
+@OnboardingNode(component = TEST_APP, name = "Red", uiType = OnboardingNode.UiType.OTHER)
class RedContract : ColourContract(Color.RED, "red")
-@OnboardingNode(component = TEST_APP, name = "Blue", hasUi = OnboardingNode.HasUi.YES)
+@OnboardingNode(component = TEST_APP, name = "Blue", uiType = OnboardingNode.UiType.OTHER)
class BlueContract : ColourContract(Color.BLUE, "blue")
-@OnboardingNode(component = TEST_APP, name = "Green", hasUi = OnboardingNode.HasUi.YES)
+@OnboardingNode(component = TEST_APP, name = "Green", uiType = OnboardingNode.UiType.OTHER)
class GreenContract : ColourContract(Color.GREEN, "green")
fun Intent.hasFlag(flag: Int) = (this.flags and flag) == flag