Merge "Update displayId when a window is moved to a new display" into pi-dev
am: 32e7a0c23b
Change-Id: I659d556f9eaa4e614951c17b81f6a98b04374d44
This commit is contained in:
@@ -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();
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user