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

Commit 92af789d authored by Yohei Yukawa's avatar Yohei Yukawa
Browse files

Do not access WindowManagerService#mCurrentUserId w/o lock.

This CL is not directly related to Bug #21766030 but is a
kind of follow up CL for I1d93095965c852ff90d8c7cc031c4755856.

Basically we should not access WMS#mCurrentUserId w/o lock.

Bug: 21766030
Change-Id: Ib06ace0a0b84d527e0d7cbcc2a7cb39b27be3794
parent 6b4703cf
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -5917,11 +5917,15 @@ public class WindowManagerService extends IWindowManager.Stub
        if (mContext.getResources().getConfiguration().isScreenRound()
                && mContext.getResources().getBoolean(
                com.android.internal.R.bool.config_windowShowCircularMask)) {
            final int currentUserId;
            synchronized(mWindowMap) {
                currentUserId = mCurrentUserId;
            }
            // Device configuration calls for a circular display mask, but we only enable the mask
            // if the accessibility color inversion feature is disabled, as the inverted mask
            // causes artifacts.
            int inversionState = Settings.Secure.getIntForUser(mContext.getContentResolver(),
                    Settings.Secure.ACCESSIBILITY_DISPLAY_INVERSION_ENABLED, 0, mCurrentUserId);
                    Settings.Secure.ACCESSIBILITY_DISPLAY_INVERSION_ENABLED, 0, currentUserId);
            int showMask = (inversionState == 1) ? 0 : 1;
            Message m = mH.obtainMessage(H.SHOW_CIRCULAR_DISPLAY_MASK);
            m.arg1 = showMask;
@@ -7422,10 +7426,10 @@ public class WindowManagerService extends IWindowManager.Stub
    }

    public void updateShowImeWithHardKeyboard() {
        synchronized (mWindowMap) {
            final boolean showImeWithHardKeyboard = Settings.Secure.getIntForUser(
                    mContext.getContentResolver(), Settings.Secure.SHOW_IME_WITH_HARD_KEYBOARD, 0,
                    mCurrentUserId) == 1;
        synchronized (mWindowMap) {
            if (mShowImeWithHardKeyboard != showImeWithHardKeyboard) {
                mShowImeWithHardKeyboard = showImeWithHardKeyboard;
                mH.sendEmptyMessage(H.SEND_NEW_CONFIGURATION);