Loading core/java/android/app/NotificationChannelGroup.java +1 −1 Original line number Diff line number Diff line Loading @@ -64,7 +64,7 @@ public final class NotificationChannelGroup implements Parcelable { mId = null; } mName = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in); in.readList(mChannels, NotificationChannel.class.getClassLoader()); in.readParcelableList(mChannels, NotificationChannel.class.getClassLoader()); } @Override Loading services/core/java/com/android/server/notification/RankingConfig.java +4 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,8 @@ import android.app.NotificationChannel; import android.app.NotificationChannelGroup; import android.content.pm.ParceledListSlice; import java.util.Collection; public interface RankingConfig { void setImportance(String packageName, int uid, int importance); Loading @@ -26,6 +28,8 @@ public interface RankingConfig { void setShowBadge(String packageName, int uid, boolean showBadge); boolean canShowBadge(String packageName, int uid); Collection<NotificationChannelGroup> getNotificationChannelGroups(String pkg, int uid); void createNotificationChannelGroup(String pkg, int uid, NotificationChannelGroup group, boolean fromTargetApp); ParceledListSlice<NotificationChannelGroup> getNotificationChannelGroups(String pkg, Loading services/core/java/com/android/server/notification/RankingHelper.java +17 −1 Original line number Diff line number Diff line Loading @@ -47,6 +47,7 @@ import org.xmlpull.v1.XmlSerializer; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.Map; Loading Loading @@ -691,13 +692,28 @@ public class RankingHelper implements RankingConfig { } } } groups.addAll(r.groups.values()); for (NotificationChannelGroup group : r.groups.values()) { if (group.getChannels().size() > 0) { groups.add(group); } } if (nonGrouped.getChannels().size() > 0) { groups.add(nonGrouped); } return new ParceledListSlice<>(groups); } @Override @VisibleForTesting public Collection<NotificationChannelGroup> getNotificationChannelGroups(String pkg, int uid) { Record r = getRecord(pkg, uid); if (r == null) { return new ArrayList<>(); } return r.groups.values(); } @Override public ParceledListSlice<NotificationChannel> getNotificationChannels(String pkg, int uid, boolean includeDeleted) { Loading services/tests/notification/src/com/android/server/notification/RankingHelperTest.java +3 −1 Original line number Diff line number Diff line Loading @@ -805,7 +805,7 @@ public class RankingHelperTest { public void testCreateGroup() throws Exception { NotificationChannelGroup ncg = new NotificationChannelGroup("group1", "name1"); mHelper.createNotificationChannelGroup(pkg, uid, ncg, true); assertEquals(ncg, mHelper.getNotificationChannelGroups(pkg, uid, false).getList().get(0)); assertEquals(ncg, mHelper.getNotificationChannelGroups(pkg, uid).iterator().next()); } @Test Loading Loading @@ -834,6 +834,8 @@ public class RankingHelperTest { @Test public void testGetChannelGroups() throws Exception { NotificationChannelGroup unused = new NotificationChannelGroup("unused", "s"); mHelper.createNotificationChannelGroup(pkg, uid, unused, true); NotificationChannelGroup ncg = new NotificationChannelGroup("group1", "name1"); mHelper.createNotificationChannelGroup(pkg, uid, ncg, true); NotificationChannelGroup ncg2 = new NotificationChannelGroup("group2", "name2"); Loading Loading
core/java/android/app/NotificationChannelGroup.java +1 −1 Original line number Diff line number Diff line Loading @@ -64,7 +64,7 @@ public final class NotificationChannelGroup implements Parcelable { mId = null; } mName = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in); in.readList(mChannels, NotificationChannel.class.getClassLoader()); in.readParcelableList(mChannels, NotificationChannel.class.getClassLoader()); } @Override Loading
services/core/java/com/android/server/notification/RankingConfig.java +4 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,8 @@ import android.app.NotificationChannel; import android.app.NotificationChannelGroup; import android.content.pm.ParceledListSlice; import java.util.Collection; public interface RankingConfig { void setImportance(String packageName, int uid, int importance); Loading @@ -26,6 +28,8 @@ public interface RankingConfig { void setShowBadge(String packageName, int uid, boolean showBadge); boolean canShowBadge(String packageName, int uid); Collection<NotificationChannelGroup> getNotificationChannelGroups(String pkg, int uid); void createNotificationChannelGroup(String pkg, int uid, NotificationChannelGroup group, boolean fromTargetApp); ParceledListSlice<NotificationChannelGroup> getNotificationChannelGroups(String pkg, Loading
services/core/java/com/android/server/notification/RankingHelper.java +17 −1 Original line number Diff line number Diff line Loading @@ -47,6 +47,7 @@ import org.xmlpull.v1.XmlSerializer; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.Map; Loading Loading @@ -691,13 +692,28 @@ public class RankingHelper implements RankingConfig { } } } groups.addAll(r.groups.values()); for (NotificationChannelGroup group : r.groups.values()) { if (group.getChannels().size() > 0) { groups.add(group); } } if (nonGrouped.getChannels().size() > 0) { groups.add(nonGrouped); } return new ParceledListSlice<>(groups); } @Override @VisibleForTesting public Collection<NotificationChannelGroup> getNotificationChannelGroups(String pkg, int uid) { Record r = getRecord(pkg, uid); if (r == null) { return new ArrayList<>(); } return r.groups.values(); } @Override public ParceledListSlice<NotificationChannel> getNotificationChannels(String pkg, int uid, boolean includeDeleted) { Loading
services/tests/notification/src/com/android/server/notification/RankingHelperTest.java +3 −1 Original line number Diff line number Diff line Loading @@ -805,7 +805,7 @@ public class RankingHelperTest { public void testCreateGroup() throws Exception { NotificationChannelGroup ncg = new NotificationChannelGroup("group1", "name1"); mHelper.createNotificationChannelGroup(pkg, uid, ncg, true); assertEquals(ncg, mHelper.getNotificationChannelGroups(pkg, uid, false).getList().get(0)); assertEquals(ncg, mHelper.getNotificationChannelGroups(pkg, uid).iterator().next()); } @Test Loading Loading @@ -834,6 +834,8 @@ public class RankingHelperTest { @Test public void testGetChannelGroups() throws Exception { NotificationChannelGroup unused = new NotificationChannelGroup("unused", "s"); mHelper.createNotificationChannelGroup(pkg, uid, unused, true); NotificationChannelGroup ncg = new NotificationChannelGroup("group1", "name1"); mHelper.createNotificationChannelGroup(pkg, uid, ncg, true); NotificationChannelGroup ncg2 = new NotificationChannelGroup("group2", "name2"); Loading