Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android 13+] Missing notification player actions #9764

Closed
6 tasks done
benazarenko opened this issue Feb 9, 2023 · 30 comments · Fixed by #10712
Closed
6 tasks done

[Android 13+] Missing notification player actions #9764

benazarenko opened this issue Feb 9, 2023 · 30 comments · Fixed by #10712
Labels
bug Issue is related to a bug device/software specific Issues that only happen on some devices or with some specific hardware/software player notification Anything to do with the MediaStyle notification

Comments

@benazarenko
Copy link

benazarenko commented Feb 9, 2023

Checklist

  • I am able to reproduce the bug with the latest version.
  • I made sure that there are no existing issues - open or closed - which I could contribute my information to.
  • I have read the FAQ and my problem isn't listed.
  • I have taken the time to fill in all the required details. I understand that the bug report will be dismissed otherwise.
  • This issue contains only one bug.
  • I have read and understood the contribution guidelines.

Affected version

0.25.0

Steps to reproduce the bug

Play any song,
Swipe down to see the notification player
Swipe the notification player, or just tap on it

Expected behavior

Next/previous track buttons, pause/play, repeat, close buttons are visible.

Actual behavior

Only next/previous track and play/pause buttons are visible. Changing it in preferences does nothing. Not mentioning that I have enough space to have all five of them.

Screenshots/Screen recordings

photo_2023-02-09_15-26-51

Logs

No response

Affected Android/Custom ROM version

Android 13

Affected device model

Galaxy M12

Additional information

No response

@benazarenko benazarenko added bug Issue is related to a bug needs triage Issue is not yet ready for PR authors to take up labels Feb 9, 2023
@AudricV
Copy link
Member

AudricV commented Feb 9, 2023

Likely related to this change when targeting Android 13: https://developer.android.com/about/versions/13/behavior-changes-13#playback-controls

I wonder why nobody found this change in the release candidate, as it is pretty easy to see.

@AudricV AudricV added device/software specific Issues that only happen on some devices or with some specific hardware/software player notification Anything to do with the MediaStyle notification and removed needs triage Issue is not yet ready for PR authors to take up labels Feb 9, 2023
@AudricV AudricV changed the title Missing notification player actions [Android 13] Missing notification player actions Feb 9, 2023
@mendhak

This comment was marked as duplicate.

@gqqjhffr

This comment was marked as spam.

@AudricV AudricV added the help wanted Help is wanted in fixing this issue label Feb 20, 2023
@AudricV AudricV changed the title [Android 13] Missing notification player actions [Android 13+] Missing notification player actions Feb 25, 2023
@AudricV AudricV pinned this issue Feb 25, 2023
@SameenAhnaf
Copy link
Collaborator

I don't think, this is exclusive to Android 13. My Tecno Spark Go running on Android 12 face the same bug

@opusforlife2
Copy link
Collaborator

Sometimes OEMs implement specific features from newer Android versions. Look at a few images of the A12 media notification and compare yours to them.

@mecuricat

This comment was marked as off-topic.

@malekairmaroc7

This comment was marked as duplicate.

@dvalter
Copy link

dvalter commented Jun 13, 2023

As a temporary workaround, targetSdk can be set back to 32 until transition to PlaybackSession is complete

@dvalter
Copy link

dvalter commented Jul 25, 2023

This totally depends on the skin (UI). Some skins adapt to the latest Material You guidelines, such as ZenUI, Moto devices, etc which has this issue bydefault. Some UIs like from BBK subsets, completely have their own notification implementation ever since they existed.

This issue is basically a stall, unless NP decides to comeup with You guidelines.

Now, as mentioned above by @AudricV, it's broken for all UIs that follow Google's A13 reference, so if support something, this is the most reasonable thing to support

@em-mw
Copy link

em-mw commented Jul 29, 2023

I don't think, this is exclusive to Android 13. My Tecno Spark Go running on Android 12 face the same bug

I am also facing this problem on my pixel 6 with graphene os (custom rom). I remember it worked fine untill I updated newpipe. I think I updated to 0.23 (long time ago) and till this day I still don't have the additional actions in the notification.

