diff options
| author | Naomi Musgrave <nmusgrave@google.com> | 2021-02-03 10:08:15 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2021-02-03 10:08:15 +0000 |
| commit | 173704e599de3b6eecfc3fdfc1261291635bfa12 (patch) | |
| tree | 4dfa6de59d597ee032193fa99967f9845de2735e /core/java/android/view/DisplayInfo.java | |
| parent | 61e00321e5ae182f1d2a0a91a16cc8608460fc2c (diff) | |
| parent | 4d3f1c5681c4db99ffb4be881cee134b750542eb (diff) | |
Merge "Sandbox letterbox and size compat apps" into sc-dev
Diffstat (limited to 'core/java/android/view/DisplayInfo.java')
| -rw-r--r-- | core/java/android/view/DisplayInfo.java | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/core/java/android/view/DisplayInfo.java b/core/java/android/view/DisplayInfo.java index d200a328773b..7cabb04767bb 100644 --- a/core/java/android/view/DisplayInfo.java +++ b/core/java/android/view/DisplayInfo.java @@ -24,6 +24,7 @@ import static android.view.DisplayInfoProto.LOGICAL_WIDTH; import static android.view.DisplayInfoProto.NAME; import android.annotation.Nullable; +import android.app.WindowConfiguration; import android.compat.annotation.UnsupportedAppUsage; import android.content.res.CompatibilityInfo; import android.content.res.Configuration; @@ -605,11 +606,29 @@ public final class DisplayInfo implements Parcelable { getMetricsWithSize(outMetrics, ci, configuration, appWidth, appHeight); } + /** + * Populates {@code outMetrics} with details of the logical display. Bounds are limited + * by the logical size of the display. + * + * @param outMetrics the {@link DisplayMetrics} to be populated + * @param compatInfo the {@link CompatibilityInfo} to be applied + * @param configuration the {@link Configuration} + */ public void getLogicalMetrics(DisplayMetrics outMetrics, CompatibilityInfo compatInfo, Configuration configuration) { getMetricsWithSize(outMetrics, compatInfo, configuration, logicalWidth, logicalHeight); } + /** + * Similar to {@link #getLogicalMetrics}, but the limiting bounds are determined from + * {@link WindowConfiguration#getMaxBounds()} + */ + public void getMaxBoundsMetrics(DisplayMetrics outMetrics, CompatibilityInfo compatInfo, + Configuration configuration) { + Rect bounds = configuration.windowConfiguration.getMaxBounds(); + getMetricsWithSize(outMetrics, compatInfo, configuration, bounds.width(), bounds.height()); + } + public int getNaturalWidth() { return rotation == Surface.ROTATION_0 || rotation == Surface.ROTATION_180 ? logicalWidth : logicalHeight; |
