summaryrefslogtreecommitdiff
path: root/core/java/android/util/DisplayUtils.java
Commit message (Collapse)AuthorAgeFilesLines
* DisplayUtils: Introduce getScaleFactorAnierinB2022-12-301-0/+18
| | | | | | | | | | | Gets the display size ratio for the current resolution vs the maximum supported resolution. Start by applying this to physical_power_button_center_screen_location_y and sfpsProps so we can accurately scale them down based on the current resolution. Change-Id: Idfbf8e70664226919b603d92616104c09e94e3d1
* Replace DisplayManager.getStableDisplaySize with max Display.ModeShawn Lin2022-05-211-5/+24
| | | | | | | | | | | | | | | | | | | | | | The DisplayManager.getStableDisplaySize is not the right way to get the size we want for screen decorations and display team is going to get rid of it. Instead, we use the maximum display size supported by the display as the base size to define the cutout and rounded corner configs. Also fixed a bug that DisplayCutoutBaseView didn't update the shoudDrawCutout config when display change. Bug: 230227839 Test: 1. On foldable device, fold and unfold the device and check if the cutout is correctly drawn. 2. On device supporting multiple resolutions, switch resolution between FHD & QHD and check if the cutout is correctly drawn. Test: atest LocalDisplayAdapterTest DisplayCutoutTest ScreenDecorationsTest RoundedCornersTest DisplayCutoutBaseViewTest Change-Id: I7a602b5abd7d6a21d17eae4f8e99414eaf765fa5
* Support scaled cutout & roundedcorners when resolution is overriddenshawnlin2022-04-201-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | | In current desgin, the confgis for cutout and rounded corner are based on the original display size. If the display resolution is overridden, cutous and rounded corners will be drawn in incorrect places with incorrect size. We should load the cutout & rounded corners with the orignal display size and then scale the results with the display ratio which is calculated by dividing current size with original size. Bug: 209592558 Test: manual: 1. Go Settings-> Display-> Screen Resolution 2. Switch between FHD+ and QHD+ 3. Check if the cutout and rounded corner looks the same as they are in the original display size. Test: manual: 1. adb shell wm size 1080x2340 2. Check if the cutout and rounded corner looks the same as they are in the original display size. Test: atest DisplayCutoutTest LocalDisplayAdapterTest ScreenDecorationsTest RoundedCornerResDelegateTest Change-Id: Iea42b73c0276b82983c1ddbce9455355afdc164d
* Support rounded corner for multi-display devicesshawnlin2021-08-251-0/+54
- Add new array configs for every rounded corner configs. - Update rounded corner drawable when a display changes in ScreenDecorations. Bug: 131221697 Test: atest DisplayCutoutTest RoundedCornersTest LocalDisplayAdapterTest ScreenDecorationsTest Change-Id: I1f32ff680609267010b05a39a5b8e84511bf1243