diff --git a/src/com/android/settings/notification/AppNotificationSettings.java b/src/com/android/settings/notification/AppNotificationSettings.java index d12842c32d3..88d0a4714bd 100644 --- a/src/com/android/settings/notification/AppNotificationSettings.java +++ b/src/com/android/settings/notification/AppNotificationSettings.java @@ -145,7 +145,7 @@ public class AppNotificationSettings extends NotificationSettingsBase { ? R.string.notification_channels_other : R.string.notification_channels); } else { - groupCategory.setTitle(getNotificationGroupLabel(group)); + groupCategory.setTitle(group.getName()); } groupCategory.setKey(group.getId()); groupCategory.setOrderingAsAdded(true); @@ -161,13 +161,13 @@ public class AppNotificationSettings extends NotificationSettingsBase { getPrefContext()); channelPref.setDisabledByAdmin(mSuspendedAppsAdmin); channelPref.setKey(channel.getId()); - channelPref.setTitle(getNotificationChannelLabel(channel)); + channelPref.setTitle(channel.getName()); channelPref.setChecked(channel.getImportance() != IMPORTANCE_NONE); channelPref.setMultiLine(true); if (channel.isDeleted()) { channelPref.setTitle(getString(R.string.deleted_channel_name, - getNotificationChannelLabel(channel))); + channel.getName())); channelPref.setEnabled(false); } else { channelPref.setSummary(getImportanceSummary(channel.getImportance())); @@ -257,8 +257,8 @@ public class AppNotificationSettings extends NotificationSettingsBase { if (left.isDeleted() != right.isDeleted()) { return Boolean.compare(left.isDeleted(), right.isDeleted()); } - CharSequence leftName = getNotificationChannelLabel(left); - CharSequence rightName = getNotificationChannelLabel(right); + CharSequence leftName = left.getName(); + CharSequence rightName = right.getName(); if (!Objects.equals(leftName, rightName)) { return sCollator.compare(leftName.toString(), rightName.toString()); } @@ -278,8 +278,8 @@ public class AppNotificationSettings extends NotificationSettingsBase { } else if (right.getId() == null && left.getId() != null) { return -1; } - CharSequence leftName = getNotificationGroupLabel(left); - CharSequence rightName = getNotificationGroupLabel(right); + CharSequence leftName = left.getName(); + CharSequence rightName = right.getName(); // sort rest of the groups by name if (!Objects.equals(leftName, rightName)) { return sCollator.compare(leftName.toString(), rightName.toString()); diff --git a/src/com/android/settings/notification/ChannelNotificationSettings.java b/src/com/android/settings/notification/ChannelNotificationSettings.java index 18e00f831e4..9ca1d865bab 100644 --- a/src/com/android/settings/notification/ChannelNotificationSettings.java +++ b/src/com/android/settings/notification/ChannelNotificationSettings.java @@ -113,7 +113,7 @@ public class ChannelNotificationSettings extends NotificationSettingsBase { .getApplicationFeatureProvider(activity) .newAppHeaderController(this /* fragment */, null /* appHeader */) .setIcon(mAppRow.icon) - .setLabel(getNotificationChannelLabel(mChannel)) + .setLabel(mChannel.getName()) .setSummary(mAppRow.label) .setPackageName(mAppRow.pkg) .setUid(mAppRow.uid) diff --git a/src/com/android/settings/notification/NotificationSettingsBase.java b/src/com/android/settings/notification/NotificationSettingsBase.java index 6a40ea59e74..c666b72bd33 100644 --- a/src/com/android/settings/notification/NotificationSettingsBase.java +++ b/src/com/android/settings/notification/NotificationSettingsBase.java @@ -251,25 +251,4 @@ abstract public class NotificationSettingsBase extends SettingsPreferenceFragmen return getContext().getString(R.string.notification_importance_high); } } - - protected CharSequence getNotificationGroupLabel(NotificationChannelGroup group) { - return getLabel(group.getName(), group.getNameResId()); - } - - protected CharSequence getNotificationChannelLabel(NotificationChannel channel) { - return getLabel(channel.getName(), channel.getNameResId()); - } - - private CharSequence getLabel(CharSequence name, int nameResId) { - if (!TextUtils.isEmpty(name)) { - return name; - } - try { - ApplicationInfo info = mPm.getApplicationInfoAsUser(mAppRow.pkg, 0, mAppRow.userId); - return mPm.getText(mAppRow.pkg, nameResId, info); - } catch (NameNotFoundException e) { - e.printStackTrace(); - } - return null; - } }