summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Ibrahim Yilmaz <iyz@google.com> 2025-03-03 05:55:11 -0800
committer Ibrahim Yilmaz <iyz@google.com> 2025-03-03 05:55:11 -0800
commit06a99c9a7193119d85bfae6df053e6575f57d23e (patch)
tree7099def8360fdbf1e15ad22d9ac1b8dff1fef5a3
parentbdb2c65f1df2c6224067ab13c59ebdd41ea414c3 (diff)
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
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationTemplateViewWrapper.java10
1 files changed, 9 insertions, 1 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationTemplateViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationTemplateViewWrapper.java
index 4146a941c025..f3bb82802468 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationTemplateViewWrapper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationTemplateViewWrapper.java
@@ -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;
- mNotificationTopLine.setHeaderTextMarginEnd(marginEnd);
+ // 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) {