1.优化断电重启文件丢失(服务器已上报),重新下载图片
This commit is contained in:
@@ -496,7 +496,9 @@ public class ADManager implements DownLoadManeger.DownloadListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public void hasDownloadButLostFile(AdsInfoBean adsInfoBean,String url, int taskType,long fileSize){
|
||||||
|
addDownloadTask(adsInfoBean,url,taskType,fileSize);
|
||||||
|
}
|
||||||
public boolean checkTaskQueueClear(){
|
public boolean checkTaskQueueClear(){
|
||||||
return DownLoadManeger.getInstance().checkTaskQueueClear();
|
return DownLoadManeger.getInstance().checkTaskQueueClear();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import android.content.pm.PackageManager;
|
|||||||
import android.content.pm.ResolveInfo;
|
import android.content.pm.ResolveInfo;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
|
||||||
|
import com.android.SharePreUtils;
|
||||||
import com.android.database.DaoManager;
|
import com.android.database.DaoManager;
|
||||||
import com.android.database.lib.AdsInfoBean;
|
import com.android.database.lib.AdsInfoBean;
|
||||||
import com.android.database.lib.AppBean;
|
import com.android.database.lib.AppBean;
|
||||||
@@ -593,6 +594,11 @@ public class AppManager {
|
|||||||
favNaviBean = new FavNaviBean(index, adsInfoBean.getLocalFilePath(), adsInfoBean.getInfo(), null);
|
favNaviBean = new FavNaviBean(index, adsInfoBean.getLocalFilePath(), adsInfoBean.getInfo(), null);
|
||||||
}else {//考虑下载好图片重启后变回 -tmp文件的情况
|
}else {//考虑下载好图片重启后变回 -tmp文件的情况
|
||||||
File tempFile=new File(adsInfoBean.getLocalFilePath()+"-tmp");
|
File tempFile=new File(adsInfoBean.getLocalFilePath()+"-tmp");
|
||||||
|
//对已上报的图片文件 系统丢失文件情况 重新下载
|
||||||
|
if(!tempFile.exists()&& SharePreUtils.filterByKeyValue(String.valueOf(adsInfoBean.getAdResourceId()),String.valueOf(0))){
|
||||||
|
LogUtils.loge("sys lost file which has upload,redownload it but not notify");
|
||||||
|
ADManager.getInstance().hasDownloadButLostFile(adsInfoBean,adsInfoBean.getAdUri(),0,adsInfoBean.getAdSize());
|
||||||
|
}
|
||||||
if(tempFile.exists()&&tempFile.length()==adsInfoBean.getAdSize()){
|
if(tempFile.exists()&&tempFile.length()==adsInfoBean.getAdSize()){
|
||||||
tempFile.renameTo(file);
|
tempFile.renameTo(file);
|
||||||
tempFile.delete();
|
tempFile.delete();
|
||||||
|
|||||||
Reference in New Issue
Block a user