In Android 13, a new System UI affordance called the Task Manager notifies the user about the state and resources being used by the foreground services on background apps and enables the user to stop these apps.
With the introduction of notification permissions in Android 13, users have control over turning off notifications from background apps that run foreground services for location, media playback and projection, data sync, video and voice calls, and connected devices. When such notifications are turned off, required notifications from foreground services that indicate their state and resource usage to the user aren't displayed. The Task Manager adds an information bar on the Quick Settings display to inform users of the apps running in the background and their usage of phone resources such as memory and battery. With this interface, users are notified if an app is running a foreground service for a long time and can choose to stop an app. The affordance is placed on the display in a subtle way so it doesn't obstruct important notifications. See Task Manager for more information.
Implement Task Manager for background apps
Although a reference AOSP implementation for this feature is available, Android-powered device implementers can customize and modify this System UI. The stop affordance in the Task Manager mustn't be displayed for apps which are core to the functionality of the device, such as Dialer and Camera.
The AOSP implementation uses a new internal callback API between the System UI and System Server. This API lets the System Server notify the System UI when new foreground services are started. The API also notifies the System Server to stop certain apps, when requested by the user.
Validate Task Manager for background apps notifications
For manual testing, validate the Task Manager feature against apps that are running in the background.
For unit testing, use unit tests available in AOSP.