From 01f2d1ac7e035227ae81ca23217f06631923b559 Mon Sep 17 00:00:00 2001 From: Adrian Roos Date: Thu, 9 Jul 2015 16:22:24 -0700 Subject: [PATCH] Fix premature clearing of clearable sysui flags Fixes a bug where all clearable flags would be cleared even if only a subset actually changes; new behavior is clearing only the flags that actually got cleared. Bug: 22331526 Change-Id: Icbb12121c977e48457692c054571521c6f6eb730 --- .../android/server/wm/WindowManagerService.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index ac4fea8e42e09..ec566bc882ace 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -10978,6 +10978,13 @@ public class WindowManagerService extends IWindowManager.Stub if (mLastDispatchedSystemUiVisibility == visibility) { return; } + final int globalDiff = (visibility ^ mLastDispatchedSystemUiVisibility) + // We are only interested in differences of one of the + // clearable flags... + & View.SYSTEM_UI_CLEARABLE_FLAGS + // ...if it has actually been cleared. + & ~visibility; + mLastDispatchedSystemUiVisibility = visibility; mInputManager.setSystemUiVisibility(visibility); final WindowList windows = getDefaultWindowListLocked(); @@ -10986,12 +10993,7 @@ public class WindowManagerService extends IWindowManager.Stub WindowState ws = windows.get(i); try { int curValue = ws.mSystemUiVisibility; - int diff = curValue ^ visibility; - // We are only interested in differences of one of the - // clearable flags... - diff &= View.SYSTEM_UI_CLEARABLE_FLAGS; - // ...if it has actually been cleared. - diff &= ~visibility; + int diff = (curValue ^ visibility) & globalDiff; int newValue = (curValue&~diff) | (visibility&diff); if (newValue != curValue) { ws.mSeq++;