2025 年 3 月 27 日より、AOSP のビルドとコントリビューションには aosp-main
ではなく android-latest-release
を使用することをおすすめします。詳細については、AOSP の変更をご覧ください。
フラッシュ ウェアの管理
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
Android Automotive の内部ストレージでは、数千回の消去 / 書き込みサイクルを伴うフラッシュ メモリが使用されます。フラッシュ メモリで障害が発生した場合、システムが使用不能になる可能性があります。車両の寿命は長い(通常は 10 年を超える)ため、フラッシュ メモリの信頼性は非常に高くなければなりません。このページでは、フラッシュ メモリの動作と OEM がフラッシュ メモリ デバイスの障害発生リスクを軽減する仕組みについて説明します。
フラッシュ メモリ デバイスは、消耗均一化手法を使用してデータの配置や書き込みをシステム全体に均等に分散させることで、消去や書き込みの制限を回避します。このため、大量の書き込みが原因で特定のブロックが失敗することはありません。フラッシュ メモリの推定寿命は次の条件によって異なります。
- 書き込み回数
- 書き込みパターン
- フラッシュ メモリの使用可能なサイズ(ストレージ サイズが大きいほど、消耗均一化アルゴリズムにより書き込みを分散できるブロックの数が増えます)
- 消耗均一化手法
- 環境的な要因(たとえば、動作温度の範囲は通常 -20~85°C であり、これ以外の温度ではフラッシュ メモリの寿命が短くなる可能性があります)
フラッシュ メモリの寿命は、以下の数式を使って計算できます。
$$
\frac{Max\ erase\ cycles * Storage\ capacity}{Data\ written\ per\ year} = {Flash\ memory\ lifespan\ in\ years}
$$
ただし、使用可能なストレージ サイズが小さくなるため、フラッシュ メモリが完全に消耗するよりもかなり早く、システムは正常に動作しなくなります。また、使用する均一化手法や書き込みパターンによっては、フラッシュ メモリの寿命はさらに短くなる場合があります。また、この推定値では、不正な動作や悪意のあるアプリの影響も考慮されていません。これらのアプリは、特別な権限がなくてもジャンクデータの大きなブロックをフラッシュ メモリに書き込むことにより Automotive システムを停止させる恐れがあります。
フラッシュ メモリの障害を未然に検出するには、システム全体のヘルス モニタリングの一環として適切なストレージ ヘルス モニタリングを組み込む必要があります。
フラッシュ メモリの実装
Android Automotive は、OEM がシステムの内部ストレージを保護およびモニタリングし、その寿命を延ばすことができるようにする機能をサポートしています。
フラッシュの消耗の抑制
内部ストレージのフラッシュの消耗を懸念している OEM は、適用ストレージとして使用できる速度を備えた SD カードを追加することもできます。この SD カードに求められるプロパティは次のとおりです。
- 適用されると、SD カードは暗号化され、アプリデータが安全に保存される。
- SD カードスロットは安全な場所に配置する必要がある(ユーザーが SD カードを何度も取り外すことは想定されていません)。
- Automotive システムとパソコン間のデータの移行には SD カードを使用できない。
- SD カードを取り出しても、実行中のシステムに影響しない(ただし、交換の必要がある場合以外は取り外さないでください)。
SD カード上のアプリ
Android Automotive システムの内部ストレージの保護を強化するため、OEM は、サードパーティ製アプリを内部ストレージにインストールできるかどうかを指定できます(アプリはインストール先のパーティションにしか書き込みを行えません)。設定するには、リソース オーバーレイで次のように設定します。
<bool name="config_allow3rdPartyAppOnInternal">false</bool>
セカンド パーティ製アプリ(自動車アプリ デベロッパーによって作成されたアプリ)を SD カードにインストールすることが自動車で必要な場合にこのインストールを実行できるようにするには、自動車アプリ デベロッパーがアプリのマニフェスト ファイルに android:installLocation=["auto" | "preferExternal"]
を含める必要があります。
自動車でサードパーティ製アプリを内部ストレージにインストールすることが許可されていない場合、このフラグがなければ(または、installLocation=internalOnly
が設定されていれば)アプリのインストールは失敗します。
ディスク指標の取得
AAOS 13 では、カー ウォッチドッグの一環として、フラッシュ メモリ過剰使用のモニタリングと指標の収集が導入されました。詳しくは、フラッシュ メモリ使用量のモニタリングをご覧ください。
Android 8 では「storaged」が導入されました。これは新しいシステム サービスで、ディスクとフラッシュ メモリの指標(ディスク全体の使用状況、フラッシュ メモリの推定寿命、アプリごとのディスク I/O 統計データなど)をサンプリングして公開します。OEM は、内部ストレージに障害が発生したときや、特定のアプリが実行しているディスク I/O の数が多すぎるときに、この情報を使用して警告を表示できます。詳しくは、storaged の実装をご覧ください。
このページのコンテンツやコードサンプルは、コンテンツ ライセンスに記載のライセンスに従います。Java および OpenJDK は Oracle および関連会社の商標または登録商標です。
最終更新日 2025-07-26 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-07-26 UTC。"],[],[],null,["# Flash wear management\n\nAndroid Automotive internal storage uses flash memory with thousands of erase and write cycles.\nIf flash memory fails, the system can become unusable. As vehicles have long lifespans\n(typically more than 10 years), flash memory must be extremely reliable. This page describes\nflash memory behavior and how OEMS can mitigate the risk of flash memory devices failing.\n\nFlash memory performance\n------------------------\n\n\nFlash memory devices use wear leveling techniques to work around erase and write limitations by\narranging data and distributing writes evenly across the system so that no single block fails\ndue to intensive writes. The estimated life of flash memory depends on:\n\n- **Number of writes**\n- **Write patterns**\n- **Available size of flash memory.** Larger storage size means the wear leveling algorithm can spread the writes across a larger number of blocks.\n- **Wear leveling techniques**\n- **Environmental factors.** Examples include an operating temperature range of usually -20 to 85 Celsius. Temperatures outside this range could further shorten the lifespan of the flash memory.\n\n\nFlash memory lifespan can be calculated with the help of this formula: \n$$ \\\\frac{Max\\\\ erase\\\\ cycles \\* Storage\\\\ capacity}{Data\\\\ written\\\\ per\\\\ year} = {Flash\\\\ memory\\\\ lifespan\\\\ in\\\\ years} $$\n\n\nHowever, the system would stop functioning properly long before the flash memory completely wears\nout as the usable storage size decreases, and the eMMC may have an even shorter lifespan depending\non the leveling techniques and the write patterns used. In addition, this estimate does not\nconsider the effects of misbehaved or malicious apps, which could disrupt Automotive systems by\nwriting large blocks of junk data to flash memory without special permissions.\n\nTo detect the possible flash memory failure before it actually happens, proper storage health\nmonitoring should be built in as part of the overall system health monitoring\n\nImplement flash memory\n----------------------\n\n\nAndroid Automotive supports features that enable OEMs to protect and monitor their systems'\ninternal storage to prolong its lifespan.\n\n### Reduce flash wear\n\nOEMs concerned about flash wear on internal storage can also add an SD card fast enough to be\nused as adopted storage. The SD card is expected to have the following properties:\n\n- When adopted, the SD card is encrypted and is safe for storing app data.\n- SD card slot must be in a safe location (users are not expected to remove the SD card frequently).\n- SD card cannot be used for transferring data between Automotive systems and a computer.\n- Ejecting the SD card doesn't affect a running system. However, it shouldn't be removed unless it needs to be replaced.\n\n### Apps on SD cards\n\n\nTo further protect the internal storage of Android Automotive system, OEMs can specify whether\nthird-party apps can be installed on internal storage so that apps can write only to the\npartition on which they are installed. To configure, set the following configuration in\nthe resource overlay: \n\n```scdoc\n\u003cbool name=\"config_allow3rdPartyAppOnInternal\"\u003efalse\u003c/bool\u003e\n```\n\nTo ensure second-party apps (those built by car app developers) can be installed on SD cards if\nthe car mandates, car app developers must include\n`android:installLocation=[\"auto\" | \"preferExternal\"]` in the app's manifest file.\n\nIf the car does not allow third-party apps to be installed on internal storage, app installation\nfails without this flag (or if the `installLocation=internalOnly`\nsetting is configured).\n\n### Get disk metrics\n\n\nAAOS 13 introduced Flash Memory Overuse monitoring and metrics collection as part of Car\nWatchdog. For details, see\n[Monitor flash memory usage](/docs/automotive/watchdog/wd_flash_memory).\n\n\nAndroid 8 introduced *storaged,* a system service that samples and publishes disk and flash\nmemory metrics, such as information about overall disk usage, flash memory lifetime estimation,\nand per app disk I/O stats. OEMs can use this information to warn users when the internal storage\nbegins to fail or when specific apps are performing too many disk I/Os. For details, see\n[Implement storaged](/docs/core/tests/debug/storaged)."]]