summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTony Wickham <twickham@google.com>2017-04-03 17:50:25 +0000
committerandroid-build-merger <android-build-merger@google.com>2017-04-03 17:50:25 +0000
commit7022ba3bf1343b88909bb529f3cd406929b8bb39 (patch)
tree89684211ce6f197404ddcd6b33be30d7eac5932e
parent0f9e5321d63680721017be8ca7d6085be8db57dd (diff)
parent39a99e709815216b21def81336f1b91ec1f8c90c (diff)
downloadandroid_packages_apps_Trebuchet-7022ba3bf1343b88909bb529f3cd406929b8bb39.tar.gz
android_packages_apps_Trebuchet-7022ba3bf1343b88909bb529f3cd406929b8bb39.tar.bz2
android_packages_apps_Trebuchet-7022ba3bf1343b88909bb529f3cd406929b8bb39.zip
Merge "Temporarily use reflection to get notification badge icon type" into ub-launcher3-dorval
am: 39a99e7098 Change-Id: I0fdc617a99d608aef61bd2dd3849467345cfba48
-rw-r--r--src/com/android/launcher3/notification/NotificationInfo.java17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/com/android/launcher3/notification/NotificationInfo.java b/src/com/android/launcher3/notification/NotificationInfo.java
index f6779b331..0b41743b9 100644
--- a/src/com/android/launcher3/notification/NotificationInfo.java
+++ b/src/com/android/launcher3/notification/NotificationInfo.java
@@ -25,6 +25,7 @@ import android.graphics.drawable.Drawable;
import android.graphics.drawable.Icon;
import android.os.Bundle;
import android.service.notification.StatusBarNotification;
+import android.util.Log;
import android.view.View;
import com.android.launcher3.Launcher;
@@ -64,7 +65,21 @@ 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 = notification.getBadgeIcon();
+
+ // TODO(b/36855196): use getBadgeIconType() without reflection
+ int badgeIcon = Notification.BADGE_ICON_NONE;
+ try {
+ badgeIcon = (int) Notification.class.getMethod("getBadgeIconType").invoke(notification);
+ } catch (Exception e) {
+ Log.w("NotificationInfo", "getBadgeIconType() failed", e);
+ // Try the old name, getBadgeIcon(), instead.
+ try {
+ badgeIcon = (int) Notification.class.getMethod("getBadgeIcon").invoke(notification);
+ } catch (Exception e1) {
+ Log.e("NotificationInfo", "getBadgeIcon() failed", e);
+ }
+ }
+ mBadgeIcon = badgeIcon;
// 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();