summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTony Wickham <twickham@google.com>2018-12-05 21:20:14 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2018-12-05 21:20:14 +0000
commite2c724204e690c403c4025e09a4874d9fc46b553 (patch)
tree65547c7cd232db7398f35d5444d42c790d7882e6 /src
parent712049059531ffdb62c6a25e4894d232e67225de (diff)
parentc70f2fd5f1afe638298dc2693f655bdc01a948a1 (diff)
downloadandroid_packages_apps_Trebuchet-e2c724204e690c403c4025e09a4874d9fc46b553.tar.gz
android_packages_apps_Trebuchet-e2c724204e690c403c4025e09a4874d9fc46b553.tar.bz2
android_packages_apps_Trebuchet-e2c724204e690c403c4025e09a4874d9fc46b553.zip
Merge "Remove some obsolete notification badging code" into ub-launcher3-master
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher3/dot/DotInfo.java14
-rw-r--r--src/com/android/launcher3/notification/NotificationInfo.java17
-rw-r--r--src/com/android/launcher3/popup/PopupDataProvider.java10
3 files changed, 7 insertions, 34 deletions
diff --git a/src/com/android/launcher3/dot/DotInfo.java b/src/com/android/launcher3/dot/DotInfo.java
index 9d0e5d38d..15b2a3b01 100644
--- a/src/com/android/launcher3/dot/DotInfo.java
+++ b/src/com/android/launcher3/dot/DotInfo.java
@@ -92,18 +92,4 @@ public class DotInfo {
public int getNotificationCount() {
return Math.min(mTotalCount, MAX_COUNT);
}
-
- /**
- * TODO: this is outdated now that we only show dots instead of icons/numbers. can remove?
- * Whether newDot represents the same PackageUserKey as this badge, and icons with
- * this badge should be invalidated. So, for instance, if a badge has 3 notifications
- * and one of those notifications is updated, this method should return false because
- * the badge still says "3" and the contents of those notifications are only retrieved
- * upon long-click. This method always returns true when adding or removing notifications,
- * or if the badge has a notification icon to show.
- */
- public boolean shouldBeInvalidated(DotInfo newDot) {
- return mPackageUserKey.equals(newDot.mPackageUserKey)
- && (getNotificationCount() != newDot.getNotificationCount());
- }
}
diff --git a/src/com/android/launcher3/notification/NotificationInfo.java b/src/com/android/launcher3/notification/NotificationInfo.java
index 92f2265b5..e5525b2fa 100644
--- a/src/com/android/launcher3/notification/NotificationInfo.java
+++ b/src/com/android/launcher3/notification/NotificationInfo.java
@@ -51,7 +51,6 @@ public class NotificationInfo implements View.OnClickListener {
public final boolean autoCancel;
public final boolean dismissable;
- private int mBadgeIcon;
private Drawable mIconDrawable;
private int mIconColor;
private boolean mIsIconLarge;
@@ -66,10 +65,10 @@ public class NotificationInfo implements View.OnClickListener {
title = notification.extras.getCharSequence(Notification.EXTRA_TITLE);
text = notification.extras.getCharSequence(Notification.EXTRA_TEXT);
- mBadgeIcon = notification.getBadgeIconType();
+ int iconType = notification.getBadgeIconType();
// 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 == Notification.BADGE_ICON_SMALL ? null : notification.getLargeIcon();
+ Icon icon = iconType == Notification.BADGE_ICON_SMALL ? null : notification.getLargeIcon();
if (icon == null) {
// Use the small icon.
icon = notification.getSmallIcon();
@@ -85,7 +84,6 @@ public class NotificationInfo implements View.OnClickListener {
mIconDrawable = new BitmapDrawable(context.getResources(), LauncherAppState
.getInstance(context).getIconCache()
.getDefaultIcon(statusBarNotification.getUser()).icon);
- mBadgeIcon = Notification.BADGE_ICON_NONE;
}
intent = notification.contentIntent;
autoCancel = (notification.flags & Notification.FLAG_AUTO_CANCEL) != 0;
@@ -126,15 +124,4 @@ public class NotificationInfo implements View.OnClickListener {
icon.setTint(mIconColor);
return icon;
}
-
- public boolean isIconLarge() {
- return mIsIconLarge;
- }
-
- 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 == Notification.BADGE_ICON_LARGE
- || !mIsIconLarge && mBadgeIcon == Notification.BADGE_ICON_SMALL;
- }
}
diff --git a/src/com/android/launcher3/popup/PopupDataProvider.java b/src/com/android/launcher3/popup/PopupDataProvider.java
index a7184947c..984a03df5 100644
--- a/src/com/android/launcher3/popup/PopupDataProvider.java
+++ b/src/com/android/launcher3/popup/PopupDataProvider.java
@@ -115,8 +115,7 @@ public class PopupDataProvider implements NotificationListener.NotificationsChan
dotInfo = new DotInfo(packageUserKey);
mPackageUserToDotInfos.put(packageUserKey, dotInfo);
}
- dotInfo.addOrUpdateNotificationKey(NotificationKeyData
- .fromNotification(notification));
+ dotInfo.addOrUpdateNotificationKey(NotificationKeyData.fromNotification(notification));
}
// Add and remove from updatedDots so it contains the PackageUserKeys of updated dots.
@@ -126,9 +125,10 @@ public class PopupDataProvider implements NotificationListener.NotificationsChan
if (prevDot == null) {
updatedDots.put(packageUserKey, newDot);
} else {
- if (!prevDot.shouldBeInvalidated(newDot)) {
- updatedDots.remove(packageUserKey);
- }
+ // No need to update the dot if it already existed (no visual change).
+ // Note that if the dot was removed entirely, we wouldn't reach this point because
+ // this loop only includes active notifications added above.
+ updatedDots.remove(packageUserKey);
}
}