The Watch Face Format is required for watch faces to be installed on devices with Wear OS 5 or later pre-installed and for all new watch faces published on Google Play.
Starting in January 2026, the Watch Face Format will be required for watch faces to be installed on all Wear OS devices.
Learn more about the user-facing changes in this Help Center article.
使用硬體加速功能改善錶面效能
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
使用標準檢視的 Wear OS 應用程式受惠於自動硬體加速圖形算繪的優勢。不過,錶面通常會使用畫布進行實作,因此不會自動執行硬體加速。
為什麼要為錶面使用經硬體加速的畫布?
在大多數情況下,使用經硬體加速的畫布時,錶面會以較高的影格速率算繪。影格速率較高時,肉眼看到的動畫和轉場效果會更順暢,從而提供更優質的使用者體驗。
使用經硬體加速的畫布時,您也可以存取更多錶面相關的 UI 效能資料。例如,只有在使用經硬體加速的畫布時,才能存取評估使用者介面效能中所述的詳細影格資訊。
我的錶面是否使用硬體加速功能?
您可以使用開發人員選項或 adb
,檢查錶面是否使用硬體加速功能。
使用開發人員選項檢查
如要使用開發人員選項檢查錶面是否使用硬體加速功能,請按照下列步驟操作:
- 在 Wear OS 裝置上,依序前往「設定」>「開發人員選項」。
啟用「針對 GPU 剖析進行偵錯」。
這個選項會在可見介面上方繪製疊加 (每個介面上一個疊加),顯示該介面各 GPU 轉譯階段花費的時間。
在裝置上返回錶面。
如果錶面使用經硬體加速的畫布,錶面的每個轉譯影格都會顯示從右到左移動的新長條。
使用 ADB 檢查
如要使用 adb
檢查錶面是否使用硬體加速功能,請按照下列步驟操作:
- 在 Wear OS 裝置上,將錶面變更為要測試的錶面。
- 讓錶面在互動模式下執行幾秒鐘。
執行下列 adb
指令,檢查錶面是否使用硬體加速功能:
adb shell dumpsys gfxinfo [package-name]
執行指令後,會取得類似以下範例的輸出內容:
Applications Graphics Acceleration Info:
Uptime: 2239933 Realtime: 13568751
** Graphics info for pid 1100 [package-name] **
Stats since: 59875589194ns
Total frames rendered: 1213
Janky frames: 0 (0.00%)
50th percentile: 7ms
90th percentile: 18ms
95th percentile: 25ms
99th percentile: 150ms
Number Missed Vsync: 0
Number High input latency: 0
Number Slow UI thread: 0
Number Slow bitmap uploads: 0
Number Slow issue draw commands: 0
Number Frame deadline missed: 0
...
在此輸出內容範例中,請注意顯示 Total frames rendered
這一行。一般而言,如果輸出內容顯示的轉譯影格總數大於 0,就表示錶面使用加速畫布。否則,轉譯影格總數和報表中的其他影格資料通常為 0。
不過,由於 gfxinfo
是應用程式完整套件的輸出內容,除了經硬體加速的畫布外,可能會顯示某些來自其他元素的影格時間資訊,例如應用程式用於設定畫面的 Activity
。為了分辨差異,請確認錶面是唯一可見的介面,然後重新執行 adb shell dumpsys gfxinfo
指令,檢查 Total frames rendered
的值是否增加。
最佳做法
採用下列最佳做法,即可確保使用者能享有最佳體驗。
盡量延長電池續航力
如果錶面含有長時間執行的動畫,使用硬體加速功能可能會大幅降低裝置的電池續航力。如果錶面嘗試在每個影格中繪圖,問題可能會更嚴重。為避免對使用者造成負面影響,請勿在錶面中長時間執行動畫。這項原則並非特別適用於使用硬體加速功能的情況,而是因為使用硬體加速功能會增加能繪製的影格數量,依循這項原則就更為重要。詳情請參閱「動畫最佳做法」。
使用支援的繪圖作業
使用硬體加速功能時,系統不支援某些繪圖作業。如要瞭解哪些是支援的作業,請參閱「硬體加速」。如果您有一小段程式碼路徑使用不支援的作業,可以建立支援點陣圖的畫布,然後使用 canvas.drawBitmap()
將點陣圖繪製到錶面的畫布上。
使用硬體加速功能時維持相容性
硬體加速功能適用於搭載 Android 9 (API 級別 28) 以上版本的 Wear OS 裝置。如要避免在不支援硬體加速的舊裝置上執行特定繪圖作業,或避免在經硬體加速的畫布上執行不支援的繪圖作業,可以檢查 Canvas.isHardwareAccelerated()
,然後提供替代功能。
為您推薦
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2025-07-27 (世界標準時間)。
[null,null,["上次更新時間:2025-07-27 (世界標準時間)。"],[],[],null,["# Improve your watch face performance with hardware acceleration\n\nWear OS apps that use standard views benefit from automatic hardware-accelerated\ngraphics rendering. But watch faces are usually implemented using\ncanvases, so they don't automatically get hardware acceleration.\n\nWhy use a hardware-accelerated canvas for your watch face?\n----------------------------------------------------------\n\nIn most cases, your watch face renders at a higher frame rate when using a\nhardware-accelerated canvas. At higher frame rates, animations and transitions\nappear smoother to the eye, providing a better user experience.\n\nWhen you use a hardware-accelerated canvas, you can also access more UI\nperformance data about your watch face. For example, you can only access the\ndetailed frame information described in [Measure UI\nperformance](/topic/performance/overview)\nwhen you are using a hardware-accelerated canvas.\n\nIs my watch face using hardware acceleration?\n---------------------------------------------\n\nYou can check whether your watch face is using hardware acceleration\nusing either the developer options or `adb`.\n\n### Check using developer options\n\nTo use developer options to check whether your watch face is using hardware acceleration,\nfollow these steps:\n\n1. On a Wear OS device, navigate to **Settings** \\\u003e **Developer options**.\n2. Enable **Debug GPU profiling**.\n\n This option draws an overlay on top of visible surfaces, one on each surface,\n to show the amount of time spent in each stage of GPU rendering for that\n surface.\n3. On the device, navigate back to your watch face.\n\n4. If your watch face uses a hardware-accelerated canvas, you see a new bar\n that moves from right to left for each rendered frame of your watch face.\n\n### Check using adb\n\nTo use `adb` to check whether your watch face is using hardware acceleration,\nfollow these steps:\n\n1. On a Wear OS device, change the watch face to your watch face that you want to test.\n2. Let the watch face run for a few seconds in interactive mode.\n3. Run the following `adb` command to check whether your watch face is using\n hardware acceleration:\n\n `adb shell dumpsys gfxinfo `\u003cvar translate=\"no\"\u003e[package-name]\u003c/var\u003e\n\nAfter running the command, you get output similar to the following\nexample: \n\n```\nApplications Graphics Acceleration Info:\nUptime: 2239933 Realtime: 13568751\n\n** Graphics info for pid 1100 [package-name] **\n\nStats since: 59875589194ns\nTotal frames rendered: 1213\nJanky frames: 0 (0.00%)\n50th percentile: 7ms\n90th percentile: 18ms\n95th percentile: 25ms\n99th percentile: 150ms\nNumber Missed Vsync: 0\nNumber High input latency: 0\nNumber Slow UI thread: 0\nNumber Slow bitmap uploads: 0\nNumber Slow issue draw commands: 0\nNumber Frame deadline missed: 0\n\n...\n```\n\nIn this sample output, notice the line reading `Total frames rendered`.\nGenerally, if your output shows total frames rendered greater than 0, then your\nwatch face uses an accelerated canvas. Otherwise the total frames rendered\nand other frame data in the report is normally 0.\n\nHowever, because the `gfxinfo` is output for your app's full package, you might\nsee some frame time information from something other than a hardware-accelerated\ncanvas, such as an `Activity` that your app uses for a configuration screen. To\ntell the difference, make sure that your watch face is the only surface that is\nvisible and then rerun the `adb shell dumpsys gfxinfo` command to check whether\nthe value for `Total frames rendered` increases.\n\nBest practices\n--------------\n\nFollow these best practices to ensure the best possible experience for your\nusers.\n\n### Maximize battery life\n\nIf your watch face has long-running animations, using hardware acceleration can\ngreatly lower the battery life of a device. This problem can get worse if\nyour watch face tries to draw in every frame. To avoid negatively impacting your\nusers, don't use long-running animations in your watch face. This\nguideline is not specific to using hardware acceleration, but because using\nhardware acceleration increases the number of frames you're able to draw, it is\neven more important to follow. For more information, see [Best practices for\nanimations](/training/wearables/watch-faces/performance#Animations).\n\n### Use supported drawing operations\n\nSome drawing operations are are not supported when using hardware acceleration.\nFor information on what is supported, see [Hardware\nacceleration](/topic/performance/hardware-accel#drawing-support).\nIf you have a small code path that uses an unsupported operation, you can create\na bitmap-backed canvas and then draw that bitmap into the watch face's canvas\nusing\n[`canvas.drawBitmap()`](/reference/android/graphics/Canvas#drawBitmap(android.graphics.Bitmap,%20android.graphics.Rect,%20android.graphics.RectF,%20android.graphics.Paint)).\n\n### Maintain compatibility when using hardware acceleration\n\nHardware acceleration is available on Wear OS devices that run Android 9 (API\nlevel 28) or higher. If you want to avoid a specific draw operation on older\ndevices, where hardware acceleration is not available, or an unsupported draw\noperation on a hardware accelerated canvas, you can check [`Canvas.isHardwareAccelerated()`](/reference/android/graphics/Canvas#isHardwareAccelerated()),\nthen provide the alternative functionality.\n\nRecommended for you\n-------------------\n\n- Note: link text is displayed when JavaScript is off\n- [dumpsys](/tools/dumpsys)\n- [Slow rendering](/topic/performance/vitals/render)\n- [Device compatibility mode](/guide/practices/device-compatibility-mode)"]]