Starting March 27, 2025, we recommend using android-latest-release
instead of aosp-main
to build and contribute to AOSP. For more information, see Changes to AOSP.
Implement haptics
Stay organized with collections
Save and categorize content based on your preferences.
Device manufacturers are generally considered the owners of the private assets
created for each device. As such, their engineering efforts are often focused on
a per-device basis; little to no effort goes to the consistency of other
devices in the ecosystem.
In direct contrast, developers strive to build apps that work on all Android
phones in the ecosystem, regardless of each device's technical specifications.
This difference in approach can cause a fragmentation problem, for example, the
hardware capabilities of certain phones don't match expectations set by the app
developers. So if the haptics APIs work on some Android phones but not others,
the result is an inconsistent ecosystem. This is why hardware configuration
plays a critical role in ensuring that manufacturers can implement Android
haptics APIs on every device.
This page provides a step-by-step checklist to set up hardware compliance for
the best use of the Android haptics APIs.
The following figure illustrates building common knowledge between device
manufacturers and developers, which is a critical step in creating a cohesive
ecosystem:
Figure 1. Building knowledge between device manufacturers and developers
Haptics implementation checklist
Implement constants
- List of constants to implement haptics.
Implement primitives
- Implementation guidance for HAL composition primitives.
Map constants between HAL and API
Implement piecewise linear envelope (PWLE) effects
- Implementation guidance for amplitude and frequency envelopes.
Assess the hardware
- Instructions on target haptic effects. Use these instructions to perform
quick checks on your hardware.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-06-12 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-06-12 UTC."],[],[],null,["# Implement haptics\n\nDevice manufacturers are generally considered the owners of the private assets\ncreated for each device. As such, their engineering efforts are often focused on\na *per-device basis*; little to no effort goes to the consistency of other\ndevices in the ecosystem.\n\nIn direct contrast, developers strive to build apps that work on *all* Android\nphones in the ecosystem, regardless of each device's technical specifications.\nThis difference in approach can cause a fragmentation problem, for example, the\nhardware capabilities of certain phones don't match expectations set by the app\ndevelopers. So if the haptics APIs work on some Android phones but not others,\nthe result is an inconsistent ecosystem. This is why hardware configuration\nplays a critical role in ensuring that manufacturers can implement Android\nhaptics APIs on *every* device.\n\nThis page provides a step-by-step checklist to set up hardware compliance for\nthe best use of the Android haptics APIs.\n\nThe following figure illustrates building common knowledge between device\nmanufacturers and developers, which is a critical step in creating a cohesive\necosystem:\n\n**Figure 1.** Building knowledge between device manufacturers and developers\n\nHaptics implementation checklist\n--------------------------------\n\n1. [Implement constants](/docs/core/interaction/haptics/haptics-constants-primitives#implement-constants)\n\n - List of constants to implement haptics.\n2. [Implement primitives](/docs/core/interaction/haptics/haptics-constants-primitives#implement-primitives)\n\n - Implementation guidance for HAL composition primitives.\n3. [Map constants between HAL and API](/docs/core/interaction/haptics/haptics-map-constants)\n\n - Mapping recommendations between public API constants (named *placeholders* in the framework) and HAL constants, which implement the placeholders.\n - See [Design principles to guide the recommended mapping](/docs/core/interaction/haptics/haptics-ux-design) to learn more about this process.\n4. [Implement piecewise linear envelope (PWLE) effects](/docs/core/interaction/haptics/haptics-pwle)\n\n - Implementation guidance for amplitude and frequency envelopes.\n5. [Assess the hardware](/docs/core/interaction/haptics/haptics-assess-hardware)\n\n - Instructions on target haptic effects. Use these instructions to perform quick checks on your hardware.\n\n| **Note:** You can learn more about building common knowledge between device manufacturers and developers in [Advanced Haptics: The When, What, and How of\n| Haptic APIs](https://www.youtube.com/watch?v=00jRoEFnpk8)."]]