1 package com.android.systemui.statusbar.policy 2 3 import android.content.res.Configuration 4 5 /** Fake implementation of [ConfigurationController] for tests. */ 6 class FakeConfigurationController : ConfigurationController { 7 8 private var listeners = mutableListOf<ConfigurationController.ConfigurationListener>() 9 10 override fun addCallback(listener: ConfigurationController.ConfigurationListener) { 11 listeners += listener 12 } 13 14 override fun removeCallback(listener: ConfigurationController.ConfigurationListener) { 15 listeners -= listener 16 } 17 18 override fun onConfigurationChanged(newConfiguration: Configuration?) { 19 listeners.forEach { it.onConfigChanged(newConfiguration) } 20 } 21 22 override fun notifyThemeChanged() { 23 listeners.forEach { it.onThemeChanged() } 24 } 25 26 fun notifyDensityOrFontScaleChanged() { 27 listeners.forEach { it.onDensityOrFontScaleChanged() } 28 } 29 30 fun notifyConfigurationChanged() { 31 onConfigurationChanged(newConfiguration = null) 32 } 33 34 override fun isLayoutRtl(): Boolean = false 35 } 36