To provide an improvement on a game’s loading time, Android 13
introduces a new power mode named GAME_LOADING
in the Android
Dynamic Performance Framework (ADPF). GAME_LOADING
indicates to the Power HAL
if the game app is in the loading state so that the Power HAL can provide a
loading boost. This indication allows the Power HAL to provide performance
boosting measures that can speed up the game loading time.
This page describes how the game app passes the game state to the Power HAL, explains how to configure Power HAL in order to take advantage of it in your devices, as well as how to test your Power HAL implementation.
Loading state detection and notification
The loading boost mode works by detecting when a game app is in a loading
state and notifying the Power HAL. Android 13
introduces a new game state called isLoading
in the developer-facing API. This game state uses the new
GAME_LOADING
power mode in the Power Manager Service to notify the Power HAL about the top
level game state. Once the Power HAL is notified of the game loading state, it
can adjust the platform's performance settings and CPU clock rate, which results
in improved load times. OEMs can choose to implement and customize the loading
boost in the Power HAL. See the Customize Power HAL implementation
section for more information.
To indicate that a game is loading, the game app uses the Game Dashboard to set
an isLoading
state in the Game Manager. The Game Manger passes this state to the Game Manager
Service, which uses setPowerMode
with the new GAME_LOADING
power mode to invoke the
Power Manager Service. The GAME_LOADING
power mode indicates to the
Power HAL that the game is in a loading state
so that the Power HAL can provide a loading boost.
The following figure explains the flow of information from the app to the Power HAL to indicate the loading state:
Figure 1. Information flow to indicate that a game is in a loading state.
Customize Power HAL to improve game load times
In order to take advantage of the GAME_LOADING
mode, OEMs must customize their
implementation of the Power HAL
when in the game loading mode. Measures such as increasing CPU clock speed,
temporarily reducing temperature throttling, and increasing the CPU priority to
the foreground task help with boosting performance.
As performance boosting is hardware specific, there are no reference implementations for the boost mode, until a reference implementation for the Google Pixel device is released.
The game dashboard allows users to turn the loading boost feature on or off with the Performance Setting. The Performance Setting always defaults to off.
Test and validate game loading implementation
To test the implementation, use android.gamemanager.cts.GameManagerTest#testSetGameContext
. This test verifies if GameManager::setGameContext()
with an
isLoading
context invokes the game loading mode on the Power HAL in performance
mode.
However, since the implementation of this feature is hardware specific, OEMs must perform their own manual tests to see if the game loading times are decreased while using this feature.