自 Android 14 起,Android 動態效能架構 (ADPF) 中新增了名為 GAME 的省電模式,可在遊戲使用期間自訂手機效能。GAME 會向 Power HAL 指出遊戲應用程式位於前景。這項指示可讓 Power HAL 在遊戲進行時採用電源管理策略,讓使用者體驗到穩定且效能更佳的遊戲體驗。
為改善遊戲的載入時間,Android 13 在 ADPF 中推出了名為 GAME_LOADING 的新省電模式。GAME_LOADING 會指出遊戲應用程式是否處於載入狀態,以便 Power HAL 提供載入加速功能。這項指示可讓 Power HAL 提供可加快遊戲載入時間的效能提升措施。
本頁面說明遊戲應用程式如何將遊戲狀態傳遞至 Power HAL,並說明如何設定 Power HAL,以便在裝置中充分利用 Power HAL,以及如何測試 Power HAL 實作。
載入加速模式會偵測遊戲應用程式處於載入狀態,並通知 Power HAL。Android 13 在面向開發人員的 API 中推出了名為 isLoading 的新遊戲狀態。這個遊戲狀態會使用 Power Manager Service 中的新 GAME_LOADING 電源模式,向 Power HAL 通知頂層遊戲狀態。一旦 Power HAL 收到遊戲載入狀態的通知,便可調整平台的效能設定和 CPU 時脈率,進而縮短載入時間。
為了表示遊戲正在載入,遊戲應用程式會使用遊戲資訊主頁,在遊戲管理工具中設定 isLoading 狀態。遊戲管理員會將此狀態傳遞至遊戲管理員服務,後者會使用 setPowerMode 搭配新的 GAME_LOADING 電源模式,叫用電源管理員服務。GAME_LOADING 電源模式會向 Power HAL 指出遊戲處於載入狀態,以便 Power HAL 提供載入加速功能。
下圖說明從應用程式傳送至電源 HAL 的資訊流,用來指出載入狀態:
圖 2. 資訊流,用來指出遊戲處於載入狀態。
遊戲資訊主頁可讓使用者透過「效能設定」開啟或關閉載入加速功能。效能設定一律預設為關閉。
使用 GAME 和 GAME_LOADING 自訂 Power HAL
如要充分利用 GAME 和 GAME_LOADING 模式,原始設備製造商 (OEM) 必須自訂 Power HAL 的實作方式。由於電源管理和效能提升功能是硬體專屬,因此在 Google Pixel 裝置的參考實作項目發布之前,不會提供 GAME 或 GAME_LOADING 模式的參考實作項目。
為提升 GAME 和 GAME_LOADING 模式的效能,原始設備製造商可以選擇同時實作下列措施:
穩定影格速率
提高 CPU 時脈速度
暫時降低溫度節流
為前景遊戲應用程式指派較高的 CPU 優先順序
減少為一般非遊戲應用程式調整的 CPU 提昇功能
最佳化熱能相關的電力分配策略
測試 GAME 模式實作
如要測試 GAME 模式的實作方式,請在 GameManagerServiceTests.java 中使用前置為 testGamePowerMode_ 的測試。
[[["容易理解","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-27 (世界標準時間)。"],[],[],null,["# Performance boost for games\n\nStarting with Android 14 a new power mode named [`GAME`](https://cs.android.com/android/platform/superproject/+/android-latest-release:hardware/interfaces//power/aidl/android/hardware/power/Mode.aidl)\nin the Android Dynamic Performance Framework (ADPF) enables customization of\nphone performance during game use. `GAME` indicates to the Power HAL that a\ngame app is in the foreground. This indication allows the Power HAL to\nadopt power management strategies when a game is being played, so that the user\nexperiences a stable and improved performance.\n\nTo provide an improvement on a game's loading time, Android\n13 introduces a new power mode named [`GAME_LOADING`](https://cs.android.com/android/platform/superproject/+/android-latest-release:hardware/interfaces//power/aidl/android/hardware/power/Mode.aidl)\nin ADPF. `GAME_LOADING` indicates if a game app is in the loading state so that\nthe Power HAL can provide a loading boost. This indication allows the Power HAL\nto provide performance boosting measures that can speed up the game loading\ntime.\n\nThis page describes how the game app passes\nthe game state to the Power HAL, explains how to configure Power HAL in order to\ntake advantage of it in your devices, as well as how to test your Power HAL\nimplementation.\n\nPower mode detection and notification\n-------------------------------------\n\nThis section describes how the Power Manager handles the [`GAME`](https://cs.android.com/android/platform/superproject/+/android-latest-release:hardware/interfaces//power/aidl/android/hardware/power/Mode.aidl) and [`GAME_LOADING`](https://cs.android.com/android/platform/superproject/+/android-latest-release:hardware/interfaces//power/aidl/android/hardware/power/Mode.aidl) modes.\n\n### GAME power mode\n\nThe new power mode `GAME` in Android 14 indicates to\nthe [Power Manager Service](https://cs.android.com/android/platform/superproject/+/android-latest-release:frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java)\nthat the user is playing a game. When the Power HAL is notified of the `GAME`\nmode, it can adjust power to enhance performance, lower temperature and extend\nbattery life, while the game is being played.\n\nThe following figure explains the flow of information to the Power HAL to\nindicate the `GAME` power mode:\n\n**Figure 1.** Information flow to indicate that a game is being played.\n\nThe `GAME` power mode is always set for apps with an `appCategory`\nof `GAME` in [`AndroidManifest.xml`](https://android.googlesource.com/platform/frameworks/base/+/android16-release/core/res/AndroidManifest.xml).\n\n### GAME_LOADING power mode\n\nThe loading boost mode works by detecting when a game app is in a loading\nstate and notifying the Power HAL. Android 13\nintroduces a new game state called [`isLoading`](https://cs.android.com/android/platform/superproject/+/android-latest-release:frameworks/base//core/java/android/app/GameState.java) in the [developer-facing API](https://developer.android.com/reference/android/app/GameState).\nThis game state uses the new [`GAME_LOADING`](https://cs.android.com/android/platform/superproject/+/android-latest-release:hardware/interfaces//power/aidl/android/hardware/power/Mode.aidl)\npower mode in the Power Manager Service to notify the Power HAL about the top\nlevel game state. Once the Power HAL is notified of the game loading state, it\ncan adjust the platform's performance settings and CPU clock rate, which results\nin improved load times.\n\nTo indicate that a game is loading, the game app uses the Game Dashboard to set\nan [`isLoading`](https://cs.android.com/android/platform/superproject/+/android-latest-release:frameworks/base//core/java/android/app/GameState.java)\nstate in the Game Manager. The Game Manager passes this state to the Game\nManager Service, which uses [`setPowerMode`](https://cs.android.com/android/platform/superproject/+/android-latest-release:frameworks/base//core/java/android/os/IPowerManager.aidl)\nwith the new [`GAME_LOADING`](https://cs.android.com/android/platform/superproject/+/android-latest-release:hardware/interfaces//power/aidl/android/hardware/power/Mode.aidl)\npower mode to invoke the Power Manager Service. The `GAME_LOADING` power mode\nindicates to the [Power HAL](/docs/core/power/performance) that the game is in a\nloading state so that the Power HAL can provide a loading boost.\n\nThe following figure explains the flow of information from the app to the Power\nHAL to indicate the loading state:\n\n**Figure 2.** Information flow to indicate that a game is in a loading state.\n\nThe game dashboard allows users to turn the loading boost feature on or off with\nthe Performance Setting. The Performance Setting always defaults to off.\n\nCustomize Power HAL using GAME and GAME_LOADING\n-----------------------------------------------\n\nTo take advantage of the `GAME` and `GAME_LOADING` modes, OEMs must\ncustomize their implementation of the [Power HAL](https://android.googlesource.com/platform/hardware/interfaces/+/android16-release/power/aidl/default/Power.cpp).\nAs power management and performance boosting is hardware specific, no reference\nimplementations for the `GAME` or `GAME_LOADING` modes are made available until\na reference implementation for the Google Pixel device is released.\n\nTo enhance performance in a `GAME` and `GAME_LOADING` mode, OEMs can choose to\nimplement a combination of the following measures:\n\n- Stabilize frame rate\n- Increase CPU clock speed\n- Temporarily reduce temperature throttling\n- Assign a higher CPU priority to the foreground game app\n- Reduce CPU boost tuned for regular, non-game apps\n- Optimize the thermal-related power distribution strategy\n\nTest GAME mode implementation\n-----------------------------\n\nTo test the implementation of the `GAME` mode, use tests prefixed with\n`testGamePowerMode_` in `GameManagerServiceTests.java`.\n\nTest GAME_LOADING implementation\n--------------------------------\n\nTo test the implementation of the `GAME_LOADING` mode, use [`android.gamemanager.cts.GameManagerTest#testSetGameContext`](https://cs.android.com/android/platform/superproject/+/android-latest-release:cts//tests/tests/gamemanager/src/android/gamemanager/cts/GameManagerTest.java).\nThis test verifies if `GameManager::setGameContext()` with an `isLoading`\ncontext invokes the game loading mode on the Power HAL in performance mode.\n| **Note:** Because the implementation of these modes is hardware specific, OEMs must perform their own manual tests to see if game performance is enhanced and the game loading times are decreased while using this feature. Measuring an improvement in the performance boost can be difficult. Hence, it might be necessary to perform many tests using different boost configurations to determine if improvements are being made."]]