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

Commit 06a99c9a authored by Ibrahim Yilmaz's avatar Ibrahim Yilmaz
Browse files

Add null check to NotificationToplineView

NotificationToplineView can be null for custom decorated view notifications, which we don't let such notifications to be promoted ongoing. For test purpose, we let some custom notifications to be a RON, this causes NPE since NTLV doesn't exist. This CL fixes this issue.

Bug: 400185978
Test: Presubmit & Post a RON with Custom Decorated Notification and no crash.
Flag: com.android.systemui.ui_rich_ongoing_force_expanded
Change-Id: I9d1386d9f63905f6342252b4ead7fac0b22b94bd
parent bdb2c65f
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -211,11 +211,19 @@ public class NotificationTemplateViewWrapper extends NotificationHeaderViewWrapp
            rightIconLP.setMarginEnd(horizontalMargin);
            mRightIcon.setLayoutParams(rightIconLP);

            // if there is no title and topline view, there is nothing to adjust.
            if (mNotificationTopLine == null && mTitle == null) {
                return;
            }

            // align top line view to start of the right icon.
            final int iconSize = mView.getResources().getDimensionPixelSize(
                com.android.internal.R.dimen.notification_right_icon_size);
            final int marginEnd = 2 * horizontalMargin + iconSize;
            // set margin end for the top line view if it exists
            if (mNotificationTopLine != null) {
                mNotificationTopLine.setHeaderTextMarginEnd(marginEnd);
            }

            // title has too much margin on the right, so we need to reduce it
            if (mTitle != null) {