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

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

Merge "Fix per-display flags propagation in flexiglass" into main

parents ff67aee7 2b1c406b
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -20,7 +20,8 @@ import com.android.app.displaylib.PerDisplayRepository
import java.util.function.Consumer

/** Fake version of [PerDisplayRepository], to be used in tests. */
class FakePerDisplayRepository<T> : PerDisplayRepository<T> {
class FakePerDisplayRepository<T>(private val defaultIfAbsent: ((Int) -> T)? = null) :
    PerDisplayRepository<T> {

    private val instances = mutableMapOf<Int, T>()

@@ -33,7 +34,11 @@ class FakePerDisplayRepository<T> : PerDisplayRepository<T> {
    }

    override fun get(displayId: Int): T? {
        return instances[displayId]
        return if (defaultIfAbsent != null) {
            instances.getOrPut(displayId) { defaultIfAbsent(displayId) }
        } else {
            instances[displayId]
        }
    }

    override val debugName: String