2025 年 3 月 27 日より、AOSP のビルドとコントリビューションには aosp-main
ではなく android-latest-release
を使用することをおすすめします。詳細については、AOSP の変更をご覧ください。
アプリ バックグラウンド動作トラッカー
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
Android 13 では、消費電力トラッカーというコンセプトが導入されました。これは、フォアグラウンドまたはバックグラウンドでのアプリによるバッテリー使用量をモニタリングするプロセスで、アプリがなんらかのポリシーに違反していないかどうかを確認するものです。Android 13 では、フォアグラウンド サービス トラッカーとバックグラウンド バッテリー使用量トラッカーの 2 つの消費電力トラッカーが用意されています。独自のメカニズムを使用してアプリによるバッテリーの浪費を特定するのではなく、これらのトラッカーを使用して過度のバッテリー使用をモニタリングしてユーザーに警告することをおすすめします。
フォアグラウンド サービス トラッカー
フォアグラウンド サービスが、バッテリーを長時間にわたり使用することがあります。フォアグラウンド サービス トラッカーは、フォアグラウンド サービスが長時間実行されているが非表示になっている場合(ユーザーがサービスの通知を無視している場合など)に、ユーザーに通知を表示します。ユーザーが通知をクリックするとタスクマネージャーが表示されるので、ユーザーはこれを使用してフォアグラウンド サービスを停止できます。このトラッカーはデフォルトで有効になっています。
バックグラウンドのバッテリー使用量トラッカー
ユーザーが気づかないうちに、バックグラウンドでアプリによりバッテリーが浪費されることがあります。バックグラウンドのバッテリー トラッカーは、各アプリのバッテリー使用量を監視します。このコンテキストでのバッテリー使用量は、最上位のフォアグラウンド アプリ、非表示の何かを実行しているフォアグラウンド サービス、アプリのバックグラウンド部分の 3 つの項目で定義されます。アプリのバッテリー使用量のバックグラウンド部分がしきい値を超えると、そのアプリが制限されたバケットに移動され、1 日あたり 1 つのジョブに制限されます。このトラッカーはデフォルトで無効になっています。このトラッカーを有効にするには、次のコマンドを実行します。
adb shell device_config put activity_manager bg_auto_restrict_abusive_apps 1
adb shell device_config put activity_manager bg_current_drain_auto_restrict_abusive_apps_enabled 1
このページのコンテンツやコードサンプルは、コンテンツ ライセンスに記載のライセンスに従います。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,["# App background behavior trackers\n\nAndroid 13 introduces the concept of a\n*power consumption tracker*, which is a process that monitors foreground or\nbackground battery usage by apps to determine if apps violate some policy.\nAndroid 13 contains two power consumption trackers:\nthe foreground service tracker and background battery usage tracker. As opposed\nto using your own mechanisms to determine battery abuse by apps, we\nrecommend using these trackers to monitor and alert users of excessive battery\nusage.\n\nForeground service tracker\n--------------------------\n\nForeground services can execute and use battery for an extended period of time.\nThe foreground service tracker displays a notification to users when a\nforeground service has been running for a long period of time but is invisible,\nsuch as when a user has dismissed the service's notification. If the user\nclicks the notification, the task manager is displayed and lets\nthe user stop the foreground service. This tracker is enabled by default.\n\nBackground battery usage tracker\n--------------------------------\n\nApps can drain battery in the background without the user being aware. The\nbackground battery tracker watches battery usage for each app. Battery usage\nin this context is defined by three dimensions: foreground app on top,\nforeground service running something that isn't visible, and background part of\napp. If the background portion of the app's battery usage crosses some threshold,\nthe app is moved into a restricted bucket limiting it to one job per day. This\ntracker is disabled by default. To enable this tracker, run the following\ncommands: \n\n adb shell device_config put activity_manager bg_auto_restrict_abusive_apps 1\n adb shell device_config put activity_manager bg_current_drain_auto_restrict_abusive_apps_enabled 1"]]