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

Commit b8d2bfe9 authored by Ioana Alexandru's avatar Ioana Alexandru
Browse files

[Notif redesign] Prevent NPR in NotificationHeaderView

This can in theory only happen if a test does something wrong, but the
null check can't hurt anyway.

Fix: 397656509
Test: NotificationContentViewTest
Flag: android.app.notifications_redesign_templates
Change-Id: I56edf6678c06c3ba20bb538f948acababd2a5600
parent 7cbacbdc
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -223,10 +223,16 @@ public class NotificationHeaderView extends RelativeLayout {
        super.onMeasure(widthMeasureSpec, heightMeasureSpec);

        if (notificationsRedesignTemplates()) {
            // TODO: b/378660052 - These should never be null in practice, consider using
            //  requireViewById() in the onFinishInflate.
            if (mTopLineView != null) {
                mTopLineTranslation = measureCenterTranslation(mTopLineView);
            }
            if (mExpandButton != null) {
                mExpandButtonTranslation = measureCenterTranslation(mExpandButton);
            }
        }
    }

    private float measureCenterTranslation(View view) {
        // When the view is centered (see centerTopLine), its height is MATCH_PARENT