TeamNewPipe / NewPipe

A libre lightweight streaming front-end for Android.
https://newpipe.net
GNU General Public License v3.0
31.1k stars 3.02k forks source link

Fire OS 8 on FireTV: Allow enabling SAF (for file exports/imports) #10643

Open k9janer opened 9 months ago

k9janer commented 9 months ago

Checklist

Affected version

0.25.2

Steps to reproduce the bug

On a Fire TV Stick 4K Max 2nd Gen, it seems to be impossible to export/import settings as SAF can't be enabled on Fire TVs and without SAF, the app doesn't have the necessary permission.

This is possibly a side effect of the solution to my previous issue #6455.

This issue doesn't occur with FireOS 7 (Android 9) but it seems like FireOS 8 (Android 11) triggers it.

To reproduce:

You will see, that the file is not visible and can't be selected.

Now try to enable SAF to be able to select the file this way:

Other workarounds I tried don't seem to work either:

Expected behavior

It should be possible to use SAF on Fire TV if the non-SAF-path isn't viable.

If possible, please rework the solution in issue #6455 to EXCLUDE FireOS 8+ Fire TVs and allow them to use SAF.

Maybe it's not possible to navigate the SAF dialogue but it's still better to be able to navigate the menu with an external mouse then not beeing able to export/import settings AT ALL.

Actual behavior

No response

Screenshots/Screen recordings

No response

Logs

No response

Affected Android/Custom ROM version

Android 11 / FireOS 8.1.0.1

Affected device model

Fire TV Stick 4K Max (2nd Gen)

Additional information

No response

k9janer commented 9 months ago

Update: I'm no developer but I just tried it by broadly disabling the check for a Fire TV in app/src/main/java/org/schabi/newpipe/settings/NewPipeSettings.java

    public static boolean useStorageAccessFramework(final Context context) {
        // There's a FireOS bug which prevents SAF open/close dialogs from being confirmed with a
        // remote (see #6455).
        if (DeviceUtils.isFireTv()) {
            return false; -> return true;
        } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
            return true;
        }

Now SAF is enforced and the import works without an issue. :)

As feared, I couldn't browse directories in the file open dialogue, however thankfully the first time I tried it, it opened in the recent section and so I could easily pick the file. (The second time I tried it, it opened in the Download directory where I also had that same NewPipeData.zip file).

Maybe this Fire TV check should be refined and limited to pre-Android 10?

mangoheini commented 9 months ago

Update: I'm no developer but I just tried it by broadly disabling the check for a Fire TV in app/src/main/java/org/schabi/newpipe/settings/NewPipeSettings.java [...] Now SAF is enforced and the import works without an issue. :) [...]

I'm also affected. Losing my whole viewing history stops me from migrating to my new FireTV Stick 4k max (2nd gen). :-( Would be really nice to have this fixed.

@k9janer I'm even more no developer than you. What did you do exactly to test your findings and is this suitable as workaround on the firetv stick?

I noticed something else during my unsuccessful import attempts. If you export settings on the FireTV Stick 4k max (2nd gen), this file (next to the invisible one coming from my old stick) is then visible in the import window and the import seems to work. Even if you rename the file. However, I have not been able to move the contents of my old installation to Newpipe. Newpipe somehow "knows" its own exported file.

k9janer commented 9 months ago

Well, I just loaded the project in Android Studio, changed the file as stated and created a signed apk file. Then I copied that to a USB stick and connected that to the FireTV Stick with a USB Y splitter cable to be able to access and install it with Total Commander. You have to uninstall the original version of NewPipe beforehand however. I copied my export file the same way from the old FireTV Stick to the new one. I haven't found a way to import settings without compiling a new version of NewPipe as all the workarounds I have tried (renaming the file, sharing it to NewPipe from a file manager) failed.

Instead of using an USB Y cable I guess you could also just upload the files somewhere but entering urls is painful with a remote.

However I noticed, that both NewPipe and STN crash because they keep running out of memory - NewPipe when updating my massive subscription list as it reaches channel ~180 and STN has to recover from an out of memory issue every few minutes or so with a 4K video.

To be honest, I have given up on the Fire TV Stick 4K Max 2nd Gen. It's version of Android 11 is just too buggy for me. I usually share videos from NewPipe to STN for the superior playback capabilities (HDR, framerate switching and so on) but the sharing menu is completely broken on FireOS 8. Also the SAF dialogue still can't be navigated and is now mandatory, there are the out of memory issues (maybe they are my fault though) and the device can't even adb debugg itself anymore so I can't easily disable apps with App Manager.

So I just returned back the the original 4K Max for now. It would be nice to have a device with Android 11 instead of the ancient Android 9 for security and app compatibility purposes but it's just not worth it with all the issues.

mangoheini commented 8 months ago

@k9janer Thank you so much for your detailed answer. Wasn't able to respond earlier because of an acute covid infection in my family.

Thanks for describing your steps but as you might expect, patching and compiling each NewPipe version on my own is not a thing I want to learn right now. ^^ I'll keep an eye on this issue and stay with my 4K Max (gen1) for the time being.

Please excuse my off topic question: I know App Manager. Have used it on other Android devices in the past but never thought of Firetvs. Is there a list of Apps available somewhere, that can be disabled safely on the 4K Max (gen1)? FireTVs need to be debloated more than any other device.

k9janer commented 8 months ago

Compiling your own version of NewPipe is really easy though. :) I didn't even follow any guides, I just imported the project into Android Studio, changed the code snippet and created an apk. The program is pretty beginner friendly considering all its possibilities and there are no hurdles like dependencies or the like that I had to solve.

Regarding debloating, on my 4K Max 1. Gen I just disabled all the AMAZON SPECIFIC stuff, that didn't seem important like Amazon Kids, Whisper Sync, Alexa, Amazon Shopping, Device Metrics, IMDB, Freeview and so on. Be careful with CORE ANDROID stuff like the Web View and the like as this will likely break the OS. You can then block the remaining ads and tracking with a VPN app like NetGuard or RethinkDNS.

Looks like there is also a debloat toolbox you could use if you trust that app.