Skip to content

Commit 34a75df

Browse files
Craig MautnerAndroid (Google) Code Review
authored andcommitted
Merge "Remove single pass actions from display loop." into jb-mr1-dev
2 parents ed48f9f + ea3a09a commit 34a75df

File tree

2 files changed

+34
-26
lines changed

2 files changed

+34
-26
lines changed

services/java/com/android/server/wm/DimAnimator.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,5 +212,12 @@ static class Parameters {
212212
mDimHeight = dimHeight;
213213
mDimTarget = dimTarget;
214214
}
215+
216+
Parameters(Parameters o) {
217+
mDimWinAnimator = o.mDimWinAnimator;
218+
mDimWidth = o.mDimWidth;
219+
mDimHeight = o.mDimHeight;
220+
mDimTarget = o.mDimTarget;
221+
}
215222
}
216223
}

services/java/com/android/server/wm/WindowAnimator.java

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ private void copyLayoutToAnimParamsLocked() {
176176
// Set the new DimAnimator params.
177177
DimAnimator.Parameters dimParams = layoutToAnim.mDimParams;
178178
if (dimParams == null) {
179-
mDimParams = dimParams;
179+
mDimParams = null;
180180
} else {
181181
final WindowStateAnimator newWinAnimator = dimParams.mDimWinAnimator;
182182

@@ -187,7 +187,7 @@ private void copyLayoutToAnimParamsLocked() {
187187
if (newWinAnimator.mSurfaceShown &&
188188
(existingDimWinAnimator == null || !existingDimWinAnimator.mSurfaceShown
189189
|| existingDimWinAnimator.mAnimLayer < newWinAnimator.mAnimLayer)) {
190-
mDimParams = dimParams;
190+
mDimParams = new DimAnimator.Parameters(dimParams);
191191
}
192192
}
193193

@@ -559,15 +559,6 @@ private void testTokenMayBeDrawnLocked() {
559559
private void performAnimationsLocked(final WinAnimatorList winAnimatorList) {
560560
updateWindowsLocked(winAnimatorList);
561561
updateWallpaperLocked(winAnimatorList);
562-
563-
for (int i = mPendingLayoutChanges.size() - 1; i >= 0; i--) {
564-
if ((mPendingLayoutChanges.valueAt(i)
565-
& WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER) != 0) {
566-
mPendingActions |= WALLPAPER_ACTION_PENDING;
567-
}
568-
}
569-
570-
testTokenMayBeDrawnLocked();
571562
}
572563

573564
// TODO(cmautner): Change the following comment when no longer locked on mWindowMap */
@@ -576,12 +567,7 @@ private void animateLocked() {
576567
if (!mInitialized) {
577568
return;
578569
}
579-
for (int i = mWinAnimatorLists.size() - 1; i >= 0; i--) {
580-
animateLocked(mWinAnimatorLists.get(i));
581-
}
582-
}
583570

584-
private void animateLocked(final WinAnimatorList winAnimatorList) {
585571
mPendingLayoutChanges.clear();
586572
mCurrentTime = SystemClock.uptimeMillis();
587573
mBulkUpdateParams = SET_ORIENTATION_CHANGE_COMPLETE;
@@ -591,23 +577,29 @@ private void animateLocked(final WinAnimatorList winAnimatorList) {
591577
Slog.i(TAG, "!!! animate: entry time=" + mCurrentTime);
592578
}
593579

594-
// Update animations of all applications, including those
595-
// associated with exiting/removed apps
580+
if (WindowManagerService.SHOW_TRANSACTIONS) Slog.i(
581+
TAG, ">>> OPEN TRANSACTION animateLocked");
596582
Surface.openTransaction();
597-
598583
try {
599584
updateWindowsAppsAndRotationAnimationsLocked();
600-
performAnimationsLocked(winAnimatorList);
601585

602-
// THIRD LOOP: Update the surfaces of all windows.
586+
for (int i = mWinAnimatorLists.size() - 1; i >= 0; i--) {
587+
final WinAnimatorList winAnimatorList = mWinAnimatorLists.get(i);
603588

604-
if (mScreenRotationAnimation != null) {
605-
mScreenRotationAnimation.updateSurfacesInTransaction();
589+
// Update animations of all applications, including those
590+
// associated with exiting/removed apps
591+
performAnimationsLocked(winAnimatorList);
592+
593+
final int N = winAnimatorList.size();
594+
for (int j = 0; j < N; j++) {
595+
winAnimatorList.get(j).prepareSurfaceLocked(true);
596+
}
606597
}
607598

608-
final int N = winAnimatorList.size();
609-
for (int i = 0; i < N; i++) {
610-
winAnimatorList.get(i).prepareSurfaceLocked(true);
599+
testTokenMayBeDrawnLocked();
600+
601+
if (mScreenRotationAnimation != null) {
602+
mScreenRotationAnimation.updateSurfacesInTransaction();
611603
}
612604

613605
if (mDimParams != null) {
@@ -634,6 +626,15 @@ private void animateLocked(final WinAnimatorList winAnimatorList) {
634626
Log.wtf(TAG, "Unhandled exception in Window Manager", e);
635627
} finally {
636628
Surface.closeTransaction();
629+
if (WindowManagerService.SHOW_TRANSACTIONS) Slog.i(
630+
TAG, "<<< CLOSE TRANSACTION animateLocked");
631+
}
632+
633+
for (int i = mPendingLayoutChanges.size() - 1; i >= 0; i--) {
634+
if ((mPendingLayoutChanges.valueAt(i)
635+
& WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER) != 0) {
636+
mPendingActions |= WALLPAPER_ACTION_PENDING;
637+
}
637638
}
638639

639640
if (mBulkUpdateParams != 0 || mPendingLayoutChanges.size() > 0) {

0 commit comments

Comments
 (0)