Jump to content

No album art, track progress lost after returning from sleep - Android car head unit


slizzap

Recommended Posts

The head unit is a Joying JY-UQ128N4G running their latest firmware (Android 12 - 2022-8-15). Poweramp version is "build-939-bundle-play" (Full Version - 64-bit). FLAC files stored on a USB flash drive.

Poweramp is installed on my Joying head unit. I'll play music with album art and meta info displaying without issue. When I turn off my car (Joying goes into sleep mode) and later return to it, it typically behaves in one of two ways:

  1. Album art is missing, but meta info (artist, album, track) is displaying. Swiping down to access library or left/right to change tracks typically does not work. Workaround: Click on the library button in the navbar, then click on the now playing bar to return to the main interface. Album art displays again and I can swipe to interact as expected.
  2. Album art is missing, but meta info (artist, album, track) is displaying. Swiping down to access library works, but going back does not fix anything. Swiping left/right shows album art for the next/previous track, but not current. After skipping around a few tracks and going back to the original, it will display the artwork again.

Side note: It also typically loses track of the position of the currently playing track. I suspect this is all tied in to the same underlying cause, but may as well focus on one thing at a time.

I've done the following in attempt to fix the problem:

  • In the Library section I turned off all automatic scans after plugging in new device. My logic was that returning from sleep mode was seeing the USB drive re-attached and potentially re-scanning causing a delay in reading the info. These changes did not help.
  • Turned on the option to wait for USB storage before resume playing. Did not see any change in behavior either way.

My best guess is that Poweramp was not designed with a head unit in mind or having the tablet/device go into sleep mode that it has to recover from. Part of sleep mode is that the USB drive gets detached, and this may be part/all of the problem. I wonder if Poweramp kept track of what specific track was playing and where it was in the track and cached all the info (album art, meta info) when sleep mode was triggered, it could easily recover. As a side note, more often than not I'm finding that regardless of where I am in the current track, it typically either puts playback at 0:00 in the current track, or starts with the very next track in the list.

Let me know if there is any logging information I can provide to help support these claims or assist in troubleshooting.

Thanks.

Edited by slizzap
Link to comment
Share on other sites

  • 10 months later...

Adjusted title of post to reflect both issues caused by this problem.

I wanted to provide some additional detail for changes I've made and further troubleshooting attempted. A few months back I upgraded the firmware of my head unit, which caused a full Android reset back to factory settings. I basically started from scratch with a brand new Poweramp and YAPS build. This time I was determined to find a fix for why I was being forced to use file access Legacy Mode, as the other mode simply would not see my files. I understand that Legacy Mode is going away, so I wanted to figure this out as well. Ultimately I fixed the issue and was able to use the default mode. However, once doing so, the orignal reported problem above got so much worse. When the head unit came out of sleep mode (i.e. I started the car), I saw a minimum of 3 problems in various times:

  1. Album artwork lost with no way to recover. Workarounds listed above did not work in this mode.
  2. Track progress lost
  3. Entire library lost multiple times, caused frequent re-scans, and sometimes a change in number of songs detected

All of this forced me to revert back to Legacy Mode. So the first thing I want to say here is "PLEASE do not remove Legacy Mode from Poweramp!!"

With that being done and reverting back to Legacy Mode, it's working better, which is to say I'm back to square one with my original post. The album art being lost is an annoyance, and I'm used to performing my workaround everytime I start the car. What's more annoying is that the track progress is lost...it either resets back to the start of the track, or skips to the next track while flashing a quick message stating something like "failed to play back item". Again, I could be wrong, but this all seems to point to Android disconnecting the USB storage while in sleep mode and/or Poweramp not being able to handle that accordingly.

Any suggestions? Is a fix possible? Is there another way to look at this for resolution?

Thanks.

Edited by slizzap
Link to comment
Share on other sites

The DL;DR here seems to be that either (1) your device is powering down without giving Poweramp enough time to save its status, or (2) when the device powers up again, it is not mounting the USB storage quickly enough before Poweramp commences its storage scan. 

