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

Commit 2f55e694 authored by Yunfan Chen's avatar Yunfan Chen
Browse files

Clean up: remove unnecessary display info access

The previous fixes changed the calculation to use the display related
information from the context to make things consistent. The display info
is no longer needed.

Additional comments are added to clarify that the context should be the
display context containing the corresponding cutout to avoid misuse.

Bug: 404727504
Test: build
Flag: EXEMPT cleanup
Change-Id: I3d32c57d4c1938da390aefc493d532c4fd6ef101
parent f2ff33e8
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -23,7 +23,6 @@ import android.content.res.Resources;
import android.graphics.Insets;
import android.view.Display;
import android.view.DisplayCutout;
import android.view.DisplayInfo;
import android.view.Surface;

import com.android.internal.R;
@@ -56,14 +55,15 @@ public final class SystemBarUtils {

    /**
     * Gets the status bar height for a specific rotation.
     *
     * @param context the Context to reflect the display containing the display cutout. The size and
     *                the rotation will be used as a reference of the calculation.
     */
    public static int getStatusBarHeightForRotation(
            Context context, @Surface.Rotation int targetRot) {
        final Display display = context.getDisplay();
        final int rotation = display.getRotation();
        final DisplayCutout cutout = display.getCutout();
        DisplayInfo info = new DisplayInfo();
        display.getDisplayInfo(info);
        Insets insets;
        Insets waterfallInsets;
        final int localWidth = context.getResources().getDisplayMetrics().widthPixels;