Merge "Reset layout needed at each animation step."
This commit is contained in:
committed by
Android (Google) Code Review
commit
d5f2374e13
@@ -616,10 +616,11 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
|
||||
if (!mFirstScreenful && tasks.size() == 0) {
|
||||
return;
|
||||
}
|
||||
mNumItemsWaitingForThumbnailsAndIcons =
|
||||
mFirstScreenful ? tasks.size() : mRecentTaskDescriptions.size();
|
||||
mNumItemsWaitingForThumbnailsAndIcons = mFirstScreenful
|
||||
? tasks.size() : mRecentTaskDescriptions == null
|
||||
? 0 : mRecentTaskDescriptions.size();
|
||||
if (mRecentTaskDescriptions == null) {
|
||||
mRecentTaskDescriptions = new ArrayList(tasks);
|
||||
mRecentTaskDescriptions = new ArrayList<TaskDescription>(tasks);
|
||||
} else {
|
||||
mRecentTaskDescriptions.addAll(tasks);
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ import com.android.internal.policy.impl.PhoneWindowManager;
|
||||
* on behalf of WindowManagerService.
|
||||
*/
|
||||
public class WindowAnimator {
|
||||
private static final String TAG = "WindowAnimations";
|
||||
private static final String TAG = "WindowAnimator";
|
||||
|
||||
final WindowManagerService mService;
|
||||
final Context mContext;
|
||||
@@ -67,8 +67,24 @@ public class WindowAnimator {
|
||||
final int NAT = mService.mAppTokens.size();
|
||||
for (i=0; i<NAT; i++) {
|
||||
final AppWindowToken appToken = mService.mAppTokens.get(i);
|
||||
final boolean wasAnimating = appToken.animation != null;
|
||||
if (appToken.stepAnimationLocked(mCurrentTime, mInnerDw, mInnerDh)) {
|
||||
mAnimating = true;
|
||||
} else if (wasAnimating) {
|
||||
// stopped animating, do one more pass through the layout
|
||||
mPendingLayoutChanges |= WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
|
||||
}
|
||||
}
|
||||
|
||||
final int NEAT = mService.mExitingAppTokens.size();
|
||||
for (i=0; i<NEAT; i++) {
|
||||
final AppWindowToken appToken = mService.mExitingAppTokens.get(i);
|
||||
final boolean wasAnimating = appToken.animation != null;
|
||||
if (appToken.stepAnimationLocked(mCurrentTime, mInnerDw, mInnerDh)) {
|
||||
mAnimating = true;
|
||||
} else if (wasAnimating) {
|
||||
// stopped animating, do one more pass through the layout
|
||||
mPendingLayoutChanges |= WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -526,6 +542,7 @@ public class WindowAnimator {
|
||||
}
|
||||
|
||||
void animate() {
|
||||
mPendingLayoutChanges = 0;
|
||||
mCurrentTime = SystemClock.uptimeMillis();
|
||||
|
||||
// Update animations of all applications, including those
|
||||
|
||||
@@ -608,6 +608,9 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
}
|
||||
LayoutAndSurfaceFields mInnerFields = new LayoutAndSurfaceFields();
|
||||
|
||||
/** Only do a maximum of 6 repeated layouts. After that quit */
|
||||
private int mLayoutRepeatCount;
|
||||
|
||||
private final class AnimationRunnable implements Runnable {
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -1917,7 +1920,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
rawChanged = true;
|
||||
}
|
||||
|
||||
if (rawChanged && (wallpaperWin.getAttrs().privateFlags &
|
||||
if (rawChanged && (wallpaperWin.mAttrs.privateFlags &
|
||||
WindowManager.LayoutParams.PRIVATE_FLAG_WANTS_OFFSET_NOTIFICATIONS) != 0) {
|
||||
try {
|
||||
if (DEBUG_WALLPAPER) Slog.v(TAG, "Report new wp offset "
|
||||
@@ -2316,7 +2319,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
if (wasVisible) {
|
||||
|
||||
int transit = WindowManagerPolicy.TRANSIT_EXIT;
|
||||
if (win.getAttrs().type == TYPE_APPLICATION_STARTING) {
|
||||
if (win.mAttrs.type == TYPE_APPLICATION_STARTING) {
|
||||
transit = WindowManagerPolicy.TRANSIT_PREVIEW_DONE;
|
||||
}
|
||||
// Try starting an animation.
|
||||
@@ -2790,7 +2793,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
// Try starting an animation; if there isn't one, we
|
||||
// can destroy the surface right away.
|
||||
int transit = WindowManagerPolicy.TRANSIT_EXIT;
|
||||
if (win.getAttrs().type == TYPE_APPLICATION_STARTING) {
|
||||
if (win.mAttrs.type == TYPE_APPLICATION_STARTING) {
|
||||
transit = WindowManagerPolicy.TRANSIT_PREVIEW_DONE;
|
||||
}
|
||||
if (!win.mSurfacePendingDestroy && win.isWinVisibleLw() &&
|
||||
@@ -7575,10 +7578,25 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
|
||||
} else {
|
||||
mInLayout = false;
|
||||
if (mLayoutNeeded) {
|
||||
requestTraversalLocked();
|
||||
}
|
||||
}
|
||||
|
||||
if (mLayoutNeeded) {
|
||||
if (++mLayoutRepeatCount < 6) {
|
||||
requestTraversalLocked();
|
||||
} else {
|
||||
Slog.e(TAG, "Performed 6 layouts in a row. Skipping");
|
||||
mLayoutRepeatCount = 0;
|
||||
}
|
||||
} else {
|
||||
mLayoutRepeatCount = 0;
|
||||
}
|
||||
|
||||
if (mAnimator.mAnimating) {
|
||||
// Do this even if requestTraversalLocked was called above so we get a frame drawn
|
||||
// at the proper time as well as the one drawn early.
|
||||
scheduleAnimationLocked();
|
||||
}
|
||||
|
||||
if (mWindowsChanged && !mWindowChangeListeners.isEmpty()) {
|
||||
mH.removeMessages(H.REPORT_WINDOWS_CHANGE);
|
||||
mH.sendMessage(mH.obtainMessage(H.REPORT_WINDOWS_CHANGE));
|
||||
@@ -8366,6 +8384,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
mLayoutNeeded = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ((mPendingLayoutChanges & WindowManagerPolicy.FINISH_LAYOUT_REDO_CONFIG) != 0) {
|
||||
if (DEBUG_LAYOUT) Slog.v(TAG, "Computing new config from layout");
|
||||
if (updateOrientationFromAppTokensLocked(true)) {
|
||||
@@ -8373,6 +8392,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
mH.sendEmptyMessage(H.SEND_NEW_CONFIGURATION);
|
||||
}
|
||||
}
|
||||
|
||||
if ((mPendingLayoutChanges & WindowManagerPolicy.FINISH_LAYOUT_REDO_LAYOUT) != 0) {
|
||||
mLayoutNeeded = true;
|
||||
}
|
||||
@@ -8584,8 +8604,6 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
}
|
||||
}
|
||||
|
||||
boolean needRelayout = false;
|
||||
|
||||
if (!mAnimator.mAnimating && mAppTransitionRunning) {
|
||||
// We have finished the animation of an app transition. To do
|
||||
// this, we have delayed a lot of operations like showing and
|
||||
@@ -8594,7 +8612,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
// be out of sync with it. So here we will just rebuild the
|
||||
// entire app window list. Fun!
|
||||
mAppTransitionRunning = false;
|
||||
needRelayout = true;
|
||||
mLayoutNeeded = true;
|
||||
rebuildAppWindowListLocked();
|
||||
assignLayersLocked();
|
||||
// Clear information about apps that were moving.
|
||||
@@ -8605,19 +8623,10 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
mH.sendEmptyMessage(H.REPORT_LOSING_FOCUS);
|
||||
}
|
||||
if (wallpaperDestroyed) {
|
||||
needRelayout = adjustWallpaperWindowsLocked() != 0;
|
||||
mLayoutNeeded |= adjustWallpaperWindowsLocked() != 0;
|
||||
}
|
||||
if ((mPendingLayoutChanges & (
|
||||
WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER |
|
||||
ADJUST_WALLPAPER_LAYERS_CHANGED |
|
||||
WindowManagerPolicy.FINISH_LAYOUT_REDO_CONFIG |
|
||||
WindowManagerPolicy.FINISH_LAYOUT_REDO_LAYOUT)) != 0) {
|
||||
needRelayout = true;
|
||||
}
|
||||
if (needRelayout) {
|
||||
requestTraversalLocked();
|
||||
} else if (mAnimator.mAnimating) {
|
||||
scheduleAnimationLocked();
|
||||
if (mPendingLayoutChanges != 0) {
|
||||
mLayoutNeeded = true;
|
||||
}
|
||||
|
||||
// Finally update all input windows now that the window changes have stabilized.
|
||||
@@ -8660,7 +8669,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
}
|
||||
}
|
||||
|
||||
if (mInnerFields.mOrientationChangeComplete && !needRelayout &&
|
||||
if (mInnerFields.mOrientationChangeComplete && !mLayoutNeeded &&
|
||||
!mInnerFields.mUpdateRotation) {
|
||||
checkDrawnWindowsLocked();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user