Loading services/core/java/com/android/server/wm/DisplayContent.java +14 −9 Original line number Original line Diff line number Diff line Loading @@ -3577,17 +3577,22 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo drawnWindowTypes.put(TYPE_NOTIFICATION_SHADE, true); drawnWindowTypes.put(TYPE_NOTIFICATION_SHADE, true); final WindowState visibleNotDrawnWindow = getWindow(w -> { final WindowState visibleNotDrawnWindow = getWindow(w -> { if (w.mViewVisibility == View.VISIBLE && !w.mObscured && !w.isDrawnLw()) { boolean isVisible = w.mViewVisibility == View.VISIBLE && !w.mObscured; boolean hasDrawn = w.isDrawnLw() && w.hasDrawnLw(); if (isVisible && !hasDrawn) { return true; return true; } } if (w.isDrawnLw()) { if (hasDrawn) { final int type = w.mAttrs.type; switch (w.mAttrs.type) { if (type == TYPE_BOOT_PROGRESS || type == TYPE_BASE_APPLICATION case TYPE_BOOT_PROGRESS: || type == TYPE_WALLPAPER) { case TYPE_BASE_APPLICATION: drawnWindowTypes.put(type, true); case TYPE_WALLPAPER: } else if (type == TYPE_NOTIFICATION_SHADE) { drawnWindowTypes.put(w.mAttrs.type, true); break; case TYPE_NOTIFICATION_SHADE: drawnWindowTypes.put(TYPE_NOTIFICATION_SHADE, drawnWindowTypes.put(TYPE_NOTIFICATION_SHADE, mWmService.mPolicy.isKeyguardDrawnLw()); mWmService.mPolicy.isKeyguardDrawnLw()); break; } } } } return false; return false; Loading services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java +20 −6 Original line number Original line Diff line number Diff line Loading @@ -97,9 +97,7 @@ import android.view.InsetsState; import android.view.MotionEvent; import android.view.MotionEvent; import android.view.Surface; import android.view.Surface; import android.view.SurfaceControl.Transaction; import android.view.SurfaceControl.Transaction; import android.view.ViewRootImpl; import android.view.WindowManager; import android.view.WindowManager; import android.view.test.InsetsModeSession; import androidx.test.filters.SmallTest; import androidx.test.filters.SmallTest; Loading Loading @@ -448,7 +446,7 @@ public class DisplayContentTests extends WindowTestsBase { assertTrue(defaultDisplay.shouldWaitForSystemDecorWindowsOnBoot()); assertTrue(defaultDisplay.shouldWaitForSystemDecorWindowsOnBoot()); // Verify not waiting for drawn windows. // Verify not waiting for drawn windows. makeWindowsDrawn(windows); makeWindowsDrawnState(windows, WindowStateAnimator.HAS_DRAWN); assertFalse(defaultDisplay.shouldWaitForSystemDecorWindowsOnBoot()); assertFalse(defaultDisplay.shouldWaitForSystemDecorWindowsOnBoot()); } } Loading @@ -469,10 +467,26 @@ public class DisplayContentTests extends WindowTestsBase { assertTrue(secondaryDisplay.shouldWaitForSystemDecorWindowsOnBoot()); assertTrue(secondaryDisplay.shouldWaitForSystemDecorWindowsOnBoot()); // Verify not waiting for drawn windows on display with system decorations. // Verify not waiting for drawn windows on display with system decorations. makeWindowsDrawn(windows); makeWindowsDrawnState(windows, WindowStateAnimator.HAS_DRAWN); assertFalse(secondaryDisplay.shouldWaitForSystemDecorWindowsOnBoot()); assertFalse(secondaryDisplay.shouldWaitForSystemDecorWindowsOnBoot()); } } @Test public void testShouldWaitForSystemDecorWindowsOnBoot_OnWindowReadyToShowAndDrawn() { mWm.mSystemBooted = true; final DisplayContent defaultDisplay = mWm.getDefaultDisplayContentLocked(); final WindowState[] windows = createNotDrawnWindowsOn(defaultDisplay, TYPE_WALLPAPER, TYPE_APPLICATION); // Verify waiting for windows to be drawn. makeWindowsDrawnState(windows, WindowStateAnimator.READY_TO_SHOW); assertTrue(defaultDisplay.shouldWaitForSystemDecorWindowsOnBoot()); // Verify not waiting for drawn windows. makeWindowsDrawnState(windows, WindowStateAnimator.HAS_DRAWN); assertFalse(defaultDisplay.shouldWaitForSystemDecorWindowsOnBoot()); } private WindowState[] createNotDrawnWindowsOn(DisplayContent displayContent, int... types) { private WindowState[] createNotDrawnWindowsOn(DisplayContent displayContent, int... types) { final WindowState[] windows = new WindowState[types.length]; final WindowState[] windows = new WindowState[types.length]; for (int i = 0; i < types.length; i++) { for (int i = 0; i < types.length; i++) { Loading @@ -483,10 +497,10 @@ public class DisplayContentTests extends WindowTestsBase { return windows; return windows; } } private static void makeWindowsDrawn(WindowState[] windows) { private static void makeWindowsDrawnState(WindowState[] windows, int state) { for (WindowState window : windows) { for (WindowState window : windows) { window.mHasSurface = true; window.mHasSurface = true; window.mWinAnimator.mDrawState = WindowStateAnimator.HAS_DRAWN; window.mWinAnimator.mDrawState = state; } } } } Loading Loading
services/core/java/com/android/server/wm/DisplayContent.java +14 −9 Original line number Original line Diff line number Diff line Loading @@ -3577,17 +3577,22 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo drawnWindowTypes.put(TYPE_NOTIFICATION_SHADE, true); drawnWindowTypes.put(TYPE_NOTIFICATION_SHADE, true); final WindowState visibleNotDrawnWindow = getWindow(w -> { final WindowState visibleNotDrawnWindow = getWindow(w -> { if (w.mViewVisibility == View.VISIBLE && !w.mObscured && !w.isDrawnLw()) { boolean isVisible = w.mViewVisibility == View.VISIBLE && !w.mObscured; boolean hasDrawn = w.isDrawnLw() && w.hasDrawnLw(); if (isVisible && !hasDrawn) { return true; return true; } } if (w.isDrawnLw()) { if (hasDrawn) { final int type = w.mAttrs.type; switch (w.mAttrs.type) { if (type == TYPE_BOOT_PROGRESS || type == TYPE_BASE_APPLICATION case TYPE_BOOT_PROGRESS: || type == TYPE_WALLPAPER) { case TYPE_BASE_APPLICATION: drawnWindowTypes.put(type, true); case TYPE_WALLPAPER: } else if (type == TYPE_NOTIFICATION_SHADE) { drawnWindowTypes.put(w.mAttrs.type, true); break; case TYPE_NOTIFICATION_SHADE: drawnWindowTypes.put(TYPE_NOTIFICATION_SHADE, drawnWindowTypes.put(TYPE_NOTIFICATION_SHADE, mWmService.mPolicy.isKeyguardDrawnLw()); mWmService.mPolicy.isKeyguardDrawnLw()); break; } } } } return false; return false; Loading
services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java +20 −6 Original line number Original line Diff line number Diff line Loading @@ -97,9 +97,7 @@ import android.view.InsetsState; import android.view.MotionEvent; import android.view.MotionEvent; import android.view.Surface; import android.view.Surface; import android.view.SurfaceControl.Transaction; import android.view.SurfaceControl.Transaction; import android.view.ViewRootImpl; import android.view.WindowManager; import android.view.WindowManager; import android.view.test.InsetsModeSession; import androidx.test.filters.SmallTest; import androidx.test.filters.SmallTest; Loading Loading @@ -448,7 +446,7 @@ public class DisplayContentTests extends WindowTestsBase { assertTrue(defaultDisplay.shouldWaitForSystemDecorWindowsOnBoot()); assertTrue(defaultDisplay.shouldWaitForSystemDecorWindowsOnBoot()); // Verify not waiting for drawn windows. // Verify not waiting for drawn windows. makeWindowsDrawn(windows); makeWindowsDrawnState(windows, WindowStateAnimator.HAS_DRAWN); assertFalse(defaultDisplay.shouldWaitForSystemDecorWindowsOnBoot()); assertFalse(defaultDisplay.shouldWaitForSystemDecorWindowsOnBoot()); } } Loading @@ -469,10 +467,26 @@ public class DisplayContentTests extends WindowTestsBase { assertTrue(secondaryDisplay.shouldWaitForSystemDecorWindowsOnBoot()); assertTrue(secondaryDisplay.shouldWaitForSystemDecorWindowsOnBoot()); // Verify not waiting for drawn windows on display with system decorations. // Verify not waiting for drawn windows on display with system decorations. makeWindowsDrawn(windows); makeWindowsDrawnState(windows, WindowStateAnimator.HAS_DRAWN); assertFalse(secondaryDisplay.shouldWaitForSystemDecorWindowsOnBoot()); assertFalse(secondaryDisplay.shouldWaitForSystemDecorWindowsOnBoot()); } } @Test public void testShouldWaitForSystemDecorWindowsOnBoot_OnWindowReadyToShowAndDrawn() { mWm.mSystemBooted = true; final DisplayContent defaultDisplay = mWm.getDefaultDisplayContentLocked(); final WindowState[] windows = createNotDrawnWindowsOn(defaultDisplay, TYPE_WALLPAPER, TYPE_APPLICATION); // Verify waiting for windows to be drawn. makeWindowsDrawnState(windows, WindowStateAnimator.READY_TO_SHOW); assertTrue(defaultDisplay.shouldWaitForSystemDecorWindowsOnBoot()); // Verify not waiting for drawn windows. makeWindowsDrawnState(windows, WindowStateAnimator.HAS_DRAWN); assertFalse(defaultDisplay.shouldWaitForSystemDecorWindowsOnBoot()); } private WindowState[] createNotDrawnWindowsOn(DisplayContent displayContent, int... types) { private WindowState[] createNotDrawnWindowsOn(DisplayContent displayContent, int... types) { final WindowState[] windows = new WindowState[types.length]; final WindowState[] windows = new WindowState[types.length]; for (int i = 0; i < types.length; i++) { for (int i = 0; i < types.length; i++) { Loading @@ -483,10 +497,10 @@ public class DisplayContentTests extends WindowTestsBase { return windows; return windows; } } private static void makeWindowsDrawn(WindowState[] windows) { private static void makeWindowsDrawnState(WindowState[] windows, int state) { for (WindowState window : windows) { for (WindowState window : windows) { window.mHasSurface = true; window.mHasSurface = true; window.mWinAnimator.mDrawState = WindowStateAnimator.HAS_DRAWN; window.mWinAnimator.mDrawState = state; } } } } Loading