Skip to content

Stop Glide from upscaling favicons during decode#8712

Open
LukasPaczos wants to merge 1 commit into
developfrom
fix/lpaczos/favicon-upscaling
Open

Stop Glide from upscaling favicons during decode#8712
LukasPaczos wants to merge 1 commit into
developfrom
fix/lpaczos/favicon-upscaling

Conversation

@LukasPaczos
Copy link
Copy Markdown
Contributor

@LukasPaczos LukasPaczos commented May 28, 2026

Task/Issue URL: https://app.asana.com/1/137249556945/project/1208671518894266/task/1214789916598888?focus=true

Description

Glide's default CENTER_OUTSIDE downsample strategy was inflating small favicons (e.g. 32x32) up to MAX_FAVICON_SIZE_PX (512x512) before they got encoded to disk, breaking FaviconPersister's size-based dedup (width > existing skips, but every URL-fetched favicon now had width=512 regardless of source) and the iconReceived pre-check added in #8156 (which rejected real higher-res bitmaps because the on-disk file was reported as 512). Regression from #7710, which added the 512 target without specifying a downsample strategy.

Switch to CENTER_INSIDE on the Glide loads in GlideFaviconDownloader: keeps the 512 px memory ceiling that #7710 wanted (large OOM-class favicons still get downsampled), but never scales smaller sources up.

Steps to test this PR

python3 blurry-favicons-repro-server.py
  • Checkout a commit before the fix.
  • Install the app on an emulator and point a tab to http://10.0.2.2:8088/.
  • Wait a couple of seconds (until the blue icon loads on the page).
  • Open the tab switcher.
  • Verify that the tab used the 32x32 icon (red) and its text is blurry.
  • (optional) Use fire button.
  • Checkout the fix branch.
  • Install the app on an emulator and point a tab to http://10.0.2.2:8088/.
  • Wait a couple of seconds (until the blue icon loads on the page).
  • Open the tab switcher.
  • Verify that the tab used the 192x192 icon (blue) and its text is sharp.

Note

Low Risk
Scoped favicon decode/persist behavior with a remote kill switch; no auth or sensitive data paths.

Overview
Fixes favicons being decoded at a fake 512×512 size by routing all GlideFaviconDownloader loads through a shared faviconRequest() that applies DownsampleStrategy.CENTER_INSIDE when the new remote flag is on (default). That keeps the existing 512px cap for large icons but stops Glide from upscaling small sources before they are written to disk, so FaviconPersister can again compare real dimensions and higher-res icons can win in the tab switcher.

Adds FaviconDownloaderGlideDownsamplingStrategyFixFeature as a kill switch (toggle off restores Glide’s prior downsampling) and wires it through FaviconModule into GlideFaviconDownloader.

Reviewed by Cursor Bugbot for commit 220bdd3. Bugbot is set up for automated code reviews on this repo. Configure here.

Glide's default CENTER_OUTSIDE downsample strategy was inflating small
favicons (e.g. 32x32) up to MAX_FAVICON_SIZE_PX (512x512) before they
got encoded to disk, breaking FaviconPersister's size-based dedup
(width > existing skips, but every URL-fetched favicon now had
width=512 regardless of source) and the iconReceived pre-check added
in #8156 (which rejected real higher-res bitmaps because the on-disk
file was reported as 512). Regression from #7710, which added the 512
target without specifying a downsample strategy.

Switch to CENTER_INSIDE on the Glide loads in GlideFaviconDownloader:
keeps the 512 px memory ceiling that #7710 wanted (large OOM-class
favicons still get downsampled), but never scales smaller sources up.

Centralise the shared Glide config (downsample, diskCacheStrategy,
skipMemoryCache) behind a faviconRequest() helper so the policy lives
in one place.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants