Loading core/java/android/app/INotificationManager.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -95,7 +95,7 @@ interface INotificationManager void updateNotificationChannelForPackage(String pkg, int uid, in NotificationChannel channel); NotificationChannel getNotificationChannel(String callingPkg, int userId, String pkg, String channelId); NotificationChannel getConversationNotificationChannel(String callingPkg, int userId, String pkg, String channelId, boolean returnParentIfNoConversationChannel, String conversationId); void createConversationNotificationChannelForPackage(String pkg, int uid, in NotificationChannel parentChannel, String conversationId); void createConversationNotificationChannelForPackage(String pkg, int uid, String triggeringKey, in NotificationChannel parentChannel, String conversationId); NotificationChannel getNotificationChannelForPackage(String pkg, int uid, String channelId, boolean includeDeleted); void deleteNotificationChannel(String pkg, String channelId); void deleteConversationNotificationChannels(String pkg, int uid, String conversationId); Loading core/java/android/service/notification/StatusBarNotification.java +18 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,9 @@ package android.service.notification; import static android.app.NotificationChannel.PLACEHOLDER_CONVERSATION_ID; import static android.util.FeatureFlagUtils.*; import android.annotation.NonNull; import android.app.Notification; import android.app.NotificationManager; Loading @@ -29,6 +32,8 @@ import android.os.Build; import android.os.Parcel; import android.os.Parcelable; import android.os.UserHandle; import android.text.TextUtils; import android.util.FeatureFlagUtils; import com.android.internal.logging.nano.MetricsProto; import com.android.internal.logging.nano.MetricsProto.MetricsEvent; Loading Loading @@ -436,6 +441,19 @@ public class StatusBarNotification implements Parcelable { return logMaker; } /** * @hide */ public String getShortcutId(Context context) { String conversationId = getNotification().getShortcutId(); if (isEnabled(context, NOTIF_CONVO_BYPASS_SHORTCUT_REQ) && getNotification().getNotificationStyle() == Notification.MessagingStyle.class && TextUtils.isEmpty(conversationId)) { conversationId = getId() + getTag() + PLACEHOLDER_CONVERSATION_ID; } return conversationId; } private String getGroupLogTag() { return shortenTag(getGroup()); } Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationConversationInfo.java +4 −10 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ package com.android.systemui.statusbar.notification.row; import static android.app.Notification.EXTRA_IS_GROUP_CONVERSATION; import static android.app.NotificationChannel.PLACEHOLDER_CONVERSATION_ID; import static android.app.NotificationManager.IMPORTANCE_DEFAULT; import static android.app.NotificationManager.IMPORTANCE_LOW; import static android.app.NotificationManager.IMPORTANCE_UNSPECIFIED; Loading Loading @@ -103,7 +102,6 @@ public class NotificationConversationInfo extends LinearLayout implements private NotificationEntry mEntry; private StatusBarNotification mSbn; private boolean mIsDeviceProvisioned; private int mStartingChannelImportance; private boolean mStartedAsBubble; private boolean mIsBubbleable; Loading Loading @@ -212,11 +210,10 @@ public class NotificationConversationInfo extends LinearLayout implements mLauncherApps = launcherApps; mConversationId = mNotificationChannel.getConversationId(); if (TextUtils.isEmpty(mNotificationChannel.getConversationId())) { mConversationId = mSbn.getNotification().getShortcutId(); mConversationId = mSbn.getShortcutId(mContext); } // TODO: flag this when flag exists if (TextUtils.isEmpty(mConversationId)) { mConversationId = mSbn.getId() + mSbn.getTag() + PLACEHOLDER_CONVERSATION_ID; throw new IllegalArgumentException("Does not have required information"); } // TODO: consider querying this earlier in the notification pipeline and passing it in LauncherApps.ShortcutQuery query = new LauncherApps.ShortcutQuery() Loading @@ -243,10 +240,9 @@ public class NotificationConversationInfo extends LinearLayout implements // a custom channel if (TextUtils.isEmpty(mNotificationChannel.getConversationId())) { try { // TODO: associate this key with this channel service side so the customization // isn't forgotten on the next update mINotificationManager.createConversationNotificationChannelForPackage( mPackageName, mAppUid, mNotificationChannel, mConversationId); mPackageName, mAppUid, mSbn.getKey(), mNotificationChannel, mConversationId); mNotificationChannel = mINotificationManager.getConversationNotificationChannel( mContext.getOpPackageName(), UserHandle.getUserId(mAppUid), mPackageName, mNotificationChannel.getId(), false, mConversationId); Loading Loading @@ -363,7 +359,6 @@ public class NotificationConversationInfo extends LinearLayout implements image.setImageDrawable(mLauncherApps.getShortcutBadgedIconDrawable(mShortcutInfo, mContext.getResources().getDisplayMetrics().densityDpi)); } else { // TODO: flag this behavior if (mSbn.getNotification().extras.getBoolean(EXTRA_IS_GROUP_CONVERSATION, false)) { // TODO: maybe use a generic group icon, or a composite of recent senders image.setImageDrawable(mPm.getDefaultActivityIcon()); Loading Loading @@ -391,7 +386,6 @@ public class NotificationConversationInfo extends LinearLayout implements if (mShortcutInfo != null) { name.setText(mShortcutInfo.getShortLabel()); } else { // TODO: flag this behavior Bundle extras = mSbn.getNotification().extras; String nameString = extras.getString(Notification.EXTRA_CONVERSATION_TITLE); if (TextUtils.isEmpty(nameString)) { Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationConversationInfoTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -797,7 +797,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase { null, true); verify(mMockINotificationManager, times(1)).createConversationNotificationChannelForPackage( anyString(), anyInt(), any(), eq(CONVERSATION_ID)); anyString(), anyInt(), anyString(), any(), eq(CONVERSATION_ID)); } @Test Loading @@ -817,7 +817,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase { null, true); verify(mMockINotificationManager, never()).createConversationNotificationChannelForPackage( anyString(), anyInt(), any(), eq(CONVERSATION_ID)); anyString(), anyInt(), anyString(), any(), eq(CONVERSATION_ID)); } @Test Loading services/core/java/com/android/server/notification/NotificationChannelExtractor.java +8 −3 Original line number Diff line number Diff line Loading @@ -15,7 +15,10 @@ */ package com.android.server.notification; import android.app.Notification; import android.app.NotificationChannel; import android.content.Context; import android.util.FeatureFlagUtils; import android.util.Slog; /** Loading @@ -26,8 +29,10 @@ public class NotificationChannelExtractor implements NotificationSignalExtractor private static final boolean DBG = false; private RankingConfig mConfig; private Context mContext; public void initialize(Context ctx, NotificationUsageStats usageStats) { mContext = ctx; if (DBG) Slog.d(TAG, "Initializing " + getClass().getSimpleName() + "."); } Loading @@ -41,11 +46,11 @@ public class NotificationChannelExtractor implements NotificationSignalExtractor if (DBG) Slog.d(TAG, "missing config"); return null; } record.updateNotificationChannel(mConfig.getConversationNotificationChannel( NotificationChannel updatedChannel = mConfig.getConversationNotificationChannel( record.sbn.getPackageName(), record.sbn.getUid(), record.getChannel().getId(), record.getNotification().getShortcutId(), true, false)); record.sbn.getShortcutId(mContext), true, false); record.updateNotificationChannel(updatedChannel); return null; } Loading Loading
core/java/android/app/INotificationManager.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -95,7 +95,7 @@ interface INotificationManager void updateNotificationChannelForPackage(String pkg, int uid, in NotificationChannel channel); NotificationChannel getNotificationChannel(String callingPkg, int userId, String pkg, String channelId); NotificationChannel getConversationNotificationChannel(String callingPkg, int userId, String pkg, String channelId, boolean returnParentIfNoConversationChannel, String conversationId); void createConversationNotificationChannelForPackage(String pkg, int uid, in NotificationChannel parentChannel, String conversationId); void createConversationNotificationChannelForPackage(String pkg, int uid, String triggeringKey, in NotificationChannel parentChannel, String conversationId); NotificationChannel getNotificationChannelForPackage(String pkg, int uid, String channelId, boolean includeDeleted); void deleteNotificationChannel(String pkg, String channelId); void deleteConversationNotificationChannels(String pkg, int uid, String conversationId); Loading
core/java/android/service/notification/StatusBarNotification.java +18 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,9 @@ package android.service.notification; import static android.app.NotificationChannel.PLACEHOLDER_CONVERSATION_ID; import static android.util.FeatureFlagUtils.*; import android.annotation.NonNull; import android.app.Notification; import android.app.NotificationManager; Loading @@ -29,6 +32,8 @@ import android.os.Build; import android.os.Parcel; import android.os.Parcelable; import android.os.UserHandle; import android.text.TextUtils; import android.util.FeatureFlagUtils; import com.android.internal.logging.nano.MetricsProto; import com.android.internal.logging.nano.MetricsProto.MetricsEvent; Loading Loading @@ -436,6 +441,19 @@ public class StatusBarNotification implements Parcelable { return logMaker; } /** * @hide */ public String getShortcutId(Context context) { String conversationId = getNotification().getShortcutId(); if (isEnabled(context, NOTIF_CONVO_BYPASS_SHORTCUT_REQ) && getNotification().getNotificationStyle() == Notification.MessagingStyle.class && TextUtils.isEmpty(conversationId)) { conversationId = getId() + getTag() + PLACEHOLDER_CONVERSATION_ID; } return conversationId; } private String getGroupLogTag() { return shortenTag(getGroup()); } Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationConversationInfo.java +4 −10 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ package com.android.systemui.statusbar.notification.row; import static android.app.Notification.EXTRA_IS_GROUP_CONVERSATION; import static android.app.NotificationChannel.PLACEHOLDER_CONVERSATION_ID; import static android.app.NotificationManager.IMPORTANCE_DEFAULT; import static android.app.NotificationManager.IMPORTANCE_LOW; import static android.app.NotificationManager.IMPORTANCE_UNSPECIFIED; Loading Loading @@ -103,7 +102,6 @@ public class NotificationConversationInfo extends LinearLayout implements private NotificationEntry mEntry; private StatusBarNotification mSbn; private boolean mIsDeviceProvisioned; private int mStartingChannelImportance; private boolean mStartedAsBubble; private boolean mIsBubbleable; Loading Loading @@ -212,11 +210,10 @@ public class NotificationConversationInfo extends LinearLayout implements mLauncherApps = launcherApps; mConversationId = mNotificationChannel.getConversationId(); if (TextUtils.isEmpty(mNotificationChannel.getConversationId())) { mConversationId = mSbn.getNotification().getShortcutId(); mConversationId = mSbn.getShortcutId(mContext); } // TODO: flag this when flag exists if (TextUtils.isEmpty(mConversationId)) { mConversationId = mSbn.getId() + mSbn.getTag() + PLACEHOLDER_CONVERSATION_ID; throw new IllegalArgumentException("Does not have required information"); } // TODO: consider querying this earlier in the notification pipeline and passing it in LauncherApps.ShortcutQuery query = new LauncherApps.ShortcutQuery() Loading @@ -243,10 +240,9 @@ public class NotificationConversationInfo extends LinearLayout implements // a custom channel if (TextUtils.isEmpty(mNotificationChannel.getConversationId())) { try { // TODO: associate this key with this channel service side so the customization // isn't forgotten on the next update mINotificationManager.createConversationNotificationChannelForPackage( mPackageName, mAppUid, mNotificationChannel, mConversationId); mPackageName, mAppUid, mSbn.getKey(), mNotificationChannel, mConversationId); mNotificationChannel = mINotificationManager.getConversationNotificationChannel( mContext.getOpPackageName(), UserHandle.getUserId(mAppUid), mPackageName, mNotificationChannel.getId(), false, mConversationId); Loading Loading @@ -363,7 +359,6 @@ public class NotificationConversationInfo extends LinearLayout implements image.setImageDrawable(mLauncherApps.getShortcutBadgedIconDrawable(mShortcutInfo, mContext.getResources().getDisplayMetrics().densityDpi)); } else { // TODO: flag this behavior if (mSbn.getNotification().extras.getBoolean(EXTRA_IS_GROUP_CONVERSATION, false)) { // TODO: maybe use a generic group icon, or a composite of recent senders image.setImageDrawable(mPm.getDefaultActivityIcon()); Loading Loading @@ -391,7 +386,6 @@ public class NotificationConversationInfo extends LinearLayout implements if (mShortcutInfo != null) { name.setText(mShortcutInfo.getShortLabel()); } else { // TODO: flag this behavior Bundle extras = mSbn.getNotification().extras; String nameString = extras.getString(Notification.EXTRA_CONVERSATION_TITLE); if (TextUtils.isEmpty(nameString)) { Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationConversationInfoTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -797,7 +797,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase { null, true); verify(mMockINotificationManager, times(1)).createConversationNotificationChannelForPackage( anyString(), anyInt(), any(), eq(CONVERSATION_ID)); anyString(), anyInt(), anyString(), any(), eq(CONVERSATION_ID)); } @Test Loading @@ -817,7 +817,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase { null, true); verify(mMockINotificationManager, never()).createConversationNotificationChannelForPackage( anyString(), anyInt(), any(), eq(CONVERSATION_ID)); anyString(), anyInt(), anyString(), any(), eq(CONVERSATION_ID)); } @Test Loading
services/core/java/com/android/server/notification/NotificationChannelExtractor.java +8 −3 Original line number Diff line number Diff line Loading @@ -15,7 +15,10 @@ */ package com.android.server.notification; import android.app.Notification; import android.app.NotificationChannel; import android.content.Context; import android.util.FeatureFlagUtils; import android.util.Slog; /** Loading @@ -26,8 +29,10 @@ public class NotificationChannelExtractor implements NotificationSignalExtractor private static final boolean DBG = false; private RankingConfig mConfig; private Context mContext; public void initialize(Context ctx, NotificationUsageStats usageStats) { mContext = ctx; if (DBG) Slog.d(TAG, "Initializing " + getClass().getSimpleName() + "."); } Loading @@ -41,11 +46,11 @@ public class NotificationChannelExtractor implements NotificationSignalExtractor if (DBG) Slog.d(TAG, "missing config"); return null; } record.updateNotificationChannel(mConfig.getConversationNotificationChannel( NotificationChannel updatedChannel = mConfig.getConversationNotificationChannel( record.sbn.getPackageName(), record.sbn.getUid(), record.getChannel().getId(), record.getNotification().getShortcutId(), true, false)); record.sbn.getShortcutId(mContext), true, false); record.updateNotificationChannel(updatedChannel); return null; } Loading