2025 年 3 月 27 日より、AOSP のビルドとコントリビューションには aosp-main
ではなく android-latest-release
を使用することをおすすめします。詳細については、AOSP の変更をご覧ください。
Android の電力プロファイル
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
電池使用量の情報は、電池使用量の統計情報と電力プロファイルの値から取得できます。
電池使用量の統計情報
このフレームワークは、デバイス コンポーネントがさまざまな状態で電力を消費する時間を追跡することで、電池使用量の統計情報を自動的に決定します。コンポーネント(Wi-Fi チップセット、セル無線通信、Bluetooth、GPS、ディスプレイ、CPU)が状態を変更する(OFF/ON、アイドル/フル電力、明るさの低/高など)と、コントロール サービスはフレームワーク BatteryStats サービスに報告します。BatteryStats は時間の経過とともに情報を収集し、再起動後に使用するために保存します。このサービスでは、バッテリーの電流引き込みを直接追跡するのではなく、さまざまなコンポーネントによるバッテリー消費量の概算に使用できるタイミング情報を収集します。
このフレームワークは、次のメソッドを使用して統計情報を収集します。
- プッシュ型: サービスがコンポーネントの変更を認識すると、状態の変更を BatteryStats サービスにプッシュします。
- プル型: アプリケーションによるコンポーネント(CPU など)の使用の場合、フレームワークは移行ポイント(アクティビティの開始や停止など)で自動的にデータをプルし、スナップショットを取得します。
リソース消費は、リソースを使用するアプリケーションに関連付けられます。複数のアプリケーションが同時に 1 つのリソース(システムの停止を防ぐウェイクロックなど)を使用する場合、フレームワークはアプリケーション間で消費を分散させますが、必ずしも均等ではありません。
電池残量がゼロになったためシャットダウンするなど、電池の消費問題を示している可能性があるシャットダウン イベントで使用量の統計情報が失われるのを防ぐために、フレームワークは約 30 分ごとに統計情報をフラッシュします。
電池使用量の統計情報はフレームワークによって完全に処理され、OEM の変更は不要です。
電力プロファイルの値
注意: デバイス メーカーは、コンポーネントの電流消費値とコンポーネントに起因する経時的な電池の消耗を定義する、コンポーネントの電力プロファイルを提供しなければなりません。このプロファイルは platform/frameworks/base/core/res/res/xml/power_profile.xml で定義されています。設定のガイドについては、電力値をご覧ください。
電力プロファイルでは、消費電力は定格電圧での電流引き込みのミリアンブ(mA)で指定されます。小数値のマイクロ アンペア(μA)で指定されることもあります。この値は、電池で消費される mA であり、電池で消費される電流に対応しない電源レールに適用される値ではありません。
たとえば、ディスプレイの電力プロファイルは、ディスプレイを最小輝度と最大輝度で維持するのに必要な電流の mA を指定します。ディスプレイをオンに維持する電力コスト(ディスプレイ コンポーネントによる電池の消耗など)を決定するために、フレームワークは明るさのレベルごとで消費された時間を追跡し、それらの時間に、補間されたディスプレイの明るさにおけるコストを乗算します。
また、このフレームワークは、各アプリケーションの CPU 時間に、特定の速度で CPU を実行するために必要な mA を乗算します。この計算では、CPU コードを実行することでアプリケーションが消費する電池量の比較ランキングが設定されます(フォアグラウンド アプリとしての時間とバックグラウンド アクティビティを含む合計時間は別々に報告されます)。
このページのコンテンツやコードサンプルは、コンテンツ ライセンスに記載のライセンスに従います。Java および OpenJDK は Oracle および関連会社の商標または登録商標です。
最終更新日 2025-03-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-03-26 UTC。"],[],[],null,["# Power profiles for Android\n\nBattery use information is derived from battery use statistics and power profile values.\n\nBattery use statistics\n----------------------\n\nThe framework automatically determines battery use statistics by tracking how long device\ncomponents spend in different states. As components (Wi-Fi chipset, cellular radio, Bluetooth, GPS,\ndisplay, CPU) change states (OFF/ON, idle/full power, low/high brightness, etc.), the controlling\nservice reports to the framework BatteryStats service. BatteryStats collects information over time\nand stores it for use across reboots. The service doesn't track battery current draw directly,\nbut instead collects timing information that can be used to approximate battery\nconsumption by different components.\n\nThe framework gathers statistics using the following methods:\n\n- **Push**. Services aware of component changes push state changes to the BatteryStats service.\n- **Pull**. For components such as the CPU use by apps, the framework automatically pulls the data at transition points (such as starting or stopping an activity) to take a snapshot.\n\nResource consumption is associated with the application using the resource. When multiple\napplications simultaneously use a resource (such as wakelocks that prevent the system from\nsuspending), the framework spreads consumption across those applications, although not necessarily\nequally.\n\nTo avoid losing use statistics for a shutdown event, which may indicate battery power\nconsumption problems (i.e. shutdown occurs because the battery reached zero remaining capacity),\nthe framework flashes statistics approximately every 30 minutes.\n\nBattery use statistics are handled entirely by the framework and do not require OEM\nmodifications.\n\nPower profile values\n--------------------\n\n**Caution:** Device manufacturers must provide a component power\nprofile that defines the current consumption value for the component and the approximate battery\ndrain caused by the component over time. This profile is defined in\n[platform/frameworks/base/core/res/res/xml/power_profile.xml](https://android.googlesource.com/platform/frameworks/base/+/android16-release/core/res/res/xml/power_profile.xml).\nFor guidance on these settings, see [Power Values](/docs/core/power/values).\n\nWithin a power profile, power consumption is specified in milliamps (mA) of current draw at a\nnominal voltage and can be a fractional value specified in microamps (uA). The value should be the\nmA consumed at the battery and not a value applicable to a power rail that does not correspond to\ncurrent consumed from the battery.\n\nFor example, a display power profile specifies the mA of current required to keep the display on\nat minimum brightness and at maximum brightness. To determine the power cost (i.e the battery\ndrained by the display component) of keeping the display on, the framework tracks the time spent at\neach brightness level, then multiplies those time intervals by an interpolated display brightness\ncost.\n\nThe framework also multiplies the CPU time for each application by the mA required to run the\nCPU at a specific speed. This calculation establishes a comparative ranking of how much battery an\napplication consumes by executing CPU code (time as the foreground app and total time including\nbackground activity are reported separately)."]]