diff options
author | Dianne Hackborn <hackbod@google.com> | 2012-04-27 14:16:30 -0700 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2012-04-27 15:21:44 -0700 |
commit | 12d3a94397c33fdb773a1eaaaa13cab80bf0c571 (patch) | |
tree | 607f0f7677f8597227883ced5d97f27b0cf39c52 /services | |
parent | 11dea2945124b166f167d4b5a23a059f33c04fa1 (diff) | |
download | frameworks_base-12d3a94397c33fdb773a1eaaaa13cab80bf0c571.zip frameworks_base-12d3a94397c33fdb773a1eaaaa13cab80bf0c571.tar.gz frameworks_base-12d3a94397c33fdb773a1eaaaa13cab80bf0c571.tar.bz2 |
When a window is first shown only draw once while animating.
On some hardware allocating a new graphics buffer is quite
expensive, which blocks updates to the UI. This can cause
glitches when performing window animations.
To reduce these glitches, the view hierarchy will now only
allow itself to be drawn once if its window is being shown
while the window manager is animating, not resuming draws
until it is told that the animation is done.
Change-Id: Ie15192f6fddbd0931b022a72c76ddd55ca266d84
Diffstat (limited to 'services')
-rwxr-xr-x | services/java/com/android/server/wm/WindowManagerService.java | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java index b270cee..276bc5b 100755 --- a/services/java/com/android/server/wm/WindowManagerService.java +++ b/services/java/com/android/server/wm/WindowManagerService.java @@ -424,6 +424,12 @@ public class WindowManagerService extends IWindowManager.Stub = new ArrayList<Pair<WindowState, IRemoteCallback>>(); /** + * Windows that have called relayout() while we were running animations, + * so we need to tell when the animation is done. + */ + final ArrayList<WindowState> mRelayoutWhileAnimating = new ArrayList<WindowState>(); + + /** * Used when rebuilding window list to keep track of windows that have * been removed. */ @@ -2647,6 +2653,7 @@ public class WindowManagerService extends IWindowManager.Stub boolean inTouchMode; boolean configChanged; boolean surfaceChanged = false; + boolean animating; // if they don't have this permission, mask out the status bar bits int systemUiVisibility = 0; @@ -2946,7 +2953,11 @@ public class WindowManagerService extends IWindowManager.Stub TAG, "Relayout of " + win + ": focusMayChange=" + focusMayChange); inTouchMode = mInTouchMode; - + animating = mAnimator.mAnimating; + if (animating && !mRelayoutWhileAnimating.contains(win)) { + mRelayoutWhileAnimating.add(win); + } + mInputMonitor.updateInputWindowsLw(true /*force*/); } @@ -2958,7 +2969,8 @@ public class WindowManagerService extends IWindowManager.Stub return (inTouchMode ? WindowManagerImpl.RELAYOUT_RES_IN_TOUCH_MODE : 0) | (displayed ? WindowManagerImpl.RELAYOUT_RES_FIRST_TIME : 0) - | (surfaceChanged ? WindowManagerImpl.RELAYOUT_RES_SURFACE_CHANGED : 0); + | (surfaceChanged ? WindowManagerImpl.RELAYOUT_RES_SURFACE_CHANGED : 0) + | (animating ? WindowManagerImpl.RELAYOUT_RES_ANIMATING : 0); } public void performDeferredDestroyWindow(Session session, IWindow client) { @@ -8579,6 +8591,16 @@ public class WindowManagerService extends IWindowManager.Stub mToBottomApps.clear(); } + if (!mAnimator.mAnimating && mRelayoutWhileAnimating.size() > 0) { + for (int j=mRelayoutWhileAnimating.size()-1; j>=0; j--) { + try { + mRelayoutWhileAnimating.get(j).mClient.doneAnimating(); + } catch (RemoteException e) { + } + } + mRelayoutWhileAnimating.clear(); + } + if (wallpaperDestroyed) { mLayoutNeeded |= adjustWallpaperWindowsLocked() != 0; } |