Loading src/com/android/settings/notification/app/ConversationHeaderPreferenceController.java +7 −3 Original line number Diff line number Diff line Loading @@ -126,8 +126,12 @@ public class ConversationHeaderPreferenceController extends NotificationPreferen @VisibleForTesting CharSequence getLabel() { return mConversationInfo != null ? mConversationInfo.getLabel() : mChannel.getName(); CharSequence label = null; if (mConversationInfo != null) { label = mConversationInfo.getLabel(); } else if (mChannel != null) { label = mChannel.getName(); } return label; } } tests/robotests/src/com/android/settings/notification/app/ConversationHeaderPreferenceControllerTest.java +4 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import static android.app.NotificationManager.IMPORTANCE_NONE; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.Mockito.mock; Loading Loading @@ -121,6 +122,9 @@ public class ConversationHeaderPreferenceControllerTest { NotificationChannel channel = new NotificationChannel("cid", "cname", IMPORTANCE_NONE); mController.onResume(appRow, channel, null, null, null, null, null); assertEquals(channel.getName(), mController.getLabel()); mController.onResume(appRow, null, null, null, null, null, null); assertNull(mController.getLabel()); } @Test Loading Loading
src/com/android/settings/notification/app/ConversationHeaderPreferenceController.java +7 −3 Original line number Diff line number Diff line Loading @@ -126,8 +126,12 @@ public class ConversationHeaderPreferenceController extends NotificationPreferen @VisibleForTesting CharSequence getLabel() { return mConversationInfo != null ? mConversationInfo.getLabel() : mChannel.getName(); CharSequence label = null; if (mConversationInfo != null) { label = mConversationInfo.getLabel(); } else if (mChannel != null) { label = mChannel.getName(); } return label; } }
tests/robotests/src/com/android/settings/notification/app/ConversationHeaderPreferenceControllerTest.java +4 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import static android.app.NotificationManager.IMPORTANCE_NONE; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.Mockito.mock; Loading Loading @@ -121,6 +122,9 @@ public class ConversationHeaderPreferenceControllerTest { NotificationChannel channel = new NotificationChannel("cid", "cname", IMPORTANCE_NONE); mController.onResume(appRow, channel, null, null, null, null, null); assertEquals(channel.getName(), mController.getLabel()); mController.onResume(appRow, null, null, null, null, null, null); assertNull(mController.getLabel()); } @Test Loading