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

Commit af16ee0c authored by Beverly's avatar Beverly
Browse files

Add Coordinators to the NewNotifPipeline

Coordinators added to NotifCoordinators will be passed the
initialized NotifListBuilder and NotifCollection when they're
ready for Pluggables, NotiLfetimeExtenders and NotifCollectionListeners
to be registered.

This CL adds the KeyguardCoordinator which filters notifications based
on whether the keyguard is showing and user lockscreen notifcation
settings

Test: atest KeyguardCoordinatorTest
Bug: 145134683
Change-Id: Ie5a2c0f696a6eedbed203b1b5809164742d23132
parent 0f2b7fd2
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -65,8 +65,18 @@ public interface NotificationLockscreenUserManager {

    boolean needsRedaction(NotificationEntry entry);

    /**
     * Has the given user chosen to allow their private (full) notifications to be shown even
     * when the lockscreen is in "public" (secure & locked) mode?
     */
    boolean userAllowsPrivateNotificationsInPublic(int currentUserId);

    /**
     * Has the given user chosen to allow notifications to be shown even when the lockscreen is in
     * "public" (secure & locked) mode?
     */
    boolean userAllowsNotificationsInPublic(int userId);

    /** Notified when the current user changes. */
    interface UserChangedListener {
        void onUserChanged(int userId);
+1 −1
Original line number Diff line number Diff line
@@ -435,7 +435,7 @@ public class NotificationLockscreenUserManagerImpl implements
     * Has the given user chosen to allow notifications to be shown even when the lockscreen is in
     * "public" (secure & locked) mode?
     */
    private boolean userAllowsNotificationsInPublic(int userHandle) {
    public boolean userAllowsNotificationsInPublic(int userHandle) {
        if (isCurrentProfile(userHandle) && userHandle != mCurrentUserId) {
            return true;
        }
+5 −2
Original line number Diff line number Diff line
@@ -37,6 +37,9 @@ import javax.inject.Inject;
import javax.inject.Singleton;

/** Component which manages the various reasons a notification might be filtered out.*/
// TODO: delete NotificationFilter.java after migrating to new NotifPipeline b/145659174.
//  Notification filtering is taken care of across the different Coordinators (mostly
//  KeyguardCoordinator.java)
@Singleton
public class NotificationFilter {

@@ -109,7 +112,7 @@ public class NotificationFilter {
            return true;
        }

        if (entry.isSuspended()) {
        if (entry.getRanking().isSuspended()) {
            return true;
        }

+6 −2
Original line number Diff line number Diff line
@@ -18,6 +18,8 @@ package com.android.systemui.statusbar.notification.collection;

import android.annotation.Nullable;

import com.android.internal.annotations.VisibleForTesting;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
@@ -34,7 +36,8 @@ public class GroupEntry extends ListEntry {
    private final List<NotificationEntry> mUnmodifiableChildren =
            Collections.unmodifiableList(mChildren);

    GroupEntry(String key) {
    @VisibleForTesting
    public GroupEntry(String key) {
        super(key);
    }

@@ -52,7 +55,8 @@ public class GroupEntry extends ListEntry {
        return mUnmodifiableChildren;
    }

    void setSummary(@Nullable NotificationEntry summary) {
    @VisibleForTesting
    public void setSummary(@Nullable NotificationEntry summary) {
        mSummary = summary;
    }

+4 −1
Original line number Diff line number Diff line
@@ -18,6 +18,8 @@ package com.android.systemui.statusbar.notification.collection;

import android.annotation.Nullable;

import com.android.internal.annotations.VisibleForTesting;

/**
 * Abstract superclass for top-level entries, i.e. things that can appear in the final notification
 * list shown to users. In practice, this means either GroupEntries or NotificationEntries.
@@ -49,7 +51,8 @@ public abstract class ListEntry {
        return mParent;
    }

    void setParent(@Nullable GroupEntry parent) {
    @VisibleForTesting
    public void setParent(@Nullable GroupEntry parent) {
        mParent = parent;
    }

Loading