Loading src/com/android/launcher3/notification/NotificationInfo.java +5 −10 Original line number Diff line number Diff line Loading @@ -42,11 +42,6 @@ import com.android.launcher3.util.PackageUserKey; */ public class NotificationInfo implements View.OnClickListener { // TODO: use Notification constants directly. public static final int BADGE_ICON_NONE = 0; public static final int BADGE_ICON_SMALL = 1; public static final int BADGE_ICON_LARGE = 2; public final PackageUserKey packageUserKey; public final String notificationKey; public final CharSequence title; Loading @@ -69,10 +64,10 @@ public class NotificationInfo implements View.OnClickListener { Notification notification = statusBarNotification.getNotification(); title = notification.extras.getCharSequence(Notification.EXTRA_TITLE); text = notification.extras.getCharSequence(Notification.EXTRA_TEXT); mBadgeIcon = BADGE_ICON_LARGE; // TODO: get from the Notification mBadgeIcon = notification.getBadgeIcon(); // Load the icon. Since it is backed by ashmem, we won't copy the entire bitmap // into our process as long as we don't touch it and it exists in systemui. Icon icon = mBadgeIcon == BADGE_ICON_SMALL ? null : notification.getLargeIcon(); Icon icon = mBadgeIcon == Notification.BADGE_ICON_SMALL ? null : notification.getLargeIcon(); if (icon == null) { // Use the small icon. icon = notification.getSmallIcon(); Loading @@ -88,7 +83,7 @@ public class NotificationInfo implements View.OnClickListener { mIconDrawable = new BitmapDrawable(context.getResources(), LauncherAppState .getInstance(context).getIconCache() .getDefaultIcon(statusBarNotification.getUser())); mBadgeIcon = BADGE_ICON_NONE; mBadgeIcon = Notification.BADGE_ICON_NONE; } intent = notification.contentIntent; autoCancel = (notification.flags & Notification.FLAG_AUTO_CANCEL) != 0; Loading Loading @@ -133,7 +128,7 @@ public class NotificationInfo implements View.OnClickListener { public boolean shouldShowIconInBadge() { // If the icon we're using for this notification matches what the Notification // specified should show in the badge, then return true. return mIsIconLarge && mBadgeIcon == BADGE_ICON_LARGE || !mIsIconLarge && mBadgeIcon == BADGE_ICON_SMALL; return mIsIconLarge && mBadgeIcon == Notification.BADGE_ICON_LARGE || !mIsIconLarge && mBadgeIcon == Notification.BADGE_ICON_SMALL; } } src/com/android/launcher3/notification/NotificationListener.java +12 −1 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.launcher3.notification; import android.app.Notification; import android.app.NotificationChannel; import android.os.Handler; import android.os.Looper; import android.os.Message; Loading @@ -24,6 +25,7 @@ import android.service.notification.NotificationListenerService; import android.service.notification.StatusBarNotification; import android.support.annotation.Nullable; import android.support.v4.util.Pair; import android.text.TextUtils; import com.android.launcher3.LauncherModel; import com.android.launcher3.Utilities; Loading Loading @@ -222,8 +224,17 @@ public class NotificationListener extends NotificationListenerService { } } Notification notification = sbn.getNotification(); if (mTempRanking.getChannel().getId().equals(NotificationChannel.DEFAULT_CHANNEL_ID)) { // Special filtering for the default, legacy "Miscellaneous" channel. if ((notification.flags & Notification.FLAG_ONGOING_EVENT) != 0) { return true; } } boolean isGroupHeader = (notification.flags & Notification.FLAG_GROUP_SUMMARY) != 0; return (notification.contentIntent == null || isGroupHeader); CharSequence title = notification.extras.getCharSequence(Notification.EXTRA_TITLE); CharSequence text = notification.extras.getCharSequence(Notification.EXTRA_TEXT); boolean missingTitleOrText = TextUtils.isEmpty(title) || TextUtils.isEmpty(text); return (notification.contentIntent == null || isGroupHeader || missingTitleOrText); } public interface NotificationsChangedListener { Loading Loading
src/com/android/launcher3/notification/NotificationInfo.java +5 −10 Original line number Diff line number Diff line Loading @@ -42,11 +42,6 @@ import com.android.launcher3.util.PackageUserKey; */ public class NotificationInfo implements View.OnClickListener { // TODO: use Notification constants directly. public static final int BADGE_ICON_NONE = 0; public static final int BADGE_ICON_SMALL = 1; public static final int BADGE_ICON_LARGE = 2; public final PackageUserKey packageUserKey; public final String notificationKey; public final CharSequence title; Loading @@ -69,10 +64,10 @@ public class NotificationInfo implements View.OnClickListener { Notification notification = statusBarNotification.getNotification(); title = notification.extras.getCharSequence(Notification.EXTRA_TITLE); text = notification.extras.getCharSequence(Notification.EXTRA_TEXT); mBadgeIcon = BADGE_ICON_LARGE; // TODO: get from the Notification mBadgeIcon = notification.getBadgeIcon(); // Load the icon. Since it is backed by ashmem, we won't copy the entire bitmap // into our process as long as we don't touch it and it exists in systemui. Icon icon = mBadgeIcon == BADGE_ICON_SMALL ? null : notification.getLargeIcon(); Icon icon = mBadgeIcon == Notification.BADGE_ICON_SMALL ? null : notification.getLargeIcon(); if (icon == null) { // Use the small icon. icon = notification.getSmallIcon(); Loading @@ -88,7 +83,7 @@ public class NotificationInfo implements View.OnClickListener { mIconDrawable = new BitmapDrawable(context.getResources(), LauncherAppState .getInstance(context).getIconCache() .getDefaultIcon(statusBarNotification.getUser())); mBadgeIcon = BADGE_ICON_NONE; mBadgeIcon = Notification.BADGE_ICON_NONE; } intent = notification.contentIntent; autoCancel = (notification.flags & Notification.FLAG_AUTO_CANCEL) != 0; Loading Loading @@ -133,7 +128,7 @@ public class NotificationInfo implements View.OnClickListener { public boolean shouldShowIconInBadge() { // If the icon we're using for this notification matches what the Notification // specified should show in the badge, then return true. return mIsIconLarge && mBadgeIcon == BADGE_ICON_LARGE || !mIsIconLarge && mBadgeIcon == BADGE_ICON_SMALL; return mIsIconLarge && mBadgeIcon == Notification.BADGE_ICON_LARGE || !mIsIconLarge && mBadgeIcon == Notification.BADGE_ICON_SMALL; } }
src/com/android/launcher3/notification/NotificationListener.java +12 −1 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.launcher3.notification; import android.app.Notification; import android.app.NotificationChannel; import android.os.Handler; import android.os.Looper; import android.os.Message; Loading @@ -24,6 +25,7 @@ import android.service.notification.NotificationListenerService; import android.service.notification.StatusBarNotification; import android.support.annotation.Nullable; import android.support.v4.util.Pair; import android.text.TextUtils; import com.android.launcher3.LauncherModel; import com.android.launcher3.Utilities; Loading Loading @@ -222,8 +224,17 @@ public class NotificationListener extends NotificationListenerService { } } Notification notification = sbn.getNotification(); if (mTempRanking.getChannel().getId().equals(NotificationChannel.DEFAULT_CHANNEL_ID)) { // Special filtering for the default, legacy "Miscellaneous" channel. if ((notification.flags & Notification.FLAG_ONGOING_EVENT) != 0) { return true; } } boolean isGroupHeader = (notification.flags & Notification.FLAG_GROUP_SUMMARY) != 0; return (notification.contentIntent == null || isGroupHeader); CharSequence title = notification.extras.getCharSequence(Notification.EXTRA_TITLE); CharSequence text = notification.extras.getCharSequence(Notification.EXTRA_TEXT); boolean missingTitleOrText = TextUtils.isEmpty(title) || TextUtils.isEmpty(text); return (notification.contentIntent == null || isGroupHeader || missingTitleOrText); } public interface NotificationsChangedListener { Loading