自 2025 年 3 月 27 日起,我们建议您使用 android-latest-release
而非 aosp-main
构建 AOSP 并为其做出贡献。如需了解详情,请参阅 AOSP 的变更。
评估硬件
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
进行硬件评估时,需要针对具体评估定义三种触感反馈效果,分别标为效果 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 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-03-11。
[[["易于理解","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"]],["最后更新时间 (UTC):2025-03-11。"],[],[],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)."]]