Skip to content

Some metadata fields amongst [author, writer, composer, description] are not forwarded in some LegacyConversions actions #3018

@psam44

Description

@psam44

Version

Media3 1.9.0

More version details

No response

Devices that reproduce the issue

NA

Devices that do not reproduce the issue

No response

Reproducible in the demo app?

Not tested

Reproduction steps

NA

Expected result

  1. In LegacyConversions.convertToMediaDescriptionCompat(), when displayTitle is not set, the fallback tries to find three non-null properties named in MediaMetadataCompat.PREFERRED_DESCRIPTION_ORDER, which has 9 entries.
    Unfortunately, the associated mapper getText() considers only 7 cases.
    These are missing:
      case MediaMetadataCompat.METADATA_KEY_AUTHOR:
        return metadata.author;
      case MediaMetadataCompat.METADATA_KEY_DISPLAY_DESCRIPTION:
        return metadata.description;

This is a potential lack for a com.android.car.media.BrowseViewController consumer.

  1. In LegacyConversions.convertToMediaMetadataCompat(), these are missing:
    if (metadata.author != null) {
      builder.putText(MediaMetadataCompat.METADATA_KEY_AUTHOR, metadata.author);
    }
    if (metadata.writer != null) {
      builder.putText(MediaMetadataCompat.METADATA_KEY_WRITER, metadata.writer);
    }
    if (metadata.composer != null) {
      builder.putText(MediaMetadataCompat.METADATA_KEY_COMPOSER, metadata.composer);
    }

These lacks have an impact for a com.android.car.media.common.ui.PlaybackCardController consumer.
In android.support.v4.media.MediaMetadataCompat.getDescription(), when the key METADATA_KEY_DISPLAY_TITLE is absent, three fallback keys are looked for in PREFERRED_DESCRIPTION_ORDER, which has 7 entries and notably these:

            METADATA_KEY_WRITER,
            METADATA_KEY_AUTHOR,
            METADATA_KEY_COMPOSER

Note: METADATA_KEY_DISPLAY_SUBTITLE and METADATA_KEY_DISPLAY_DESCRIPTION are not mentioned here (anyway, v4.media or androidx.media are deprecated), contrary to the similar androidx.media3.session.legacy.MediaMetadataCompat.PREFERRED_DESCRIPTION_ORDER, but this is conformant to android.media.MediaMetadata.PREFERRED_DESCRIPTION_ORDER, so it should be correct.

Actual result

NA

Media

NA

Bug Report

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions