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
This commit is contained in:
Yohei Yukawa
2015-06-10 20:02:14 -07:00
parent 6b4703cfa6
commit 92af789d85

View File

@@ -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() {
final boolean showImeWithHardKeyboard = Settings.Secure.getIntForUser(
mContext.getContentResolver(), Settings.Secure.SHOW_IME_WITH_HARD_KEYBOARD, 0,
mCurrentUserId) == 1;
synchronized (mWindowMap) {
final boolean showImeWithHardKeyboard = Settings.Secure.getIntForUser(
mContext.getContentResolver(), Settings.Secure.SHOW_IME_WITH_HARD_KEYBOARD, 0,
mCurrentUserId) == 1;
if (mShowImeWithHardKeyboard != showImeWithHardKeyboard) {
mShowImeWithHardKeyboard = showImeWithHardKeyboard;
mH.sendEmptyMessage(H.SEND_NEW_CONFIGURATION);