For (1) it could also be that the unit is not sending a standard shutdown intent, which you may be able to re-configure for Poweramp in PA Settings=>Misc=>Shutdown Intent.

For (2) try turning off Auto-Scan in PA Settings=>Library=>Scanner. Make sure an entire initial Full Rescan process has been fully completed before turning the unit off. Also if you have 'Resume on Start' enabled in PA Settings=>Audio=>Audio Focus, try also enabling 'Wait For Storage'.

Andre

Link to comment
Share on other sites

On 8/25/2023 at 6:01 PM, andrewilley said:

The DL;DR here seems to be that either (1) your device is powering down without giving Poweramp enough time to save its status, or (2) when the device powers up again, it is not mounting the USB storage quickly enough before Poweramp commences its storage scan. 

For (1) it could also be that the unit is not sending a standard shutdown intent, which you may be able to re-configure for Poweramp in PA Settings=>Misc=>Shutdown Intent.

For (2) try turning off Auto-Scan in PA Settings=>Library=>Scanner. Make sure an entire initial Full Rescan process has been fully completed before turning the unit off. Also if you have 'Resume on Start' enabled in PA Settings=>Audio=>Audio Focus, try also enabling 'Wait For Storage'.

Andre

(1) What exactly is the purpose behind this shutdown intent option? Is this supposed to shutdown PA when the head unit goes to sleep mode? That's not what I would want here, as that means when I restart the car PA isn't running and it would put me at the home screen, and then I'd have to manually start my music again. If I'm misunderstanding the purpose here, and it's beneficial to test, I can do so. With that said, I haven't tried this, and I have no idea what text to enter into this box for testing. I don't think this is the solution I'm looking for, but willing to try.

(2) Of the options you listed, the only one I hadn't disabled again was Auto-Scan. I turned that off and went back to the native file mode instead of legacy, and the behavior is the exact same. When the head unit comes back on the album art is lost and it skips to the next track. In native file mode there's no workaround for getting the album art back. Also, if I skip ahead, future tracks have art, and if I skip backward, all previous tracks lost their artwork. File Access Legacy Mode certainly works better here simply because there's a manual workaround to recover the artwork as stated in my previous post, and it only affects 1 track. But neither are really working properly here.

Resume on Start was already enabled, as was Wait for Storage. I also have the "Pause on Screen Off" experimental option enabled.

Only new info I can add here is when I disabled File Access Legacy Mode, re-added the folders, rescanned my USB flash drive, and ensured auto-scan was off, I then tested turning the head unit on/off multiple times. First test I removed the key, waited 15 seconds, then reinserted and went to accessory mode to turn on the head unit. The artwork was fine and the track continued from where it left off. I turned and removed the key, waited 30-45 seconds, and did the same test with the same results. Then I turned and removed the key, waited 10 mins, and this time it said "Failed to play item" and skipped to the next track. Album artwork was gone for it and all previous tracks, but skipping ahead to future tracks would show the artwork.

It seems to me that the "Wait for Storage" option isn't actually waiting for the storage. Is it possible this wasn't designed with "USB" storage in mind?  I'm at a loss as to why the artwork would disappear. I've reverted back to enabling and using File Access Legacy Mode.

Any other thoughts or suggestions? Let me know if you'd like any debug logs.

Thanks.

Edited by slizzap
Link to comment
Share on other sites

  • 2 weeks later...
On 9/1/2023 at 10:01 AM, w3wilkes said:

Do you have Look and Feel-> Notifications->Keep Service  enabled? Don't know if it will help, but it's supposed to keep PA service loaded when idle.

"Keep Notification" and "Always Keep Notification" are both enabled.

"Remove Notification on Disconnection" is disabled and sounds like it doesn't apply here. But should I try enabling it?

Link to comment
Share on other sites

Keep service obviously won't help as headunits like to shutdown completely and kill apps (almost) without the notice.

There is a standard "shutdown" Android broadcast message android.intent.action.ACTION_SHUTDOWN which alows apps to store the state before device is switched off.

