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

Commit c4b36e5c authored by Brad Stenning's avatar Brad Stenning Committed by android-build-merger
Browse files

Merge "Update displayId when a window is moved to a new display" into pi-dev

am: 32e7a0c2

Change-Id: I659d556f9eaa4e614951c17b81f6a98b04374d44
parents 7d584911 32e7a0c2
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -92,7 +92,7 @@ public final class InputWindowHandle {
    public int inputFeatures;

    // Display this input is on.
    public final int displayId;
    public int displayId;

    private native void nativeDispose();

+3 −1
Original line number Diff line number Diff line
@@ -178,6 +178,7 @@ import android.util.MergedConfiguration;
import android.util.Slog;
import android.util.TimeUtils;
import android.util.proto.ProtoOutputStream;
import android.view.Display;
import android.view.DisplayCutout;
import android.view.DisplayInfo;
import android.view.Gravity;
@@ -1366,6 +1367,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
        // Window was not laid out for this display yet, so make sure mLayoutSeq does not match.
        if (dc != null) {
            mLayoutSeq = dc.mLayoutSeq - 1;
            mInputWindowHandle.displayId = dc.getDisplayId();
        }
    }

@@ -1378,7 +1380,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
    public int getDisplayId() {
        final DisplayContent displayContent = getDisplayContent();
        if (displayContent == null) {
            return -1;
            return Display.INVALID_DISPLAY;
        }
        return displayContent.getDisplayId();
    }
+11 −0
Original line number Diff line number Diff line
@@ -326,6 +326,17 @@ public class WindowStateTests extends WindowTestsBase {
        assertThat(app.mLayoutSeq, not(is(mDisplayContent.mLayoutSeq)));
    }

    @Test
    public void testDisplayIdUpdatedOnReparent() throws Exception {
        final WindowState app = createWindow(null, TYPE_APPLICATION, "app");
        // fake a different display
        app.mInputWindowHandle.displayId = mDisplayContent.getDisplayId() + 1;
        app.onDisplayChanged(mDisplayContent);

        assertThat(app.mInputWindowHandle.displayId, is(mDisplayContent.getDisplayId()));
        assertThat(app.getDisplayId(), is(mDisplayContent.getDisplayId()));
    }

    private void testPrepareWindowToDisplayDuringRelayout(boolean wasVisible) {
        reset(mPowerManagerWrapper);
        final WindowState root = createWindow(null, TYPE_APPLICATION, "root");