Merge "Only run layout if we didn't have content" into pi-dev

This commit is contained in:
TreeHugger Robot
2018-09-24 21:30:11 +00:00
committed by Android (Google) Code Review
2 changed files with 23 additions and 10 deletions

View File

@@ -400,6 +400,9 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
private MagnificationSpec mMagnificationSpec; private MagnificationSpec mMagnificationSpec;
/** Caches the value whether told display manager that we have content. */
private boolean mLastHasContent;
private final Consumer<WindowState> mUpdateWindowsForAnimator = w -> { private final Consumer<WindowState> mUpdateWindowsForAnimator = w -> {
WindowStateAnimator winAnimator = w.mWinAnimator; WindowStateAnimator winAnimator = w.mWinAnimator;
final AppWindowToken atoken = w.mAppToken; final AppWindowToken atoken = w.mAppToken;
@@ -2916,8 +2919,9 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
forAllWindows(mApplySurfaceChangesTransaction, true /* traverseTopToBottom */); forAllWindows(mApplySurfaceChangesTransaction, true /* traverseTopToBottom */);
prepareSurfaces(); prepareSurfaces();
mLastHasContent = mTmpApplySurfaceChangesTransactionState.displayHasContent;
mService.mDisplayManagerInternal.setDisplayProperties(mDisplayId, mService.mDisplayManagerInternal.setDisplayProperties(mDisplayId,
mTmpApplySurfaceChangesTransactionState.displayHasContent, mLastHasContent,
mTmpApplySurfaceChangesTransactionState.preferredRefreshRate, mTmpApplySurfaceChangesTransactionState.preferredRefreshRate,
mTmpApplySurfaceChangesTransactionState.preferredModeId, mTmpApplySurfaceChangesTransactionState.preferredModeId,
true /* inTraversal, must call performTraversalInTrans... below */); true /* inTraversal, must call performTraversalInTrans... below */);
@@ -4052,4 +4056,11 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
private boolean canUpdateImeTarget() { private boolean canUpdateImeTarget() {
return mDeferUpdateImeTargetCount == 0; return mDeferUpdateImeTargetCount == 0;
} }
/**
* @return Cached value whether we told display manager that we have content.
*/
boolean getLastHasContent() {
return mLastHasContent;
}
} }

View File

@@ -1185,15 +1185,17 @@ class WindowStateAnimator {
if (mIsWallpaper) { if (mIsWallpaper) {
w.dispatchWallpaperVisibility(true); w.dispatchWallpaperVisibility(true);
} }
// This draw means the difference between unique content and mirroring. if (!w.getDisplayContent().getLastHasContent()) {
// Run another pass through performLayout to set mHasContent in the // This draw means the difference between unique content and mirroring.
// LogicalDisplay. // Run another pass through performLayout to set mHasContent in the
mAnimator.setPendingLayoutChanges(w.getDisplayId(), // LogicalDisplay.
FINISH_LAYOUT_REDO_ANIM); mAnimator.setPendingLayoutChanges(w.getDisplayId(),
if (DEBUG_LAYOUT_REPEATS) { FINISH_LAYOUT_REDO_ANIM);
mService.mWindowPlacerLocked.debugLayoutRepeats( if (DEBUG_LAYOUT_REPEATS) {
"showSurfaceRobustlyLocked " + w, mService.mWindowPlacerLocked.debugLayoutRepeats(
mAnimator.getPendingLayoutChanges(w.getDisplayId())); "showSurfaceRobustlyLocked " + w,
mAnimator.getPendingLayoutChanges(w.getDisplayId()));
}
} }
} else { } else {
w.setOrientationChanging(false); w.setOrientationChanging(false);