Conversation notifications and widgets

Android 11 adds support for customizing the behavior and placement of Conversation Notifications on the Notifications shade by priority and alerting level, allowing Conversations to be marked as Important and conversation specific bubbles to be launched in the Conversation space.

Building on these Android 11 features, Android 12 offers two new Conversation features:

  • The Recent Conversations feature in Settings enables users to customize notification behavior for recent conversations without waiting for a notification.

  • The Conversation Widget feature enables users to easily open chats on the home screen, giving a quick view of recent conversations.

This document describes the implementation, customization and validation aspects of conversation notifications and widgets.

Conversation Notifications overview

Android 11 introduces a new system primitive, the Conversation, that is represented by the existing sharing shortcut object (which was rolled out with Android 9).

The Conversations primitive can be used as follows:

  • To share Conversations data between the apps across the system through Sharesheet (already in Android 10).

  • For driving bubbles(shortcuts in Android 11). See Figure 1.

  • To participate in the new Conversation space on top of the Notification shade (implemented in Android 11). See Figure 2.

  • For creating Conversation Widgets (implemented in Android 12).

    conv_bubbles

    Figure 1: Notification being launched as a bubble from the notification drawer

    conv_notification

    Figure 2: Conversation space located on top of the Notification shade

Besides linking to the shortcut representing the conversation, the notification also uses MessagingStyle to include the last message of the conversation in the Conversation space.

GMS partners are required to implement the following:

  • A new Conversations space as a separate section on top of the Notification shade.
  • A notification style that allows and supports the Conversation specific bubble pattern.

Partners that implement Conversations are required to implement Important conversations as well. However, implementation of Conversations can be aligned with OEM concepts of similar nature. Overall, partners have the freedom to align the conversation section with their specific System UI. The partner does not have to modify or implement HAL/driver/kernel code/extensions.

See the following reference implementation in the SystemUI & PeopleService sections in AOSP:

frameworks/base/packages/SystemUI/src/com/android/systemui/people/
frameworks/base/core/java/android/app/people/
frameworks/base/services/people/java/com/android/server/people/

Validation

To ensure that your version of the feature works as intended, verify the following:

  1. Apps that fully support the Conversation API see their notifications in the new section, and can customize those notifications by conversation rather than by the generic NotificationChannel.

  2. Conversation specific bubbles are working.

To validate the implementation, use the following tests in the notification package:

  • CTS tests.

    cts/tests/app/src/android/app/cts/NotificationManagerTest.java
    
  • CTS Verifier tests.

    cts/apps/CtsVerifier/src/com/android/cts/verifier/notifications/
    
    

Conversation Widgets overview

In Android 12, the Conversation Widget feature builds on the Conversation representations created in Android 11 (as the preceding section describes) by allowing apps to provide status for those conversations which are displayed in Conversation Widgets.

conv_widgets

Figure 3: Conversations displayed in Conversation Widgets

The Conversation Widget feature in Android 12 promotes connection by allowing users to easily open chats on the home screen. The widgets are enhanced shortcuts that allow users to efficiently get back to their conversations while showing snippets of the conversation statuses.

The partner must implement the following:

  1. A widget provided by SystemUI.
  2. A flow to add these widgets from the widget picking screen.
  3. Support for widget resizing as follows:

Be aware of the following dependencies when implementing Conversation Widgets:

  • The partner does not have to modify or implement HAL/driver/kernel code.
  • The Status API, which allows apps to add status or availability information to a conversation and the associated widget, is used for implementation.
  • The process is the same on both new device implementations and upgrade implementation.
  • The Conversation Widgets feature has a dependency on a new feature launching in Android 12, which caches recently seen conversations (from notifications, for example). This latter feature allows to expand the list of conversations a user could potentially add to their home screen.

See the following reference implementation in SystemUI and Launcher3 files:

frameworks/base/packages/SystemUI/src/com/android/systemui/people/
frameworks/base/core/java/android/app/people/
frameworks/base/services/people/java/com/android/server/people/

Customization

The Conversation Widgets feature can’t be turned on or off. However, a partner can change the layouts of the widget templates, as long as GMS requirements are satisfied.

Validation

To ensure that your version of the feature works as intended, verify the following:

  1. On a long-press on Launcher, a new Conversation Widget for a Conversation can be added through the widget picker. See figure 4 for the Widget picker UI:

    widget_picker

    Figure 4: Widget picker UI to add a new Conversation Widget

  2. On sending notifications to the device from the selected Conversation, the widget is updated to reflect those notifications.

  3. On applying statuses to that Conversation using the ConversationStatus API, the widget reflects those statuses.

  4. Users can resize widgets and widgets can change their sizes based on their current Launcher. Your widget layouts must work well with different Launcher sizes on different devices and on resizing the widget.

To validate the implementation, use the following tests in the notification package:

  • CTS tests (PeopleManagerTest) for the API surfaces.

    cts/tests/app/src/android/app/cts/NotificationManagerTest.java
    
  • Manual tests for GMS requirement - Conversations.