Loading services/core/java/com/android/server/notification/NotificationManagerService.java +2 −1 Original line number Diff line number Diff line Loading @@ -2149,7 +2149,8 @@ public class NotificationManagerService extends SystemService { final NotificationChannel channel = channels.get(i); Preconditions.checkNotNull(channel, "channel in list is null"); mRankingHelper.createNotificationChannel(pkg, uid, channel, true /* fromTargetApp */); true /* fromTargetApp */, mConditionProviders.isPackageOrComponentAllowed( pkg, UserHandle.getUserId(uid))); mListeners.notifyNotificationChannelChanged(pkg, UserHandle.getUserHandleForUid(uid), mRankingHelper.getNotificationChannel(pkg, uid, channel.getId(), false), Loading services/core/java/com/android/server/notification/RankingConfig.java +1 −1 Original line number Diff line number Diff line Loading @@ -38,7 +38,7 @@ public interface RankingConfig { ParceledListSlice<NotificationChannelGroup> getNotificationChannelGroups(String pkg, int uid, boolean includeDeleted, boolean includeNonGrouped); void createNotificationChannel(String pkg, int uid, NotificationChannel channel, boolean fromTargetApp); boolean fromTargetApp, boolean hasDndAccess); void updateNotificationChannel(String pkg, int uid, NotificationChannel channel, boolean fromUser); NotificationChannel getNotificationChannel(String pkg, int uid, String channelId, boolean includeDeleted); void deleteNotificationChannel(String pkg, int uid, String channelId); Loading services/core/java/com/android/server/notification/RankingHelper.java +5 −4 Original line number Diff line number Diff line Loading @@ -569,7 +569,7 @@ public class RankingHelper implements RankingConfig { @Override public void createNotificationChannel(String pkg, int uid, NotificationChannel channel, boolean fromTargetApp) { boolean fromTargetApp, boolean hasDndAccess) { Preconditions.checkNotNull(pkg); Preconditions.checkNotNull(channel); Preconditions.checkNotNull(channel.getId()); Loading Loading @@ -610,8 +610,9 @@ public class RankingHelper implements RankingConfig { existing.setImportance(channel.getImportance()); } // system apps can bypass dnd if the user hasn't changed any fields on the channel yet if (existing.getUserLockedFields() == 0 & isSystemApp) { // system apps and dnd access apps can bypass dnd if the user hasn't changed any // fields on the channel yet if (existing.getUserLockedFields() == 0 && (isSystemApp || hasDndAccess)) { existing.setBypassDnd(channel.canBypassDnd()); } Loading @@ -624,7 +625,7 @@ public class RankingHelper implements RankingConfig { } // Reset fields that apps aren't allowed to set. if (fromTargetApp && !isSystemApp) { if (fromTargetApp && !(isSystemApp || hasDndAccess)) { channel.setBypassDnd(r.priority == Notification.PRIORITY_MAX); } if (fromTargetApp) { Loading services/tests/uiservicestests/src/com/android/server/notification/RankingHelperTest.java +97 −73 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
services/core/java/com/android/server/notification/NotificationManagerService.java +2 −1 Original line number Diff line number Diff line Loading @@ -2149,7 +2149,8 @@ public class NotificationManagerService extends SystemService { final NotificationChannel channel = channels.get(i); Preconditions.checkNotNull(channel, "channel in list is null"); mRankingHelper.createNotificationChannel(pkg, uid, channel, true /* fromTargetApp */); true /* fromTargetApp */, mConditionProviders.isPackageOrComponentAllowed( pkg, UserHandle.getUserId(uid))); mListeners.notifyNotificationChannelChanged(pkg, UserHandle.getUserHandleForUid(uid), mRankingHelper.getNotificationChannel(pkg, uid, channel.getId(), false), Loading
services/core/java/com/android/server/notification/RankingConfig.java +1 −1 Original line number Diff line number Diff line Loading @@ -38,7 +38,7 @@ public interface RankingConfig { ParceledListSlice<NotificationChannelGroup> getNotificationChannelGroups(String pkg, int uid, boolean includeDeleted, boolean includeNonGrouped); void createNotificationChannel(String pkg, int uid, NotificationChannel channel, boolean fromTargetApp); boolean fromTargetApp, boolean hasDndAccess); void updateNotificationChannel(String pkg, int uid, NotificationChannel channel, boolean fromUser); NotificationChannel getNotificationChannel(String pkg, int uid, String channelId, boolean includeDeleted); void deleteNotificationChannel(String pkg, int uid, String channelId); Loading
services/core/java/com/android/server/notification/RankingHelper.java +5 −4 Original line number Diff line number Diff line Loading @@ -569,7 +569,7 @@ public class RankingHelper implements RankingConfig { @Override public void createNotificationChannel(String pkg, int uid, NotificationChannel channel, boolean fromTargetApp) { boolean fromTargetApp, boolean hasDndAccess) { Preconditions.checkNotNull(pkg); Preconditions.checkNotNull(channel); Preconditions.checkNotNull(channel.getId()); Loading Loading @@ -610,8 +610,9 @@ public class RankingHelper implements RankingConfig { existing.setImportance(channel.getImportance()); } // system apps can bypass dnd if the user hasn't changed any fields on the channel yet if (existing.getUserLockedFields() == 0 & isSystemApp) { // system apps and dnd access apps can bypass dnd if the user hasn't changed any // fields on the channel yet if (existing.getUserLockedFields() == 0 && (isSystemApp || hasDndAccess)) { existing.setBypassDnd(channel.canBypassDnd()); } Loading @@ -624,7 +625,7 @@ public class RankingHelper implements RankingConfig { } // Reset fields that apps aren't allowed to set. if (fromTargetApp && !isSystemApp) { if (fromTargetApp && !(isSystemApp || hasDndAccess)) { channel.setBypassDnd(r.priority == Notification.PRIORITY_MAX); } if (fromTargetApp) { Loading
services/tests/uiservicestests/src/com/android/server/notification/RankingHelperTest.java +97 −73 File changed.Preview size limit exceeded, changes collapsed. Show changes