Loading core/java/android/app/NotificationChannel.java +29 −5 Original line number Diff line number Diff line Loading @@ -105,6 +105,7 @@ public final class NotificationChannel implements Parcelable { private static final String ATT_ORIG_IMP = "orig_imp"; private static final String ATT_PARENT_CHANNEL = "parent"; private static final String ATT_CONVERSATION_ID = "conv_id"; private static final String ATT_DEMOTE = "dem"; private static final String DELIMITER = ","; /** Loading Loading @@ -194,6 +195,7 @@ public final class NotificationChannel implements Parcelable { private boolean mImportanceLockedDefaultApp; private String mParentId = null; private String mConversationId = null; private boolean mDemoted = false; /** * Creates a notification channel. Loading Loading @@ -260,6 +262,7 @@ public final class NotificationChannel implements Parcelable { mOriginalImportance = in.readInt(); mParentId = in.readString(); mConversationId = in.readString(); mDemoted = in.readBoolean(); } @Override Loading Loading @@ -317,6 +320,7 @@ public final class NotificationChannel implements Parcelable { dest.writeInt(mOriginalImportance); dest.writeString(mParentId); dest.writeString(mConversationId); dest.writeBoolean(mDemoted); } /** Loading Loading @@ -386,8 +390,6 @@ public final class NotificationChannel implements Parcelable { return input; } // Modifiable by apps on channel creation. /** * @hide */ Loading @@ -395,6 +397,8 @@ public final class NotificationChannel implements Parcelable { mId = id; } // Modifiable by apps on channel creation. /** * Sets what group this channel belongs to. * Loading Loading @@ -766,6 +770,20 @@ public final class NotificationChannel implements Parcelable { mOriginalImportance = importance; } /** * @hide */ public void setDemoted(boolean demoted) { mDemoted = demoted; } /** * @hide */ public boolean isDemoted() { return mDemoted; } /** * Returns whether the user has chosen the importance of this channel, either to affirm the * initial selection from the app, or changed it to be higher or lower. Loading Loading @@ -829,6 +847,7 @@ public final class NotificationChannel implements Parcelable { setOriginalImportance(safeInt(parser, ATT_ORIG_IMP, DEFAULT_IMPORTANCE)); setConversationId(parser.getAttributeValue(null, ATT_PARENT_CHANNEL), parser.getAttributeValue(null, ATT_CONVERSATION_ID)); setDemoted(safeBool(parser, ATT_DEMOTE, false)); } @Nullable Loading Loading @@ -959,6 +978,9 @@ public final class NotificationChannel implements Parcelable { if (getConversationId() != null) { out.attribute(null, ATT_CONVERSATION_ID, getConversationId()); } if (isDemoted()) { out.attribute(null, ATT_DEMOTE, Boolean.toString(isDemoted())); } // mImportanceLockedDefaultApp and mImportanceLockedByOEM have a different source of // truth and so aren't written to this xml file Loading Loading @@ -1118,7 +1140,8 @@ public final class NotificationChannel implements Parcelable { && mImportanceLockedDefaultApp == that.mImportanceLockedDefaultApp && mOriginalImportance == that.mOriginalImportance && Objects.equals(getParentChannelId(), that.getParentChannelId()) && Objects.equals(getConversationId(), that.getConversationId()); && Objects.equals(getConversationId(), that.getConversationId()) && isDemoted() == that.isDemoted(); } @Override Loading @@ -1129,7 +1152,7 @@ public final class NotificationChannel implements Parcelable { isFgServiceShown(), mVibrationEnabled, mShowBadge, isDeleted(), getGroup(), getAudioAttributes(), isBlockableSystem(), mAllowBubbles, mImportanceLockedByOEM, mImportanceLockedDefaultApp, mOriginalImportance, mParentId, mConversationId); mParentId, mConversationId, mDemoted); result = 31 * result + Arrays.hashCode(mVibration); return result; } Loading Loading @@ -1176,7 +1199,8 @@ public final class NotificationChannel implements Parcelable { + ", mImportanceLockedDefaultApp=" + mImportanceLockedDefaultApp + ", mOriginalImp=" + mOriginalImportance + ", mParent=" + mParentId + ", mConversationId=" + mConversationId; + ", mConversationId=" + mConversationId + ", mDemoted=" + mDemoted; } /** @hide */ Loading core/java/android/util/FeatureFlagUtils.java +1 −1 Original line number Diff line number Diff line Loading @@ -61,7 +61,7 @@ public class FeatureFlagUtils { DEFAULT_FLAGS.put(SETTINGS_WIFITRACKER2, "false"); DEFAULT_FLAGS.put("settings_controller_loading_enhancement", "false"); DEFAULT_FLAGS.put("settings_conditionals", "false"); DEFAULT_FLAGS.put(NOTIF_CONVO_BYPASS_SHORTCUT_REQ, "false"); DEFAULT_FLAGS.put(NOTIF_CONVO_BYPASS_SHORTCUT_REQ, "true"); } /** Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationRankingManager.kt +4 −3 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ 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 Loading Loading @@ -191,9 +192,9 @@ open class NotificationRankingManager @Inject constructor( } private fun NotificationEntry.isPeopleNotification() = sbn.isPeopleNotification() private fun StatusBarNotification.isPeopleNotification() = peopleNotificationIdentifier.isPeopleNotification(this) sbn.isPeopleNotification(channel) private fun StatusBarNotification.isPeopleNotification(channel: NotificationChannel) = peopleNotificationIdentifier.isPeopleNotification(this, channel) private fun NotificationEntry.isHighPriority() = highPriorityProvider.isHighPriority(this) Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/provider/HighPriorityProvider.java +2 −1 Original line number Diff line number Diff line Loading @@ -99,7 +99,8 @@ public class HighPriorityProvider { } private boolean isPeopleNotification(NotificationEntry entry) { return mPeopleNotificationIdentifier.isPeopleNotification(entry.getSbn()); return mPeopleNotificationIdentifier.isPeopleNotification( entry.getSbn(), entry.getChannel()); } private boolean hasUserSetImportance(NotificationEntry entry) { Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/people/PeopleNotificationIdentifier.kt +6 −4 Original line number Diff line number Diff line Loading @@ -18,13 +18,14 @@ package com.android.systemui.statusbar.notification.people import android.app.Notification import android.content.Context import android.app.NotificationChannel import android.service.notification.StatusBarNotification import android.util.FeatureFlagUtils import javax.inject.Inject import javax.inject.Singleton interface PeopleNotificationIdentifier { fun isPeopleNotification(sbn: StatusBarNotification): Boolean fun isPeopleNotification(sbn: StatusBarNotification, channel: NotificationChannel): Boolean } @Singleton Loading @@ -33,12 +34,13 @@ class PeopleNotificationIdentifierImpl @Inject constructor( private val context: Context ) : PeopleNotificationIdentifier { override fun isPeopleNotification(sbn: StatusBarNotification) = (sbn.notification.notificationStyle == Notification.MessagingStyle::class.java && override fun isPeopleNotification(sbn: StatusBarNotification, channel: NotificationChannel) = ((sbn.notification.notificationStyle == Notification.MessagingStyle::class.java && (sbn.notification.shortcutId != null || FeatureFlagUtils.isEnabled( context, FeatureFlagUtils.NOTIF_CONVO_BYPASS_SHORTCUT_REQ ))) || personExtractor.isPersonNotification(sbn) personExtractor.isPersonNotification(sbn)) && !channel.isDemoted } No newline at end of file Loading
core/java/android/app/NotificationChannel.java +29 −5 Original line number Diff line number Diff line Loading @@ -105,6 +105,7 @@ public final class NotificationChannel implements Parcelable { private static final String ATT_ORIG_IMP = "orig_imp"; private static final String ATT_PARENT_CHANNEL = "parent"; private static final String ATT_CONVERSATION_ID = "conv_id"; private static final String ATT_DEMOTE = "dem"; private static final String DELIMITER = ","; /** Loading Loading @@ -194,6 +195,7 @@ public final class NotificationChannel implements Parcelable { private boolean mImportanceLockedDefaultApp; private String mParentId = null; private String mConversationId = null; private boolean mDemoted = false; /** * Creates a notification channel. Loading Loading @@ -260,6 +262,7 @@ public final class NotificationChannel implements Parcelable { mOriginalImportance = in.readInt(); mParentId = in.readString(); mConversationId = in.readString(); mDemoted = in.readBoolean(); } @Override Loading Loading @@ -317,6 +320,7 @@ public final class NotificationChannel implements Parcelable { dest.writeInt(mOriginalImportance); dest.writeString(mParentId); dest.writeString(mConversationId); dest.writeBoolean(mDemoted); } /** Loading Loading @@ -386,8 +390,6 @@ public final class NotificationChannel implements Parcelable { return input; } // Modifiable by apps on channel creation. /** * @hide */ Loading @@ -395,6 +397,8 @@ public final class NotificationChannel implements Parcelable { mId = id; } // Modifiable by apps on channel creation. /** * Sets what group this channel belongs to. * Loading Loading @@ -766,6 +770,20 @@ public final class NotificationChannel implements Parcelable { mOriginalImportance = importance; } /** * @hide */ public void setDemoted(boolean demoted) { mDemoted = demoted; } /** * @hide */ public boolean isDemoted() { return mDemoted; } /** * Returns whether the user has chosen the importance of this channel, either to affirm the * initial selection from the app, or changed it to be higher or lower. Loading Loading @@ -829,6 +847,7 @@ public final class NotificationChannel implements Parcelable { setOriginalImportance(safeInt(parser, ATT_ORIG_IMP, DEFAULT_IMPORTANCE)); setConversationId(parser.getAttributeValue(null, ATT_PARENT_CHANNEL), parser.getAttributeValue(null, ATT_CONVERSATION_ID)); setDemoted(safeBool(parser, ATT_DEMOTE, false)); } @Nullable Loading Loading @@ -959,6 +978,9 @@ public final class NotificationChannel implements Parcelable { if (getConversationId() != null) { out.attribute(null, ATT_CONVERSATION_ID, getConversationId()); } if (isDemoted()) { out.attribute(null, ATT_DEMOTE, Boolean.toString(isDemoted())); } // mImportanceLockedDefaultApp and mImportanceLockedByOEM have a different source of // truth and so aren't written to this xml file Loading Loading @@ -1118,7 +1140,8 @@ public final class NotificationChannel implements Parcelable { && mImportanceLockedDefaultApp == that.mImportanceLockedDefaultApp && mOriginalImportance == that.mOriginalImportance && Objects.equals(getParentChannelId(), that.getParentChannelId()) && Objects.equals(getConversationId(), that.getConversationId()); && Objects.equals(getConversationId(), that.getConversationId()) && isDemoted() == that.isDemoted(); } @Override Loading @@ -1129,7 +1152,7 @@ public final class NotificationChannel implements Parcelable { isFgServiceShown(), mVibrationEnabled, mShowBadge, isDeleted(), getGroup(), getAudioAttributes(), isBlockableSystem(), mAllowBubbles, mImportanceLockedByOEM, mImportanceLockedDefaultApp, mOriginalImportance, mParentId, mConversationId); mParentId, mConversationId, mDemoted); result = 31 * result + Arrays.hashCode(mVibration); return result; } Loading Loading @@ -1176,7 +1199,8 @@ public final class NotificationChannel implements Parcelable { + ", mImportanceLockedDefaultApp=" + mImportanceLockedDefaultApp + ", mOriginalImp=" + mOriginalImportance + ", mParent=" + mParentId + ", mConversationId=" + mConversationId; + ", mConversationId=" + mConversationId + ", mDemoted=" + mDemoted; } /** @hide */ Loading
core/java/android/util/FeatureFlagUtils.java +1 −1 Original line number Diff line number Diff line Loading @@ -61,7 +61,7 @@ public class FeatureFlagUtils { DEFAULT_FLAGS.put(SETTINGS_WIFITRACKER2, "false"); DEFAULT_FLAGS.put("settings_controller_loading_enhancement", "false"); DEFAULT_FLAGS.put("settings_conditionals", "false"); DEFAULT_FLAGS.put(NOTIF_CONVO_BYPASS_SHORTCUT_REQ, "false"); DEFAULT_FLAGS.put(NOTIF_CONVO_BYPASS_SHORTCUT_REQ, "true"); } /** Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationRankingManager.kt +4 −3 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ 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 Loading Loading @@ -191,9 +192,9 @@ open class NotificationRankingManager @Inject constructor( } private fun NotificationEntry.isPeopleNotification() = sbn.isPeopleNotification() private fun StatusBarNotification.isPeopleNotification() = peopleNotificationIdentifier.isPeopleNotification(this) sbn.isPeopleNotification(channel) private fun StatusBarNotification.isPeopleNotification(channel: NotificationChannel) = peopleNotificationIdentifier.isPeopleNotification(this, channel) private fun NotificationEntry.isHighPriority() = highPriorityProvider.isHighPriority(this) Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/provider/HighPriorityProvider.java +2 −1 Original line number Diff line number Diff line Loading @@ -99,7 +99,8 @@ public class HighPriorityProvider { } private boolean isPeopleNotification(NotificationEntry entry) { return mPeopleNotificationIdentifier.isPeopleNotification(entry.getSbn()); return mPeopleNotificationIdentifier.isPeopleNotification( entry.getSbn(), entry.getChannel()); } private boolean hasUserSetImportance(NotificationEntry entry) { Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/people/PeopleNotificationIdentifier.kt +6 −4 Original line number Diff line number Diff line Loading @@ -18,13 +18,14 @@ package com.android.systemui.statusbar.notification.people import android.app.Notification import android.content.Context import android.app.NotificationChannel import android.service.notification.StatusBarNotification import android.util.FeatureFlagUtils import javax.inject.Inject import javax.inject.Singleton interface PeopleNotificationIdentifier { fun isPeopleNotification(sbn: StatusBarNotification): Boolean fun isPeopleNotification(sbn: StatusBarNotification, channel: NotificationChannel): Boolean } @Singleton Loading @@ -33,12 +34,13 @@ class PeopleNotificationIdentifierImpl @Inject constructor( private val context: Context ) : PeopleNotificationIdentifier { override fun isPeopleNotification(sbn: StatusBarNotification) = (sbn.notification.notificationStyle == Notification.MessagingStyle::class.java && override fun isPeopleNotification(sbn: StatusBarNotification, channel: NotificationChannel) = ((sbn.notification.notificationStyle == Notification.MessagingStyle::class.java && (sbn.notification.shortcutId != null || FeatureFlagUtils.isEnabled( context, FeatureFlagUtils.NOTIF_CONVO_BYPASS_SHORTCUT_REQ ))) || personExtractor.isPersonNotification(sbn) personExtractor.isPersonNotification(sbn)) && !channel.isDemoted } No newline at end of file