Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 91f651e5 authored by Nergi Rahardi's avatar Nergi Rahardi Committed by Android (Google) Code Review
Browse files

Merge "Refactor Display.*Tests to use WindowStateBuilder" into main

parents 44664bd8 1fd8ca0f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -450,7 +450,7 @@ public class DisplayAreaTest extends WindowTestsBase {
    public void testGetOrientation() {
        final DisplayArea.Tokens area = new DisplayArea.Tokens(mWm, ABOVE_TASKS, "test");
        mDisplayContent.addChild(area, POSITION_TOP);
        final WindowState win = createWindow(null, TYPE_APPLICATION_OVERLAY, "overlay");
        final WindowState win = newWindowBuilder("overlay", TYPE_APPLICATION_OVERLAY).build();
        win.mAttrs.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
        win.mToken.reparent(area, POSITION_TOP);
        spyOn(win);
+2 −2
Original line number Diff line number Diff line
@@ -76,7 +76,7 @@ public class DisplayPolicyLayoutTests extends DisplayPolicyTestsBase {

    @Before
    public void setUp() throws Exception {
        mWindow = spy(createWindow(null, TYPE_APPLICATION, "window"));
        mWindow = spy(newWindowBuilder("window", TYPE_APPLICATION).build());

        spyOn(mStatusBarWindow);
        spyOn(mNavBarWindow);
@@ -147,7 +147,7 @@ public class DisplayPolicyLayoutTests extends DisplayPolicyTestsBase {
    public void addingWindow_withInsetsTypes() {
        mDisplayPolicy.removeWindowLw(mStatusBarWindow);  // Removes the existing one.

        final WindowState win = createWindow(null, TYPE_STATUS_BAR_SUB_PANEL, "statusBar");
        final WindowState win = newWindowBuilder("statusBar", TYPE_STATUS_BAR_SUB_PANEL).build();
        final Binder owner = new Binder();
        win.mAttrs.providedInsets = new InsetsFrameProvider[] {
                new InsetsFrameProvider(owner, 0, WindowInsets.Type.statusBars()),
+6 −6
Original line number Diff line number Diff line
@@ -76,7 +76,7 @@ import org.junit.runner.RunWith;
public class DisplayPolicyTests extends WindowTestsBase {

    private WindowState createOpaqueFullscreen(boolean hasLightNavBar) {
        final WindowState win = createWindow(null, TYPE_BASE_APPLICATION, "opaqueFullscreen");
        final WindowState win = newWindowBuilder("opaqueFullscreen", TYPE_BASE_APPLICATION).build();
        final WindowManager.LayoutParams attrs = win.mAttrs;
        attrs.width = MATCH_PARENT;
        attrs.height = MATCH_PARENT;
@@ -99,7 +99,7 @@ public class DisplayPolicyTests extends WindowTestsBase {
    }

    private WindowState createDimmingDialogWindow(boolean canBeImTarget) {
        final WindowState win = spy(createWindow(null, TYPE_APPLICATION, "dimmingDialog"));
        final WindowState win = spy(newWindowBuilder("dimmingDialog", TYPE_APPLICATION).build());
        final WindowManager.LayoutParams attrs = win.mAttrs;
        attrs.width = WRAP_CONTENT;
        attrs.height = WRAP_CONTENT;
@@ -111,7 +111,7 @@ public class DisplayPolicyTests extends WindowTestsBase {

    private WindowState createInputMethodWindow(boolean visible, boolean drawNavBar,
            boolean hasLightNavBar) {
        final WindowState win = createWindow(null, TYPE_INPUT_METHOD, "inputMethod");
        final WindowState win = newWindowBuilder("inputMethod", TYPE_INPUT_METHOD).build();
        final WindowManager.LayoutParams attrs = win.mAttrs;
        attrs.width = MATCH_PARENT;
        attrs.height = MATCH_PARENT;
@@ -301,7 +301,7 @@ public class DisplayPolicyTests extends WindowTestsBase {
    }

    private WindowState createApplicationWindow() {
        final WindowState win = createWindow(null, TYPE_APPLICATION, "Application");
        final WindowState win = newWindowBuilder("Application", TYPE_APPLICATION).build();
        final WindowManager.LayoutParams attrs = win.mAttrs;
        attrs.width = MATCH_PARENT;
        attrs.height = MATCH_PARENT;
@@ -312,7 +312,7 @@ public class DisplayPolicyTests extends WindowTestsBase {
    }

    private WindowState createBaseApplicationWindow() {
        final WindowState win = createWindow(null, TYPE_BASE_APPLICATION, "Application");
        final WindowState win = newWindowBuilder("Application", TYPE_BASE_APPLICATION).build();
        final WindowManager.LayoutParams attrs = win.mAttrs;
        attrs.width = MATCH_PARENT;
        attrs.height = MATCH_PARENT;
@@ -450,7 +450,7 @@ public class DisplayPolicyTests extends WindowTestsBase {
        displayPolicy.getDecorInsetsInfo(Surface.ROTATION_90, di.logicalHeight, di.logicalWidth);
        // Add a window that provides the same insets in current rotation. But it specifies
        // different insets in other rotations.
        final WindowState bar2 = createWindow(null, navbar.mAttrs.type, "bar2");
        final WindowState bar2 = newWindowBuilder("bar2", navbar.mAttrs.type).build();
        bar2.mAttrs.providedInsets = new InsetsFrameProvider[] {
                new InsetsFrameProvider(bar2, 0, WindowInsets.Type.navigationBars())
                        .setInsetsSize(Insets.of(0, 0, 0, NAV_BAR_HEIGHT))