Garage Mode

Garage Mode provides idle time in cars by keeping the system awake until jobs in the JobScheduler, constrained with idleness, can be executed.

What is Garage Mode?

On connected devices such as phones, users rely on the system to keep the device stable, up-to-date, and optimized. To achieve that state, the Android platform devised a special idle time window, which enables applications to perform tasks when the user is not interacting with the phone and the device is idle. A phone is considered idle when users do not touch it for an extended duration (60+ minutes) and the screen is turned off.

Unlike a phone, when a car is not being used, it is turned off, which means the app doesn't have an idle time window. Garage Mode was created to ensure idle time in a car.

Garage Mode has Android compatibility requirements. For details, see the Android Compatibility Definition Document (CDD).

OEM implementation guidelines

To activate Garage Mode, when turning off the vehicle, the Vehicle HAL (VHAL) must send AP_POWER_STATE_REQ to the state SHUTDOWN_PREPARE with the parameter set to SHUTDOWN_ONLY or CAN_SLEEP.

For the state SHUTDOWN_PREPARE to be explicit, the VHAL must specify the two parameters (state and the additional param) for the AP_POWER_STATE_REQ command. This enables the device to enter Garage Mode, which detects scheduled jobs in the JobScheduler and prevents the system from proceeding to either suspend or shutdown until the jobs are completed.

How do OEMs connect to the AOSP framework?

For Garage Mode, the framework requests the VHAL to extend the shutdown time until either the 15-minute duration is exceeded or all jobs have been executed at which point the OEM HAL should grant more time. OEM implementations at the HAL level can still shut down the system without respecting the request from the framework.

How do third-party developers work with Garage Mode?

Applications and services do not interact directly with Garage Mode. Instead, apps can schedule jobs in the JobScheduler and those that are constrained with idleness will be executed during Garage Mode.