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

Commit 5ff476a9 authored by Danning Chen's avatar Danning Chen Committed by Android (Google) Code Review
Browse files

Merge "Add isConversation() API to NotificationRecord and a corresponding key in Adjustment"

parents 5f695d5d 10326cf5
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -10129,6 +10129,7 @@ package android.service.notification {
    field @NonNull public static final android.os.Parcelable.Creator<android.service.notification.Adjustment> CREATOR;
    field public static final String KEY_CONTEXTUAL_ACTIONS = "key_contextual_actions";
    field public static final String KEY_IMPORTANCE = "key_importance";
    field public static final String KEY_NOT_CONVERSATION = "key_not_conversation";
    field public static final String KEY_PEOPLE = "key_people";
    field public static final String KEY_RANKING_SCORE = "key_ranking_score";
    field public static final String KEY_SNOOZE_CRITERIA = "key_snooze_criteria";
+7 −0
Original line number Diff line number Diff line
@@ -130,6 +130,13 @@ public final class Adjustment implements Parcelable {
     */
    public static final String KEY_RANKING_SCORE = "key_ranking_score";

    /**
     * Data type: boolean, when true it suggests this is NOT a conversation notification.
     * @hide
     */
    @SystemApi
    public static final String KEY_NOT_CONVERSATION = "key_not_conversation";

    /**
     * Create a notification adjustment.
     *
+17 −3
Original line number Diff line number Diff line
@@ -1539,6 +1539,7 @@ public abstract class NotificationListenerService extends Service {
        private ArrayList<CharSequence> mSmartReplies;
        private boolean mCanBubble;
        private boolean mVisuallyInterruptive;
        private boolean mIsConversation;

        private static final int PARCEL_VERSION = 2;

@@ -1571,6 +1572,7 @@ public abstract class NotificationListenerService extends Service {
            out.writeCharSequenceList(mSmartReplies);
            out.writeBoolean(mCanBubble);
            out.writeBoolean(mVisuallyInterruptive);
            out.writeBoolean(mIsConversation);
        }

        /** @hide */
@@ -1604,6 +1606,7 @@ public abstract class NotificationListenerService extends Service {
            mSmartReplies = in.readCharSequenceList();
            mCanBubble = in.readBoolean();
            mVisuallyInterruptive = in.readBoolean();
            mIsConversation = in.readBoolean();
        }


@@ -1800,6 +1803,14 @@ public abstract class NotificationListenerService extends Service {
            return mNoisy;
        }

        /**
         * Returns whether this notification is a conversation notification.
         * @hide
         */
        public boolean isConversation() {
            return mIsConversation;
        }

        /**
         * @hide
         */
@@ -1812,7 +1823,7 @@ public abstract class NotificationListenerService extends Service {
                int userSentiment, boolean hidden, long lastAudiblyAlertedMs,
                boolean noisy, ArrayList<Notification.Action> smartActions,
                ArrayList<CharSequence> smartReplies, boolean canBubble,
                boolean visuallyInterruptive) {
                boolean visuallyInterruptive, boolean isConversation) {
            mKey = key;
            mRank = rank;
            mIsAmbient = importance < NotificationManager.IMPORTANCE_LOW;
@@ -1834,6 +1845,7 @@ public abstract class NotificationListenerService extends Service {
            mSmartReplies = smartReplies;
            mCanBubble = canBubble;
            mVisuallyInterruptive = visuallyInterruptive;
            mIsConversation = isConversation;
        }

        /**
@@ -1859,7 +1871,8 @@ public abstract class NotificationListenerService extends Service {
                    other.mSmartActions,
                    other.mSmartReplies,
                    other.mCanBubble,
                    other.mVisuallyInterruptive);
                    other.mVisuallyInterruptive,
                    other.mIsConversation);
        }

        /**
@@ -1912,7 +1925,8 @@ public abstract class NotificationListenerService extends Service {
                        == (other.mSmartActions == null ? 0 : other.mSmartActions.size()))
                    && Objects.equals(mSmartReplies, other.mSmartReplies)
                    && Objects.equals(mCanBubble, other.mCanBubble)
                    && Objects.equals(mVisuallyInterruptive, other.mVisuallyInterruptive);
                    && Objects.equals(mVisuallyInterruptive, other.mVisuallyInterruptive)
                    && Objects.equals(mIsConversation, other.mIsConversation);
        }
    }

+1 −0
Original line number Diff line number Diff line
@@ -195,6 +195,7 @@ public class NotificationListener extends NotificationListenerWithPlugins {
                    new ArrayList<>(),
                    new ArrayList<>(),
                    false,
                    false,
                    false
            );
        }
+1 −4
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@

package com.android.systemui.statusbar.notification.collection

import android.app.NotificationChannel
import android.app.NotificationManager.IMPORTANCE_HIGH
import android.app.NotificationManager.IMPORTANCE_MIN
import android.service.notification.NotificationListenerService.Ranking
@@ -192,9 +191,7 @@ open class NotificationRankingManager @Inject constructor(
    }

    private fun NotificationEntry.isPeopleNotification() =
            sbn.isPeopleNotification(channel)
    private fun StatusBarNotification.isPeopleNotification(channel: NotificationChannel) =
            peopleNotificationIdentifier.isPeopleNotification(this, channel)
            peopleNotificationIdentifier.isPeopleNotification(sbn, ranking)

    private fun NotificationEntry.isHighPriority() =
            highPriorityProvider.isHighPriority(this)
Loading