diff --git a/core/java/android/view/InsetsFrameProvider.java b/core/java/android/view/InsetsFrameProvider.java index 470c2801d838e..37b6c77e3c74b 100644 --- a/core/java/android/view/InsetsFrameProvider.java +++ b/core/java/android/view/InsetsFrameProvider.java @@ -223,6 +223,10 @@ public class InsetsFrameProvider implements Parcelable { if (mArbitraryRectangle != null) { sb.append(", mArbitraryRectangle=").append(mArbitraryRectangle.toShortString()); } + if (mMinimalInsetsSizeInDisplayCutoutSafe != null) { + sb.append(", mMinimalInsetsSizeInDisplayCutoutSafe=") + .append(mMinimalInsetsSizeInDisplayCutoutSafe); + } sb.append("}"); return sb.toString(); } @@ -248,6 +252,7 @@ public class InsetsFrameProvider implements Parcelable { mInsetsSize = in.readTypedObject(Insets.CREATOR); mInsetsSizeOverrides = in.createTypedArray(InsetsSizeOverride.CREATOR); mArbitraryRectangle = in.readTypedObject(Rect.CREATOR); + mMinimalInsetsSizeInDisplayCutoutSafe = in.readTypedObject(Insets.CREATOR); } @Override @@ -258,6 +263,7 @@ public class InsetsFrameProvider implements Parcelable { out.writeTypedObject(mInsetsSize, flags); out.writeTypedArray(mInsetsSizeOverrides, flags); out.writeTypedObject(mArbitraryRectangle, flags); + out.writeTypedObject(mMinimalInsetsSizeInDisplayCutoutSafe, flags); } public boolean idEquals(InsetsFrameProvider o) { @@ -276,13 +282,16 @@ public class InsetsFrameProvider implements Parcelable { return mId == other.mId && mSource == other.mSource && mFlags == other.mFlags && Objects.equals(mInsetsSize, other.mInsetsSize) && Arrays.equals(mInsetsSizeOverrides, other.mInsetsSizeOverrides) - && Objects.equals(mArbitraryRectangle, other.mArbitraryRectangle); + && Objects.equals(mArbitraryRectangle, other.mArbitraryRectangle) + && Objects.equals(mMinimalInsetsSizeInDisplayCutoutSafe, + other.mMinimalInsetsSizeInDisplayCutoutSafe); } @Override public int hashCode() { return Objects.hash(mId, mSource, mFlags, mInsetsSize, - Arrays.hashCode(mInsetsSizeOverrides), mArbitraryRectangle); + Arrays.hashCode(mInsetsSizeOverrides), mArbitraryRectangle, + mMinimalInsetsSizeInDisplayCutoutSafe); } public static final @NonNull Parcelable.Creator CREATOR = diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java index b0fb349083e6c..682335e0b419a 100644 --- a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java +++ b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java @@ -76,7 +76,6 @@ import android.telecom.TelecomManager; import android.text.TextUtils; import android.util.Log; import android.view.Display; -import android.view.DisplayCutout; import android.view.Gravity; import android.view.HapticFeedbackConstants; import android.view.InsetsFrameProvider; @@ -1730,9 +1729,6 @@ public class NavigationBar extends ViewController implements tappableElementProvider.setInsetsSize(Insets.NONE); } - final DisplayCutout cutout = userContext.getDisplay().getCutout(); - final int safeInsetsLeft = cutout != null ? cutout.getSafeInsetLeft() : 0; - final int safeInsetsRight = cutout != null ? cutout.getSafeInsetRight() : 0; final int gestureHeight = userContext.getResources().getDimensionPixelSize( com.android.internal.R.dimen.navigation_bar_gesture_height); final boolean handlingGesture = mEdgeBackGestureHandler.isHandlingGestures(); @@ -1742,19 +1738,23 @@ public class NavigationBar extends ViewController implements mandatoryGestureProvider.setInsetsSize(Insets.of(0, 0, 0, gestureHeight)); } final int gestureInsetsLeft = handlingGesture - ? mEdgeBackGestureHandler.getEdgeWidthLeft() + safeInsetsLeft : 0; + ? mEdgeBackGestureHandler.getEdgeWidthLeft() : 0; final int gestureInsetsRight = handlingGesture - ? mEdgeBackGestureHandler.getEdgeWidthRight() + safeInsetsRight : 0; + ? mEdgeBackGestureHandler.getEdgeWidthRight() : 0; return new InsetsFrameProvider[] { navBarProvider, tappableElementProvider, mandatoryGestureProvider, new InsetsFrameProvider(mInsetsSourceOwner, 0, WindowInsets.Type.systemGestures()) .setSource(InsetsFrameProvider.SOURCE_DISPLAY) - .setInsetsSize(Insets.of(gestureInsetsLeft, 0, 0, 0)), + .setInsetsSize(Insets.of(gestureInsetsLeft, 0, 0, 0)) + .setMinimalInsetsSizeInDisplayCutoutSafe( + Insets.of(gestureInsetsLeft, 0, 0, 0)), new InsetsFrameProvider(mInsetsSourceOwner, 1, WindowInsets.Type.systemGestures()) .setSource(InsetsFrameProvider.SOURCE_DISPLAY) .setInsetsSize(Insets.of(0, 0, gestureInsetsRight, 0)) + .setMinimalInsetsSizeInDisplayCutoutSafe( + Insets.of(0, 0, gestureInsetsRight, 0)) }; }