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 ที่ใช้มุมมองมาตรฐานจะได้รับประโยชน์จากระบบเร่งฮาร์ดแวร์โดยอัตโนมัติ
การแสดงภาพกราฟิก แต่หน้าปัดมักมีการใช้งานโดยใช้
ทำให้ไม่มีการเร่งฮาร์ดแวร์โดยอัตโนมัติ
เหตุใดจึงควรใช้แคนวาสที่มีการเร่งฮาร์ดแวร์สำหรับหน้าปัดของคุณ
ในกรณีส่วนใหญ่ หน้าปัดของคุณจะแสดงผลที่อัตราเฟรมสูงขึ้นเมื่อใช้
แคนวาสที่มีการเร่งฮาร์ดแวร์ ภาพเคลื่อนไหวและการเปลี่ยนภาพในอัตราเฟรมที่สูงขึ้น
มีลักษณะเรียบเนียนขึ้น เพื่อให้ประสบการณ์ของผู้ใช้ดีขึ้น
เมื่อใช้ Canvas ที่มีการเร่งฮาร์ดแวร์ คุณจะเข้าถึง UI เพิ่มเติมได้ด้วย
ข้อมูลประสิทธิภาพของหน้าปัด ตัวอย่างเช่น คุณสามารถเข้าถึง
ข้อมูลเฟรมโดยละเอียดที่อธิบายไว้ใน Measure UI
ประสิทธิภาพ
เมื่อคุณใช้ Canvas ที่เร่งการแสดงผลด้วยฮาร์ดแวร์
หน้าปัดของฉันใช้การเร่งฮาร์ดแวร์หรือไม่
คุณสามารถตรวจสอบว่าหน้าปัดของคุณใช้การเร่งฮาร์ดแวร์หรือไม่
โดยใช้ตัวเลือกสำหรับนักพัฒนาซอฟต์แวร์หรือ adb
ตรวจสอบโดยใช้ตัวเลือกสำหรับนักพัฒนาแอป
หากต้องการใช้ตัวเลือกสำหรับนักพัฒนาแอปเพื่อตรวจสอบว่าหน้าปัดของคุณใช้การเร่งฮาร์ดแวร์หรือไม่
ให้ทำตามขั้นตอนต่อไปนี้
- ในอุปกรณ์ Wear OS ให้ไปที่การตั้งค่า > ตัวเลือกสำหรับนักพัฒนาซอฟต์แวร์
เปิดใช้แก้ไขข้อบกพร่องในการทำโปรไฟล์ GPU
ตัวเลือกนี้จะวาดซ้อนทับบนพื้นผิวที่มองเห็นได้ โดยแสดง 1 ตำแหน่งต่อ 1 พื้นผิว
เพื่อแสดงระยะเวลาที่ใช้ในการแสดงผล GPU แต่ละขั้น
แพลตฟอร์ม
กลับไปที่หน้าปัดในอุปกรณ์
หากหน้าปัดใช้แคนวาสที่มีการเร่งฮาร์ดแวร์ คุณจะเห็นแถบใหม่
ซึ่งจะย้ายจากขวาไปซ้ายสำหรับเฟรมที่แสดงผลแต่ละเฟรมของหน้าปัด
ตรวจสอบโดยใช้ adb
หากต้องการใช้ adb
เพื่อตรวจสอบว่าหน้าปัดของคุณใช้การเร่งฮาร์ดแวร์หรือไม่
ให้ทำตามขั้นตอนต่อไปนี้
- ในอุปกรณ์ Wear OS ให้เปลี่ยนหน้าปัดเป็นหน้าปัดที่ต้องการ
เพื่อทดสอบ
- ให้หน้าปัดทำงานเป็นเวลา 2-3 วินาทีในโหมดอินเทอร์แอกทีฟ
เรียกใช้คำสั่ง 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()
รักษาความเข้ากันได้เมื่อใช้การเร่งฮาร์ดแวร์
การเร่งฮาร์ดแวร์พร้อมใช้งานในอุปกรณ์ Wear OS ที่ใช้ Android 9 (API
ระดับ 28) ขึ้นไป หากต้องการเลี่ยงการดำเนินการวาดที่เจาะจงในเวอร์ชันที่เก่ากว่า
อุปกรณ์ที่ไม่สามารถใช้งานการเร่งฮาร์ดแวร์ หรือการวาดที่ไม่มีการสนับสนุน
การดำเนินการใน Canvas ที่เร่งการแสดงผลด้วยฮาร์ดแวร์ คุณสามารถตรวจสอบ Canvas.isHardwareAccelerated()
เพื่อให้มีฟังก์ชันการทำงานอื่น
แนะนำสำหรับคุณ
ตัวอย่างเนื้อหาและโค้ดในหน้าเว็บนี้ขึ้นอยู่กับใบอนุญาตที่อธิบายไว้ในใบอนุญาตการใช้เนื้อหา Java และ OpenJDK เป็นเครื่องหมายการค้าหรือเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-27 UTC
[[["เข้าใจง่าย","easyToUnderstand","thumb-up"],["แก้ปัญหาของฉันได้","solvedMyProblem","thumb-up"],["อื่นๆ","otherUp","thumb-up"]],[["ไม่มีข้อมูลที่ฉันต้องการ","missingTheInformationINeed","thumb-down"],["ซับซ้อนเกินไป/มีหลายขั้นตอนมากเกินไป","tooComplicatedTooManySteps","thumb-down"],["ล้าสมัย","outOfDate","thumb-down"],["ปัญหาเกี่ยวกับการแปล","translationIssue","thumb-down"],["ตัวอย่าง/ปัญหาเกี่ยวกับโค้ด","samplesCodeIssue","thumb-down"],["อื่นๆ","otherDown","thumb-down"]],["อัปเดตล่าสุด 2025-07-27 UTC"],[],[],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)"]]