Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0cdeb11c authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Allow apps with dnd access to bypass DND" into pi-dev

parents ba653938 1fe10944
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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),
+1 −1
Original line number Diff line number Diff line
@@ -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);
+5 −4
Original line number Diff line number Diff line
@@ -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());
@@ -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());
            }

@@ -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) {
+97 −73

File changed.

Preview size limit exceeded, changes collapsed.