diff options
| -rw-r--r-- | core/java/android/view/Display.java | 7 | ||||
| -rw-r--r-- | core/java/android/view/WindowMetrics.java | 4 |
2 files changed, 8 insertions, 3 deletions
diff --git a/core/java/android/view/Display.java b/core/java/android/view/Display.java index 6464239eb2fc..be572f8249d5 100644 --- a/core/java/android/view/Display.java +++ b/core/java/android/view/Display.java @@ -1677,7 +1677,12 @@ public final class Display { * {@code getWindowManager()} or {@code getSystemService(Context.WINDOW_SERVICE)}), the * returned metrics provide the size of the current app window. As a result, in * multi-window mode, the returned size can be smaller than the size of the device - * screen. + * screen. System decoration handling may vary depending on API level: + * <ul> + * <li>API level 35 and above, the window size will be returned. + * <li>API level 34 and below, the window size minus system decoration areas and + * display cutout is returned. + * </ul> * <li>If metrics are requested from a non-activity context (for example, the application * context, where the WindowManager is accessed by * {@code getApplicationContext().getSystemService(Context.WINDOW_SERVICE)}), the diff --git a/core/java/android/view/WindowMetrics.java b/core/java/android/view/WindowMetrics.java index 8bcc9de118e2..12af692a4556 100644 --- a/core/java/android/view/WindowMetrics.java +++ b/core/java/android/view/WindowMetrics.java @@ -107,8 +107,8 @@ public final class WindowMetrics { * and display cutout areas depending on the calling context and target SDK level. Please refer * to {@link Display#getSize(Point)} for details. * <p> - * The value reported by {@link Display#getSize(Point)} excluding system decoration areas can be - * obtained by using: + * The following code snippet shows how to get the bounds excluding navigation bars and display + * cutout: * <pre class="prettyprint"> * final WindowMetrics metrics = windowManager.getCurrentWindowMetrics(); * // Gets all excluding insets |