laoyuyu 5 years ago
parent a1c294bcbd
commit 290e58c58b
  1. 1
      DEV_LOG.md
  2. 1
      PublicComponent/src/main/java/com/arialyy/aria/core/group/SubRecordHandler.java
  3. 2
      PublicComponent/src/main/java/com/arialyy/aria/core/loader/NormalLoader.java
  4. 12
      PublicComponent/src/main/java/com/arialyy/aria/core/loader/SubLoader.java
  5. 6
      PublicComponent/src/main/java/com/arialyy/aria/orm/DelegateFind.java
  6. 8
      PublicComponent/src/main/java/com/arialyy/aria/orm/DelegateUpdate.java
  7. 11
      PublicComponent/src/main/java/com/arialyy/aria/orm/SqlHelper.java
  8. 2
      PublicComponent/src/main/java/com/arialyy/aria/orm/SqlUtil.java
  9. 2
      build.gradle

@ -8,6 +8,7 @@
- 修复组任务中,其中一个子任务是30x地址,导致调度器无法出现该子任务状态的问题
- 增加组任务groupHash冲突检查 https://github.com/AriaLyy/Aria/issues/635
- 修复task.cancel(false)还是把本地文件删除的问题 https://github.com/AriaLyy/Aria/issues/646
- fix bug https://github.com/AriaLyy/Aria/issues/670
+ v_3.8.6 (2020/2/17)
- fix bug https://github.com/AriaLyy/Aria/issues/608
- fix bug https://github.com/AriaLyy/Aria/issues/579#issuecomment-586665035

