In Android 11, Google introduced a major redesign to media playback controls, moving them from standard notifications into a dedicated space within the Quick Settings (QS) panel. Along with this functional change came a significant visual overhaul: the color extraction algorithm became more refined, ensuring consistent lightness, better text contrast, and a cleaner overall aesthetic compared to the older MediaNotificationProcessor used in Android 8.0 through 10.

If you are looking to understand how Android 11 extracts these colors and styles the media player, here is exactly where to find the source code in the Android Open Source Project (AOSP) and how the mechanism works.

The Source Code Location

In Android 11, the media control UI is managed entirely by SystemUI. The source code responsible for the Quick Settings media player, including its layout, data binding, and colorization, is located in the following directory:

/frameworks/base/packages/SystemUI/src/com/android/systemui/media/

The specific classes responsible for handling the media player UI and color styling are:

  • MediaControlPanel.java: This is the primary controller class that binds the media data (including the album art/thumbnail) to the player view. It contains the logic for extracting colors from the artwork and applying them to the background and controls.
  • MediaDataManager.kt: Manages the loading of media notifications and artwork bitmaps.

How to Find It on Android Code Search (cs.android.com)

Because the master branch of AOSP constantly evolves, searching directly on cs.android.com can sometimes hide older Android 11 implementation details. To view the exact Android 11 code, follow these steps:

  1. Go to cs.android.com.
  2. In the search bar, specify the Android 11 branch (e.g., android-11.0.0_r1) by using the ref filter.
  3. Search for the file path directly:
    file:packages/SystemUI/src/com/android/systemui/media/MediaControlPanel.java

How Color Extraction Works in Android 11

If you compare the behavior of Android 9/10 with Android 11, you will notice that Android 11 media players have much more consistent background lightness, and the text colors are kept neutral (usually solid black or white) rather than being dynamically colored.

Here is how Android 11 achieves this look under the hood in MediaControlPanel.java:

1. Palette Color Extraction

When new media metadata is received, the system extracts a color palette from the album artwork bitmap using the Jetpack Palette library. However, instead of using the raw dominant color directly (which can lead to harsh contrast issues), the system processes the extracted color.

2. Enforcing Consistent Lightness and Saturation

To prevent the background from being too bright, too dark, or overly saturated, the system converts the extracted color to the HSL (Hue, Saturation, Lightness) color space. It then clamps the saturation and lightness values to predefined safe ranges. This guarantees that the background is always a soft, muted pastel version of the dominant artwork color.

3. Standardizing Text and Icon Contrast

Unlike Android 9, which dynamically colored the title and control buttons with accent colors extracted from the artwork, Android 11 simplifies this for readability. It checks the background color's luminance and applies a high-contrast neutral color (either dark charcoal or crisp white) to all text elements and playback control icons.