Skip to content

MediaLibraryService can't reject System UI playback resumption notification on API 30 #355

Closed

Description

@marcbaechinger

Media3 Version

Media3 1.0.1

Devices that reproduce the issue

All devices on API 30

Devices that do not reproduce the issue

Devices on API below 30 and above API 30

Reproducible in the demo app?

Yes

Reproduction steps

To reproduce the issue, please follow these steps:

  • Launch the demo-session app.
  • Start playing any media.
  • Press the pause button.
  • Press the home button to exit the app.
  • Clear all apps from the recent apps list.
  • Attempt to play media from the stale notification by pressing the play button.
  • Wait for the error to occur in logcat.

See https://developer.android.com/guide/topics/media/media-controls#mediabrowserservice_implementation

Expected result

The System UI playback resumption notification is not shown.

Actual result

There is a System UI playback resumption notification after the demo app has been treminated.

It's currently not possible to do that with MediaLibraryService on API 30.

On API 30, allowing to connect a browser the MediaBrowserService seems sufficient for posting a playback resumption notification. onLoadChildre/onGetChildren is never called with package com.android.systemui:

04-25 08:19:18.466 10159   995   995 D MediaResumeListener: Checking for service component for androidx.media3.demo.session
04-25 08:19:18.467 10159   995  1093 D MediaResumeListener: Testing if we can connect to ComponentInfo{androidx.media3.demo.session/androidx.media3.demo.session.PlaybackService}
04-25 08:19:18.676 10175 10479 10479 D resumption: onConnect(): androidx.media3.demo.session
04-25 08:19:18.692 10175 10479 10479 D resumption: onPostConnect(): androidx.media3.demo.session
04-25 08:19:18.765 10175 10479 10479 D resumption: onConnect(): com.android.systemui
04-25 08:19:18.768 10175 10479 10479 D resumption: onGetLibraryRoot(): com.android.systemui
04-25 08:19:18.769 10159   995  1093 D ResumeMediaBrowser: connected
04-25 08:19:18.769 10159   995  1093 D MediaResumeListener: yes we can resume with ComponentInfo{androidx.media3.demo.session/androidx.media3.demo.session.PlaybackService}

On API 31, the browser with com.android.systemui insists in calling onLoadChildren/onGetChildren and checks whether there is a playable child.

04-25 08:14:04.449 10137  1030  1030 D MediaResumeListener: Checking for service component for androidx.media3.demo.session
04-25 08:14:04.450 10137  1030  1135 D MediaResumeListener: Testing if we can connect to ComponentInfo{androidx.media3.demo.session/androidx.media3.demo.session.PlaybackService}
04-25 08:14:04.658 10154 15670 15670 D resumption: onConnect(): androidx.media3.demo.session
04-25 08:14:04.667 10154 15670 15670 D resumption: onPostConnect(): androidx.media3.demo.session
04-25 08:14:04.747 10154 15670 15670 D resumption: onConnect(): com.android.systemui
04-25 08:14:04.749 10154 15670 15670 D resumption: onGetLibraryRoot(): com.android.systemui
04-25 08:14:04.751 10137  1030  1135 D ResumeMediaBrowser: Service connected for ComponentInfo{androidx.media3.demo.session/androidx.media3.demo.session.PlaybackService}
04-25 08:14:04.751 10137  1030  1135 D MediaResumeListener: Connected to ComponentInfo{androidx.media3.demo.session/androidx.media3.demo.session.PlaybackService}
04-25 08:14:05.106 10154 15670 15670 D resumption: onGetChildren(): com.android.systemui
04-25 08:14:05.142 10137  1030  1135 D ResumeMediaBrowser: Child found but not playable for ComponentInfo{androidx.media3.demo.session/androidx.media3.demo.session.PlaybackService}
04-25 08:14:05.142 10137  1030  1135 E MediaResumeListener: Cannot resume with ComponentInfo{androidx.media3.demo.session/androidx.media3.demo.session.PlaybackService}

Media

Any media of the session demo app

Bug Report

Activity

  1. changed the title [-]MediaLibraryService can't reject SYstem UI playback resumption notification on API 30[/-] [+]MediaLibraryService can't reject System UI playback resumption notification on API 30[/+] on Apr 25, 2023
  2. marcbaechinger commented on Apr 25, 2023

    @marcbaechinger
    ContributorAuthor

    For Media3 1.0.1 there is no fix besides not adding

    <action android:name="android.media.browse.MediaBrowserService"/>
    

    to the intent filter of the MediaLibraryService. Please note that when android.media.browse.MediaBrowserService is not added clients like Android Auto can not discover the service either.

    We are working on a fix for this.

  3. locked and limited conversation to collaborators on Aug 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions