TeamNewPipe / NewPipe

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

History OFF dumps tons of cache images/data to getExternalCacheDir() #10442

Open alpenamilch opened 1 year ago

alpenamilch commented 1 year ago

Checklist

Feature description

At the moment even with history OFF, tons of thumbnails/other video-data is dumped togetExternalCacheDir(). This is usually STORAGE/Android/data/org.schabi.newpipe. See This is accessible easily on an unlocked phone.

One possibility is to replace this

--- a/app/src/main/java/org/schabi/newpipe/player/helper/PlayerDataSource.java
+++ b/app/src/main/java/org/schabi/newpipe/player/helper/PlayerDataSource.java
@@ -200,7 +200,7 @@ public class PlayerDataSource {

     private static void instantiateCacheIfNeeded(final Context context) {
         if (cache == null) {
-            final File cacheDir = new File(context.getExternalCacheDir(), CACHE_FOLDER_NAME);
+            final File cacheDir = new File(context.getCacheDir(), CACHE_FOLDER_NAME);
             if (DEBUG) {
                 Log.d(TAG, "instantiateCacheIfNeeded: cacheDir = " + cacheDir.getAbsolutePath());
             }

This would mean instead of using /data/ - this is not easily accessible.

Why do you want this feature?

Privacy for viewer

Additional information

My idea would be

opusforlife2 commented 1 year ago

You could clear the app cache from the History menu after you're done using Newpipe?

alpenamilch commented 1 year ago

Yes, I do agree. That is a good idea. Usually I go and clear everything from App->Info-> Clear all.

What I observe is that: I now have "Watch History" disabled - This gives a feeling I am in incognito but things are dumped to disk.

opusforlife2 commented 1 year ago

I suppose we could have a setting below the Clear Cache button to "Always clear cache upon exiting Newpipe", or something to that effect.

SameenAhnaf commented 1 year ago

How is it different from https://github.com/TeamNewPipe/NewPipe/issues/2338?

opusforlife2 commented 1 year ago

The entire point of opening this issue is that cache data is being left behind despite history being off.

That issue is merely asking for a GUI convenience feature. This one is asking to tighten up data privacy.

alpenamilch commented 1 year ago

by dev nulling the cache directory)

Which phone? In phones with 1-2 RAM, I have found not having cache directory causes the device to freeze a lot. (I mean works great on a > 8 GB RAM phone but...)

alpenamilch commented 1 year ago

Try it on a Android Go device with 2GB eMMC - example Nokia 1.3 or Nokia 1.4 . If not using externalCacheDir - it dumps everything in /data/data or somewhere like that - this place is already having lots of things.

3 gig old device

like a flagship?

alpenamilch commented 1 year ago

You are correct. I did not think of /dev/null from linux.

I thought you were talking about developers nulling it in builds or something like that. Is it not possible to replace the getExternalCacheDir by /dev/null in code?

final File cacheDir = new File(context.getExternalCacheDir(), CACHE_FOLDER_NAME);