diff options
2 files changed, 24 insertions, 3 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/PartialConversationInfo.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/PartialConversationInfo.java index 66c07bd94e59..1dc828bfb0b5 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/PartialConversationInfo.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/PartialConversationInfo.java @@ -192,9 +192,9 @@ public class PartialConversationInfo extends LinearLayout implements private void bindName() { TextView name = findViewById(R.id.name); Bundle extras = mSbn.getNotification().extras; - String nameString = extras.getString(Notification.EXTRA_CONVERSATION_TITLE); + CharSequence nameString = extras.getCharSequence(Notification.EXTRA_CONVERSATION_TITLE, ""); if (TextUtils.isEmpty(nameString)) { - nameString = extras.getString(Notification.EXTRA_TITLE); + nameString = extras.getCharSequence(Notification.EXTRA_TITLE, ""); } name.setText(nameString); } diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/PartialConversationInfoTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/PartialConversationInfoTest.java index f21b1a649b3e..545b59a4556a 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/PartialConversationInfoTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/PartialConversationInfoTest.java @@ -47,6 +47,7 @@ import android.service.notification.StatusBarNotification; import android.test.suitebuilder.annotation.SmallTest; import android.testing.AndroidTestingRunner; import android.testing.TestableLooper; +import android.text.SpannableString; import android.view.LayoutInflater; import android.view.View; import android.widget.ImageView; @@ -151,8 +152,11 @@ public class PartialConversationInfoTest extends SysuiTestCase { NotificationChannel.DEFAULT_CHANNEL_ID, TEST_CHANNEL_NAME, IMPORTANCE_LOW); mDefaultNotificationChannelSet.add(mDefaultNotificationChannel); + Notification n = new Notification.Builder(mContext, mNotificationChannel.getId()) + .setContentTitle(new SpannableString("title")) + .build(); mSbn = new StatusBarNotification(TEST_PACKAGE_NAME, TEST_PACKAGE_NAME, 0, null, TEST_UID, 0, - new Notification(), UserHandle.CURRENT, null, 0); + n, UserHandle.CURRENT, null, 0); mEntry = new NotificationEntryBuilder().setSbn(mSbn).build(); } @@ -176,6 +180,23 @@ public class PartialConversationInfoTest extends SysuiTestCase { } @Test + public void testBindNotification_SetsName() { + mInfo.bindNotification( + mMockPackageManager, + mMockINotificationManager, + mChannelEditorDialogController, + TEST_PACKAGE_NAME, + mNotificationChannel, + mNotificationChannelSet, + mEntry, + null, + true, + false); + final TextView textView = mInfo.findViewById(R.id.name); + assertTrue(textView.getText().toString().contains("title")); + } + + @Test public void testBindNotification_groupSetsPackageIcon() { mEntry.getSbn().getNotification().extras.putBoolean(EXTRA_IS_GROUP_CONVERSATION, true); final Drawable iconDrawable = mock(Drawable.class); |