CleanCacheWorker: delete all package files, not just *.apk
The installer can copy OTA .zip, *.obf, etc. there too. refs #1869
This commit is contained in:
parent
eb6ab1ec0a
commit
ce7d241196
@ -0,0 +1,5 @@
|
|||||||
|
package org.fdroid.fdroid.nearby;
|
||||||
|
|
||||||
|
public class LocalRepoManager {
|
||||||
|
public static final String[] WEB_ROOT_ASSET_FILES = {};
|
||||||
|
}
|
@ -64,7 +64,7 @@ public final class LocalRepoManager {
|
|||||||
private final AssetManager assetManager;
|
private final AssetManager assetManager;
|
||||||
private final String fdroidPackageName;
|
private final String fdroidPackageName;
|
||||||
|
|
||||||
private static final String[] WEB_ROOT_ASSET_FILES = {
|
public static final String[] WEB_ROOT_ASSET_FILES = {
|
||||||
"swap-icon.png",
|
"swap-icon.png",
|
||||||
"swap-tick-done.png",
|
"swap-tick-done.png",
|
||||||
"swap-tick-not-done.png",
|
"swap-tick-not-done.png",
|
||||||
|
@ -20,8 +20,11 @@ import org.apache.commons.io.FileUtils;
|
|||||||
import org.fdroid.fdroid.Preferences;
|
import org.fdroid.fdroid.Preferences;
|
||||||
import org.fdroid.fdroid.Utils;
|
import org.fdroid.fdroid.Utils;
|
||||||
import org.fdroid.fdroid.installer.ApkCache;
|
import org.fdroid.fdroid.installer.ApkCache;
|
||||||
|
import org.fdroid.fdroid.nearby.LocalRepoManager;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -127,8 +130,9 @@ public class CleanCacheWorker extends Worker {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final List<String> webRootAssetFiles = Arrays.asList(LocalRepoManager.WEB_ROOT_ASSET_FILES);
|
||||||
for (File f : files) {
|
for (File f : files) {
|
||||||
if (f.getName().endsWith(".apk")) {
|
if (f.isFile() && !f.getName().endsWith(".html") && !webRootAssetFiles.contains(f.getName())) {
|
||||||
clearOldFiles(f, TimeUnit.HOURS.toMillis(1));
|
clearOldFiles(f, TimeUnit.HOURS.toMillis(1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user