On the earlier days of Android headuinits, some OEM modified that for some reason to something like OEM_NAME.intent.action.ACTION_SHUTDOWN and the next OEM which used the same firmware/source, modified it further to OEM_NAME2.intent.action.ACTION_POWER_OFF, etc., etc. and now each headunit OEM has own SHUTDOWN intent variant - just due to that original headunit firmware developer who modified the system intent name and the every next OEM2-3-4 using global find/replace for "OEM" to "OEM2-3-4" in sources.

If you don't know the shutdown intent for your headunit, try to write "android.intent.action.SCREEN_OFF" (no quotes) in Settings / Misc / Shutdown Intent. Provided that headunit switches off screen when it's powered off, that may help.

Link to comment
Share on other sites

10 hours ago, slizzap said:

There is no such setting. That's why I figured you were referring to the 3 settings I listed above.

My About shows I'm on version build-957-bundle-play

Keep Service. You need to scroll the Notifications screen down to reveal the Keep Service item.

Link to comment
Share on other sites

On 9/12/2023 at 11:46 AM, andrewilley said:

That option used to be in Settings=>Misc. Are you using an older version of Poweramp?

Andre

My version (957) has it located where you stated. I have enabled this setting and kept an eye on it for a couple days.

Early indications are that it fixed 1 of the 2 problems related to this. Since enabling this setting, when turning on my car, the album artwork remains...I haven't yet seen that default placeholder when there's no cover. So that's looking positive.

The remaining problem is that it is still not retaining the place in the song. I don't recall offhand if it's resetting to the beginning of the song or skipping to the next song. It was inconsistent before. I'm going to keep monitoring, and I'll keep a closer eye on both.

Thanks for the suggestion.

Link to comment
Share on other sites

On 9/13/2023 at 11:44 PM, slizzap said:

Early indications are that it fixed 1 of the 2 problems related to this. Since enabling this setting, when turning on my car, the album artwork remains...I haven't yet seen that default placeholder when there's no cover. So that's looking positive.

After monitoring for the past week, I can say that this has not resolved the issue, but has certainly greatly reduced the occurrences. I think this has happened to me twice since enabling that setting, and that's out of the dozen plus times I've used my car in the past week. Even though it's still happening, a couple times is definitely a LOT nicer than this happening every single time I start the car.

Link to comment
Share on other sites

42 minutes ago, andrewilley said:

The song position is saved when PA is sent a shutdown command from Android, if the power is being cut before that occurs then the position won't be saved. Try pausing playback and exiting the app manually, then turn off the device power.

Andre

I can try this for testing, but is there a way around this? Not sure how to play around with the shutdown intent setting that was mentioned. Even if this solved my problem by manually pausing the song, that really defeats the purpose of using this as a replacement for a typical head unit where this isn't a problem.

I'm also going to look at an option in the head unit that sounds like it prevents the unit from going to sleep. I'm going to have to use this cautiously as I don't want my battery to die. So I'll have to monitor battery usage. Less of an issue since I drive so regularly, but a concern nonetheless.

Link to comment
Share on other sites

2 hours ago, slizzap said:

I can try this for testing, but is there a way around this? 

If, as we are suspecting, your headunit is shutting down without sending Poweramp an agreed shutdown intent, or worse simply cutting the power instantaneously, there's nothing much that can be done from the app side.

Andre

Link to comment
Share on other sites

10 minutes ago, andrewilley said:

If, as we are suspecting, your headunit is shutting down without sending Poweramp an agreed shutdown intent, or worse simply cutting the power instantaneously, there's nothing much that can be done from the app side.

Andre

In case this helps, the head unit is not shutting down...it's going into a sleep mode. It only shuts down when I manually do so like a full reset for some reason, or if the power is lost such as the battery getting disconnected for some type of maintenance.

A full system reset takes somewhere around 45 seconds and shows all the boot screens as the launcher loads, and I would notice this if it were happening. When I start the car, it takes about 3-4 seconds for it to resume and Poweramp is still running.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...