Git Product home page Git Product logo

Comments (11)

ryanheise avatar ryanheise commented on June 3, 2024 1

Thanks, sounds like an incompatibility in the Oppo version of Android 13. I can work around that with some conditional code. I'll create a fix for you after I finish upgrading my system.

from audio_service.

ryanheise avatar ryanheise commented on June 3, 2024 1

See:

https://developer.android.com/about/versions/13/behavior-changes-13

Prior to Android 13, the system displayed up to five actions from the MediaStyle notification in the order in which they were added. In compact mode—for example, in the collapsed quick settings—up to three actions specified with setShowActionsInCompactView() were shown.

Starting with Android 13, the system displays up to five action buttons based on the PlaybackState as described in the following table. In compact mode, only the first three action slots will be displayed. 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.

from audio_service.

ryanheise avatar ryanheise commented on June 3, 2024 1

So my reasoning for this fix, according to the Android documentation quoted above, is that all new apps should be targeting at least SDK version 33 or higher (it is now required by Google Play), which means that setShowActionsInCompactView would never be used anyway for all "new" apps published from this point onwards at least WHEN they are run on devices with Android 13. If run on a device with an older version of Android, my reading of those paragraphs is that setShowActionsInCompactView "would" be used in that situation.

So the current fix is simply to check if the device is running Android 13 and if it is, then it skips the call to setShowActionsInCompactView, which also happily deals with the Oppo bug.

I have had a report from another developer that this fix worked on their Oppo: ryanheise/just_audio#1056

But so far, we have only tested this fix on Oppo with Android 13, not Oppo with older versions of Android, so we don't know if it would crash on older Oppos. I have tested it on older Pixel phones and there was no crash, but I don't have the data on old Oppos. But since this bug was never reported before until recently, maybe it's safe to assume that Oppo with older versions of Android were working fine, and it's just the Android 13 version for Oppo that has the bug.

from audio_service.

ryanheise avatar ryanheise commented on June 3, 2024

I haven't had a chance to run your project yet, but the error doesn't look like a bug. audio_service will throw exceptions if it is not used in accordance with the documentation, and so that is why in the first section of the bug report you are first asked to cross reference the behaviour with the documentation to show that you are using the API correctly.

My guess is that you passed in a compact action index that was out of bounds for the list of actions that you passed in.

from audio_service.

EArminjon avatar EArminjon commented on June 3, 2024

@ryanheise, I edited the example inside the post to show more.

My androidCompactActionIndices property has 2 indexes in accordance with the controls property list size.

from audio_service.

ryanheise avatar ryanheise commented on June 3, 2024

How about I just disable compact actions on Android 13 altogether, not just Oppo? I think the idea is that Android 13 is supposed to ignore the compact actions, so this should work. But do you have any Android 13 devices where the compact actions are being used?

If not, I have created a branch fix/oppo_android_13 with this approach.

from audio_service.

EArminjon avatar EArminjon commented on June 3, 2024

I didn't know how it should react on Android 13 :/
I can't affirm want you need to do, i'm sorry.

That's feel not a good solution to remove the option for all Android 13, except if documentation said that...
Also, I can't really test : i didn't have any oppo device. It was a crash in production and i found the issue using some stackoverflow post and some 'blind fix' (pushing to prod praying that it will fix the crash) ...

from audio_service.

ryanheise avatar ryanheise commented on June 3, 2024

Before merging this fix, I will need volunteers to test it on different devices both with Android 13 and pre Android 13. And according to the second paragraph above, also testing targeting Android 13 and pre Android 13.

from audio_service.

EArminjon avatar EArminjon commented on June 3, 2024

Agree with this :)

from audio_service.

ryanheise avatar ryanheise commented on June 3, 2024

The fix has now been published. Thank you for reporting the bug as well as the detail of the devices affected.

from audio_service.

github-actions avatar github-actions commented on June 3, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs, or use StackOverflow if you need help with audio_service.

from audio_service.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.