Loading core/java/com/android/internal/policy/SystemBarUtils.java +17 −16 Original line number Diff line number Diff line Loading @@ -19,8 +19,9 @@ package com.android.internal.policy; import android.content.Context; import android.content.res.Resources; import android.graphics.Insets; import android.util.RotationUtils; import android.view.Display; import android.view.DisplayCutout; import android.view.DisplayInfo; import android.view.Surface; import com.android.internal.R; Loading Loading @@ -56,21 +57,21 @@ public final class SystemBarUtils { */ public static int getStatusBarHeightForRotation( Context context, @Surface.Rotation int targetRot) { final int rotation = context.getDisplay().getRotation(); final DisplayCutout cutout = context.getDisplay().getCutout(); Insets insets = cutout == null ? Insets.NONE : Insets.of(cutout.getSafeInsets()); Insets waterfallInsets = cutout == null ? Insets.NONE : cutout.getWaterfallInsets(); // rotate insets to target rotation if needed. if (rotation != targetRot) { if (!insets.equals(Insets.NONE)) { insets = RotationUtils.rotateInsets( insets, RotationUtils.deltaRotation(rotation, targetRot)); } if (!waterfallInsets.equals(Insets.NONE)) { waterfallInsets = RotationUtils.rotateInsets( waterfallInsets, RotationUtils.deltaRotation(rotation, 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; if (cutout == null) { insets = Insets.NONE; waterfallInsets = Insets.NONE; } else { DisplayCutout rotated = cutout.getRotated(info.logicalWidth, info.logicalHeight, rotation, targetRot); insets = Insets.of(rotated.getSafeInsets()); waterfallInsets = rotated.getWaterfallInsets(); } final int defaultSize = context.getResources().getDimensionPixelSize(R.dimen.status_bar_height_default); Loading Loading
core/java/com/android/internal/policy/SystemBarUtils.java +17 −16 Original line number Diff line number Diff line Loading @@ -19,8 +19,9 @@ package com.android.internal.policy; import android.content.Context; import android.content.res.Resources; import android.graphics.Insets; import android.util.RotationUtils; import android.view.Display; import android.view.DisplayCutout; import android.view.DisplayInfo; import android.view.Surface; import com.android.internal.R; Loading Loading @@ -56,21 +57,21 @@ public final class SystemBarUtils { */ public static int getStatusBarHeightForRotation( Context context, @Surface.Rotation int targetRot) { final int rotation = context.getDisplay().getRotation(); final DisplayCutout cutout = context.getDisplay().getCutout(); Insets insets = cutout == null ? Insets.NONE : Insets.of(cutout.getSafeInsets()); Insets waterfallInsets = cutout == null ? Insets.NONE : cutout.getWaterfallInsets(); // rotate insets to target rotation if needed. if (rotation != targetRot) { if (!insets.equals(Insets.NONE)) { insets = RotationUtils.rotateInsets( insets, RotationUtils.deltaRotation(rotation, targetRot)); } if (!waterfallInsets.equals(Insets.NONE)) { waterfallInsets = RotationUtils.rotateInsets( waterfallInsets, RotationUtils.deltaRotation(rotation, 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; if (cutout == null) { insets = Insets.NONE; waterfallInsets = Insets.NONE; } else { DisplayCutout rotated = cutout.getRotated(info.logicalWidth, info.logicalHeight, rotation, targetRot); insets = Insets.of(rotated.getSafeInsets()); waterfallInsets = rotated.getWaterfallInsets(); } final int defaultSize = context.getResources().getDimensionPixelSize(R.dimen.status_bar_height_default); Loading