Fleker / CumulusTV

Android TV Live Channel Plugin with user-entered stream files
MIT License
185 stars 72 forks source link

Fix "Channel HashMap is null" on wake up #293

Closed ryao closed 6 years ago

ryao commented 6 years ago

If you turn "off" a Sony Bravia TV while watching a Live Channel provided by Cumulus TV, wait a while and turn it back on, an error prompt about "Channel HashMap is null" will appear and the channel will fail to display.

That is caused by a race condition in the channel database where an external caller will initialize a hashmap asynchronously via getInstance() and then immediately use it, typically before the hashmap has initialized. This race might not cause a problem with only one or two channels, but if you have a dozen, then it becomes a problem.

This had been driving my mother crazy, so I took a few minutes to track down the bug, fix it, recompile and install the recompiled version. THe recompiled version has run without a single "Channel HashMap is null" error for a week, so I believe that it is okay.

Sadly, the recompiled version breaks Google Drive integration, but I imagine that is because I do not know how to build it properly such that it will accept a app/google-services.json rather than any real regression.

Lastly, the project's license is unclear. I had been very hesitant to upstream a fix to a project without clarification on the license used by the project. After some soul searching, I have decided to publish this patch under the terms of either the Apache 2.0 or MIT licenses. If the project lead wishes to fix the unclear licensing with a different OSS license, I would likely be happy to follow suit. However, this fix itself is so small that I doubt it qualifies for copyright protection, so the license under which I choose to release it is likely a moot point unless I start sending more patches.

Signed-off-by: Richard Yao ryao@gentoo.org

ryao commented 6 years ago

@Fleker Just a FYI, it might interest you to know that your project attracted contributions from a non-Android developer. This is my first patch to any Android project. It is also my first patch to any Java project.

People who know me generally do not know that I know Java. It is something that I had intentionally omitted from my resume. Had my mother not motivated me to write this patch, I would have taken that fact to the grave, but the secret is out now, so c'est la vie. :)

gritstub commented 6 years ago

The "Channel HashMap is null" issue also affects Nvidia Shield TV in the same way as described in the bug.

nextux commented 6 years ago

@Fleker This would be great to implement. CumulusTV is unusable without it on a Sony TV at the moment.

JasGill commented 5 years ago

Where can I get an apk with this fix? Thanks.