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

Commit dd3e86bc authored by Julia Reynolds's avatar Julia Reynolds
Browse files

Allowing querying for apps with blocked topics.

Bug: 26882239
Change-Id: If888cb18891a412067bcb28e575f502c6091f77a
parent 76fb3ee7
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.