To reduce distraction while driving, heads-up notifications (HUN) provide drivers with essential and relevant information without diverting their attention to a display or mobile device. However, since HUNs can interfere with the task of driving, it's crucial to consider the advantages and disadvantages of HUNs to ensure drivers are not distracted.
Use these Android notification-specific safety features to reduce driver distraction:
This content describes configurations and resources that pertain to
platform/packages/apps/Car/Notification
.
Queue and prioritize
When multiple incoming HUNs are received, the queue and prioritize mechanism displays the most important and relevant information to the driver.
To enable or disable the queue mechanism, set the boolean value for the
config_suppressAndThrottleHeadsUp config
.
Queued HUNs are sorted based on priority determined by the
category
of the notification. Specify the headsup_category_priority
array in a
descending order of priority.
Some time-sensitive notifications, such as CATEGORY_CALL
and
CATEGORY_CAR_EMERGENCY
, should be displayed immediately instead of queued.
To immediately display these types of HUNs, add these categories to the
headsup_category_immediate_show
array.
Throttle and pace
When a user performs an action during which it would be unsafe or distracting to show HUNs, such as interacting with Assistant or Dialer, you can throttle HUNs.
To employ throttling, add the package names of apps that require attention to
the allowlist (headsup_throttled_foreground_packages
). This stops the queue
from displaying new HUNs while the specified apps run in the foreground.
To give drivers time to focus on driving, add a time interval between the
display of each HUN. This time interval (headsup_delay_duration
)
applies after packages from headsup_throttled_foreground_packages
are
moved to the background.
Suppression
HUNs that remain in the queue for an extended period can be suppressed. When HUNs become irrelevant to the driver, they can cause distraction. Instead of triggering a HUN, direct expired notifications to the Notification center. You can tailor your management of HUNs by prescribing different values for the Drive and Park states.
For the Drive state:
- Set
config_expireHeadsUpWhenDriving
totrue
and specify theheadsup_queue_expire_driving_duration_ms
as the duration (in milliseconds) after the post time when the notification is to expire.
For the Park state:
- Set
config_expireHeadsUpWhenParked
totrue
and specify theheadsup_queue_expire_parked_duration_ms
as the duration (in milliseconds) after the post time when the notification is to expire.
In the event of a suppression, send a trailing system HUN to notify the
driver. Modify the title of this notification by updating the values of
hun_suppression_notification_title_drive
and
hun_suppression_notification_title_park
To automatically dismiss the HUN queue when the Notification center is opened:
- Set the
config_dismissHeadsUpWhenNotificationCenterOpens
boolean totrue
.