Loading res/values/strings.xml +8 −0 Original line number Diff line number Diff line Loading @@ -8608,6 +8608,14 @@ <!-- [CHAR LIMIT=NONE] App notification settings: link to app notification settings--> <string name="app_settings_link">Additional settings in the app</string> <!-- [CHAR LIMIT=20] 3-dot menu option, reloads the screen to show channels that have not received notifications in the last two week --> <string name="show_unused_channels">Show unused channels</string> <!-- [CHAR LIMIT=20] 3-dot menu option, reloads the screen to hide channels that have not received notifications in the last two week --> <string name="hide_unused_channels">Hide unused channels</string> <!-- [CHAR LIMIT=NONE] Footer listing a count of deleted channels. --> <string name="deleted_channels">{count, plural, =1 {# category deleted} src/com/android/settings/notification/NotificationBackend.java +10 −0 Original line number Diff line number Diff line Loading @@ -272,6 +272,16 @@ public class NotificationBackend { } } public ParceledListSlice<NotificationChannelGroup> getGroupsWithRecentBlockedFilter(String pkg, int uid) { try { return sINM.getRecentBlockedNotificationChannelGroupsForPackage(pkg, uid); } catch (Exception e) { Log.w(TAG, "Error calling NoMan", e); return ParceledListSlice.emptyList(); } } public ParceledListSlice<ConversationChannelWrapper> getConversations(String pkg, int uid) { try { return sINM.getConversationsForPackage(pkg, uid); Loading src/com/android/settings/notification/app/AppNotificationSettings.java +40 −0 Original line number Diff line number Diff line Loading @@ -16,10 +16,16 @@ package com.android.settings.notification.app; import static com.android.server.notification.Flags.notificationHideUnusedChannels; import android.app.settings.SettingsEnums; import android.content.Context; import android.text.TextUtils; import android.util.Log; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import com.android.internal.widget.LockPatternUtils; import com.android.settings.R; Loading @@ -33,6 +39,8 @@ public class AppNotificationSettings extends NotificationSettings { private static final String TAG = "AppNotificationSettings"; private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG); boolean mShowAll = false; @Override public int getMetricsCategory() { return SettingsEnums.NOTIFICATION_APP_NOTIFICATION; Loading Loading @@ -101,4 +109,36 @@ public class AppNotificationSettings extends NotificationSettings { mControllers.add(new DeletedChannelsPreferenceController(context, mBackend)); return new ArrayList<>(mControllers); } private final int SHOW_ALL_CHANNELS = 1; @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { if (notificationHideUnusedChannels()) { menu.add(Menu.NONE, SHOW_ALL_CHANNELS, Menu.NONE, mShowAll ? R.string.hide_unused_channels : R.string.show_unused_channels); } super.onCreateOptionsMenu(menu, inflater); } @Override public boolean onOptionsItemSelected(MenuItem item) { if (!notificationHideUnusedChannels()) { return super.onOptionsItemSelected(item); } switch (item.getItemId()) { case SHOW_ALL_CHANNELS: mShowAll = !mShowAll; item.setTitle(mShowAll ? R.string.hide_unused_channels : R.string.show_unused_channels); ChannelListPreferenceController list = use(ChannelListPreferenceController.class); list.setShowAll(mShowAll); list.updateState(findPreference(list.getPreferenceKey())); return true; default: return super.onOptionsItemSelected(item); } } } src/com/android/settings/notification/app/ChannelListPreferenceController.java +17 −1 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.settings.notification.app; import static android.app.NotificationManager.IMPORTANCE_LOW; import static android.app.NotificationManager.IMPORTANCE_NONE; import static com.android.server.notification.Flags.notificationHideUnusedChannels; import android.app.NotificationChannel; import android.app.NotificationChannelGroup; Loading Loading @@ -58,6 +59,8 @@ public class ChannelListPreferenceController extends NotificationPreferenceContr private List<NotificationChannelGroup> mChannelGroupList; private PreferenceCategory mPreference; private boolean mShowAll; public ChannelListPreferenceController(Context context, NotificationBackend backend) { super(context, backend); } Loading Loading @@ -96,7 +99,16 @@ public class ChannelListPreferenceController extends NotificationPreferenceContr new AsyncTask<Void, Void, Void>() { @Override protected Void doInBackground(Void... unused) { if (notificationHideUnusedChannels()) { if (mShowAll) { mChannelGroupList = mBackend.getGroups(mAppRow.pkg, mAppRow.uid).getList(); } else { mChannelGroupList = mBackend.getGroupsWithRecentBlockedFilter(mAppRow.pkg, mAppRow.uid).getList(); } } else { mChannelGroupList = mBackend.getGroups(mAppRow.pkg, mAppRow.uid).getList(); } Collections.sort(mChannelGroupList, CHANNEL_GROUP_COMPARATOR); return null; } Loading @@ -111,6 +123,10 @@ public class ChannelListPreferenceController extends NotificationPreferenceContr }.execute(); } protected void setShowAll(boolean showAll) { mShowAll = showAll; } /** * Update the preferences group to match the * @param groupPrefsList Loading Loading
res/values/strings.xml +8 −0 Original line number Diff line number Diff line Loading @@ -8608,6 +8608,14 @@ <!-- [CHAR LIMIT=NONE] App notification settings: link to app notification settings--> <string name="app_settings_link">Additional settings in the app</string> <!-- [CHAR LIMIT=20] 3-dot menu option, reloads the screen to show channels that have not received notifications in the last two week --> <string name="show_unused_channels">Show unused channels</string> <!-- [CHAR LIMIT=20] 3-dot menu option, reloads the screen to hide channels that have not received notifications in the last two week --> <string name="hide_unused_channels">Hide unused channels</string> <!-- [CHAR LIMIT=NONE] Footer listing a count of deleted channels. --> <string name="deleted_channels">{count, plural, =1 {# category deleted}
src/com/android/settings/notification/NotificationBackend.java +10 −0 Original line number Diff line number Diff line Loading @@ -272,6 +272,16 @@ public class NotificationBackend { } } public ParceledListSlice<NotificationChannelGroup> getGroupsWithRecentBlockedFilter(String pkg, int uid) { try { return sINM.getRecentBlockedNotificationChannelGroupsForPackage(pkg, uid); } catch (Exception e) { Log.w(TAG, "Error calling NoMan", e); return ParceledListSlice.emptyList(); } } public ParceledListSlice<ConversationChannelWrapper> getConversations(String pkg, int uid) { try { return sINM.getConversationsForPackage(pkg, uid); Loading
src/com/android/settings/notification/app/AppNotificationSettings.java +40 −0 Original line number Diff line number Diff line Loading @@ -16,10 +16,16 @@ package com.android.settings.notification.app; import static com.android.server.notification.Flags.notificationHideUnusedChannels; import android.app.settings.SettingsEnums; import android.content.Context; import android.text.TextUtils; import android.util.Log; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import com.android.internal.widget.LockPatternUtils; import com.android.settings.R; Loading @@ -33,6 +39,8 @@ public class AppNotificationSettings extends NotificationSettings { private static final String TAG = "AppNotificationSettings"; private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG); boolean mShowAll = false; @Override public int getMetricsCategory() { return SettingsEnums.NOTIFICATION_APP_NOTIFICATION; Loading Loading @@ -101,4 +109,36 @@ public class AppNotificationSettings extends NotificationSettings { mControllers.add(new DeletedChannelsPreferenceController(context, mBackend)); return new ArrayList<>(mControllers); } private final int SHOW_ALL_CHANNELS = 1; @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { if (notificationHideUnusedChannels()) { menu.add(Menu.NONE, SHOW_ALL_CHANNELS, Menu.NONE, mShowAll ? R.string.hide_unused_channels : R.string.show_unused_channels); } super.onCreateOptionsMenu(menu, inflater); } @Override public boolean onOptionsItemSelected(MenuItem item) { if (!notificationHideUnusedChannels()) { return super.onOptionsItemSelected(item); } switch (item.getItemId()) { case SHOW_ALL_CHANNELS: mShowAll = !mShowAll; item.setTitle(mShowAll ? R.string.hide_unused_channels : R.string.show_unused_channels); ChannelListPreferenceController list = use(ChannelListPreferenceController.class); list.setShowAll(mShowAll); list.updateState(findPreference(list.getPreferenceKey())); return true; default: return super.onOptionsItemSelected(item); } } }
src/com/android/settings/notification/app/ChannelListPreferenceController.java +17 −1 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.settings.notification.app; import static android.app.NotificationManager.IMPORTANCE_LOW; import static android.app.NotificationManager.IMPORTANCE_NONE; import static com.android.server.notification.Flags.notificationHideUnusedChannels; import android.app.NotificationChannel; import android.app.NotificationChannelGroup; Loading Loading @@ -58,6 +59,8 @@ public class ChannelListPreferenceController extends NotificationPreferenceContr private List<NotificationChannelGroup> mChannelGroupList; private PreferenceCategory mPreference; private boolean mShowAll; public ChannelListPreferenceController(Context context, NotificationBackend backend) { super(context, backend); } Loading Loading @@ -96,7 +99,16 @@ public class ChannelListPreferenceController extends NotificationPreferenceContr new AsyncTask<Void, Void, Void>() { @Override protected Void doInBackground(Void... unused) { if (notificationHideUnusedChannels()) { if (mShowAll) { mChannelGroupList = mBackend.getGroups(mAppRow.pkg, mAppRow.uid).getList(); } else { mChannelGroupList = mBackend.getGroupsWithRecentBlockedFilter(mAppRow.pkg, mAppRow.uid).getList(); } } else { mChannelGroupList = mBackend.getGroups(mAppRow.pkg, mAppRow.uid).getList(); } Collections.sort(mChannelGroupList, CHANNEL_GROUP_COMPARATOR); return null; } Loading @@ -111,6 +123,10 @@ public class ChannelListPreferenceController extends NotificationPreferenceContr }.execute(); } protected void setShowAll(boolean showAll) { mShowAll = showAll; } /** * Update the preferences group to match the * @param groupPrefsList Loading