public int inputFeatures;
// Display this input is on.
- public final int displayId;
+ public int displayId;
private native void nativeDispose();
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;
// 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();
}
}
public int getDisplayId() {
final DisplayContent displayContent = getDisplayContent();
if (displayContent == null) {
- return -1;
+ return Display.INVALID_DISPLAY;
}
return displayContent.getDisplayId();
}
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");