summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Ale Nijamkin <nijamkin@google.com> 2024-08-21 18:10:02 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2024-08-21 18:10:02 +0000
commit5ecbc5f78264f626d8c8c6a95ad19110ea1757d6 (patch)
treeb4331f1759205aeb2762fa2e9eb43c5f46d02e8c
parent770e8b579ce2d7b2b1b945f9384be98bc6de9210 (diff)
parentc13087d5c71a0d84818e892ad090f8e7e00907e7 (diff)
Merge "Adds some missing doc" into main
-rw-r--r--packages/SystemUI/src/com/android/systemui/lifecycle/SysUiViewModel.kt13
1 files changed, 13 insertions, 0 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/lifecycle/SysUiViewModel.kt b/packages/SystemUI/src/com/android/systemui/lifecycle/SysUiViewModel.kt
index 32c476093774..979eaef30a23 100644
--- a/packages/SystemUI/src/com/android/systemui/lifecycle/SysUiViewModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/lifecycle/SysUiViewModel.kt
@@ -30,6 +30,12 @@ import kotlinx.coroutines.launch
/** Base class for all System UI view-models. */
abstract class SysUiViewModel : BaseActivatable() {
+ /**
+ * Returns a snapshot [State] that's kept up-to-date as long as the [SysUiViewModel] is active.
+ *
+ * @param source The upstream [StateFlow] to collect from; values emitted to it will be
+ * automatically set on the returned [State].
+ */
@StateFactoryMarker
fun <T> hydratedStateOf(
source: StateFlow<T>,
@@ -40,6 +46,13 @@ abstract class SysUiViewModel : BaseActivatable() {
)
}
+ /**
+ * Returns a snapshot [State] that's kept up-to-date as long as the [SysUiViewModel] is active.
+ *
+ * @param initialValue The first value to place on the [State]
+ * @param source The upstream [Flow] to collect from; values emitted to it will be automatically
+ * set on the returned [State].
+ */
@StateFactoryMarker
fun <T> hydratedStateOf(
initialValue: T,