NewPipe icon indicating copy to clipboard operation
NewPipe copied to clipboard

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

Open k9janer opened this issue 2 years ago • 7 comments

Checklist

  • [X] I am able to reproduce the bug with the latest version given here: CLICK THIS LINK.
  • [X] I made sure that there are no existing issues - open or closed - which I could contribute my information to.
  • [X] I have read the FAQ and my problem isn't listed.
  • [X] I have taken the time to fill in all the required details. I understand that the bug report will be dismissed otherwise.
  • [X] This issue contains only one bug.
  • [X] I have read and understood the contribution guidelines.

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:

  • Copy a settings file to your Fire TV (e.g. to /storage/emulated/0/NewPipe/NewPipeData.zip)
  • Install NewPipe
  • Go to sidebar - Settings - Content - Import database
  • Try to locate the file

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:

  • Go to sidebar - Settings - Download
  • You will see that it says "Starting from Android 10 only SAF is supported" but the toggle is turned off and it can't be enabled.

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

  • Using Total Commander to share the NewPipeData.zip file with NewPipe causes an error. NewPipe seems to only expect urls this way.
  • Renaming the NewPipeData.zip file to NewPipeData.zip.png DOES make it visible and allows me to proceed to the "This will override your current setup" dialogue, but NewPipe then refuses the file with a "No valid ZIP file" error message.

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 avatar Dec 09 '23 12:12 k9janer

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?

k9janer avatar Dec 09 '23 13:12 k9janer

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.

mangoheini avatar Dec 24 '23 03:12 mangoheini

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.

k9janer avatar Dec 24 '23 17:12 k9janer

@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.

mangoheini avatar Jan 08 '24 01:01 mangoheini

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.

k9janer avatar Jan 12 '24 20:01 k9janer

Coming here from my recent issue as it seems to be a duplicate.

The one thing is that I can export my config to a file even on the Gen 2 and I can load that same file back in but the issue comes from a file that I have transferred from another device and those are invisible to the app.

IMMalebolgia avatar Nov 06 '24 05:11 IMMalebolgia

As per discussion with @Stypox through chat, this issue has been added to project 0.28.0 & labeled good first issue so that someone from dev community takes it up. It would be a simple change, may come from this comment above.

ShareASmile avatar May 18 '25 18:05 ShareASmile

@k9janer @mangoheini @IMMalebolgia could you test the APK provided in this PR? https://github.com/TeamNewPipe/NewPipe/pull/12642

Stypox avatar Sep 17 '25 10:09 Stypox

Let me locate the correct device and I will test it out. I stopped using that version of FireStick due to the lack of import capability so happy to check it out.

IMMalebolgia avatar Sep 18 '25 03:09 IMMalebolgia

@IMMalebolgia have you managed to get hold of that device? :-)

Stypox avatar Sep 30 '25 15:09 Stypox

@Stypox I was just thinking last night that I need to do another search for it, did a lot of cleaning as we had houseguests so a ton of stuff got moved. Will look again today.

IMMalebolgia avatar Sep 30 '25 17:09 IMMalebolgia

@Stypox Found it. Installing the new version took a little more effort as I could not download the zip directly through the Fire Stick. Had to FTP the extracted apk and now I cannot navigate to the correct folder via the remote so charging up the bluetooth keyboard I use with it. Also installing all FireOS updates so will have some information soon.

IMMalebolgia avatar Sep 30 '25 20:09 IMMalebolgia

@Stypox Ok, did some testing. Good news is that I am able to import a full backup that I created and then FTP uploaded to the FireStick. Bad news is that navigating to the correct file is very cumbersome as it cannot be done via the remote or even a mouse. I had to make sure the export was in the directory that the NewPipe import screen defaults to and use a keyboard's TAB and arrow keys in order to randomly cycle through and stumble on the archive I wanted. I cannot change directories or even navigate up to the option to try and select a new directory using the remote, keyboard or mouse.

It seems I cannot select files I previously uploaded via FTP but due to not being able to navigate to other directories I cannot confirm that behavior. Let me know if you need any more details.

IMMalebolgia avatar Sep 30 '25 21:09 IMMalebolgia

Ok, thank you very much for testing! I think what you are describing is what I expected: NewPipe now uses SAF to access files, so I will merge #12642. As seen in #6455 and elsewhere, Amazon's SAF file picker implementation is very poorly done unfortunately, that's why you had trouble navigating to the correct file.

Stypox avatar Oct 01 '25 14:10 Stypox