2025 年 3 月 27 日より、AOSP のビルドとコントリビューションには aosp-main
ではなく android-latest-release
を使用することをおすすめします。詳細については、AOSP の変更をご覧ください。
ハプティクスを実装する
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
デバイス メーカーは通常、デバイスごとに作成されたプライベート アセットの所有者とみなされます。したがって、エンジニアリングの取り組みは、デバイス単位で行われることが多く、エコシステム内の他のデバイスとの一貫性に対する取り組みはほとんど、あるいはまったく行われません。
これとは正反対に、デベロッパーは各デバイスの技術仕様に関係なく、エコシステム内のすべての Android スマートフォンで動作するアプリを作成することを目指します。このようなアプローチの違いにより、断片化の問題が発生することがあります。たとえば、特定のスマートフォンのハードウェア機能が、アプリ デベロッパーの想定と一致しないことがあります。一部の Android スマートフォンで動作するハプティクス API が他の Android スマートフォンでは動作しない場合、結果として一貫性のないエコシステムとなります。こうした理由により、メーカーが Android ハプティクス API をすべてのデバイスに実装できるようにするうえで、ハードウェア構成が重要な役割を果たします。
このページでは、Android ハプティクス API を最大限活用するためにハードウェア コンプライアンスを設定する方法について、詳細なチェックリストをご紹介します。
下図は、デバイス メーカーとデベロッパーの間で共通の知識を構築するプロセスを示しています。これは、一貫性のあるエコシステムを構築するうえで重要なステップです。
図 1. デバイス メーカーとデベロッパーの間の知識の構築
ハプティクス実装チェックリスト
定数を実装する
プリミティブを実装する
HAL と API の間で定数をマッピングする
- 公開 API 定数(フレームワークの名前付きプレースホルダ)と、プレースホルダを実装する HAL 定数との間のマッピングの推奨事項。
- このプロセスについて詳しくは、推奨されるマッピングの指針となる設計原則をご覧ください。
ハードウェアを評価する
- ターゲットとする触覚効果についての説明。これにより、ハードウェアのクイック チェックを行います。
このページのコンテンツやコードサンプルは、コンテンツ ライセンスに記載のライセンスに従います。Java および OpenJDK は Oracle および関連会社の商標または登録商標です。
最終更新日 2025-03-10 UTC。
[[["わかりやすい","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-03-10 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)."]]