@AudricV AudricV unpinned this issue Jul 29, 2023
@dvalter dvalter mentioned this issue Jul 30, 2023
5 tasks
@Stypox Stypox pinned this issue Aug 2, 2023
@PaulWoitaschek
Copy link

I can probably help. Can you link in Code, where the custom actions are set up?

@AudricV
Copy link
Member

AudricV commented Aug 6, 2023

Player notifications are created currently in a custom way in the NotificationUtil class.

Also, keep in mind #9764 (comment). This mean the UI of the player notification settings needs to be adapted.

@opusforlife2
Copy link
Collaborator

@PaulWoitaschek Do you want this to be assigned to you?

@ghost

This comment was marked as duplicate.

@ghost

This comment was marked as off-topic.

@em-mw

This comment was marked as off-topic.

@DavidTV4

This comment was marked as off-topic.

@aminelazz

This comment was marked as duplicate.

@nico-abram
Copy link

Would the fix here be adding PlaybackState.CustomAction's to the list returned by PlaybackState.getCustomActions() ? Maybe also removing ACTION_SKIP_TO_PREVIOUS and ACTION_SKIP_TO_NEXT from the supported actions list to force it to use the custom actions for actions "2" and "3" too? Sorry, I'm not familiar with these APIs at all.

Alternatively,

For apps that don't target Android 13 or those that don't include a PlaybackState, the system will display controls based on the Action list added to the MediaStyle notification as described in the previous paragraph.

Would it be acceptable to not set the PlaybackState at all, in which case (If I'm reading these docs right) it will fall back to the same old behaviour?

I might mess around with this a bit if I can get it to compile and a dev env set up.

@nico-abram
Copy link

Got it to compile, realized the session playbackState is managed by exoplayer. I think setting custom actions on it then needs to be done on the MediaSession with MediaSessionConnector.CustomActionProvider and implementing MediaSessionConnector.CustomActionProvider

@nico-abram
Copy link

Just realized exoplayer is apparently deprecated?

Deprecated.
com.google.android.exoplayer2 is deprecated. Please migrate to androidx.media3 (which contains the same ExoPlayer code).

@nico-abram
Copy link

nico-abram commented Nov 4, 2023

I have a patch here nico-abram@7074d8a
It's not really clean enough to open a pull request, left a couple comments about the things I thought should be fixed before doing so, but it somewhat works:
imagen

If the general approach seems good enough I could clean it up and send a pull request

@dvalter
Copy link

dvalter commented Nov 11, 2023

@nico-abram thank for your attempt, hope it will get merged.

In addition A13 notifications seem to eliminate the whole at most three controls stuff, and the corresponding settings can be removed for A13+ to avoid confusion

@nico-abram
Copy link

Sent a PR #10567

@Stypox
Copy link
Member

Stypox commented Dec 23, 2023

Could you all test whether #10580 works for you? It is based on the work by nico-abram, so many thanks to him!

@rugk
Copy link

rugk commented Dec 23, 2023

@Stypox Can we get a built APK somehow or so for eas(ier) testing?

@opusforlife2
Copy link
Collaborator

@rugk The PR description tells you exactly how to download it.

@dvalter
Copy link

dvalter commented Dec 23, 2023

@Stypox, works well for me on LineageOS 20 (A13)

@Stypox
Copy link
Member

Stypox commented Dec 29, 2023

#10580 was superseded by #10712, sorry for asking again, but could you test that too? And thanks for testing so far :-)

@Stypox Can we get a built APK somehow or so for eas(ier) testing?

Yes, the PR description explains how to obtain the APK

@AudricV AudricV unpinned this issue Mar 30, 2024
dvalter added a commit to dvalter/NewPipe that referenced this issue May 6, 2024
Also changes behavior of A13+ player notification buttons.

Fixes TeamNewPipe#7880 and improves TeamNewPipe#9764
@lawson85

This comment was marked as off-topic.

@ShareASmile ShareASmile removed the help wanted Help is wanted in fixing this issue label Oct 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is related to a bug device/software specific Issues that only happen on some devices or with some specific hardware/software player notification Anything to do with the MediaStyle notification
Projects
None yet