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

Commit e8a35366 authored by felkachang's avatar felkachang Committed by Felka Chang
Browse files

Clock notification text was cut off

The root cause is that HeadsUpStatusBarView doesn't considerate the
Cut Out situation. The Cut Out situation can use
getRootWindowInsets().getDisplayCutout().getSafeInsetLeft() to get
the the value.

There are two parts need to handle Cut out.
The one part is to handle the padding. It needs to considerate both of
mLeftInset and mLeftCutOutInset because it use getLocationOnScreen to
count the location.

The other part is to handle the HeadsUpStatusBarView.translationX.
It only needs to considerate mLeftCutOutInset because landscape
degree 90 has the left side cut out and translationX by the distance
between screen left boundary and scroller's left boundary. The
distance include Cut Out so it need minus mCutOutInsetLeft in the
setPanelTranslation.

Cut Out has 4 mode: Disable, Corner, Double, and Tall. Disable and
Double are handled by the same way. Corner and Tall are handled
by the same way.

Bug: 78113562
Test: atest SystemUITests
Change-Id: Ic2a272c43f65eed8c4b3749787637f5fb848bb8a
Fix: 78113562
parent adc15344
Loading
Loading
Loading
Loading
+14 −4
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ public class HeadsUpStatusBarView extends AlphaOptimizedLinearLayout {
    private boolean mPublicMode;
    private int mMaxWidth;
    private View mRootView;
    private int mLeftCutOutInset;
    private int mLeftInset;
    private Rect mIconDrawingRect = new Rect();
    private Runnable mOnDrawingRectChangedListener;
@@ -136,7 +137,7 @@ public class HeadsUpStatusBarView extends AlphaOptimizedLinearLayout {
        int bottom = top + mIconPlaceholder.getHeight();
        mLayoutedIconRect.set(left, top, right, bottom);
        updateDrawingRect();
        int targetPadding = mAbsoluteStartPadding + mLeftInset;
        int targetPadding = mAbsoluteStartPadding + mLeftInset + mLeftCutOutInset;
        if (left != targetPadding) {
            int newPadding = targetPadding - left + getPaddingStart();
            setPaddingRelative(newPadding, 0, mEndMargin, 0);
@@ -150,9 +151,8 @@ public class HeadsUpStatusBarView extends AlphaOptimizedLinearLayout {
        }
    }

    @Override
    public void setTranslationX(float translationX) {
        super.setTranslationX(translationX);
    public void setPanelTranslation(float translationX) {
        setTranslationX(translationX - mLeftCutOutInset);
        updateDrawingRect();
    }

@@ -168,6 +168,16 @@ public class HeadsUpStatusBarView extends AlphaOptimizedLinearLayout {
    @Override
    protected boolean fitSystemWindows(Rect insets) {
        mLeftInset = insets.left;
        mLeftCutOutInset = (getRootWindowInsets().getDisplayCutout() != null)
                ? getRootWindowInsets().getDisplayCutout().getSafeInsetLeft() : 0;

        // For Double Cut Out mode, the System window navigation bar is at the right
        // hand side of the left cut out. In this condition, mLeftInset include the left cut
        // out width so we set mLeftCutOutInset to be 0.
        if (mLeftInset != 0) {
            mLeftCutOutInset = 0;
        }

        return super.fitSystemWindows(insets);
    }

+1 −1
Original line number Diff line number Diff line
@@ -123,7 +123,7 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener,

    public void updatePanelTranslation() {
        float newTranslation = mStackScroller.getLeft() + mStackScroller.getTranslationX();
        mHeadsUpStatusBarView.setTranslationX(newTranslation);
        mHeadsUpStatusBarView.setPanelTranslation(newTranslation);
    }

    private void updateTopEntry() {