Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7d432029 authored by Wen Zhang's avatar Wen Zhang
Browse files

[Bugfix]Use local width and height to get cutout in the target direction

In the vertical-to-horizontal screen orientation switch scenario, when SystemUI obtains the cutout through method applyHeight, using logicWidth and logicHeight may result in incorrect calculation of the rect for devices configured with side cutouts, leading to abnormal insets updates due to the Display updating the horizontal screen information in advance.
By aligning the direction transformation calculation with the current local width and height, the issue of abnormal calculation of side cutouts in rotation scenarios can be fundamentally resolved.

Bug: 404727504
Test:See the bug's reproduce steps.
Change-Id: I499c73a09610bdd941afe3367112dfc1943f747c
parent eea3b0d2
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -64,12 +64,14 @@ public final class SystemBarUtils {
        display.getDisplayInfo(info);
        Insets insets;
        Insets waterfallInsets;
        final int localWidth = context.getResources().getDisplayMetrics().widthPixels;
        final int localHeight = context.getResources().getDisplayMetrics().heightPixels;
        if (cutout == null) {
            insets = Insets.NONE;
            waterfallInsets = Insets.NONE;
        } else {
            DisplayCutout rotated =
                    cutout.getRotated(info.logicalWidth, info.logicalHeight, rotation, targetRot);
                    cutout.getRotated(localWidth, localHeight, rotation, targetRot);
            insets = Insets.of(rotated.getSafeInsets());
            waterfallInsets = rotated.getWaterfallInsets();
        }