@ -25,7 +25,6 @@ import com.arialyy.aria.core.loader.IRecordHandler;
import com.arialyy.aria.core.wrapper.AbsTaskWrapper;
import com.arialyy.aria.core.wrapper.ITaskWrapper;
import com.arialyy.aria.util.RecordUtil;
import java.util.ArrayList;
/**

@ -132,8 +132,6 @@ public class NormalLoader<T extends AbsTaskWrapper> extends AbsNormalLoader<T> {
ThreadTaskManager.getInstance().startThread(mTaskWrapper.getKey(), threadTask);
}
List<IThreadTask> list = getTaskList();
// 启动定时器
startTimer();
}

@ -22,7 +22,6 @@ import android.os.Message;
import android.text.TextUtils;
import com.arialyy.aria.core.TaskRecord;
import com.arialyy.aria.core.common.AbsEntity;
import com.arialyy.aria.core.common.AbsNormalEntity;
import com.arialyy.aria.core.common.CompleteInfo;
import com.arialyy.aria.core.inf.IThreadStateManager;
import com.arialyy.aria.core.manager.ThreadTaskManager;
@ -116,7 +115,8 @@ public final class SubLoader implements ILoader, ILoaderVisitor {
sendNormalState(IThreadStateManager.STATE_COMPLETE);
return;
}
List<IThreadTask> task = ttBuild.buildThreadTask(record, new Handler(looper, mStateManager.getHandlerCallback()));
List<IThreadTask> task =
ttBuild.buildThreadTask(record, new Handler(looper, mStateManager.getHandlerCallback()));
mStateManager.setLooper(record, looper);
if (task == null || task.isEmpty()) {
ALog.e(TAG, "创建子任务的线程任务失败,key:" + wrapper.getKey());
@ -129,7 +129,6 @@ public final class SubLoader implements ILoader, ILoaderVisitor {
return;
}
sendNormalState(IThreadStateManager.STATE_PRE);
mTask.addAll(task);
try {
@ -181,12 +180,12 @@ public final class SubLoader implements ILoader, ILoaderVisitor {
for (IThreadTask iThreadTask : mTask) {
iThreadTask.stop();
}
}
@Override public boolean isRunning() {
if(mTask.isEmpty())
if (mTask.isEmpty()) {
return false;
}
for (IThreadTask iThreadTask : mTask) {
if (!iThreadTask.isBreak()) return true;
}
@ -223,7 +222,8 @@ public final class SubLoader implements ILoader, ILoaderVisitor {
}
@Override public long getCurrentProgress() {
return isRunning() ? mStateManager.getCurrentProgress() : getWrapper().getEntity().getCurrentProgress();
return isRunning() ? mStateManager.getCurrentProgress()
: getWrapper().getEntity().getCurrentProgress();
}
@Override public void addComponent(IRecordHandler recordHandler) {

@ -139,8 +139,8 @@ class DelegateFind extends AbsDelegate {
Class parentClazz = Class.forName(one.getType().getName());
Class childClazz = Class.forName(CommonUtil.getListParamType(many).getName());
// 检查表
SqlUtil.checkTable(db, parentClazz);
SqlUtil.checkTable(db, childClazz);
SqlUtil.checkOrCreateTable(db, parentClazz);
SqlUtil.checkOrCreateTable(db, childClazz);
final String pTableName = parentClazz.getSimpleName();
final String cTableName = childClazz.getSimpleName();
List<Field> pColumn = SqlUtil.getAllNotIgnoreField(parentClazz);
@ -460,7 +460,7 @@ class DelegateFind extends AbsDelegate {
*/
private <T extends DbEntity> List<T> exeNormalDataSql(SQLiteDatabase db, Class<T> clazz,
String sql, String[] selectionArgs) {
SqlUtil.checkTable(db, clazz);
SqlUtil.checkOrCreateTable(db, clazz);
Cursor cursor;
if (selectionArgs != null) {

@ -38,7 +38,7 @@ class DelegateUpdate extends AbsDelegate {
*/
synchronized <T extends DbEntity> void delData(SQLiteDatabase db, Class<T> clazz,
String... expression) {
SqlUtil.checkTable(db, clazz);
SqlUtil.checkOrCreateTable(db, clazz);
db = checkDb(db);
if (!CommonUtil.checkSqlExpression(expression)) {
return;
@ -58,7 +58,7 @@ class DelegateUpdate extends AbsDelegate {
* 修改某行数据
*/
synchronized void updateData(SQLiteDatabase db, DbEntity dbEntity) {
SqlUtil.checkTable(db, dbEntity.getClass());
SqlUtil.checkOrCreateTable(db, dbEntity.getClass());
db = checkDb(db);
ContentValues values = createValues(dbEntity);
if (values != null) {
@ -111,7 +111,7 @@ class DelegateUpdate extends AbsDelegate {
if (oldClazz == null || oldClazz != entity.getClass() || table == null) {
oldClazz = entity.getClass();
table = CommonUtil.getClassName(oldClazz);
SqlUtil.checkTable(db, oldClazz);
SqlUtil.checkOrCreateTable(db, oldClazz);
}
ContentValues value = createValues(entity);
@ -133,7 +133,7 @@ class DelegateUpdate extends AbsDelegate {
* 插入数据
*/
synchronized void insertData(SQLiteDatabase db, DbEntity dbEntity) {
SqlUtil.checkTable(db, dbEntity.getClass());
SqlUtil.checkOrCreateTable(db, dbEntity.getClass());
db = checkDb(db);
ContentValues values = createValues(dbEntity);
if (values != null) {

@ -22,7 +22,11 @@ import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.os.Build;
import android.text.TextUtils;
import com.arialyy.aria.core.TaskRecord;
import com.arialyy.aria.core.ThreadRecord;
import com.arialyy.aria.core.download.DownloadEntity;
import com.arialyy.aria.core.download.M3U8Entity;
import com.arialyy.aria.core.upload.UploadEntity;
import com.arialyy.aria.core.wrapper.ITaskWrapper;
import com.arialyy.aria.util.ALog;
import java.io.File;
@ -308,6 +312,11 @@ final class SqlHelper extends SQLiteOpenHelper {
*/
private void addTaskRecordType(SQLiteDatabase db) {
try {
SqlUtil.checkOrCreateTable(db, ThreadRecord.class);
SqlUtil.checkOrCreateTable(db, TaskRecord.class);
SqlUtil.checkOrCreateTable(db, UploadEntity.class);
SqlUtil.checkOrCreateTable(db, DownloadEntity.class);
db.beginTransaction();
/*
* 增加下载实体的类型
@ -380,6 +389,7 @@ final class SqlHelper extends SQLiteOpenHelper {
* 删除重复的repeat数据
*/
private void delRepeatThreadRecord(SQLiteDatabase db) {
SqlUtil.checkOrCreateTable(db, ThreadRecord.class);
String repeatSql = "DELETE FROM ThreadRecord WHERE (rowid) "
+ "IN (SELECT rowid FROM ThreadRecord GROUP BY taskKey, threadId, endLocation HAVING COUNT(*) > 1) "
+ "AND rowid NOT IN (SELECT MIN(rowid) FROM ThreadRecord GROUP BY taskKey, threadId, endLocation HAVING COUNT(*)> 1)";
@ -406,6 +416,7 @@ final class SqlHelper extends SQLiteOpenHelper {
* 处理365版本以下的升级
*/
private void handle365Update(SQLiteDatabase db) {
SqlUtil.checkOrCreateTable(db, ThreadRecord.class);
db.execSQL("UPDATE ThreadRecord SET threadId=0 WHERE threadId=-1");
Map<String, Map<String, String>> modifyMap = new HashMap<>();

@ -49,7 +49,7 @@ final class SqlUtil {
/**
* 检查表是否存在不存在则创建表
*/
static void checkTable(SQLiteDatabase db, Class<? extends DbEntity> clazz) {
static void checkOrCreateTable(SQLiteDatabase db, Class<? extends DbEntity> clazz) {
if (!tableExists(db, clazz)) {
createTable(db, clazz);
}

@ -45,7 +45,7 @@ task clean(type: Delete) {
ext {
versionCode = 387
versionName = '3.8.7-beta-11'
versionName = '3.8.7-beta-12'
userOrg = 'arialyy'
groupId = 'com.arialyy.aria'
publishVersion = versionName

Loading…
Cancel
Save