自 2025 年 3 月 27 日起,我們建議您使用 android-latest-release
而非 aosp-main
建構及貢獻 AOSP。詳情請參閱「Android 開放原始碼計畫變更」。
評估硬體
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
硬體評估涉及定義三種觸覺效果,並在本評估中將其標示為「效果 1」、「效果 2」和「效果 3」。
效果 1:預先定義的短觸覺常數
VibrationEffect.EFFECT_CLICK
常數是 HAL-API 對應中的基本效果或共同分母,如「在 HAL 和 API 之間對應常數」一文所述。並與最常用的效果 HapticFeedbackConstants.KEYBOARD_PRESS
對應。評估這項效果有助於判斷目標裝置是否可支援清晰觸覺回饋。
效果 2:短暫自訂觸覺技術效果
VibrationEffect.createOneShot(20,255)
常數用於自訂觸覺技術效果。針對短暫的單一自訂衝動,建議的時間長度上限為 20 毫秒。不建議使用長度超過 20 毫秒的單一脈衝,因為系統會將其視為嗡嗡作響的震動。
圖 19. 短暫自訂觸覺技術效果
效果 3:長時間自訂觸覺技術效果,並變更振幅
VibrationEffect.createWaveform(timings[], amplitudes[], int
repeat)
常數適用於長型自訂效果,且振幅會有所變化。能否產生不同振幅的自訂觸覺效果,是評估裝置豐富觸覺效果能力的指標之一。建議的 timings []
和 amplitudes []
分別為 {500, 500}
和 {128, 255}
,分別呈現從 50% 到 100% 的振幅上升趨勢,取樣率為 500 毫秒。
圖 20. 長時間自訂觸覺技術效果 (振幅變化)
如要檢查效果 3 的振幅控制功能硬體功能,請使用 Vibrator.hasAmplitudeControl()
方法。結果必須是 true
,才能依預期執行 VibrationEffect.createWaveform
,並以不同的振幅變化。
圖 21. 對觸覺效果 1、2 和 3 的受試者評估
進行主觀評估
如要快速檢查一致性,請先進行主觀評估。主觀評估的目標是觀察觸覺效果的振幅,以判斷裝置是否能產生人類可感知的振幅觸覺效果。
以此概念為架構的具體問題如下:裝置是否能如預期為使用者產生可感知的觸覺效果?回答這個問題有助於避免觸覺回饋失敗,包括使用者無法感覺到的微弱觸覺回饋,或是波形未按照預期產生模式的非預期觸覺回饋。
強烈建議您進行進階品質評估。進階品質評估可描述觸覺效果的可量化屬性,以實現高品質觸覺回饋。完成後,裝置製造商應可診斷目前的觸覺回饋狀態,也就是說,他們可以設定目標來改善整體品質。請參閱「硬體評估」一節。
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2025-07-27 (世界標準時間)。
[[["容易理解","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 (世界標準時間)。"],[],[],null,["# Assess the hardware\n\nHardware assessment involves defining three haptic effects, labeled Effects 1,\n2, and 3 for this specific assessment.\n\nEffect 1: Predefined short haptic constants\n-------------------------------------------\n\nThe\n[`VibrationEffect.EFFECT_CLICK`](https://developer.android.com/reference/android/os/VibrationEffect.html#EFFECT_CLICK)\nconstant is the baseline effect or common denominator in the HAL-API mapping\nprovided in [Map constants between HAL and API](/docs/core/interaction/haptics/haptics-map-constants)\n. It's mapped with the most used effect, [`HapticFeedbackConstants.KEYBOARD_PRESS`](https://developer.android.com/reference/android/view/HapticFeedbackConstants#KEYBOARD_PRESS)\n. Assessing this effect helps determine the readiness of your target device for\n[*clear haptics*](/docs/core/interaction/haptics/haptics-ux-foundation#clear-haptics).\n\nEffect 2: Short custom haptic effect\n------------------------------------\n\nThe\n[`VibrationEffect.createOneShot(20,255)`](https://developer.android.com/reference/android/os/VibrationEffect#createOneShot(long,%20int))\nconstant is for custom haptic effects. For short, single custom impulses,\n20 ms is the recommended maximum threshold to define duration. A single\nimpulse longer than 20 ms isn't recommended because it's perceived as a\n[*buzzy\nvibration*](/docs/core/interaction/haptics/haptics-ux-foundation#buzzy-vibration).\n\n**Figure 19.** Short custom haptic effect\n\nEffect 3: Long custom haptic effect with amplitude variation\n------------------------------------------------------------\n\nThe [`VibrationEffect.createWaveform(timings[], amplitudes[], int\nrepeat)`](https://developer.android.com/reference/android/os/VibrationEffect#createWaveform(long%5B%5D,%20int%5B%5D,%20int))\nconstant is for long custom effects with amplitude variation. The ability to\nproduce varying amplitudes for custom haptic effects is one of the indicators to\nevaluate the device's capabilities for [*rich\nhaptics*](/docs/core/interaction/haptics/haptics-ux-foundation#ease-in). The\nrecommended `timings []` and `amplitudes []` are `{500, 500}` and `{128, 255}`,\nrespectively, which presents an increasing trend of amplitude from 50% to 100%,\nwith a 500 ms sampling rate.\n\n**Figure 20.** Long custom haptic effect with amplitude variation\n\nTo check the hardware capabilities of amplitude control for Effect 3, use the\n[`Vibrator.hasAmplitudeControl()`](https://developer.android.com/reference/android/os/Vibrator#hasAmplitudeControl())\nmethod. The result has to be `true` to execute\n[`VibrationEffect.createWaveform`](https://developer.android.com/reference/android/os/VibrationEffect#createWaveform(long%5B%5D,%20int%5B%5D,%20int))\nwith varying amplitude as intended.\n\n**Figure 21.** Subject assessment of haptic effect 1, 2, and 3\n\n### Perform a subjective assessment\n\nFor a quick coherence check, perform a subjective assessment first. The goal of\nthe subjective assessment is to observe the amplitude of the haptic effects to\ndetermine whether the device can generate haptics with human-perceptible\namplitudes.\n\nA specific question structured around this notion looks like this: *Can the\ndevice produce perceptible haptic effects to the users as expected?* Answering\nthis question helps you avoid *failed haptics*, including imperceptible haptics\nthat users can't feel, or unintended haptics where waveforms don't produce\npatterns as intended.\n\n### Perform an advanced assessment\n\nPerforming advanced quality assessments is highly recommended. Advanced quality\nassessments characterize quantifiable attributes of haptic effects to implement\n*quality haptics* . When finished, device manufacturers should be able to\ndiagnose the current haptic status, which means they can set goals to improve\nthe overall quality. See [Hardware\nassessment](/docs/core/interaction/haptics/hardware)."]]