Loading packages/SystemUI/res/layout/notification_conversation_info.xml +2 −0 Original line number Original line Diff line number Diff line Loading @@ -67,11 +67,13 @@ android:layout_height="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" android:layout_centerVertical="true" style="@style/TextAppearance.NotificationImportanceHeader" style="@style/TextAppearance.NotificationImportanceHeader" android:visibility="gone" android:layout_marginStart="2dp" android:layout_marginStart="2dp" android:layout_marginEnd="2dp" android:layout_marginEnd="2dp" android:text="@*android:string/notification_header_divider_symbol" /> android:text="@*android:string/notification_header_divider_symbol" /> <TextView <TextView android:id="@+id/name" android:id="@+id/name" android:visibility="gone" android:layout_width="wrap_content" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:layout_weight="1" Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationConversationInfo.java +12 −3 Original line number Original line Diff line number Diff line Loading @@ -240,6 +240,10 @@ public class NotificationConversationInfo extends LinearLayout implements // a custom channel // a custom channel if (TextUtils.isEmpty(mNotificationChannel.getConversationId())) { if (TextUtils.isEmpty(mNotificationChannel.getConversationId())) { try { try { // TODO: remove mNotificationChannel.setName(mContext.getString( R.string.notification_summary_message_format, getName(), mNotificationChannel.getName())); mINotificationManager.createConversationNotificationChannelForPackage( mINotificationManager.createConversationNotificationChannelForPackage( mPackageName, mAppUid, mSbn.getKey(), mNotificationChannel, mPackageName, mAppUid, mSbn.getKey(), mNotificationChannel, mConversationId); mConversationId); Loading Loading @@ -347,7 +351,8 @@ public class NotificationConversationInfo extends LinearLayout implements channelName.setText(mNotificationChannel.getName()); channelName.setText(mNotificationChannel.getName()); bindGroup(); bindGroup(); bindName(); // TODO: bring back when channel name does not include name // bindName(); bindPackage(); bindPackage(); bindIcon(); bindIcon(); Loading Loading @@ -383,15 +388,19 @@ public class NotificationConversationInfo extends LinearLayout implements private void bindName() { private void bindName() { TextView name = findViewById(R.id.name); TextView name = findViewById(R.id.name); name.setText(getName()); } private String getName() { if (mShortcutInfo != null) { if (mShortcutInfo != null) { name.setText(mShortcutInfo.getShortLabel()); return mShortcutInfo.getShortLabel().toString(); } else { } else { Bundle extras = mSbn.getNotification().extras; Bundle extras = mSbn.getNotification().extras; String nameString = extras.getString(Notification.EXTRA_CONVERSATION_TITLE); String nameString = extras.getString(Notification.EXTRA_CONVERSATION_TITLE); if (TextUtils.isEmpty(nameString)) { if (TextUtils.isEmpty(nameString)) { nameString = extras.getString(Notification.EXTRA_TITLE); nameString = extras.getString(Notification.EXTRA_TITLE); } } name.setText(nameString); return nameString; } } } } Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationConversationInfoTest.java +2 −22 Original line number Original line Diff line number Diff line Loading @@ -208,26 +208,6 @@ public class NotificationConversationInfoTest extends SysuiTestCase { .thenReturn(mConversationChannel); .thenReturn(mConversationChannel); } } @Test public void testBindNotification_SetsTextShortcutName() { mNotificationInfo.bindNotification( mShortcutManager, mLauncherApps, mMockPackageManager, mMockINotificationManager, mVisualStabilityManager, TEST_PACKAGE_NAME, mNotificationChannel, mEntry, null, null, null, true); final TextView textView = mNotificationInfo.findViewById(R.id.name); assertEquals(mShortcutInfo.getShortLabel(), textView.getText().toString()); assertEquals(VISIBLE, mNotificationInfo.findViewById(R.id.header).getVisibility()); } @Test @Test public void testBindNotification_SetsShortcutIcon() { public void testBindNotification_SetsShortcutIcon() { mNotificationInfo.bindNotification( mNotificationInfo.bindNotification( Loading Loading @@ -267,7 +247,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase { assertTrue(textView.getText().toString().contains("App Name")); assertTrue(textView.getText().toString().contains("App Name")); assertEquals(VISIBLE, mNotificationInfo.findViewById(R.id.header).getVisibility()); assertEquals(VISIBLE, mNotificationInfo.findViewById(R.id.header).getVisibility()); } } /** @Test @Test public void testBindNotification_SetsTextChannelName() { public void testBindNotification_SetsTextChannelName() { mNotificationInfo.bindNotification( mNotificationInfo.bindNotification( Loading @@ -287,7 +267,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase { assertTrue(textView.getText().toString().contains(mNotificationChannel.getName())); assertTrue(textView.getText().toString().contains(mNotificationChannel.getName())); assertEquals(VISIBLE, mNotificationInfo.findViewById(R.id.header).getVisibility()); assertEquals(VISIBLE, mNotificationInfo.findViewById(R.id.header).getVisibility()); } } */ @Test @Test public void testBindNotification_SetsTextGroupName() throws Exception { public void testBindNotification_SetsTextGroupName() throws Exception { NotificationChannelGroup group = new NotificationChannelGroup("id", "name"); NotificationChannelGroup group = new NotificationChannelGroup("id", "name"); Loading Loading
packages/SystemUI/res/layout/notification_conversation_info.xml +2 −0 Original line number Original line Diff line number Diff line Loading @@ -67,11 +67,13 @@ android:layout_height="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" android:layout_centerVertical="true" style="@style/TextAppearance.NotificationImportanceHeader" style="@style/TextAppearance.NotificationImportanceHeader" android:visibility="gone" android:layout_marginStart="2dp" android:layout_marginStart="2dp" android:layout_marginEnd="2dp" android:layout_marginEnd="2dp" android:text="@*android:string/notification_header_divider_symbol" /> android:text="@*android:string/notification_header_divider_symbol" /> <TextView <TextView android:id="@+id/name" android:id="@+id/name" android:visibility="gone" android:layout_width="wrap_content" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:layout_weight="1" Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationConversationInfo.java +12 −3 Original line number Original line Diff line number Diff line Loading @@ -240,6 +240,10 @@ public class NotificationConversationInfo extends LinearLayout implements // a custom channel // a custom channel if (TextUtils.isEmpty(mNotificationChannel.getConversationId())) { if (TextUtils.isEmpty(mNotificationChannel.getConversationId())) { try { try { // TODO: remove mNotificationChannel.setName(mContext.getString( R.string.notification_summary_message_format, getName(), mNotificationChannel.getName())); mINotificationManager.createConversationNotificationChannelForPackage( mINotificationManager.createConversationNotificationChannelForPackage( mPackageName, mAppUid, mSbn.getKey(), mNotificationChannel, mPackageName, mAppUid, mSbn.getKey(), mNotificationChannel, mConversationId); mConversationId); Loading Loading @@ -347,7 +351,8 @@ public class NotificationConversationInfo extends LinearLayout implements channelName.setText(mNotificationChannel.getName()); channelName.setText(mNotificationChannel.getName()); bindGroup(); bindGroup(); bindName(); // TODO: bring back when channel name does not include name // bindName(); bindPackage(); bindPackage(); bindIcon(); bindIcon(); Loading Loading @@ -383,15 +388,19 @@ public class NotificationConversationInfo extends LinearLayout implements private void bindName() { private void bindName() { TextView name = findViewById(R.id.name); TextView name = findViewById(R.id.name); name.setText(getName()); } private String getName() { if (mShortcutInfo != null) { if (mShortcutInfo != null) { name.setText(mShortcutInfo.getShortLabel()); return mShortcutInfo.getShortLabel().toString(); } else { } else { Bundle extras = mSbn.getNotification().extras; Bundle extras = mSbn.getNotification().extras; String nameString = extras.getString(Notification.EXTRA_CONVERSATION_TITLE); String nameString = extras.getString(Notification.EXTRA_CONVERSATION_TITLE); if (TextUtils.isEmpty(nameString)) { if (TextUtils.isEmpty(nameString)) { nameString = extras.getString(Notification.EXTRA_TITLE); nameString = extras.getString(Notification.EXTRA_TITLE); } } name.setText(nameString); return nameString; } } } } Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationConversationInfoTest.java +2 −22 Original line number Original line Diff line number Diff line Loading @@ -208,26 +208,6 @@ public class NotificationConversationInfoTest extends SysuiTestCase { .thenReturn(mConversationChannel); .thenReturn(mConversationChannel); } } @Test public void testBindNotification_SetsTextShortcutName() { mNotificationInfo.bindNotification( mShortcutManager, mLauncherApps, mMockPackageManager, mMockINotificationManager, mVisualStabilityManager, TEST_PACKAGE_NAME, mNotificationChannel, mEntry, null, null, null, true); final TextView textView = mNotificationInfo.findViewById(R.id.name); assertEquals(mShortcutInfo.getShortLabel(), textView.getText().toString()); assertEquals(VISIBLE, mNotificationInfo.findViewById(R.id.header).getVisibility()); } @Test @Test public void testBindNotification_SetsShortcutIcon() { public void testBindNotification_SetsShortcutIcon() { mNotificationInfo.bindNotification( mNotificationInfo.bindNotification( Loading Loading @@ -267,7 +247,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase { assertTrue(textView.getText().toString().contains("App Name")); assertTrue(textView.getText().toString().contains("App Name")); assertEquals(VISIBLE, mNotificationInfo.findViewById(R.id.header).getVisibility()); assertEquals(VISIBLE, mNotificationInfo.findViewById(R.id.header).getVisibility()); } } /** @Test @Test public void testBindNotification_SetsTextChannelName() { public void testBindNotification_SetsTextChannelName() { mNotificationInfo.bindNotification( mNotificationInfo.bindNotification( Loading @@ -287,7 +267,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase { assertTrue(textView.getText().toString().contains(mNotificationChannel.getName())); assertTrue(textView.getText().toString().contains(mNotificationChannel.getName())); assertEquals(VISIBLE, mNotificationInfo.findViewById(R.id.header).getVisibility()); assertEquals(VISIBLE, mNotificationInfo.findViewById(R.id.header).getVisibility()); } } */ @Test @Test public void testBindNotification_SetsTextGroupName() throws Exception { public void testBindNotification_SetsTextGroupName() throws Exception { NotificationChannelGroup group = new NotificationChannelGroup("id", "name"); NotificationChannelGroup group = new NotificationChannelGroup("id", "name"); Loading