summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
authorNaomi Musgrave <nmusgrave@google.com>2021-10-14 11:07:00 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2021-10-14 11:07:00 +0000
commit2e398596abc2dc0fbf4b530aa0cb5a36d034ecb8 (patch)
treeedcc73e3c0e3be37f89cde1702f1243063971877 /core/java/android
parent35a6b708a4f3bbe25008b08fa25e58a82cd1e4e8 (diff)
parent992523e826bf1214495b832795e7f7573db03985 (diff)
PossibleMaximumWindowMetrics reports physical display insets for each am: a77d7425a4 am: 992523e826
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15982549 Change-Id: Iaad54f5a313171ff92f38c1cd65800309be1ef9a
Diffstat (limited to 'core/java/android')
-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));
}