diff options
| -rw-r--r-- | services/core/java/com/android/server/wm/DisplayContent.java | 39 | ||||
| -rw-r--r-- | services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java | 15 |
2 files changed, 33 insertions, 21 deletions
diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java index 49248107a004..243c3f26ad61 100644 --- a/services/core/java/com/android/server/wm/DisplayContent.java +++ b/services/core/java/com/android/server/wm/DisplayContent.java @@ -1004,6 +1004,24 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp mTmpApplySurfaceChangesTransactionState.obscured; final RootWindowContainer root = mWmService.mRoot; + if (w.mHasSurface) { + // Take care of the window being ready to display. + final boolean committed = w.mWinAnimator.commitFinishDrawingLocked(); + if (isDefaultDisplay && committed) { + if (w.hasWallpaper()) { + ProtoLog.v(WM_DEBUG_WALLPAPER, + "First draw done in potential wallpaper target %s", w); + mWallpaperMayChange = true; + pendingLayoutChanges |= FINISH_LAYOUT_REDO_WALLPAPER; + if (DEBUG_LAYOUT_REPEATS) { + surfacePlacer.debugLayoutRepeats( + "wallpaper and commitFinishDrawingLocked true", + pendingLayoutChanges); + } + } + } + } + // Update effect. w.mObscured = mTmpApplySurfaceChangesTransactionState.obscured; @@ -1090,30 +1108,9 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp w.handleWindowMovedIfNeeded(); - final WindowStateAnimator winAnimator = w.mWinAnimator; - //Slog.i(TAG, "Window " + this + " clearing mContentChanged - done placing"); w.resetContentChanged(); - // Moved from updateWindowsAndWallpaperLocked(). - if (w.mHasSurface) { - // Take care of the window being ready to display. - final boolean committed = winAnimator.commitFinishDrawingLocked(); - if (isDefaultDisplay && committed) { - if (w.hasWallpaper()) { - ProtoLog.v(WM_DEBUG_WALLPAPER, - "First draw done in potential wallpaper target %s", w); - mWallpaperMayChange = true; - pendingLayoutChanges |= FINISH_LAYOUT_REDO_WALLPAPER; - if (DEBUG_LAYOUT_REPEATS) { - surfacePlacer.debugLayoutRepeats( - "wallpaper and commitFinishDrawingLocked true", - pendingLayoutChanges); - } - } - } - } - final ActivityRecord activity = w.mActivityRecord; if (activity != null && activity.isVisibleRequested()) { activity.updateLetterboxSurface(w); diff --git a/services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java b/services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java index 5b88c8cbec92..c6fa8a1b5a98 100644 --- a/services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java @@ -643,6 +643,21 @@ public class DisplayContentTests extends WindowTestsBase { } @Test + public void testDisplayHasContent() { + final WindowState window = createWindow(null, TYPE_APPLICATION_OVERLAY, "window"); + setDrawnState(WindowStateAnimator.COMMIT_DRAW_PENDING, window); + assertFalse(mDisplayContent.getLastHasContent()); + // The pending draw state should be committed and the has-content state is also updated. + mDisplayContent.applySurfaceChangesTransaction(); + assertTrue(window.isDrawn()); + assertTrue(mDisplayContent.getLastHasContent()); + // If the only window is no longer visible, has-content will be false. + setDrawnState(WindowStateAnimator.NO_SURFACE, window); + mDisplayContent.applySurfaceChangesTransaction(); + assertFalse(mDisplayContent.getLastHasContent()); + } + + @Test public void testImeIsAttachedToDisplayForLetterboxedApp() { final DisplayContent dc = mDisplayContent; final WindowState ws = createWindow(null, TYPE_APPLICATION, dc, "app window"); |