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

Commit fae63a28 authored by Lucas Dupin's avatar Lucas Dupin
Browse files

Reload theme before dispatching UiMode event

Test: manual
Change-Id: I0f2fc6095f706a5a3af66bf50d41b73cb8c97471
Fixes: 115649718
Fixes: 115394753
Fixes: 115992148
Fixes: 115781667
parent 7db3ae4f
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -34,9 +34,11 @@ class ConfigurationControllerImpl(context: Context)
    private val inCarMode: Boolean
    private var uiMode: Int = 0
    private var localeList: LocaleList? = null
    private val context: Context

    init {
        val currentConfig = context.resources.configuration
        this.context = context
        fontScale = currentConfig.fontScale
        density = currentConfig.densityDpi
        inCarMode = currentConfig.uiMode and Configuration.UI_MODE_TYPE_MASK ==
@@ -82,6 +84,10 @@ class ConfigurationControllerImpl(context: Context)
        }

        if (uiModeChanged) {
            // We need to force the style re-evaluation to make sure that it's up to date
            // and attrs were reloaded.
            context.theme.applyStyle(context.themeResId, true)

            this.uiMode = uiMode
            listeners.filterForEach({ this.listeners.contains(it) }) {
                it.onUiModeChanged()
+0 −5
Original line number Diff line number Diff line
@@ -1144,11 +1144,6 @@ public class StatusBar extends SystemUI implements DemoMode,

    @Override
    public void onUiModeChanged() {
        // UiMode will change the style was already evaluated.
        // We need to force the re-evaluation to make sure that all parents
        // are up to date and new attrs will be rettrieved.
        mContext.getTheme().applyStyle(mContext.getThemeResId(), true);

        if (mBrightnessMirrorController != null) {
            mBrightnessMirrorController.onUiModeChanged();
        }