javadoc for cache cleanup operations

This commit is contained in:
Hans-Christoph Steiner 2021-03-03 10:06:32 +01:00
parent 2a31b0dc61
commit fc8321de17
2 changed files with 16 additions and 1 deletions

View File

@ -42,13 +42,16 @@ import java.io.IOException;
* <i>"/Android/data/[app_package_name]/cache/apks"</i> (if card is mounted and app has
* appropriate permission) or on device's file system depending incoming parameters</li>
* <li>Before installation, the APK is copied into the private data directory of the F-Droid,
* <i>"/data/data/[app_package_name]/files/install-$random.apk"</i></li>
* <i>"/data/data/[app_package_name]/files/install-$random.apk"</i> so that the install
* process broken if the user clears the cache while it is running.</li>
* <li>The hash of the file is checked against the expected hash from the repository</li>
* <li>For {@link Build.VERSION_CODES#M < android-23}, a {@code file://} {@link Uri}
* pointing to the {@link File} is returned, for {@link Build.VERSION_CODES#M >= android-23},
* a {@code content://} {@code Uri} is returned using support lib's
* {@link FileProvider}</li>
* </ol>
*
* @see org.fdroid.fdroid.work.CleanCacheWorker
*/
public class ApkFileProvider extends FileProvider {

View File

@ -22,6 +22,18 @@ import org.fdroid.fdroid.installer.ApkCache;
import java.io.File;
import java.util.concurrent.TimeUnit;
/**
* Deletes the built-up cruft left over from various processes.
* <p>
* The installation process downloads APKs to the cache, then when an APK is being
* installed, it is copied into files for running the install. Installs can happen
* fully in the background, so the user might clear the cache at any time, so the
* APK cannot be installed from the cache. Also, F-Droid is not guaranteed to get
* an event after the APK is installed, so that can't be used to delete the APK
* from files when it is no longer needed. That's where CleanCacheWorker comes in,
* it runs regularly to ensure things are cleaned up. If something blocks it from
* running, then APKs can remain in {@link org.fdroid.fdroid.installer.ApkFileProvider}
*/
public class CleanCacheWorker extends Worker {
public static final String TAG = "CleanCacheWorker";