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

Commit 16e2397d authored by Ned Burns's avatar Ned Burns Committed by Android (Google) Code Review
Browse files

Merge "Fix issue with media notifs being misbucketed" into qt-dev

parents d007c7b9 91e425d7
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -15,7 +15,6 @@
package com.android.systemui.statusbar;

import android.content.pm.UserInfo;
import android.service.notification.StatusBarNotification;
import android.util.SparseArray;

import com.android.systemui.statusbar.notification.collection.NotificationEntry;
@@ -58,7 +57,7 @@ public interface NotificationLockscreenUserManager {

    boolean shouldHideNotifications(int userId);
    boolean shouldHideNotifications(String key);
    boolean shouldShowOnKeyguard(StatusBarNotification sbn);
    boolean shouldShowOnKeyguard(NotificationEntry entry);

    boolean isAnyProfilePublicMode();

+3 −4
Original line number Diff line number Diff line
@@ -33,7 +33,6 @@ import android.os.ServiceManager;
import android.os.UserHandle;
import android.os.UserManager;
import android.provider.Settings;
import android.service.notification.StatusBarNotification;
import android.util.Log;
import android.util.SparseArray;
import android.util.SparseBooleanArray;
@@ -302,7 +301,7 @@ public class NotificationLockscreenUserManagerImpl implements
                        Notification.VISIBILITY_SECRET;
    }

    public boolean shouldShowOnKeyguard(StatusBarNotification sbn) {
    public boolean shouldShowOnKeyguard(NotificationEntry entry) {
        if (getEntryManager() == null) {
            Log.wtf(TAG, "mEntryManager was null!", new Throwable());
            return false;
@@ -310,10 +309,10 @@ public class NotificationLockscreenUserManagerImpl implements
        boolean exceedsPriorityThreshold;
        if (NotificationUtils.useNewInterruptionModel(mContext)
                && hideSilentNotificationsOnLockscreen()) {
            exceedsPriorityThreshold = getEntryManager().getNotificationData().isHighPriority(sbn);
            exceedsPriorityThreshold = entry.isTopBucket();
        } else {
            exceedsPriorityThreshold =
                    !getEntryManager().getNotificationData().isAmbient(sbn.getKey());
                    !getEntryManager().getNotificationData().isAmbient(entry.key);
        }
        return mShowLockscreenNotifications && exceedsPriorityThreshold;
    }
+2 −4
Original line number Diff line number Diff line
@@ -394,15 +394,13 @@ public class NotificationViewHierarchyManager implements DynamicPrivacyControlle
            int userId = entry.notification.getUserId();
            boolean suppressedSummary = mGroupManager.isSummaryOfSuppressedGroup(
                    entry.notification) && !entry.isRowRemoved();
            boolean showOnKeyguard = mLockscreenUserManager.shouldShowOnKeyguard(entry
                    .notification);
            boolean showOnKeyguard = mLockscreenUserManager.shouldShowOnKeyguard(entry);
            if (!showOnKeyguard) {
                // min priority notifications should show if their summary is showing
                if (mGroupManager.isChildInGroupWithSummary(entry.notification)) {
                    NotificationEntry summary = mGroupManager.getLogicalGroupSummary(
                            entry.notification);
                    if (summary != null && mLockscreenUserManager.shouldShowOnKeyguard(
                            summary.notification))         {
                    if (summary != null && mLockscreenUserManager.shouldShowOnKeyguard(summary)) {
                        showOnKeyguard = true;
                    }
                }
+13 −5
Original line number Diff line number Diff line
@@ -25,7 +25,6 @@ import android.service.notification.NotificationListenerService.RankingMap;
import android.service.notification.SnoozeCriterion;
import android.service.notification.StatusBarNotification;
import android.util.ArrayMap;
import android.util.Slog;

import com.android.internal.annotations.VisibleForTesting;
import com.android.systemui.Dependency;
@@ -108,10 +107,19 @@ public class NotificationData {
            boolean bSystemMax = bImportance >= NotificationManager.IMPORTANCE_HIGH
                    && isSystemNotification(nb);

            boolean isHeadsUp = a.getRow().isHeadsUp();
            if (isHeadsUp != b.getRow().isHeadsUp()) {
                return isHeadsUp ? -1 : 1;
            } else if (isHeadsUp) {

            boolean aHeadsUp = a.getRow().isHeadsUp();
            boolean bHeadsUp = b.getRow().isHeadsUp();

            // HACK: This should really go elsewhere, but it's currently not straightforward to
            // extract the comparison code and we're guaranteed to touch every element, so this is
            // the best place to set the buckets for the moment.
            a.setIsTopBucket(aHeadsUp || aMedia || aSystemMax || a.isHighPriority());
            b.setIsTopBucket(bHeadsUp || bMedia || bSystemMax || b.isHighPriority());

            if (aHeadsUp != bHeadsUp) {
                return aHeadsUp ? -1 : 1;
            } else if (aHeadsUp) {
                // Provide consistent ranking with headsUpManager
                return mHeadsUpManager.compare(a, b);
            } else if (a.getRow().showingAmbientPulsing() != b.getRow().showingAmbientPulsing()) {
+14 −0
Original line number Diff line number Diff line
@@ -173,6 +173,8 @@ public final class NotificationEntry {
     */
    private boolean mHighPriority;

    private boolean mIsTopBucket;

    public NotificationEntry(StatusBarNotification n) {
        this(n, null);
    }
@@ -220,6 +222,18 @@ public final class NotificationEntry {
        this.mHighPriority = highPriority;
    }

    /**
     * @return True if the notif should appear in the "top" or "important" section of notifications
     * (as opposed to the "bottom" or "silent" section). This is usually the same as
     * {@link #isHighPriority()}, but there are certain exceptions, such as media notifs.
     */
    public boolean isTopBucket() {
        return mIsTopBucket;
    }
    public void setIsTopBucket(boolean isTopBucket) {
        mIsTopBucket = isTopBucket;
    }

    public boolean isBubble() {
        return (notification.getNotification().flags & FLAG_BUBBLE) != 0;
    }
Loading