diff options
author | Yorke Lee <yorkelee@google.com> | 2015-05-06 15:26:21 -0700 |
---|---|---|
committer | Yorke Lee <yorkelee@google.com> | 2015-05-06 15:27:18 -0700 |
commit | 6d4371d5df23d1b129a1a173292fad1fecdb362e (patch) | |
tree | 84e105abf2fa38d17695f43237caa15354e5d0a8 /InCallUI | |
parent | ed8488149b8d842ee86b4c209d0f39d71f004146 (diff) |
Cache the non-rounded large bitmap instead of the rounded version
Because a new copy of a rounded bitmap is created everytime,
the check against the cached copies of information was failing to
detect identical notifications, causing multiple full-screen
notifications to be sent to the notification manager.
This causes a delay in the time it takes for the HUN to be
hidden when accepting a call.
Bug: 20764430
Change-Id: I4f62d5091b7fc216312a612181a91e3ec4828661
Diffstat (limited to 'InCallUI')
-rw-r--r-- | InCallUI/src/com/android/incallui/StatusBarNotifier.java | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/InCallUI/src/com/android/incallui/StatusBarNotifier.java b/InCallUI/src/com/android/incallui/StatusBarNotifier.java index bc3687ced..a54536ce6 100644 --- a/InCallUI/src/com/android/incallui/StatusBarNotifier.java +++ b/InCallUI/src/com/android/incallui/StatusBarNotifier.java @@ -197,7 +197,7 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener, // Check if data has changed; if nothing is different, don't issue another notification. final int iconResId = getIconToDisplay(call); - final Bitmap largeIcon = getLargeIconToDisplay(contactInfo, call); + Bitmap largeIcon = getLargeIconToDisplay(contactInfo, call); final int contentResId = getContentString(call); final String contentTitle = getContentTitle(contactInfo, call); @@ -205,6 +205,10 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener, return; } + if (largeIcon != null) { + largeIcon = getRoundedIcon(largeIcon); + } + /* * Nothing more to check...build and send it. */ @@ -352,15 +356,18 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener, if (contactInfo.photo != null && (contactInfo.photo instanceof BitmapDrawable)) { largeIcon = ((BitmapDrawable) contactInfo.photo).getBitmap(); } + return largeIcon; + } - if (largeIcon != null) { - final int height = (int) mContext.getResources().getDimension( - android.R.dimen.notification_large_icon_height); - final int width = (int) mContext.getResources().getDimension( - android.R.dimen.notification_large_icon_width); - largeIcon = BitmapUtil.getRoundedBitmap(largeIcon, width, height); + private Bitmap getRoundedIcon(Bitmap bitmap) { + if (bitmap == null) { + return null; } - return largeIcon; + final int height = (int) mContext.getResources().getDimension( + android.R.dimen.notification_large_icon_height); + final int width = (int) mContext.getResources().getDimension( + android.R.dimen.notification_large_icon_width); + return BitmapUtil.getRoundedBitmap(bitmap, width, height); } /** |