How Android Measures UI Smoothness: Introducing the SM (Smoothness) Metric
This article explains Android's UI rendering pipeline, the role of VSync and Triple Buffer, why FPS alone cannot reflect perceived smoothness, and introduces the SM (Smoothness) metric that quantifies UI fluidity by counting VSync loops and skipped frames per second.
Background
In today's competitive mobile app market, Android app performance metrics such as CPU and memory consumption are measurable, but there has been no reliable metric that directly links user‑perceived smoothness with data. FPS works for games or video apps, yet it is unsuitable for apps with infrequent UI updates.
Principle Analysis
1. How Android Draws UI
Android’s UI update process is controlled by SurfaceFlinger, as illustrated in the diagram below.
Since Jelly Bean, Google introduced Project Butter to improve UI smoothness, adding three core components: VSYNC, Triple Buffer, and Choreographer.
2. From VSYNC
VSync (Vertical Synchronization) is a timing interrupt that synchronizes drawing to the display’s refresh rate. Android 4.1 adopted VSync, allowing the CPU and GPU to complete work within a 16.6 ms interval (the theoretical 60 fps).
If processing exceeds the 16.6 ms window, frames are skipped, leading to lower perceived smoothness.
When double‑buffering is insufficient, Android 4.1’s Triple Buffer further reduces frame loss, as shown in the next diagram.
3. From FPS & Skipped Frame to Smoothness (SM)
Many Android apps do not constantly redraw; static screens can yield low FPS while still feeling smooth. Therefore, the number of VSync loops executed per second better reflects UI fluidity than raw FPS.
Skipped Frame (SF) : When work cannot finish within a 16.6 ms interval, the frame is skipped, effectively losing one or more frames.
Smoothness (SM) : The count of VSync loops completed in one second. Fewer loops indicate more stutter; the maximum theoretical value is 60 on a 60 Hz display.
4. Counting SM
The Choreographer object, introduced in newer Android versions, provides a callback (FrameCallback) that runs once per VSync loop. By incrementing a counter each callback, developers can obtain the SM value directly.
Conclusion
After analyzing the rendering pipeline:
Android 4.1’s VSync loop runs every 16.6 ms, providing a baseline for measuring the maximum drawing capability of an app.
The number of loops executed in one second indicates the app’s smoothness (SM) and its degree of stutter.
If a loop exceeds 16.6 ms, the excess divided by 16.6 ms yields the number of skipped frames (SF).
By using Choreographer’s FrameCallback to count loops per second, developers can monitor SM internally and obtain a quantitative measure of UI smoothness.
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.
Tencent TDS Service
TDS Service offers client and web front‑end developers and operators an intelligent low‑code platform, cross‑platform development framework, universal release platform, runtime container engine, monitoring and analysis platform, and a security‑privacy compliance suite.
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.
