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

Commit 2b1c406b authored by Nicolo' Mazzucato's avatar Nicolo' Mazzucato
Browse files

Fix per-display flags propagation in flexiglass

Flags were only kept up to date for the default display, causing elements relying on them to broken on external displays (e.g. taskbar visibility)

Bug: 362719719
Bug: 417921986
Test: SceneContainerStartableTest
Flag: com.android.systemui.shade_window_goes_around
Change-Id: If769a4a26c7a0aff1e53f7d0b5e0c45b4f2be526
parent da6cc4d5
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