summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Nicolo' Mazzucato <nicomazz@google.com> 2025-03-04 14:37:15 +0000
committer Nicolo' Mazzucato <nicomazz@google.com> 2025-03-04 14:37:15 +0000
commit0490c01cd8b6ffcb9f2b4e929480bb1ba44397e3 (patch)
treeeb025eebbe7b070cc2465b9b20ae762a5105218c
parente10a48e345df50849141bca14e8ba1627f3bd000 (diff)
Improve docs of PerDisplayRepository
Bug: 362719719 Bug: 398011576 Test: NONE - just docs Flag: com.android.systemui.shade_window_goes_around Change-Id: I6d06eccc80aa24a8834c13cdba862f02a274d54f
-rw-r--r--packages/SystemUI/src/com/android/systemui/display/data/repository/PerDisplayRepository.kt12
1 files changed, 9 insertions, 3 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/display/data/repository/PerDisplayRepository.kt b/packages/SystemUI/src/com/android/systemui/display/data/repository/PerDisplayRepository.kt
index adf84900c8ba..d27e33e53dbb 100644
--- a/packages/SystemUI/src/com/android/systemui/display/data/repository/PerDisplayRepository.kt
+++ b/packages/SystemUI/src/com/android/systemui/display/data/repository/PerDisplayRepository.kt
@@ -184,8 +184,13 @@ constructor(
* Provides an instance of a given class **only** for the default display, even if asked for another
* display.
*
- * This is useful in case of flag refactors: it can be provided instead of an instance of
+ * This is useful in case of **flag refactors**: it can be provided instead of an instance of
* [PerDisplayInstanceRepositoryImpl] when a flag related to multi display refactoring is off.
+ *
+ * Note that this still requires all instances to be provided by a [PerDisplayInstanceProvider]. If
+ * you want to provide an existing instance instead for the default display, either implement it in
+ * a custom [PerDisplayInstanceProvider] (e.g. inject it in the constructor and return it if the
+ * displayId is zero), or use [SingleInstanceRepositoryImpl].
*/
class DefaultDisplayOnlyInstanceRepositoryImpl<T>(
override val debugName: String,
@@ -200,11 +205,12 @@ class DefaultDisplayOnlyInstanceRepositoryImpl<T>(
}
/**
- * Always returns only one instance.
+ * Always returns [instance] for any display.
*
* This can be used to provide a single instance based on a flag value during a refactor. Similar to
* [DefaultDisplayOnlyInstanceRepositoryImpl], but also avoids creating the
- * [PerDisplayInstanceProvider].
+ * [PerDisplayInstanceProvider]. This is useful when you want to provide an existing instance only,
+ * without even instantiating a [PerDisplayInstanceProvider].
*/
class SingleInstanceRepositoryImpl<T>(override val debugName: String, private val instance: T) :
PerDisplayRepository<T> {