How DeWu Eliminated Image White‑Screen Issues with Deep Monitoring and Optimizations
This article details how DeWu built a comprehensive white‑screen monitoring system for image loading, analyzed multi‑image, single‑image, and sampling metrics, and applied a series of decoding, priority, disk‑lock, and memory optimizations to reduce white‑screen incidents to near zero.
Background
Image loading is a critical user‑experience metric for mobile apps, and white‑screen problems caused by failed image loads severely degrade the experience. DeWu collected user feedback on white screens and built a monitoring system from zero to identify and resolve these issues.
White‑Screen Monitoring System
The system monitors three dimensions—image library, network library, and CDN quality—by integrating a dedicated white‑screen analysis platform. It aggregates structured logs from Fresco’s producer , request , and submit callbacks, filters irrelevant events via a handler loop, and reports when more than seven images fail to complete within ten seconds.
Image Library Monitoring Capability
DeWu implemented three monitoring capabilities:
Multi‑image monitoring : triggers when ten seconds pass with at least seven images still in the Fresco pipeline. It records stage start/end, failures, cancellations, and extra parameters in an in‑memory map, then aggregates and uploads the data.
Single‑image slow‑load monitoring : defines a slow load as a single image not completing core stages within three seconds (or ten seconds overall). It uses the same handler loop to detect and report such cases.
Global sampling monitoring : after an image finishes (success or failure), a random sample is logged to evaluate overall loading quality.
Image Library Optimization Governance
Based on monitoring data, DeWu identified several "bad cases" and applied targeted optimizations:
System decoding optimization : Fixed a case where decode‑producer tasks were blocked by Heif images containing ICC data on Android 8.1, causing long decode times and white screens. The solution ignored ICC data and forced all decode tasks to the decoding library.
Image request priority redesign : Replaced the shared Fresco PriorityNetworkFetcher queue with domain‑based routing in the network layer, eliminating cross‑domain contention and reducing average queue time by 88% and full‑chain latency by 50%.
Animated‑image frame rendering refactor : Replaced a custom Handler‑based frame scheduler with a callback‑driven approach and isolated the decoding thread pool, clearing over 1,000 pending tasks and eliminating white‑screen spikes caused by latch deadlocks.
Disk global‑lock optimization : Analyzed Fresco’s disk cache traversal (every 30 minutes) that held a single object lock, causing long waits when many files existed. Added a low‑frequency lock marker and ignored cache reads during heavy traversal, cutting disk‑related white‑screen time by about 50%.
Metadata read adaptation : Added explicit handling for Heif image dimensions, rotation, and animation flags using third‑party libHeif, falling back to the system decoder only on failure.
Memory pressure handling : Implemented onLowMemory and onTrimMemory callbacks to clear disk and memory caches, and introduced a hard‑cap callback that triggers a forced GC and degrades large animated images to static ones.
Main‑thread slow‑message governance : Collected flame‑graph data for cases where onFinalImageSet completed but the view remained white, then optimized inflate, cache file access, and native video cache queries, reducing main‑thread‑induced white screens by 80%.
Key Code Snippets
final Pair<Integer, Integer> dimensions;
if (DefaultImageFormats.isWebpFormat(imageFormat)) {
// WebP specific handling
dimensions = readWebPImageSize();
} else {
// System fallback implementation
dimensions = readImageMetaData().getDimensions();
} if (imageFormat.getName().equals(DefaultImageFormats.HEIFC.getName())) {
// Heif specific handling using libHeif
dimensions = readHeifFormatImageSizeForSimple(imageFormat);
} else if (DefaultImageFormats.isWebpFormat(imageFormat)) {
dimensions = readWebPImageSize();
} else {
dimensions = readImageMetaData().getDimensions();
}Summary
White‑screen problems are low‑probability but high‑impact issues that require end‑to‑end visibility. By constructing a full‑stack monitoring platform covering image, network, and CDN layers, DeWu achieved 100% attribution of white‑screen incidents, reduced analysis latency from hours to minutes, and brought monthly user‑reported white‑screen cases from 7‑10 down to zero over two months.
Future work will extend similar monitoring and optimization practices to network stack, CDN quality, and overall white‑screen platform refinement.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
DeWu Technology
A platform for sharing and discussing tech knowledge, guiding you toward the cloud of technology.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
