diff options
author | Craig Mautner <cmautner@google.com> | 2013-02-12 15:08:44 -0800 |
---|---|---|
committer | Craig Mautner <cmautner@google.com> | 2013-02-12 15:08:44 -0800 |
commit | fb32c6e9e97e8c7541e85fcbd200ae86e721e7a4 (patch) | |
tree | c11a8eac5828fab0ef4cc7cf8c011ba0d3835463 /services | |
parent | f9d2c2e63a3c8af5c230a24a3f243c94011bf2b7 (diff) | |
download | frameworks_base-fb32c6e9e97e8c7541e85fcbd200ae86e721e7a4.zip frameworks_base-fb32c6e9e97e8c7541e85fcbd200ae86e721e7a4.tar.gz frameworks_base-fb32c6e9e97e8c7541e85fcbd200ae86e721e7a4.tar.bz2 |
Refactor setAppOpVisibility implementation.
- Convert double iteration over DisplayContents and WindowLists to
single iteration over AllWindowsIterator.
- Use existing change check in show() and hide() to trigger animation
scheduling rather than propagate change state up through calling tree.
Change-Id: Ic703a9fddebacbd0785bd5a186e95f9d0b128c42
Diffstat (limited to 'services')
-rw-r--r-- | services/java/com/android/server/wm/WindowManagerService.java | 21 | ||||
-rw-r--r-- | services/java/com/android/server/wm/WindowState.java | 8 |
2 files changed, 10 insertions, 19 deletions
diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java index 03dcced..8c8eea8 100644 --- a/services/java/com/android/server/wm/WindowManagerService.java +++ b/services/java/com/android/server/wm/WindowManagerService.java @@ -2452,22 +2452,15 @@ public class WindowManagerService extends IWindowManager.Stub public void updateAppOpsState() { synchronized(mWindowMap) { - boolean changed = false; - for (int i=0; i<mDisplayContents.size(); i++) { - DisplayContent display = mDisplayContents.valueAt(i); - WindowList windows = display.getWindowList(); - for (int j=0; j<windows.size(); j++) { - final WindowState win = windows.get(j); - if (win.mAppOp != AppOpsManager.OP_NONE) { - changed |= win.setAppOpVisibilityLw(mAppOps.checkOpNoThrow(win.mAppOp, - win.getOwningUid(), - win.getOwningPackage()) == AppOpsManager.MODE_ALLOWED); - } + AllWindowsIterator iterator = new AllWindowsIterator(); + while (iterator.hasNext()) { + final WindowState win = iterator.next(); + if (win.mAppOp != AppOpsManager.OP_NONE) { + final int mode = mAppOps.checkOpNoThrow(win.mAppOp, win.getOwningUid(), + win.getOwningPackage()); + win.setAppOpVisibilityLw(mode == AppOpsManager.MODE_ALLOWED); } } - if (changed) { - scheduleAnimationLocked(); - } } } diff --git a/services/java/com/android/server/wm/WindowState.java b/services/java/com/android/server/wm/WindowState.java index 8dda544..bb08519 100644 --- a/services/java/com/android/server/wm/WindowState.java +++ b/services/java/com/android/server/wm/WindowState.java @@ -1058,7 +1058,7 @@ final class WindowState implements WindowManagerPolicy.WindowState { return true; } - public boolean setAppOpVisibilityLw(boolean state) { + public void setAppOpVisibilityLw(boolean state) { if (mAppOpVisibility != state) { mAppOpVisibility = state; if (state) { @@ -1068,13 +1068,11 @@ final class WindowState implements WindowManagerPolicy.WindowState { // ops modifies they should only be hidden by policy due to the // lock screen, and the user won't be changing this if locked. // Plus it will quickly be fixed the next time we do a layout. - showLw(true, false); + showLw(true, true); } else { - hideLw(true, false); + hideLw(true, true); } - return true; } - return false; } @Override |