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

Commit 78d43e11 authored by Riddle Hsu's avatar Riddle Hsu Committed by Android (Google) Code Review
Browse files

Merge "Assign display field when creating WindowState" into main

parents 2d95833e d84b2dad
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1106,7 +1106,7 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
        return mInsetsSourceProviders;
    }

    public DisplayContent getDisplayContent() {
    public final DisplayContent getDisplayContent() {
        return mDisplayContent;
    }

+1 −5
Original line number Diff line number Diff line
@@ -1089,6 +1089,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
        mClient = c;
        mAppOp = appOp;
        mToken = token;
        mDisplayContent = token.mDisplayContent;
        mActivityRecord = mToken.asActivityRecord();
        mOwnerUid = ownerId;
        mShowUserId = showUserId;
@@ -1564,11 +1565,6 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
        mOrientationChangeTimedOut = true;
    }

    @Override
    public DisplayContent getDisplayContent() {
        return mToken.getDisplayContent();
    }

    @Override
    void onDisplayChanged(DisplayContent dc) {
        if (dc != null && mDisplayContent != null && dc != mDisplayContent
+4 −19
Original line number Diff line number Diff line
@@ -66,8 +66,6 @@ import android.os.Binder;
import android.os.IBinder;
import android.platform.test.annotations.Presubmit;
import android.view.SurfaceControl;
import android.view.View;
import android.view.WindowManager;
import android.window.DisplayAreaInfo;
import android.window.IDisplayAreaOrganizer;

@@ -451,17 +449,11 @@ public class DisplayAreaTest extends WindowTestsBase {
    @Test
    public void testGetOrientation() {
        final DisplayArea.Tokens area = new DisplayArea.Tokens(mWm, ABOVE_TASKS, "test");
        final WindowToken token = createWindowToken(TYPE_APPLICATION_OVERLAY);
        spyOn(token);
        doReturn(mock(DisplayContent.class)).when(token).getDisplayContent();
        doNothing().when(token).setParent(any());
        final WindowState win = createWindowState(token);
        spyOn(win);
        doNothing().when(win).setParent(any());
        mDisplayContent.addChild(area, POSITION_TOP);
        final WindowState win = createWindow(null, TYPE_APPLICATION_OVERLAY, "overlay");
        win.mAttrs.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
        token.addChild(win, 0);
        area.addChild(token);

        win.mToken.reparent(area, POSITION_TOP);
        spyOn(win);
        doReturn(true).when(win).isVisible();

        assertEquals("Visible window can request orientation",
@@ -753,13 +745,6 @@ public class DisplayAreaTest extends WindowTestsBase {
        }
    }

    private WindowState createWindowState(WindowToken token) {
        return new WindowState(mWm, getTestSession(), new TestIWindow(), token,
                null /* parentWindow */, 0 /* appOp */, new WindowManager.LayoutParams(),
                View.VISIBLE, 0 /* ownerId */, 0 /* showUserId */,
                false /* ownerCanAddInternalSystemWindow */);
    }

    private WindowToken createWindowToken(int type) {
        return new WindowToken.Builder(mWm, new Binder(), type).build();
    }