diff options
author | Yorke Lee <yorkelee@google.com> | 2015-05-06 15:26:21 -0700 |
---|---|---|
committer | Yorke Lee <yorkelee@google.com> | 2015-05-07 15:59:27 -0700 |
commit | 4c711526bfcd94b99dc486765073123d0a7a5636 (patch) | |
tree | 76883f9a4c2f2487bd59207c4c8a7164a7f7f510 /InCallUI | |
parent | f2f2d2d1c1e325272738bad429dc0c1000d82f35 (diff) |
DO NOT MERGE 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 1dd8a6cc5..d46444be0 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); } /** |