Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3ca51a1e authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Remove displayIds from PerDisplayRepository" into main

parents 22fcd609 95eb4844
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -32,9 +32,6 @@ class FakePerDisplayRepository<T> : PerDisplayRepository<T> {
        return instances[displayId]
    }

    override val displayIds: Set<Int>
        get() = instances.keys

    override val debugName: String
        get() = "FakePerDisplayRepository"
}
+0 −10
Original line number Diff line number Diff line
@@ -86,9 +86,6 @@ interface PerDisplayRepository<T> {
    /** Gets the cached instance or create a new one for a given display. */
    operator fun get(displayId: Int): T?

    /** List of display ids for which this repository has an instance. */
    val displayIds: Set<Int>

    /** Debug name for this repository, mainly for tracing and logging. */
    val debugName: String
}
@@ -122,9 +119,6 @@ constructor(
        backgroundApplicationScope.launch("$debugName#start") { start() }
    }

    override val displayIds: Set<Int>
        get() = perDisplayInstances.keys

    private suspend fun start() {
        dumpManager.registerNormalDumpable("PerDisplayRepository-${debugName}", this)
        displayRepository.displayIds.collectLatest { displayIds ->
@@ -199,8 +193,6 @@ class DefaultDisplayOnlyInstanceRepositoryImpl<T>(
    private val lazyDefaultDisplayInstance by lazy {
        instanceProvider.createInstance(Display.DEFAULT_DISPLAY)
    }
    override val displayIds: Set<Int> = setOf(Display.DEFAULT_DISPLAY)

    override fun get(displayId: Int): T? = lazyDefaultDisplayInstance
}

@@ -214,7 +206,5 @@ class DefaultDisplayOnlyInstanceRepositoryImpl<T>(
 */
class SingleInstanceRepositoryImpl<T>(override val debugName: String, private val instance: T) :
    PerDisplayRepository<T> {
    override val displayIds: Set<Int> = setOf(Display.DEFAULT_DISPLAY)

    override fun get(displayId: Int): T? = instance
}