summaryrefslogtreecommitdiff
path: root/core/java/android/view/WindowManagerImpl.java
diff options
context:
space:
mode:
Diffstat (limited to 'core/java/android/view/WindowManagerImpl.java')
-rw-r--r--core/java/android/view/WindowManagerImpl.java35
1 files changed, 16 insertions, 19 deletions
diff --git a/core/java/android/view/WindowManagerImpl.java b/core/java/android/view/WindowManagerImpl.java
index 5dd7c840d99a..dd8041684c78 100644
--- a/core/java/android/view/WindowManagerImpl.java
+++ b/core/java/android/view/WindowManagerImpl.java
@@ -351,25 +351,11 @@ public final class WindowManagerImpl implements WindowManager {
throw e.rethrowFromSystemServer();
}
- int size = possibleDisplayInfos.size();
- DisplayInfo currentDisplayInfo;
- WindowInsets windowInsets = null;
- if (size > 0) {
- currentDisplayInfo = possibleDisplayInfos.get(0);
-
- final WindowManager.LayoutParams params = new WindowManager.LayoutParams();
- final boolean isScreenRound = (currentDisplayInfo.flags & Display.FLAG_ROUND) != 0;
- // TODO(181127261) not computing insets correctly - need to have underlying
- // frame reflect the faked orientation.
- windowInsets = getWindowInsetsFromServerForDisplay(
- currentDisplayInfo.displayId, params,
- new Rect(0, 0, currentDisplayInfo.getNaturalWidth(),
- currentDisplayInfo.getNaturalHeight()), isScreenRound,
- WINDOWING_MODE_FULLSCREEN);
- }
-
Set<WindowMetrics> maxMetrics = new HashSet<>();
- for (int i = 0; i < size; i++) {
+ WindowInsets windowInsets;
+ DisplayInfo currentDisplayInfo;
+ final WindowManager.LayoutParams params = new WindowManager.LayoutParams();
+ for (int i = 0; i < possibleDisplayInfos.size(); i++) {
currentDisplayInfo = possibleDisplayInfos.get(i);
// Calculate max bounds for this rotation and state.
@@ -377,7 +363,18 @@ public final class WindowManagerImpl implements WindowManager {
currentDisplayInfo.logicalHeight);
// Calculate insets for the rotated max bounds.
- // TODO(181127261) calculate insets for each display rotation and state.
+ final boolean isScreenRound = (currentDisplayInfo.flags & Display.FLAG_ROUND) != 0;
+ // Initialize insets based upon display rotation. Note any window-provided insets
+ // will not be set.
+ windowInsets = getWindowInsetsFromServerForDisplay(
+ currentDisplayInfo.displayId, params,
+ new Rect(0, 0, currentDisplayInfo.getNaturalWidth(),
+ currentDisplayInfo.getNaturalHeight()), isScreenRound,
+ WINDOWING_MODE_FULLSCREEN);
+ // Set the hardware-provided insets.
+ windowInsets = new WindowInsets.Builder(windowInsets).setRoundedCorners(
+ currentDisplayInfo.roundedCorners)
+ .setDisplayCutout(currentDisplayInfo.displayCutout).build();
maxMetrics.add(new WindowMetrics(maxBounds, windowInsets));
}