Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotificationRowContentBinderImplTest.kt +6 −2 Original line number Diff line number Diff line Loading @@ -116,6 +116,7 @@ class NotificationRowContentBinderImplTest : SysuiTestCase() { } } private val promotedNotificationContentExtractor = FakePromotedNotificationContentExtractor() private val conversationNotificationProcessor: ConversationNotificationProcessor = mock() @Before fun setUp() { Loading @@ -132,7 +133,7 @@ class NotificationRowContentBinderImplTest : SysuiTestCase() { NotificationRowContentBinderImpl( cache, mock(), mock<ConversationNotificationProcessor>(), conversationNotificationProcessor, mock(), smartReplyStateInflater, layoutInflaterFactoryProvider, Loading Loading @@ -462,12 +463,15 @@ class NotificationRowContentBinderImplTest : SysuiTestCase() { @Test fun testInflatePublicSingleLineConversationView() { val testPerson = Person.Builder().setName("Person").build() val style = Notification.MessagingStyle(testPerson) val messagingBuilder = Notification.Builder(mContext, "no-id") .setSmallIcon(R.drawable.ic_person) .setContentTitle("Title") .setContentText("Text") .setStyle(Notification.MessagingStyle(testPerson)) .setStyle(style) whenever(conversationNotificationProcessor.processNotification(any(), any(), any())) .thenReturn(style) val messagingRow = spy(testHelper.createRow(messagingBuilder.build())) messagingRow.publicLayout.removeAllViews() Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentInflater.java +41 −14 Original line number Diff line number Diff line Loading @@ -203,18 +203,20 @@ public class NotificationContentInflater implements NotificationRowContentBinder result = inflateSmartReplyViews(result, reInflateFlags, entry, row.getContext(), packageContext, row.getExistingSmartReplyState(), smartRepliesInflater, mLogger); boolean isConversation = entry.getRanking().isConversation(); if (AsyncHybridViewInflation.isEnabled()) { Notification.MessagingStyle messagingStyle = null; if (isConversation) { if (isConversation && (AsyncHybridViewInflation.isEnabled() || LockscreenOtpRedaction.isSingleLineViewEnabled())) { messagingStyle = mConversationProcessor .processNotification(entry, builder, mLogger); } if (AsyncHybridViewInflation.isEnabled()) { SingleLineViewModel viewModel = SingleLineViewInflater .inflateSingleLineViewModel( entry.getSbn().getNotification(), messagingStyle, builder, row.getContext() row.getContext(), false ); // If the messagingStyle is null, we want to inflate the normal view isConversation = viewModel.isConversation(); Loading @@ -228,11 +230,22 @@ public class NotificationContentInflater implements NotificationRowContentBinder mLogger ); } if (LockscreenOtpRedaction.isSingleLineViewEnabled()) { if (bindParams.redactionType == REDACTION_TYPE_SENSITIVE_CONTENT) { result.mPublicInflatedSingleLineViewModel = SingleLineViewInflater.inflateRedactedSingleLineViewModel(row.getContext(), isConversation); SingleLineViewInflater.inflateSingleLineViewModel( entry.getSbn().getNotification(), messagingStyle, builder, row.getContext(), true); } else { result.mPublicInflatedSingleLineViewModel = SingleLineViewInflater.inflateRedactedSingleLineViewModel( row.getContext(), isConversation ); } result.mPublicInflatedSingleLineView = SingleLineViewInflater.inflatePublicSingleLineView( isConversation, Loading Loading @@ -1300,7 +1313,8 @@ public class NotificationContentInflater implements NotificationRowContentBinder mEntry.getSbn().getNotification(), messagingStyle, recoveredBuilder, mContext mContext, false ); result.mInflatedSingleLineView = SingleLineViewInflater.inflatePrivateSingleLineView( Loading @@ -1313,9 +1327,22 @@ public class NotificationContentInflater implements NotificationRowContentBinder } if (LockscreenOtpRedaction.isSingleLineViewEnabled()) { if (mBindParams.redactionType == REDACTION_TYPE_SENSITIVE_CONTENT) { result.mPublicInflatedSingleLineViewModel = SingleLineViewInflater.inflateSingleLineViewModel( mEntry.getSbn().getNotification(), messagingStyle, recoveredBuilder, mContext, true ); } else { result.mPublicInflatedSingleLineViewModel = SingleLineViewInflater.inflateRedactedSingleLineViewModel(mContext, isConversation); SingleLineViewInflater.inflateRedactedSingleLineViewModel( mContext, isConversation ); } result.mPublicInflatedSingleLineView = SingleLineViewInflater.inflatePublicSingleLineView( isConversation, Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationRowContentBinderImpl.kt +15 −4 Original line number Diff line number Diff line Loading @@ -718,6 +718,7 @@ constructor( messagingStyle = messagingStyle, builder = builder, systemUiContext = systemUiContext, redactText = false, ) } else null Loading @@ -727,10 +728,20 @@ constructor( reInflateFlags and FLAG_CONTENT_VIEW_PUBLIC_SINGLE_LINE != 0 ) { logger.logAsyncTaskProgress(entry, "inflating public single line view model") if (bindParams.redactionType == REDACTION_TYPE_SENSITIVE_CONTENT) { SingleLineViewInflater.inflateSingleLineViewModel( notification = entry.sbn.notification, messagingStyle = messagingStyle, builder = builder, systemUiContext = systemUiContext, redactText = true, ) } else { SingleLineViewInflater.inflateRedactedSingleLineViewModel( systemUiContext, entry.ranking.isConversation, ) } } else null val headsUpStatusBarModel = Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/row/SingleLineViewInflater.kt +11 −2 Original line number Diff line number Diff line Loading @@ -51,6 +51,7 @@ internal object SingleLineViewInflater { * notification, not for legacy messaging notifications * @param builder the recovered Notification Builder * @param systemUiContext the context of Android System UI * @param redactText indicates if the text needs to be redacted * @return the inflated SingleLineViewModel */ @JvmStatic Loading @@ -59,13 +60,21 @@ internal object SingleLineViewInflater { messagingStyle: MessagingStyle?, builder: Notification.Builder, systemUiContext: Context, redactText: Boolean, ): SingleLineViewModel { if (AsyncHybridViewInflation.isUnexpectedlyInLegacyMode()) { return SingleLineViewModel(null, null, null) } peopleHelper.init(systemUiContext) var titleText = HybridGroupManager.resolveTitle(notification) var contentText = HybridGroupManager.resolveText(notification) var contentText = if (redactText) { systemUiContext.getString( com.android.systemui.res.R.string.redacted_notification_single_line_text ) } else { HybridGroupManager.resolveText(notification) } if (messagingStyle == null) { return SingleLineViewModel( Loading @@ -81,7 +90,7 @@ internal object SingleLineViewInflater { if (conversationTextData?.conversationTitle?.isNotEmpty() == true) { titleText = conversationTextData.conversationTitle } if (conversationTextData?.conversationText?.isNotEmpty() == true) { if (!redactText && conversationTextData?.conversationText?.isNotEmpty() == true) { contentText = conversationTextData.conversationText } Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/SingleLineViewBinderTest.kt +3 −0 Original line number Diff line number Diff line Loading @@ -89,6 +89,7 @@ class SingleLineViewBinderTest : SysuiTestCase() { messagingStyle = null, builder = notificationBuilder, systemUiContext = context, redactText = false, ) // WHEN: binds the viewHolder Loading Loading @@ -149,6 +150,7 @@ class SingleLineViewBinderTest : SysuiTestCase() { messagingStyle = style, builder = notificationBuilder, systemUiContext = context, redactText = false, ) // WHEN: binds the view SingleLineViewBinder.bind(viewModel, view) Loading Loading @@ -197,6 +199,7 @@ class SingleLineViewBinderTest : SysuiTestCase() { messagingStyle = null, builder = notificationBuilder, systemUiContext = context, redactText = false, ) // WHEN: binds the view with the view model SingleLineViewBinder.bind(viewModel, view) Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotificationRowContentBinderImplTest.kt +6 −2 Original line number Diff line number Diff line Loading @@ -116,6 +116,7 @@ class NotificationRowContentBinderImplTest : SysuiTestCase() { } } private val promotedNotificationContentExtractor = FakePromotedNotificationContentExtractor() private val conversationNotificationProcessor: ConversationNotificationProcessor = mock() @Before fun setUp() { Loading @@ -132,7 +133,7 @@ class NotificationRowContentBinderImplTest : SysuiTestCase() { NotificationRowContentBinderImpl( cache, mock(), mock<ConversationNotificationProcessor>(), conversationNotificationProcessor, mock(), smartReplyStateInflater, layoutInflaterFactoryProvider, Loading Loading @@ -462,12 +463,15 @@ class NotificationRowContentBinderImplTest : SysuiTestCase() { @Test fun testInflatePublicSingleLineConversationView() { val testPerson = Person.Builder().setName("Person").build() val style = Notification.MessagingStyle(testPerson) val messagingBuilder = Notification.Builder(mContext, "no-id") .setSmallIcon(R.drawable.ic_person) .setContentTitle("Title") .setContentText("Text") .setStyle(Notification.MessagingStyle(testPerson)) .setStyle(style) whenever(conversationNotificationProcessor.processNotification(any(), any(), any())) .thenReturn(style) val messagingRow = spy(testHelper.createRow(messagingBuilder.build())) messagingRow.publicLayout.removeAllViews() Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentInflater.java +41 −14 Original line number Diff line number Diff line Loading @@ -203,18 +203,20 @@ public class NotificationContentInflater implements NotificationRowContentBinder result = inflateSmartReplyViews(result, reInflateFlags, entry, row.getContext(), packageContext, row.getExistingSmartReplyState(), smartRepliesInflater, mLogger); boolean isConversation = entry.getRanking().isConversation(); if (AsyncHybridViewInflation.isEnabled()) { Notification.MessagingStyle messagingStyle = null; if (isConversation) { if (isConversation && (AsyncHybridViewInflation.isEnabled() || LockscreenOtpRedaction.isSingleLineViewEnabled())) { messagingStyle = mConversationProcessor .processNotification(entry, builder, mLogger); } if (AsyncHybridViewInflation.isEnabled()) { SingleLineViewModel viewModel = SingleLineViewInflater .inflateSingleLineViewModel( entry.getSbn().getNotification(), messagingStyle, builder, row.getContext() row.getContext(), false ); // If the messagingStyle is null, we want to inflate the normal view isConversation = viewModel.isConversation(); Loading @@ -228,11 +230,22 @@ public class NotificationContentInflater implements NotificationRowContentBinder mLogger ); } if (LockscreenOtpRedaction.isSingleLineViewEnabled()) { if (bindParams.redactionType == REDACTION_TYPE_SENSITIVE_CONTENT) { result.mPublicInflatedSingleLineViewModel = SingleLineViewInflater.inflateRedactedSingleLineViewModel(row.getContext(), isConversation); SingleLineViewInflater.inflateSingleLineViewModel( entry.getSbn().getNotification(), messagingStyle, builder, row.getContext(), true); } else { result.mPublicInflatedSingleLineViewModel = SingleLineViewInflater.inflateRedactedSingleLineViewModel( row.getContext(), isConversation ); } result.mPublicInflatedSingleLineView = SingleLineViewInflater.inflatePublicSingleLineView( isConversation, Loading Loading @@ -1300,7 +1313,8 @@ public class NotificationContentInflater implements NotificationRowContentBinder mEntry.getSbn().getNotification(), messagingStyle, recoveredBuilder, mContext mContext, false ); result.mInflatedSingleLineView = SingleLineViewInflater.inflatePrivateSingleLineView( Loading @@ -1313,9 +1327,22 @@ public class NotificationContentInflater implements NotificationRowContentBinder } if (LockscreenOtpRedaction.isSingleLineViewEnabled()) { if (mBindParams.redactionType == REDACTION_TYPE_SENSITIVE_CONTENT) { result.mPublicInflatedSingleLineViewModel = SingleLineViewInflater.inflateSingleLineViewModel( mEntry.getSbn().getNotification(), messagingStyle, recoveredBuilder, mContext, true ); } else { result.mPublicInflatedSingleLineViewModel = SingleLineViewInflater.inflateRedactedSingleLineViewModel(mContext, isConversation); SingleLineViewInflater.inflateRedactedSingleLineViewModel( mContext, isConversation ); } result.mPublicInflatedSingleLineView = SingleLineViewInflater.inflatePublicSingleLineView( isConversation, Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationRowContentBinderImpl.kt +15 −4 Original line number Diff line number Diff line Loading @@ -718,6 +718,7 @@ constructor( messagingStyle = messagingStyle, builder = builder, systemUiContext = systemUiContext, redactText = false, ) } else null Loading @@ -727,10 +728,20 @@ constructor( reInflateFlags and FLAG_CONTENT_VIEW_PUBLIC_SINGLE_LINE != 0 ) { logger.logAsyncTaskProgress(entry, "inflating public single line view model") if (bindParams.redactionType == REDACTION_TYPE_SENSITIVE_CONTENT) { SingleLineViewInflater.inflateSingleLineViewModel( notification = entry.sbn.notification, messagingStyle = messagingStyle, builder = builder, systemUiContext = systemUiContext, redactText = true, ) } else { SingleLineViewInflater.inflateRedactedSingleLineViewModel( systemUiContext, entry.ranking.isConversation, ) } } else null val headsUpStatusBarModel = Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/row/SingleLineViewInflater.kt +11 −2 Original line number Diff line number Diff line Loading @@ -51,6 +51,7 @@ internal object SingleLineViewInflater { * notification, not for legacy messaging notifications * @param builder the recovered Notification Builder * @param systemUiContext the context of Android System UI * @param redactText indicates if the text needs to be redacted * @return the inflated SingleLineViewModel */ @JvmStatic Loading @@ -59,13 +60,21 @@ internal object SingleLineViewInflater { messagingStyle: MessagingStyle?, builder: Notification.Builder, systemUiContext: Context, redactText: Boolean, ): SingleLineViewModel { if (AsyncHybridViewInflation.isUnexpectedlyInLegacyMode()) { return SingleLineViewModel(null, null, null) } peopleHelper.init(systemUiContext) var titleText = HybridGroupManager.resolveTitle(notification) var contentText = HybridGroupManager.resolveText(notification) var contentText = if (redactText) { systemUiContext.getString( com.android.systemui.res.R.string.redacted_notification_single_line_text ) } else { HybridGroupManager.resolveText(notification) } if (messagingStyle == null) { return SingleLineViewModel( Loading @@ -81,7 +90,7 @@ internal object SingleLineViewInflater { if (conversationTextData?.conversationTitle?.isNotEmpty() == true) { titleText = conversationTextData.conversationTitle } if (conversationTextData?.conversationText?.isNotEmpty() == true) { if (!redactText && conversationTextData?.conversationText?.isNotEmpty() == true) { contentText = conversationTextData.conversationText } Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/SingleLineViewBinderTest.kt +3 −0 Original line number Diff line number Diff line Loading @@ -89,6 +89,7 @@ class SingleLineViewBinderTest : SysuiTestCase() { messagingStyle = null, builder = notificationBuilder, systemUiContext = context, redactText = false, ) // WHEN: binds the viewHolder Loading Loading @@ -149,6 +150,7 @@ class SingleLineViewBinderTest : SysuiTestCase() { messagingStyle = style, builder = notificationBuilder, systemUiContext = context, redactText = false, ) // WHEN: binds the view SingleLineViewBinder.bind(viewModel, view) Loading Loading @@ -197,6 +199,7 @@ class SingleLineViewBinderTest : SysuiTestCase() { messagingStyle = null, builder = notificationBuilder, systemUiContext = context, redactText = false, ) // WHEN: binds the view with the view model SingleLineViewBinder.bind(viewModel, view) Loading