自 2025 年 3 月 27 日起,我们建议您使用 android-latest-release
而非 aosp-main
构建 AOSP 并为其做出贡献。如需了解详情,请参阅 AOSP 的变更。
分析波形
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
下载并运行 MATLAB 文件后,请使用以下流程图分析在上一步中记录的波形文件。
图 1. 效果 1 和效果 2 的波形分析流程图
图 2. 效果 3 的波形分析流程图
失败案例
在分析之前和分析期间,请检查失败情况 (F01–F05)。
- MATLAB 代码无法处理 F01 和 F02 指定的效果。
- 使用 F03-1 指定的效果不符合添加到性能图的条件,即使 MATLAB 代码处理这些效果时没有出错也是如此。
- 使用 F03-2、F04 和 F05 指定的效果仍可添加到性能图中,即使处理失败也是如此。
- 如果
Vibrator.hasAmplitudeControl()
返回 false
,则 DUT 被指定为 F04 或 F05。
- 如果在测量期间点击“效果 3”按钮后出现明显延迟(超过 500 毫秒),则 DUT 会被指定为 F04。
失败代码 |
失败说明 |
适用的效果 |
失败原因 |
修复失败问题 |
F01 |
未记录任何输出信号。 |
效果 1 |
未实现触感反馈常量。 |
按照实现常量中的说明实现空常量。 |
F02 |
MATLAB 代码错误。MATLAB 错误的示例:
索引超出矩阵维度。 |
效果 1、效果 2 |
触感反馈效果的振幅太弱。 |
提高触感反馈效果的振幅。 |
F03-1、F03-2 |
[F03-1] 没有 MATLAB 错误,但通过 MATLAB 代码填充的 PRR 小于 0。
[F03-2] 没有 MATLAB 错误,但通过 MATLAB 代码填充的振幅小于 0.1 g。 |
效果 1、效果 2 |
触感反馈效果的振幅太弱。 |
提高触感反馈效果的振幅。 |
F04 |
信号过短(大约 500 毫秒,而不是 1000 毫秒)。 |
效果 3 |
设备未能正确生成缩放后的振幅。即使调用了 50% 的振幅,系统也会以 0% 的振幅生成前 500 毫秒阶段的振幅。 |
启用振幅缩放功能。 |
F05 |
这两个最大振幅几乎没有差异。 |
效果 3 |
设备未能正确生成缩放后的振幅。 |
启用振幅缩放功能。 |
图 3. F03-1(左侧)和 F03-2(右侧)的 MATLAB 信号图示例
图 4. F04(左侧)和 F05(右侧)的 MATLAB 信号图示例
从分析中获取数据
针对每种效果运行 MATLAB 代码时,您可以读取 MATLAB 软件的命令窗口中显示的结果。
图 5. 命令窗口中的 MATLAB 结果示例:效果 1(第一个)和效果 3(第二个)
效果 1 和效果 2(短脉冲)
- 峰值时长(毫秒)
- 峰值振幅 (G)
- 使用 PRR 计算清晰度指标 (FOMS = PRR/峰值时长)
效果 3(长时间振动)
使用性能图比较结果包含从 Android 生态中的代表性设备获取的同一组数据,以便您可以相应地填充性能图。这有助于您了解整个生态系统,并将您的数据与性能图数据进行比较。
请参阅下表,了解您的 DUT 与 Android 生态系统中的其他手机或平板电脑的比较结果。围绕该概念产生的具体问题类似于:与具有类似特性(例如价格层级)的其他 Android 手机相比,我的手机性能是优是劣?
[输入]
要分析的效果 |
[输出]
峰值/最大振幅 (G) |
[输出] 峰值时长(毫秒) |
[输出]
脉冲到响铃比率 (PRR) |
效果 1:预定义的触感反馈常量 (VibrationEffect.EFFECT_CLICK ) |
[1] 数据 1-1 |
[2] 数据 1-2 |
[3] 数据 1-3 |
效果 2:短时自定义触感反馈效果(时长 = 20 毫秒,振幅 = 100%) |
[4] 数据 2-1 |
[5] 数据 2-2 |
[6] 数据 2-3 |
效果 3-1:长时自定义触感反馈效果加速第 1 阶段,第 1 个 500 毫秒的振幅为 50% |
[7] 数据 3-1 |
不适用 |
不适用 |
效果 3-2:长时自定义触感反馈效果加速第 2 阶段,第 2 个 500 毫秒的振幅为 100% |
[8] 数据 3-2 |
不适用 |
不适用 |
效果 1 和效果 2 的脉冲与振铃比率及峰值幅度
效果 1 和效果 2 中测量的两个关键参数是脉冲到响铃比率 (PRR) 和峰值振幅。这些参数基于加速度计设置进行的加速度测量。
PRR 是通过主脉冲与响铃振幅的比率计算得出的。
时长是主脉冲的经过时间。PRR 的计算公式如下:
$$
\text{Pulse to ring ratio (PRR)} = 20log_{10}\frac{\text{RMS (main pulse)}}{\text{RMS (ring)}}
$$
图 6. 模拟加速信号
这些元素如图 6 所示:
效果 3 的最大振幅
图 7. 致动器过冲
这些元素如图 7 所示:
- 长时间振动
- 最大振幅
- 过冲
- 当致动器偏离共振时,会发生过冲。此图显示了当正弦输入促使振动器偏离共振状态时发生的行为类型。这是极端超调的示例。
- 当 LRA 以其共振频率驱动时,极少会出现或完全不会出现过冲现象。LRA 的典型共振频率介于 50 Hz 到 250 Hz 之间。
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-03-10。
[[["易于理解","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-10。"],[],[],null,["# Analyze the waveform\n\nAfter downloading and running the MATLAB files, use the following flowcharts\nto analyze the waveform files recorded in the previous step.\n\n**Figure 1.** Waveform analysis flowchart for Effect 1 and Effect 2\n\n**Figure 2.** Waveform analysis flowchart for Effect 3\n\n### Failure cases\n\nBefore and during the analysis, check for failure cases (F01--F05).\n\n- Effects designated with **F01** and **F02** can't be processed by MATLAB code.\n- Effects designated with **F03-1** aren't eligible to be added to the performance map, even if they're processed by MATLAB code with no errors.\n- Effects designated with **F03-2** , **F04** , and **F05** can still be added to the performance map, despite failing processing.\n- If [`Vibrator.hasAmplitudeControl()`](https://developer.android.com/reference/android/os/Vibrator#hasAmplitudeControl()) returns `false`, the DUT is designated as either **F04** or **F05**.\n- If there's a noticeable delay (more than 500 ms) after clicking the Effect 3 button during the measurement, the DUT earns an **F04** designation.\n\n| **Failure code** | **Description of failure** | **Applicable effects** | **Reason for failure** | **Fix for failure** |\n|------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------|\n| F01 | No output signal is recorded. | Effect 1 | Haptic feedback constant isn't implemented. | Implement the empty constant as described in [Implement constants](/docs/core/interaction/haptics/haptics-constants-primitives#implement-constants). |\n| F02 | MATLAB code error. The example for the MATLAB error is: \u003cbr /\u003e *Index exceeds matrix dimensions.* | Effect 1, Effect 2 | The amplitude of the haptic effect is too weak. | Increase the amplitude of the haptic effect. |\n| F03-1, F03-2 | \\[F03-1\\] No MATLAB error, but PRR populated from the MATLAB code is smaller than 0. \u003cbr /\u003e \\[F03-2\\] No MATLAB error, but amplitude populated from the MATLAB code is smaller than 0.1 g. | Effect 1, Effect 2 | The amplitude of the haptic effect is too weak. | Increase the amplitude of the haptic effect. |\n| F04 | Signal is is too short (around 500 ms rather than 1000 ms). | Effect 3 | The device fails to generate scaled amplitude properly. The first 500 ms phase amplitude is generated with 0% amplitude even though 50% amplitude was called for. | Enable amplitude scale capabilities. |\n| F05 | The two max amplitude values have little or no difference. | Effect 3 | The device fails to generate scaled amplitude properly. | Enable amplitude scale capabilities. |\n\n**Figure 3.** MATLAB signal plot examples for F03-1 (left) and F03-2 (right)\n\n**Figure 4.** MATLAB signal plot examples for F04 (left) and F05 (right)\n\n### Acquire data from the analysis\n\nWhen running MATLAB code for each effect, you can read the results displayed in\nthe Command Window of the MATLAB software.\n\n**Figure 5.** MATLAB results example in Command Window, Effect 1 (first) and\nEffect 3 (second)\n\n- Effect 1 and Effect 2 (short impulse)\n\n - Peak duration (ms)\n - Peak amplitude (g)\n - PRR to calculate figure of metrics for sharpness (FOMS = PRR/peak duration)\n- Effect 3 (long vibration)\n\n - Maximum amplitude (g) for two phases\n\n[Comparing results using the performance map](/docs/core/interaction/haptics/compare)\nincludes the same set of data acquired from the representative devices in\nthe Android ecosystem, so that you can populate the performance map accordingly.\nThis helps you understand the whole ecosystem and align your data with the\nperformance map data for comparison.\n\nUse the following table to get an idea of how your DUT compares to other phones\nor tablets in the Android ecosystem. A specific question structured around that\nnotion looks like this: *Compared to other Android phones with similar\ncharacteristics (like price tier), is my phone performing better or worse than\nother phones?*\n\n| \\[Input\\] Effects to analyze | \\[Output\\] Peak/maximum amplitude (G) | \\[Output\\] Peak duration (ms) | \\[Output\\] Pulse-to-ring ratio (PRR) |\n|------------------------------------------------------------------------------------------------------|---------------------------------------|-------------------------------|--------------------------------------|\n| Effect 1: Predefined haptic constants (`VibrationEffect.EFFECT_CLICK`) | **\\[1\\] Data 1-1** | **\\[2\\] Data 1-2** | **\\[3\\] Data 1-3** |\n| Effect 2: Short custom haptic effect (duration = 20 ms, amplitude = 100%) | **\\[4\\] Data 2-1** | **\\[5\\] Data 2-2** | **\\[6\\] Data 2-3** |\n| Effect 3-1: Long custom haptic effect Acceleration phase 1 with 50% amplitude for the first 500 ms | **\\[7\\] Data 3-1** | n/a | n/a |\n| Effect 3-2: Long custom haptic effect Acceleration phase 2 with 100% amplitude for the second 500 ms | **\\[8\\] Data 3-2** | n/a | n/a |\n\n### Pulse to ring ratio and peak amplitude for Effect 1 and Effect 2\n\nTwo key parameters measured in Effect 1 and Effect 2 are **pulse to ring ratio\n(PRR)** and **peak amplitude** . These parameters are based on the acceleration\nmeasurement made by the\n[accelerometer setup](/docs/core/interaction/haptics/test-equipment#set-up-equipment).\n\nPRR is calculated by taking the ratio of *main pulse* to ringing amplitude.\n*Duration* is the elapsed time for the main pulse. The formula for PRR is: \n$$ \\\\text{Pulse to ring ratio (PRR)} = 20log_{10}\\\\frac{\\\\text{RMS (main pulse)}}{\\\\text{RMS (ring)}} $$\n\n**Figure 6.** Simulated accel signal\n\nThese elements are illustrated in Figure 6:\n\n- **Main pulse:** Defined by the signal inside the duration window where the amplitude decreases to 10% of peak amplitude.\n- **Ring time:** Defined by the signal where the amplitude decreases from\n 10% peak amplitude to less than 1% of the peak amplitude.\n\n | **Note:** In the example, the amplitude decreased to less than 1% of peak amplitude at around 0.1s.\n- Calculate the **PRR** and **duration**: Create a curve fit that uses\n peak points of each acceleration period. Curve fitting is the best method\n to do this as it improves test repeatability by minimizing noise effects.\n\n### Maximum amplitude for Effect 3\n\n**Figure 7.** Actuator overshoot\n\nThese elements are illustrated in Figure 7:\n\n- **Long vibration**\n - The output from the linear resonant actuator when a sinusoidal input is applied, at the resonant frequency.\n- **Maximum amplitude**\n - The maximum amplitude of the long vibration, when the device vibration is at a steady state.\n- **Overshoot**\n - Overshoot occurs when the actuator is driven away from its resonance. The figure shows the type of behavior that occurs when the vibrator is driven away from the resonance with a sinusoidal input. This is an example of *extreme overshoot*.\n - Minimal or no overshoot can be observed when the LRA is driven at its resonant frequency. Typical resonant frequencies of the LRA are between 50 and 250 Hz."]]