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

Commit 0d6dea4e authored by Ricardo Cerqueira's avatar Ricardo Cerqueira Committed by Ricardo Cerqueira
Browse files

GlobalActions: Fix themeing of the ShutdownThread

Apply the correct UI context so the reboot dialog is properly
themed

Change-Id: I115c81538ab9c27223b2090279f877d5b68d6dd3
parent 7da4dd0a
Loading
Loading
Loading
Loading
+21 −3
Original line number Diff line number Diff line
@@ -34,6 +34,8 @@ import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD_DIALOG;
import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER;

import com.android.internal.app.IBatteryStats;
import com.android.internal.app.ThemeUtils;

import com.android.internal.policy.PolicyManager;
import com.android.internal.policy.impl.PhoneWindowManager;
import com.android.internal.view.IInputContext;
@@ -307,6 +309,12 @@ public class WindowManagerService extends IWindowManager.Stub
        }
    };

    private BroadcastReceiver mThemeChangeReceiver = new BroadcastReceiver() {
        public void onReceive(Context context, Intent intent) {
            mUiContext = null;
        }
    };

    final BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
@@ -320,6 +328,7 @@ public class WindowManagerService extends IWindowManager.Stub
    };

    final Context mContext;
    private Context mUiContext;

    final boolean mHaveInputMethods;

@@ -938,6 +947,15 @@ public class WindowManagerService extends IWindowManager.Stub
        Surface.openTransaction();
        createWatermark();
        Surface.closeTransaction();

        ThemeUtils.registerThemeChangeReceiver(mContext, mThemeChangeReceiver);
    }

    private Context getUiContext() {
        if (mUiContext == null) {
            mUiContext = ThemeUtils.createUiContext(mContext);
        }
        return mUiContext != null ? mUiContext : mContext;
    }

    public InputManagerService getInputManagerService() {
@@ -5154,19 +5172,19 @@ public class WindowManagerService extends IWindowManager.Stub
    // Called by window manager policy.  Not exposed externally.
    @Override
    public void shutdown() {
        ShutdownThread.shutdown(mContext, true);
        ShutdownThread.shutdown(getUiContext(), true);
    }

    // Called by window manager policy.  Not exposed externally.
    @Override
    public void rebootSafeMode() {
        ShutdownThread.rebootSafeMode(mContext, true);
        ShutdownThread.rebootSafeMode(getUiContext(), true);
    }

    // Called by window manager policy.  Not exposed externally.
    @Override
    public void reboot() {
        ShutdownThread.reboot(mContext, null, true);
        ShutdownThread.reboot(getUiContext(), null, true);
    }

    public void setInputFilter(InputFilter filter) {