Merge "Fix name in partial convo guts" into rvc-dev am: 966c3e957d am: ee885dd96a
Change-Id: Ia3d1e91df908daab19ed00225ce92ad6b7a2a0b6
This commit is contained in:
@@ -192,9 +192,9 @@ public class PartialConversationInfo extends LinearLayout implements
|
|||||||
private void bindName() {
|
private void bindName() {
|
||||||
TextView name = findViewById(R.id.name);
|
TextView name = findViewById(R.id.name);
|
||||||
Bundle extras = mSbn.getNotification().extras;
|
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)) {
|
if (TextUtils.isEmpty(nameString)) {
|
||||||
nameString = extras.getString(Notification.EXTRA_TITLE);
|
nameString = extras.getCharSequence(Notification.EXTRA_TITLE, "");
|
||||||
}
|
}
|
||||||
name.setText(nameString);
|
name.setText(nameString);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ import android.service.notification.StatusBarNotification;
|
|||||||
import android.test.suitebuilder.annotation.SmallTest;
|
import android.test.suitebuilder.annotation.SmallTest;
|
||||||
import android.testing.AndroidTestingRunner;
|
import android.testing.AndroidTestingRunner;
|
||||||
import android.testing.TestableLooper;
|
import android.testing.TestableLooper;
|
||||||
|
import android.text.SpannableString;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
@@ -151,8 +152,11 @@ public class PartialConversationInfoTest extends SysuiTestCase {
|
|||||||
NotificationChannel.DEFAULT_CHANNEL_ID, TEST_CHANNEL_NAME,
|
NotificationChannel.DEFAULT_CHANNEL_ID, TEST_CHANNEL_NAME,
|
||||||
IMPORTANCE_LOW);
|
IMPORTANCE_LOW);
|
||||||
mDefaultNotificationChannelSet.add(mDefaultNotificationChannel);
|
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,
|
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();
|
mEntry = new NotificationEntryBuilder().setSbn(mSbn).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -175,6 +179,23 @@ public class PartialConversationInfoTest extends SysuiTestCase {
|
|||||||
assertEquals(VISIBLE, mInfo.findViewById(R.id.header).getVisibility());
|
assertEquals(VISIBLE, mInfo.findViewById(R.id.header).getVisibility());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@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
|
@Test
|
||||||
public void testBindNotification_groupSetsPackageIcon() {
|
public void testBindNotification_groupSetsPackageIcon() {
|
||||||
mEntry.getSbn().getNotification().extras.putBoolean(EXTRA_IS_GROUP_CONVERSATION, true);
|
mEntry.getSbn().getNotification().extras.putBoolean(EXTRA_IS_GROUP_CONVERSATION, true);
|
||||||
|
|||||||
Reference in New Issue
Block a user