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 notification action buttons #10567

Conversation

nico-abram
Copy link

What is it?

  • Bugfix (user facing)
  • Feature (user facing)
  • Codebase improvement (dev facing)
  • Meta improvement to the project (dev facing)

Description of the changes in your PR

  • Made MediaSessionPlayerUi.sessionConnector public
  • Only return ACTION_SKIP_TO_NEXT and ACTION_SKIP_TO_PREVIOUS in getSupportedQueueNavigatorActions for android < 13
  • Set custom actions using sessionConnector.setCustomActionProviders for android >= 13

Before/After Screenshots/Screen Record

  • Before:
    imagen
  • After:
    280436537-736300f3-35a0-45e0-8c18-b7684cf10cde

Fixes the following issue(s)

APK testing

The APK can be found by going to the "Checks" tab below the title. On the left pane, click on "CI", scroll down to "artifacts" and click "app" to download the zip file which contains the debug APK of this PR. You can find more info and a video demonstration on this wiki page.

Due diligence

I don't really do much java, used a one-element array as a hacky way of getting an out parameter. The two other questionable things that come to mind are making sessionConnector public and maybe the ternary operator usage in getSupportedQueueNavigatorActions.
I have not tested this on android <13 since I don't have on on hand at the moment.

Stypox added a commit to Stypox/NewPipe that referenced this pull request Nov 16, 2023
Use a workaround initially suggested in TeamNewPipe#10567
Basically tell the system that we're not able to handle "prev" and "next", in order to have 4 customizable action slots instead of just 2
On Android 13+ normal notification actions are useless, so they are not set into the notification builder anymore, to save battery
The opposite happens on Android 12-, where media session actions are not set because they don't seem to do anything
@Stypox
Copy link
Member

Stypox commented Nov 16, 2023

Thank you very much for trying out this workaround! I improved the code and opened another PR which supersedes this one, see #10580. Could you take a look at that to make sure I didn't miss anything? :-)

@Stypox Stypox closed this Nov 16, 2023
@nico-abram
Copy link
Author

@Stypox Looks good to me! Thanks.

Stypox added a commit to Stypox/NewPipe that referenced this pull request Dec 23, 2023
Use a workaround initially suggested in TeamNewPipe#10567
Basically tell the system that we're not able to handle "prev" and "next", in order to have 4 customizable action slots instead of just 2
On Android 13+ normal notification actions are useless, so they are not set into the notification builder anymore, to save battery
The opposite happens on Android 12-, where media session actions are not set because they don't seem to do anything
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Android 13+] Missing notification player actions
2 participants