尝试处理游戏搜索页和下载管理页的ANR问题

This commit is contained in:
juntao
2022-04-24 10:13:08 +08:00
parent b90d026a74
commit c828f3f479
3 changed files with 32 additions and 27 deletions

View File

@ -689,11 +689,13 @@ public class DownloadManager implements DownloadStatusListener {
public void cancel(String url, boolean isDeleteFile, boolean automatic) {
DownloadEntity entry = mDownloadDao.get(url);
if (entry != null) {
if (isDeleteFile) {
FileUtils.deleteFile(entry.getPath());
}
mDownloadDao.delete(url);
Utils.log(DownloadManager.class.getSimpleName(), "cancel==>record were deleted!");
AppExecutor.getIoExecutor().execute(() -> {
if (isDeleteFile) {
FileUtils.deleteFile(entry.getPath());
}
mDownloadDao.delete(url);
Utils.log(DownloadManager.class.getSimpleName(), "cancel==>record were deleted!");
});
}
if (entry != null) {
if (automatic) {