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

Commit b9427f34 authored by Julia Reynolds's avatar Julia Reynolds Committed by Android (Google) Code Review
Browse files

Merge "Allowing querying for apps with blocked topics."

parents 95bde8ea dd3e86bc
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -55,6 +55,7 @@ interface INotificationManager
    void setImportance(String pkg, int uid, in Notification.Topic topic, int importance);
    int getImportance(String pkg, int uid, in Notification.Topic topic);
    boolean doesAppUseTopics(String pkg, int uid);
    boolean hasBannedTopics(String pkg, int uid);

    // TODO: Remove this when callers have been migrated to the equivalent
    // INotificationListener method.
+6 −0
Original line number Diff line number Diff line
@@ -1264,6 +1264,12 @@ public class NotificationManagerService extends SystemService {
                    == AppOpsManager.MODE_ALLOWED) && !isApplicationSuspended(pkg, uid);
        }

        @Override
        public boolean hasBannedTopics(String pkg, int uid) {
            checkCallerIsSystem();
            return mRankingHelper.hasBannedTopics(pkg, uid);
        }

        @Override
        public ParceledListSlice<Notification.Topic> getTopics(String pkg, int uid) {
            checkCallerIsSystem();
+2 −0
Original line number Diff line number Diff line
@@ -37,4 +37,6 @@ public interface RankingConfig {
    int getImportance(String packageName, int uid, Notification.Topic topic);

    boolean doesAppUseTopics(String packageName, int uid);

    boolean hasBannedTopics(String packageName, int uid);
}
+11 −0
Original line number Diff line number Diff line
@@ -389,6 +389,17 @@ public class RankingHelper implements RankingConfig {
        return topics;
    }

    @Override
    public boolean hasBannedTopics(String packageName, int uid) {
        final Record r = getOrCreateRecord(packageName, uid);
        for (Topic t : r.topics.values()) {
            if (t.importance == Ranking.IMPORTANCE_NONE) {
                return true;
            }
        }
        return false;
    }

    /**
     * Gets priority. If a topic is given, returns the priority of that topic. Otherwise, the
     * priority of the app.