Repository navigation
hotfix/cp-12674-remote-images-are-decoded-at-full-size-without-downsampling - #388
unnaticleverpush wants to merge 2 commits into
Conversation
…mpling Optimize bitmap decoding to reduce memory usage in NotificationService, InboxView and AppBanner
There was a problem hiding this comment.
Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit
reviewdog
'if rcurly' has incorrect indentation level 12, expected level should be 6.
'finally rcurly' has incorrect indentation level 8, expected level should be 4.
'method def rcurly' has incorrect indentation level 4, expected level should be 2.
'method def modifier' has incorrect indentation level 4, expected level should be 2.
'method def rparen' has incorrect indentation level 4, expected level should be 2.
'if' has incorrect indentation level 8, expected level should be 4.
'if' child has incorrect indentation level 12, expected level should be 6.
'if rcurly' has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'while' has incorrect indentation level 8, expected level should be 4.
'while' child has incorrect indentation level 12, expected level should be 6.
'if' has incorrect indentation level 12, expected level should be 6.
'if' child has incorrect indentation level 16, expected level should be 8.
'if rcurly' has incorrect indentation level 12, expected level should be 6.
'while' child has incorrect indentation level 12, expected level should be 6.
'while rcurly' has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def rcurly' has incorrect indentation level 4, expected level should be 2.
Empty line should be followed by
tag on the next line.
'method def modifier' has incorrect indentation level 4, expected level should be 2.
'method def rparen' has incorrect indentation level 4, expected level should be 2.
'if' has incorrect indentation level 8, expected level should be 4.
'if' child has incorrect indentation level 12, expected level should be 6.
'if rcurly' has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def rcurly' has incorrect indentation level 4, expected level should be 2.
'method def modifier' has incorrect indentation level 4, expected level should be 2.
'method def rparen' has incorrect indentation level 4, expected level should be 2.
'if' has incorrect indentation level 8, expected level should be 4.
'if' child has incorrect indentation level 12, expected level should be 6.
'if rcurly' has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'if' has incorrect indentation level 8, expected level should be 4.
'if' child has incorrect indentation level 12, expected level should be 6.
'if rcurly' has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def rcurly' has incorrect indentation level 4, expected level should be 2.
'method def modifier' has incorrect indentation level 4, expected level should be 2.
'method def rparen' has incorrect indentation level 4, expected level should be 2.
'if' has incorrect indentation level 8, expected level should be 4.
'if' child has incorrect indentation level 12, expected level should be 6.
'if rcurly' has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'if' has incorrect indentation level 8, expected level should be 4.
'if' child has incorrect indentation level 12, expected level should be 6.
'if rcurly' has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def rcurly' has incorrect indentation level 4, expected level should be 2.
'method def modifier' has incorrect indentation level 4, expected level should be 2.
'method def rparen' has incorrect indentation level 4, expected level should be 2.
'if' has incorrect indentation level 8, expected level should be 4.
'if' child has incorrect indentation level 12, expected level should be 6.
'if rcurly' has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'if' has incorrect indentation level 8, expected level should be 4.
'if' child has incorrect indentation level 12, expected level should be 6.
'if' child has incorrect indentation level 12, expected level should be 6.
'if rcurly' has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def rcurly' has incorrect indentation level 4, expected level should be 2.
'method def modifier' has incorrect indentation level 4, expected level should be 2.
'method def rparen' has incorrect indentation level 4, expected level should be 2.
'if' has incorrect indentation level 8, expected level should be 4.
'if' child has incorrect indentation level 12, expected level should be 6.
'if rcurly' has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'if' has incorrect indentation level 8, expected level should be 4.
'if' child has incorrect indentation level 12, expected level should be 6.
'if' child has incorrect indentation level 12, expected level should be 6.
'if rcurly' has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def rcurly' has incorrect indentation level 4, expected level should be 2.
'method def modifier' has incorrect indentation level 4, expected level should be 2.
'if' has incorrect indentation level 8, expected level should be 4.
'if' child has incorrect indentation level 12, expected level should be 6.
'if rcurly' has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def rcurly' has incorrect indentation level 4, expected level should be 2.
'method def modifier' has incorrect indentation level 4, expected level should be 2.
'method def rparen' has incorrect indentation level 4, expected level should be 2.
'if' has incorrect indentation level 8, expected level should be 4.
'if' child has incorrect indentation level 12, expected level should be 6.
'if rcurly' has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'if' has incorrect indentation level 8, expected level should be 4.
'if' child has incorrect indentation level 12, expected level should be 6.
'if rcurly' has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'if' has incorrect indentation level 8, expected level should be 4.
'if' child has incorrect indentation level 12, expected level should be 6.
'if rcurly' has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def rcurly' has incorrect indentation level 4, expected level should be 2.
Empty line should be followed by
tag on the next line.
'method def modifier' has incorrect indentation level 4, expected level should be 2.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'while' has incorrect indentation level 8, expected level should be 4.
'while' child has incorrect indentation level 12, expected level should be 6.
'while rcurly' has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def rcurly' has incorrect indentation level 4, expected level should be 2.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit e000ef3. Configure here.
| Glide.with(this) | ||
| .load(imageUrl) | ||
| .centerCrop() | ||
| .into(bannerBackgroundImage); |
There was a problem hiding this comment.
Inbox background no longer fills view
Medium Severity
The inbox background image is now loaded into inboxViewBannerBackgroundImage, a wrap_content ImageView, instead of being applied as the parent background. That image will only occupy its intrinsic height and will not cover the full inbox detail surface the way the previous parent background did.
Reviewed by Cursor Bugbot for commit e000ef3. Configure here.
There was a problem hiding this comment.
5 issues found across 8 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="cleverpush/src/main/java/com/cleverpush/inbox/InboxDetailBannerCarouselAdapter.java">
<violation number="1" location="cleverpush/src/main/java/com/cleverpush/inbox/InboxDetailBannerCarouselAdapter.java:821">
P3: This `removeTrailingBlankLines` is an exact copy of `AppBannerCarouselAdapter.removeTrailingBlankLines`. Call the existing method instead of adding a second public static copy here, or move it to a shared util if both adapters should own it.</violation>
</file>
<file name="cleverpush/src/main/java/com/cleverpush/inbox/InboxDetailActivity.java">
<violation number="1" location="cleverpush/src/main/java/com/cleverpush/inbox/InboxDetailActivity.java:547">
P2: The background image now goes into `inboxViewBannerBackgroundImage`, which is `wrap_content` high in the layout. The body-height sizing listener still targets the parent, so the image will not fill the banner body as before. Size the image view to match the body, or keep the image on the sized container.</violation>
</file>
<file name="cleverpush/src/main/java/com/cleverpush/service/NotificationService.java">
<violation number="1" location="cleverpush/src/main/java/com/cleverpush/service/NotificationService.java:368">
P2: The 512px height cap shrinks portrait and square big-picture images to a few hundred pixels on their long edge. The system then upscales them to notification width, which looks soft. Cap only the long edge, or raise the height limit, so non-2:1 artwork keeps usable resolution.</violation>
<violation number="2" location="cleverpush/src/main/java/com/cleverpush/service/NotificationService.java:845">
P2: Carousel images are sized to fit inside the 180dp box, but the `big_picture` view uses `centerCrop`, which fills the box. Square, portrait, and 4:3 images are therefore shrunk and then upscaled by the view, about 1.5–2x, so they look soft. Decode to cover the box and center-crop before PNG compression instead.</violation>
</file>
<file name="cleverpush/src/main/java/com/cleverpush/util/BitmapUtils.java">
<violation number="1" location="cleverpush/src/main/java/com/cleverpush/util/BitmapUtils.java:111">
P2: `decodeStream` reads the entire remote payload into heap before decoding, and `toByteArray()` duplicates it. Large images can still OOM despite the sampled bitmap; spool to a temporary file or cap payload size.</violation>
</file>
Tip: Get a Slack DM when cubic finishes reviewing your PRs. Connect Slack
View guided diff | Turn on auto-fix | Re-trigger cubic
| Drawable drawable = new BitmapDrawable(bitmap); | ||
| bannerBackground.setBackgroundDrawable(drawable); | ||
| } | ||
| ImageView bannerBackgroundImage = |
There was a problem hiding this comment.
P2: The background image now goes into inboxViewBannerBackgroundImage, which is wrap_content high in the layout. The body-height sizing listener still targets the parent, so the image will not fill the banner body as before. Size the image view to match the body, or keep the image on the sized container.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At cleverpush/src/main/java/com/cleverpush/inbox/InboxDetailActivity.java, line 547:
<comment>The background image now goes into `inboxViewBannerBackgroundImage`, which is `wrap_content` high in the layout. The body-height sizing listener still targets the parent, so the image will not fill the banner body as before. Size the image view to match the body, or keep the image on the sized container.</comment>
<file context>
@@ -546,13 +544,12 @@ public void onGlobalLayout() {
- Drawable drawable = new BitmapDrawable(bitmap);
- bannerBackground.setBackgroundDrawable(drawable);
- }
+ ImageView bannerBackgroundImage =
+ findViewById(R.id.inboxViewBannerBackgroundImage);
+ Glide.with(this)
</file context>
| Bitmap media = getBitmapFromUrl(mediaUrl); | ||
| Bitmap media = getBitmapFromUrl( | ||
| mediaUrl, | ||
| BIG_PICTURE_MAX_WIDTH, |
There was a problem hiding this comment.
P2: The 512px height cap shrinks portrait and square big-picture images to a few hundred pixels on their long edge. The system then upscales them to notification width, which looks soft. Cap only the long edge, or raise the height limit, so non-2:1 artwork keeps usable resolution.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At cleverpush/src/main/java/com/cleverpush/service/NotificationService.java, line 368:
<comment>The 512px height cap shrinks portrait and square big-picture images to a few hundred pixels on their long edge. The system then upscales them to notification width, which looks soft. Cap only the long edge, or raise the height limit, so non-2:1 artwork keeps usable resolution.</comment>
<file context>
@@ -354,7 +363,11 @@ private NotificationCompat.Builder createBasicNotification(Context context, Stri
- Bitmap media = getBitmapFromUrl(mediaUrl);
+ Bitmap media = getBitmapFromUrl(
+ mediaUrl,
+ BIG_PICTURE_MAX_WIDTH,
+ BIG_PICTURE_MAX_HEIGHT
+ );
</file context>
| context.getResources().getDisplayMetrics(); | ||
|
|
||
| int targetWidth = displayMetrics.widthPixels; | ||
| int targetHeight = context.getResources().getDimensionPixelSize( |
There was a problem hiding this comment.
P2: Carousel images are sized to fit inside the 180dp box, but the big_picture view uses centerCrop, which fills the box. Square, portrait, and 4:3 images are therefore shrunk and then upscaled by the view, about 1.5–2x, so they look soft. Decode to cover the box and center-crop before PNG compression instead.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At cleverpush/src/main/java/com/cleverpush/service/NotificationService.java, line 845:
<comment>Carousel images are sized to fit inside the 180dp box, but the `big_picture` view uses `centerCrop`, which fills the box. Square, portrait, and 4:3 images are therefore shrunk and then upscaled by the view, about 1.5–2x, so they look soft. Decode to cover the box and center-crop before PNG compression instead.</comment>
<file context>
@@ -809,44 +828,65 @@ private static Bitmap scaleBitmapAndKeepRation(Bitmap targetBmp, int reqWidthInP
+ context.getResources().getDisplayMetrics();
+
+ int targetWidth = displayMetrics.widthPixels;
+ int targetHeight = context.getResources().getDimensionPixelSize(
+ R.dimen.cp_notification_big_pic_height);
+
</file context>
| return null; | ||
| } | ||
|
|
||
| return decodeByteArray(readBytes(inputStream), reqWidth, reqHeight); |
There was a problem hiding this comment.
P2: decodeStream reads the entire remote payload into heap before decoding, and toByteArray() duplicates it. Large images can still OOM despite the sampled bitmap; spool to a temporary file or cap payload size.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At cleverpush/src/main/java/com/cleverpush/util/BitmapUtils.java, line 111:
<comment>`decodeStream` reads the entire remote payload into heap before decoding, and `toByteArray()` duplicates it. Large images can still OOM despite the sampled bitmap; spool to a temporary file or cap payload size.</comment>
<file context>
@@ -0,0 +1,342 @@
+ return null;
+ }
+
+ return decodeByteArray(readBytes(inputStream), reqWidth, reqHeight);
+ }
+
</file context>
| } | ||
| } | ||
|
|
||
| public static Spanned removeTrailingBlankLines(Spanned spanned) { |
There was a problem hiding this comment.
P3: This removeTrailingBlankLines is an exact copy of AppBannerCarouselAdapter.removeTrailingBlankLines. Call the existing method instead of adding a second public static copy here, or move it to a shared util if both adapters should own it.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At cleverpush/src/main/java/com/cleverpush/inbox/InboxDetailBannerCarouselAdapter.java, line 821:
<comment>This `removeTrailingBlankLines` is an exact copy of `AppBannerCarouselAdapter.removeTrailingBlankLines`. Call the existing method instead of adding a second public static copy here, or move it to a shared util if both adapters should own it.</comment>
<file context>
@@ -823,4 +817,19 @@ private String getSubscriptionContextJson() {
}
}
+
+ public static Spanned removeTrailingBlankLines(Spanned spanned) {
+ SpannableStringBuilder ssb = new SpannableStringBuilder(spanned);
+
</file context>
…mpling PR changes
There was a problem hiding this comment.
Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit
reviewdog
'if' child has incorrect indentation level 12, expected level should be 6.
'if rcurly' has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'if' has incorrect indentation level 8, expected level should be 4.
'if' child has incorrect indentation level 12, expected level should be 6.
'if rcurly' has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def rcurly' has incorrect indentation level 4, expected level should be 2.
'method def modifier' has incorrect indentation level 4, expected level should be 2.
'method def rparen' has incorrect indentation level 4, expected level should be 2.
'if' has incorrect indentation level 8, expected level should be 4.
'if' child has incorrect indentation level 12, expected level should be 6.
'if rcurly' has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'if' has incorrect indentation level 8, expected level should be 4.
'if' child has incorrect indentation level 12, expected level should be 6.
'if rcurly' has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def rcurly' has incorrect indentation level 4, expected level should be 2.
'method def modifier' has incorrect indentation level 4, expected level should be 2.
'method def rparen' has incorrect indentation level 4, expected level should be 2.
'if' has incorrect indentation level 8, expected level should be 4.
'if' child has incorrect indentation level 12, expected level should be 6.
'if rcurly' has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'if' has incorrect indentation level 8, expected level should be 4.
'if' child has incorrect indentation level 12, expected level should be 6.
'if' child has incorrect indentation level 12, expected level should be 6.
'if rcurly' has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def rcurly' has incorrect indentation level 4, expected level should be 2.
'method def modifier' has incorrect indentation level 4, expected level should be 2.
'method def rparen' has incorrect indentation level 4, expected level should be 2.
'if' has incorrect indentation level 8, expected level should be 4.
'if' child has incorrect indentation level 12, expected level should be 6.
'if rcurly' has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'if' has incorrect indentation level 8, expected level should be 4.
'if' child has incorrect indentation level 12, expected level should be 6.
'if' child has incorrect indentation level 12, expected level should be 6.
'if rcurly' has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def rcurly' has incorrect indentation level 4, expected level should be 2.
'method def modifier' has incorrect indentation level 4, expected level should be 2.
'if' has incorrect indentation level 8, expected level should be 4.
'if' child has incorrect indentation level 12, expected level should be 6.
'if rcurly' has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def rcurly' has incorrect indentation level 4, expected level should be 2.
'method def modifier' has incorrect indentation level 4, expected level should be 2.
'method def rparen' has incorrect indentation level 4, expected level should be 2.
'if' has incorrect indentation level 8, expected level should be 4.
'if' child has incorrect indentation level 12, expected level should be 6.
'if rcurly' has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'if' has incorrect indentation level 8, expected level should be 4.
'if' child has incorrect indentation level 12, expected level should be 6.
'if rcurly' has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'if' has incorrect indentation level 8, expected level should be 4.
'if' child has incorrect indentation level 12, expected level should be 6.
'if rcurly' has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def rcurly' has incorrect indentation level 4, expected level should be 2.
Empty line should be followed by
tag on the next line.
'method def modifier' has incorrect indentation level 4, expected level should be 2.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'while' has incorrect indentation level 8, expected level should be 4.
'while' child has incorrect indentation level 12, expected level should be 6.
'while rcurly' has incorrect indentation level 8, expected level should be 4.
'method def' child has incorrect indentation level 8, expected level should be 4.
'method def rcurly' has incorrect indentation level 4, expected level should be 2.


Optimize bitmap decoding to reduce memory usage in NotificationService, InboxView and AppBanner
Note
Medium Risk
Touches notification rendering and several banner/inbox image paths; behavior should be equivalent but Glide and sampled decode can differ on GIFs, errors, and timing versus the old manual loaders.
Overview
Reduces peak memory when loading remote images by decoding at on-screen dimensions instead of full resolution, which previously could trigger OOM on large assets.
Adds
BitmapUtilsfor sampled URL decoding and wiresNotificationServiceto use it for big-picture media, text-with-image layouts, and carousel prefetch, with explicit max sizes and bitmap recycling after carousel saves.App banner and inbox UI drop hand-rolled
HttpURLConnection/BitmapFactorybackground threads in favor of Glide (disk cache, load listeners, main-threadinto()), including banner block images, backgrounds, and inbox list thumbnails at 50dp with ImageView tags so rebound rows don’t show stale channel icons.Smaller inbox fixes: carousel
removeAllViews()on bind, HTML text uses COMPACT mode plus trailing blank-line cleanup, and inbox banner show retries are capped at 50 with a log when the host never becomes ready.Reviewed by Cursor Bugbot for commit f1df7c8. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by cubic
Reduces peak memory usage when loading remote images by decoding them at display size instead of full resolution. Previously, notification media, carousel images, and banner/inbox images were decoded at full size regardless of their on-screen size, which could cause OOM crashes on large images. UI surfaces now use Glide, which handles downsampling and caching, and
NotificationServiceuses the newBitmapUtilsfor sampled decoding.NotificationServicedecodes big-picture, text-with-image, and carousel images to device-specific target dimensions and recycles carousel bitmaps after writing them to disk.BitmapFactorythreads to Glide, dropping the GIF-specific path for plain Glide loading.Written for commit f1df7c8. Summary will update on new commits.