diff --git a/Aria/src/main/java/com/arialyy/aria/core/common/AbsThreadTask.java b/Aria/src/main/java/com/arialyy/aria/core/common/AbsThreadTask.java index b9138926..c606be66 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/common/AbsThreadTask.java +++ b/Aria/src/main/java/com/arialyy/aria/core/common/AbsThreadTask.java @@ -201,10 +201,12 @@ public abstract class AbsThreadTask 1) { startDownload(); } else { @@ -57,6 +56,7 @@ public class FtpDirDownloadUtil extends AbsGroupUtil { }); new Thread(infoThread).start(); } + return true; } private void startDownload() { diff --git a/Aria/src/main/java/com/arialyy/aria/core/queue/AbsTaskQueue.java b/Aria/src/main/java/com/arialyy/aria/core/queue/AbsTaskQueue.java index 98ab974f..062fa37c 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/queue/AbsTaskQueue.java +++ b/Aria/src/main/java/com/arialyy/aria/core/queue/AbsTaskQueue.java @@ -26,7 +26,8 @@ import com.arialyy.aria.core.manager.TaskWrapperManager; import com.arialyy.aria.core.manager.ThreadTaskManager; import com.arialyy.aria.core.queue.pool.BaseCachePool; import com.arialyy.aria.core.queue.pool.BaseExecutePool; -import com.arialyy.aria.core.queue.pool.DownloadSharePool; +import com.arialyy.aria.core.queue.pool.DGLoadSharePool; +import com.arialyy.aria.core.queue.pool.DLoadSharePool; import com.arialyy.aria.core.queue.pool.UploadSharePool; import com.arialyy.aria.core.upload.UploadTask; import com.arialyy.aria.util.ALog; @@ -47,9 +48,12 @@ public abstract class AbsTaskQueue extends DLoadExecutePool { + private final String TAG = "DGLoadExecutePool"; + + @Override protected int getMaxSize() { + return AriaManager.getInstance(AriaManager.APP).getDGroupConfig().getMaxTaskNum(); + } +} diff --git a/Aria/src/main/java/com/arialyy/aria/core/queue/pool/DownloadSharePool.java b/Aria/src/main/java/com/arialyy/aria/core/queue/pool/DGLoadSharePool.java similarity index 72% rename from Aria/src/main/java/com/arialyy/aria/core/queue/pool/DownloadSharePool.java rename to Aria/src/main/java/com/arialyy/aria/core/queue/pool/DGLoadSharePool.java index 4c07a16e..869612dc 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/queue/pool/DownloadSharePool.java +++ b/Aria/src/main/java/com/arialyy/aria/core/queue/pool/DGLoadSharePool.java @@ -19,21 +19,21 @@ package com.arialyy.aria.core.queue.pool; * Created by Aria.Lao on 2017/7/17. * 下载任务池,该池子为简单任务和任务组共用 */ -public class DownloadSharePool { - private static volatile DownloadSharePool INSTANCE; +public class DGLoadSharePool { + private static volatile DGLoadSharePool INSTANCE; - public DownloadExecutePool executePool; + public DGLoadExecutePool executePool; public BaseCachePool cachePool; - private DownloadSharePool() { - executePool = new DownloadExecutePool<>(); + private DGLoadSharePool() { + executePool = new DGLoadExecutePool<>(); cachePool = new BaseCachePool<>(); } - public static DownloadSharePool getInstance() { + public static DGLoadSharePool getInstance() { if (INSTANCE == null) { - synchronized (DownloadSharePool.class) { - INSTANCE = new DownloadSharePool(); + synchronized (DGLoadSharePool.class) { + INSTANCE = new DGLoadSharePool(); } } return INSTANCE; diff --git a/Aria/src/main/java/com/arialyy/aria/core/queue/pool/DownloadExecutePool.java b/Aria/src/main/java/com/arialyy/aria/core/queue/pool/DLoadExecutePool.java similarity index 95% rename from Aria/src/main/java/com/arialyy/aria/core/queue/pool/DownloadExecutePool.java rename to Aria/src/main/java/com/arialyy/aria/core/queue/pool/DLoadExecutePool.java index 25fcbcb0..81e5f340 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/queue/pool/DownloadExecutePool.java +++ b/Aria/src/main/java/com/arialyy/aria/core/queue/pool/DLoadExecutePool.java @@ -26,7 +26,7 @@ import java.util.concurrent.TimeUnit; * Created by AriaL on 2017/6/29. * 单个下载任务的执行池 */ -class DownloadExecutePool extends BaseExecutePool { +class DLoadExecutePool extends BaseExecutePool { private final String TAG = "DownloadExecutePool"; @Override protected int getMaxSize() { @@ -34,7 +34,7 @@ class DownloadExecutePool extends BaseExecutePool { } @Override public boolean putTask(TASK task) { - synchronized (DownloadExecutePool.class) { + synchronized (DLoadExecutePool.class) { if (task == null) { ALog.e(TAG, "任务不能为空!!"); return false; diff --git a/Aria/src/main/java/com/arialyy/aria/core/queue/pool/DLoadSharePool.java b/Aria/src/main/java/com/arialyy/aria/core/queue/pool/DLoadSharePool.java new file mode 100644 index 00000000..2ab96c9d --- /dev/null +++ b/Aria/src/main/java/com/arialyy/aria/core/queue/pool/DLoadSharePool.java @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2016 AriaLyy(https://github.com/AriaLyy/Aria) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.arialyy.aria.core.queue.pool; + +/** + * Created by Aria.Lao on 2017/7/17. + * 下载任务池,该池子为简单任务和任务组共用 + */ +public class DLoadSharePool { + private static volatile DLoadSharePool INSTANCE; + + public DLoadExecutePool executePool; + public BaseCachePool cachePool; + + private DLoadSharePool() { + executePool = new DLoadExecutePool<>(); + cachePool = new BaseCachePool<>(); + } + + public static DLoadSharePool getInstance() { + if (INSTANCE == null) { + synchronized (DLoadSharePool.class) { + INSTANCE = new DLoadSharePool(); + } + } + return INSTANCE; + } +} diff --git a/Aria/src/main/java/com/arialyy/aria/orm/DelegateCommon.java b/Aria/src/main/java/com/arialyy/aria/orm/DelegateCommon.java index b1e8c319..3408a8af 100644 --- a/Aria/src/main/java/com/arialyy/aria/orm/DelegateCommon.java +++ b/Aria/src/main/java/com/arialyy/aria/orm/DelegateCommon.java @@ -106,7 +106,9 @@ class DelegateCommon extends AbsDelegate { */ boolean checkDataExist(SQLiteDatabase db, Class clazz, String... expression) { db = checkDb(db); - CheckUtil.checkSqlExpression(expression); + if (!CheckUtil.checkSqlExpression(expression)) { + return false; + } String sql = String.format("SELECT rowid, * FROM %s WHERE %s ", CommonUtil.getClassName(clazz), expression[0]); sql = sql.replace("?", "%s"); diff --git a/Aria/src/main/java/com/arialyy/aria/orm/DelegateFind.java b/Aria/src/main/java/com/arialyy/aria/orm/DelegateFind.java index ae8e01ad..0bb8dff0 100644 --- a/Aria/src/main/java/com/arialyy/aria/orm/DelegateFind.java +++ b/Aria/src/main/java/com/arialyy/aria/orm/DelegateFind.java @@ -15,7 +15,6 @@ */ package com.arialyy.aria.orm; -import android.annotation.SuppressLint; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.text.TextUtils; @@ -30,10 +29,8 @@ import java.lang.reflect.Field; import java.net.URLDecoder; import java.util.ArrayList; import java.util.Date; -import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Set; /** * Created by laoyuyu on 2018/3/22. @@ -201,7 +198,9 @@ class DelegateFind extends AbsDelegate { .append(cTableName.concat(".").concat(m.entityColumn())); String sql; if (expression != null && expression.length > 0) { - CheckUtil.checkSqlExpression(expression); + if (!CheckUtil.checkSqlExpression(expression)) { + return null; + } sb.append(" WHERE ").append(expression[0]).append(" "); sql = sb.toString(); sql = sql.replace("?", "%s"); @@ -321,7 +320,9 @@ class DelegateFind extends AbsDelegate { */ List findData(SQLiteDatabase db, Class clazz, String... expression) { db = checkDb(db); - CheckUtil.checkSqlExpression(expression); + if (!CheckUtil.checkSqlExpression(expression)) { + return null; + } String sql = String.format("SELECT rowid, * FROM %s WHERE %s", CommonUtil.getClassName(clazz), expression[0]); String[] params = new String[expression.length - 1]; @@ -339,7 +340,9 @@ class DelegateFind extends AbsDelegate { return null; } db = checkDb(db); - CheckUtil.checkSqlExpression(expression); + if (!CheckUtil.checkSqlExpression(expression)) { + return null; + } String sql = String.format("SELECT rowid, * FROM %s WHERE %s LIMIT %s,%s", CommonUtil.getClassName(clazz), expression[0], (page - 1) * num, num); diff --git a/Aria/src/main/java/com/arialyy/aria/orm/DelegateUpdate.java b/Aria/src/main/java/com/arialyy/aria/orm/DelegateUpdate.java index ba1085a6..669e0280 100644 --- a/Aria/src/main/java/com/arialyy/aria/orm/DelegateUpdate.java +++ b/Aria/src/main/java/com/arialyy/aria/orm/DelegateUpdate.java @@ -34,13 +34,15 @@ class DelegateUpdate extends AbsDelegate { private DelegateUpdate() { } - /** + /** * 删除某条数据 */ synchronized void delData(SQLiteDatabase db, Class clazz, String... expression) { db = checkDb(db); - CheckUtil.checkSqlExpression(expression); + if (!CheckUtil.checkSqlExpression(expression)) { + return; + } String sql = "DELETE FROM " + CommonUtil.getClassName(clazz) + " WHERE " + expression[0] + " "; sql = sql.replace("?", "%s"); @@ -60,7 +62,7 @@ class DelegateUpdate extends AbsDelegate { ContentValues values = createValues(dbEntity); if (values != null) { db.update(CommonUtil.getClassName(dbEntity), values, "rowid=?", - new String[] {String.valueOf(dbEntity.rowID)}); + new String[] { String.valueOf(dbEntity.rowID) }); } else { ALog.e(TAG, "更新记录失败,记录没有属性字段"); } @@ -69,7 +71,7 @@ class DelegateUpdate extends AbsDelegate { /** * 更新多条记录 */ - synchronized void updateManyData(SQLiteDatabase db, List dbEntities) { + synchronized void updateManyData(SQLiteDatabase db, List dbEntities) { db = checkDb(db); db.beginTransaction(); try { @@ -84,7 +86,7 @@ class DelegateUpdate extends AbsDelegate { if (value == null) { ALog.e(TAG, "更新记录失败,记录没有属性字段"); } else { - db.update(table, value, "rowid=?", new String[] {String.valueOf(entity.rowID)}); + db.update(table, value, "rowid=?", new String[] { String.valueOf(entity.rowID) }); } } db.setTransactionSuccessful(); diff --git a/Aria/src/main/java/com/arialyy/aria/util/CheckUtil.java b/Aria/src/main/java/com/arialyy/aria/util/CheckUtil.java index 8891a0a5..bc453e3a 100644 --- a/Aria/src/main/java/com/arialyy/aria/util/CheckUtil.java +++ b/Aria/src/main/java/com/arialyy/aria/util/CheckUtil.java @@ -24,6 +24,7 @@ import com.arialyy.aria.core.upload.UTaskWrapper; import com.arialyy.aria.core.upload.UploadEntity; import com.arialyy.aria.exception.ParamException; import java.io.File; +import java.util.Arrays; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -68,17 +69,22 @@ public class CheckUtil { /** * 检查sql的expression是否合法 + * + * @return false 不合法 */ - public static void checkSqlExpression(String... expression) { + public static boolean checkSqlExpression(String... expression) { if (expression.length == 0) { - throw new IllegalArgumentException("sql语句表达式不能为null"); + ALog.e(TAG, "sql语句表达式不能为null"); + return false; } if (expression.length == 1) { - throw new IllegalArgumentException("表达式需要写入参数"); + ALog.e(TAG, String.format("表达式需要写入参数,参数信息:%s", Arrays.toString(expression))); + return false; } String where = expression[0]; if (!where.contains("?")) { - throw new IllegalArgumentException("请在where语句的'='后编写?"); + ALog.e(TAG, String.format("请在where语句的'='后编写?,参数信息:%s", Arrays.toString(expression))); + return false; } Pattern pattern = Pattern.compile("\\?"); Matcher matcher = pattern.matcher(where); @@ -87,11 +93,14 @@ public class CheckUtil { count++; } if (count < expression.length - 1) { - throw new IllegalArgumentException("条件语句的?个数不能小于参数个数"); + ALog.e(TAG, String.format("条件语句的?个数不能小于参数个数,参数信息:%s", Arrays.toString(expression))); + return false; } if (count > expression.length - 1) { - throw new IllegalArgumentException("条件语句的?个数不能大于参数个数"); + ALog.e(TAG, String.format("条件语句的?个数不能大于参数个数, 参数信息:%s", Arrays.toString(expression))); + return false; } + return true; } /** diff --git a/app/src/main/assets/aria_config.xml b/app/src/main/assets/aria_config.xml index 1fb5c1ec..52688d22 100644 --- a/app/src/main/assets/aria_config.xml +++ b/app/src/main/assets/aria_config.xml @@ -113,7 +113,7 @@ - + @@ -131,7 +131,7 @@ - + diff --git a/app/src/main/java/com/arialyy/simple/core/download/multi_download/MultiDownloadActivity.java b/app/src/main/java/com/arialyy/simple/core/download/multi_download/MultiDownloadActivity.java index 65e4953c..b31d4cd4 100644 --- a/app/src/main/java/com/arialyy/simple/core/download/multi_download/MultiDownloadActivity.java +++ b/app/src/main/java/com/arialyy/simple/core/download/multi_download/MultiDownloadActivity.java @@ -76,7 +76,7 @@ public class MultiDownloadActivity extends BaseActivity - - - - http://static.gaoshouyou.com/d/12/0d/7f120f50c80d2e7b8c4ba24ece4f9cdd.apk - + https://downs.muzhiwan.com/2019/06/19/com.and.games505.TerrariaPaid5d0a074e451c0.gpk + https://downs.muzhiwan.com/2017/03/28/com.xyzstudio_58da07426e959.apk http://hzdown.muzhiwan.com/2017/05/08/nl.noio.kingdom_59104935e56f0.apk - https://atom-installer.github.com/v1.13.0/AtomSetup.exe1 + http://hzdown.muzhiwan.com/2017/09/05/com.mir.iphone.empire83jie.mzw_59ae6d5a3638d.apk @@ -125,8 +122,8 @@ - http://apk500.bce.baidu-mgame.com/game/883000/883227/20170828102306_oem_5502845.apk?r=1 - http://static.gaoshouyou.com/d/92/12/5592a647b8126755647abbe8074fde39.apk + https://downs.muzhiwan.com/2019/07/23/com.amazid.me_5d36bade614d9.apk + https://downs.muzhiwan.com/2019/07/30/com.counter.terrorist.attack.fps.sniper.fight_5d3fe8f0a7edf.apk @@ -135,8 +132,8 @@ - 王者荣耀.apk - 战斗吧剑灵.apk + 泰拉瑞亚.apk + 疯狂屁股.apk @@ -151,8 +148,8 @@ - 部落冲突.apk - 城堡争霸.apk + 神奇的绳索英雄.apk + 自由火力反击.apk diff --git a/build.gradle b/build.gradle index 05b0c05b..b0fe1385 100644 --- a/build.gradle +++ b/build.gradle @@ -43,7 +43,7 @@ task clean(type: Delete) { ext { userOrg = 'arialyy' groupId = 'com.arialyy.aria' - publishVersion = '3.6.6_beta_1' + publishVersion = '3.6.6_beta_3' // publishVersion = '1.0.4' //FTP插件 repoName='maven' desc = 'android 下载框架'