From 6acc5c97c5586e071e057324d891ee4b3efca4d9 Mon Sep 17 00:00:00 2001 From: Alex Chau Date: Mon, 26 Jun 2023 19:49:47 +0000 Subject: [PATCH] Re-land "[getPossibleMaximumWindowMetrics] return bounds in natural orientation" This reverts commit 95086712145850d6a9f4d5327364729eaa6cb13d. Reason for revert: tests now passing Change-Id: I5192263dcc1770ff8077e3407226c54604508478 Fixes: 284124064 --- core/java/android/window/WindowMetricsController.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/core/java/android/window/WindowMetricsController.java b/core/java/android/window/WindowMetricsController.java index 954f68633e571..2858f0a1a725b 100644 --- a/core/java/android/window/WindowMetricsController.java +++ b/core/java/android/window/WindowMetricsController.java @@ -145,13 +145,13 @@ public final class WindowMetricsController { for (int i = 0; i < possibleDisplayInfos.size(); i++) { currentDisplayInfo = possibleDisplayInfos.get(i); - // Calculate max bounds for this rotation and state. - Rect maxBounds = new Rect(0, 0, currentDisplayInfo.logicalWidth, - currentDisplayInfo.logicalHeight); + // Calculate max bounds for natural rotation and state. + Rect maxBounds = new Rect(0, 0, currentDisplayInfo.getNaturalWidth(), + currentDisplayInfo.getNaturalHeight()); - // Calculate insets for the rotated max bounds. + // Calculate insets for the natural max bounds. final boolean isScreenRound = (currentDisplayInfo.flags & Display.FLAG_ROUND) != 0; - // Initialize insets based upon display rotation. Note any window-provided insets + // Initialize insets based on Surface.ROTATION_0. Note any window-provided insets // will not be set. windowInsets = getWindowInsetsFromServerForDisplay( currentDisplayInfo.displayId, null /* token */,