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، به تنظیمات > گزینههای برنامهنویس بروید.
پروفایل Debug 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()
آن بیت مپ را در بوم صفحه ساعت بکشید.
هنگام استفاده از شتاب سخت افزاری، سازگاری را حفظ کنید
شتاب سختافزاری در دستگاههای Wear OS که دارای Android 9 (سطح API 28) یا بالاتر هستند، در دسترس است. اگر میخواهید از یک عملیات ترسیم خاص در دستگاههای قدیمیتر، که در آن شتاب سختافزاری در دسترس نیست، یا یک عملیات ترسیم پشتیبانینشده روی بوم تسریعشده سختافزاری اجتناب کنید، میتوانید Canvas.isHardwareAccelerated()
بررسی کنید، سپس عملکرد جایگزین را ارائه کنید.
{% کلمه به کلمه %}
{% آخر کلمه %} برای شما توصیه می شود
{% کلمه به کلمه %} {% آخر کلمه %}
محتوا و نمونه کدها در این صفحه مشمول پروانههای توصیفشده در پروانه محتوا هستند. جاوا و OpenJDK علامتهای تجاری یا علامتهای تجاری ثبتشده Oracle و/یا وابستههای آن هستند.
تاریخ آخرین بهروزرسانی 2025-07-29 بهوقت ساعت هماهنگ جهانی.
[[["درک آسان","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-29 بهوقت ساعت هماهنگ جهانی."],[],[],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)"]]