移除androidx、support依赖,现在哪个版本的appcompat库都可以导入Aria

修复一个在xml中使用fragment导致的内存泄漏问题
pull/617/head
laoyuyu 5 years ago
parent 3871d8f056
commit d9ed7f87d2
  1. 2
      Aria/build.gradle
  2. 57
      Aria/src/main/java/com/arialyy/aria/core/AriaManager.java
  3. 2
      Aria/src/main/java/com/arialyy/aria/core/common/FtpOption.java
  4. 10
      Aria/src/main/java/com/arialyy/aria/core/common/HttpOption.java
  5. 21
      Aria/src/main/java/com/arialyy/aria/core/download/DownloadReceiver.java
  6. 4
      Aria/src/main/java/com/arialyy/aria/core/download/target/AbsGroupConfigHandler.java
  7. 10
      Aria/src/main/java/com/arialyy/aria/core/download/target/FtpBuilderTarget.java
  8. 6
      Aria/src/main/java/com/arialyy/aria/core/download/target/FtpDirBuilderTarget.java
  9. 5
      Aria/src/main/java/com/arialyy/aria/core/download/target/FtpDirNormalTarget.java
  10. 8
      Aria/src/main/java/com/arialyy/aria/core/download/target/FtpNormalTarget.java
  11. 10
      Aria/src/main/java/com/arialyy/aria/core/download/target/GroupBuilderTarget.java
  12. 8
      Aria/src/main/java/com/arialyy/aria/core/download/target/GroupNormalTarget.java
  13. 12
      Aria/src/main/java/com/arialyy/aria/core/download/target/HttpBuilderTarget.java
  14. 3
      Aria/src/main/java/com/arialyy/aria/core/download/target/HttpGroupConfigHandler.java
  15. 8
      Aria/src/main/java/com/arialyy/aria/core/download/target/HttpNormalTarget.java
  16. 8
      Aria/src/main/java/com/arialyy/aria/core/download/target/TcpBuilderTarget.java
  17. 5
      Aria/src/main/java/com/arialyy/aria/core/inf/AbsTarget.java
  18. 2
      Aria/src/main/java/com/arialyy/aria/core/inf/IReceiver.java
  19. 11
      Aria/src/main/java/com/arialyy/aria/core/inf/ReceiverType.java
  20. 4
      Aria/src/main/java/com/arialyy/aria/core/manager/TaskWrapperManager.java
  21. 14
      Aria/src/main/java/com/arialyy/aria/core/upload/UploadReceiver.java
  22. 5
      Aria/src/main/java/com/arialyy/aria/core/upload/target/FtpBuilderTarget.java
  23. 3
      Aria/src/main/java/com/arialyy/aria/core/upload/target/FtpNormalTarget.java
  24. 4
      Aria/src/main/java/com/arialyy/aria/core/upload/target/HttpBuilderTarget.java
  25. 4
      Aria/src/main/java/com/arialyy/aria/core/upload/target/HttpNormalTarget.java
  26. 3
      DEV_LOG.md
  27. 2
      FtpComponent/build.gradle
  28. 9
      FtpComponent/src/main/java/com/arialyy/aria/ftp/upload/FtpFISAdapter.java
  29. 4
      HttpComponent/build.gradle
  30. 1
      M3U8Component/build.gradle
  31. 1
      PublicComponent/build.gradle
  32. 1
      PublicComponent/src/main/java/com/arialyy/aria/core/FtpUrlEntity.java
  33. 15
      PublicComponent/src/main/java/com/arialyy/aria/core/ProtocolType.java
  34. 12
      PublicComponent/src/main/java/com/arialyy/aria/core/config/ConfigType.java
  35. 2
      PublicComponent/src/main/java/com/arialyy/aria/core/config/XMLReader.java
  36. 13
      PublicComponent/src/main/java/com/arialyy/aria/core/inf/TaskSchedulerType.java
  37. 3
      PublicComponent/src/main/java/com/arialyy/aria/core/processor/ITsMergeHandler.java
  38. 7
      PublicComponent/src/main/java/com/arialyy/aria/core/task/AbsTask.java
  39. 6
      PublicComponent/src/main/java/com/arialyy/aria/core/task/ITask.java
  40. 5
      PublicComponent/src/main/java/com/arialyy/aria/core/task/IThreadTaskObserver.java
  41. 7
      PublicComponent/src/main/java/com/arialyy/aria/core/task/ThreadTask.java
  42. 12
      PublicComponent/src/main/java/com/arialyy/aria/util/SSLContextUtil.java
  43. 35
      PublicComponent/src/main/java/com/arialyy/aria/util/WeakHandler.java
  44. 1
      SFtpComponent/build.gradle
  45. 2
      app/src/main/java/com/arialyy/simple/core/upload/UploadModule.java

@ -23,7 +23,7 @@ android {
dependencies { dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs') implementation fileTree(include: ['*.jar'], dir: 'libs')
testImplementation 'junit:junit:4.12' testImplementation 'junit:junit:4.12'
implementation "androidx.appcompat:appcompat:${rootProject.ext.XAppcompatVersion}" // implementation "androidx.appcompat:appcompat:${rootProject.ext.XAppcompatVersion}"
api project(':AriaAnnotations') api project(':AriaAnnotations')
api project(path: ':PublicComponent') api project(path: ':PublicComponent')
api project(path: ':HttpComponent') api project(path: ':HttpComponent')

@ -290,19 +290,31 @@ import java.util.concurrent.ConcurrentHashMap;
} }
} }
private IReceiver putReceiver(@ReceiverType String type, Object obj) { private IReceiver putReceiver(String type, Object obj) {
final String key = getKey(type, obj); final String key = getKey(type, obj);
IReceiver receiver = mReceivers.get(key); IReceiver receiver = mReceivers.get(key);
boolean needRmReceiver = false; boolean needRmReceiver = false;
// 监控Dialog、fragment、popupWindow的生命周期 // 监控Dialog、fragment、popupWindow的生命周期
final WidgetLiftManager widgetLiftManager = new WidgetLiftManager(); final WidgetLiftManager widgetLiftManager = new WidgetLiftManager();
Context subParenActivity = null;
if (obj instanceof Dialog) { if (obj instanceof Dialog) {
needRmReceiver = widgetLiftManager.handleDialogLift((Dialog) obj); needRmReceiver = widgetLiftManager.handleDialogLift((Dialog) obj);
subParenActivity = ((Dialog) obj).getOwnerActivity();
} else if (obj instanceof PopupWindow) { } else if (obj instanceof PopupWindow) {
needRmReceiver = widgetLiftManager.handlePopupWindowLift((PopupWindow) obj); needRmReceiver = widgetLiftManager.handlePopupWindowLift((PopupWindow) obj);
subParenActivity = ((PopupWindow) obj).getContentView().getContext();
} else if (isDialogFragment(obj.getClass())) { } else if (isDialogFragment(obj.getClass())) {
needRmReceiver = widgetLiftManager.handleDialogFragmentLift(getDialog(obj)); needRmReceiver = widgetLiftManager.handleDialogFragmentLift(getDialog(obj));
subParenActivity = getFragmentActivity(obj);
} else if (isFragment(obj.getClass())) {
subParenActivity = getFragmentActivity(obj);
}
if (subParenActivity instanceof Activity) {
relateSubClass(type, obj, (Activity) subParenActivity);
} }
if (receiver == null) { if (receiver == null) {
AbsReceiver absReceiver = AbsReceiver absReceiver =
type.equals(ReceiverType.DOWNLOAD) ? new DownloadReceiver() : new UploadReceiver(); type.equals(ReceiverType.DOWNLOAD) ? new DownloadReceiver() : new UploadReceiver();
@ -315,30 +327,6 @@ import java.util.concurrent.ConcurrentHashMap;
return receiver; return receiver;
} }
/**
* 根据功能类型和控件类型获取对应的key
*
* @param type {@link ReceiverType}
* @param obj 观察者对象
* @return {@link #createKey(String, Object)}
*/
private String getKey(@ReceiverType String type, Object obj) {
if (isFragment(obj.getClass())) {
relateSubClass(type, obj, getFragmentActivity(obj));
} else if (obj instanceof Dialog) {
Activity activity = ((Dialog) obj).getOwnerActivity();
if (activity != null) {
relateSubClass(type, obj, activity);
}
} else if (obj instanceof PopupWindow) {
Context context = ((PopupWindow) obj).getContentView().getContext();
if (context instanceof Activity) {
relateSubClass(type, obj, (Activity) context);
}
}
return createKey(type, obj);
}
/** /**
* 获取fragment的activity * 获取fragment的activity
* *
@ -421,14 +409,17 @@ import java.util.concurrent.ConcurrentHashMap;
* @param sub Fragment或dialog类 * @param sub Fragment或dialog类
* @param activity activity寄主类 * @param activity activity寄主类
*/ */
private void relateSubClass(@ReceiverType String type, Object sub, Activity activity) { private void relateSubClass(String type, Object sub, Activity activity) {
String key = createKey(type, activity); String key = getKey(type, activity);
List<String> list = mSubClass.get(key); List<String> subClass = mSubClass.get(key);
if (list == null) { if (subClass == null) {
list = new ArrayList<>(); subClass = new ArrayList<>();
mSubClass.put(key, list); mSubClass.put(key, subClass);
}
subClass.add(getKey(type, sub));
if (mReceivers.get(key) == null) { // 将activity填充进去
mReceivers.put(key, new DownloadReceiver());
} }
list.add(createKey(type, sub));
} }
/** /**
@ -439,7 +430,7 @@ import java.util.concurrent.ConcurrentHashMap;
* @return key的格式为{@code String.format("%s_%s_%s", obj.getClass().getName(), type, * @return key的格式为{@code String.format("%s_%s_%s", obj.getClass().getName(), type,
* obj.hashCode());} * obj.hashCode());}
*/ */
private String createKey(@ReceiverType String type, Object obj) { private String getKey(String type, Object obj) {
return String.format("%s_%s_%s", obj.getClass().getName(), type, obj.hashCode()); return String.format("%s_%s_%s", obj.getClass().getName(), type, obj.hashCode());
} }

@ -70,7 +70,7 @@ public class FtpOption extends BaseOption {
* *
* @param protocol {@link ProtocolType} * @param protocol {@link ProtocolType}
*/ */
public FtpOption setProtocol(@ProtocolType String protocol) { public FtpOption setProtocol(String protocol) {
if (TextUtils.isEmpty(protocol)) { if (TextUtils.isEmpty(protocol)) {
ALog.e(TAG, "设置协议失败,协议信息为空"); ALog.e(TAG, "设置协议失败,协议信息为空");
return this; return this;

@ -16,11 +16,6 @@
package com.arialyy.aria.core.common; package com.arialyy.aria.core.common;
import android.text.TextUtils; import android.text.TextUtils;
import androidx.annotation.CheckResult;
import androidx.annotation.NonNull;
import com.arialyy.aria.core.download.target.HttpBuilderTarget;
import com.arialyy.aria.core.inf.IOptionConstant;
import com.arialyy.aria.core.inf.Suggest;
import com.arialyy.aria.core.processor.IHttpFileLenAdapter; import com.arialyy.aria.core.processor.IHttpFileLenAdapter;
import com.arialyy.aria.util.ALog; import com.arialyy.aria.util.ALog;
import com.arialyy.aria.util.CheckUtil; import com.arialyy.aria.util.CheckUtil;
@ -50,7 +45,6 @@ public class HttpOption extends BaseOption {
* *
* @param requestEnum {@link RequestEnum} * @param requestEnum {@link RequestEnum}
*/ */
@CheckResult(suggest = Suggest.TO_CONTROLLER)
public HttpOption setRequestType(RequestEnum requestEnum) { public HttpOption setRequestType(RequestEnum requestEnum) {
this.requestEnum = requestEnum; this.requestEnum = requestEnum;
return this; return this;
@ -97,7 +91,7 @@ public class HttpOption extends BaseOption {
* @param key header对应的key * @param key header对应的key
* @param value header对应的value * @param value header对应的value
*/ */
public HttpOption addHeader(@NonNull String key, @NonNull String value) { public HttpOption addHeader(String key, String value) {
if (TextUtils.isEmpty(key)) { if (TextUtils.isEmpty(key)) {
ALog.w(TAG, "设置header失败,header对应的key不能为null"); ALog.w(TAG, "设置header失败,header对应的key不能为null");
return this; return this;
@ -118,7 +112,7 @@ public class HttpOption extends BaseOption {
* *
* @param headers 一组http header数据 * @param headers 一组http header数据
*/ */
public HttpOption addHeaders(@NonNull Map<String, String> headers) { public HttpOption addHeaders(Map<String, String> headers) {
if (headers.size() == 0) { if (headers.size() == 0) {
ALog.w(TAG, "设置header失败,map没有header数据"); ALog.w(TAG, "设置header失败,map没有header数据");
return this; return this;

@ -15,8 +15,6 @@
*/ */
package com.arialyy.aria.core.download; package com.arialyy.aria.core.download;
import androidx.annotation.CheckResult;
import androidx.annotation.NonNull;
import com.arialyy.annotations.TaskEnum; import com.arialyy.annotations.TaskEnum;
import com.arialyy.aria.core.AriaConfig; import com.arialyy.aria.core.AriaConfig;
import com.arialyy.aria.core.AriaManager; import com.arialyy.aria.core.AriaManager;
@ -74,8 +72,7 @@ public class DownloadReceiver extends AbsReceiver {
* *
* @param url 下载地址 * @param url 下载地址
*/ */
@CheckResult public HttpBuilderTarget load(String url) {
public HttpBuilderTarget load(@NonNull String url) {
ComponentUtil.getInstance().checkComponentExist(ComponentUtil.COMPONENT_TYPE_HTTP); ComponentUtil.getInstance().checkComponentExist(ComponentUtil.COMPONENT_TYPE_HTTP);
return DTargetFactory.getInstance() return DTargetFactory.getInstance()
.generateBuilderTarget(HttpBuilderTarget.class, url); .generateBuilderTarget(HttpBuilderTarget.class, url);
@ -87,7 +84,6 @@ public class DownloadReceiver extends AbsReceiver {
* @param taskId 任务id可从{@link AbsBuilderTarget#create()}{@link AbsBuilderTarget#add()}{@link * @param taskId 任务id可从{@link AbsBuilderTarget#create()}{@link AbsBuilderTarget#add()}{@link
* AbsEntity#getId()}读取任务id * AbsEntity#getId()}读取任务id
*/ */
@CheckResult
public HttpNormalTarget load(long taskId) { public HttpNormalTarget load(long taskId) {
ComponentUtil.getInstance().checkComponentExist(ComponentUtil.COMPONENT_TYPE_HTTP); ComponentUtil.getInstance().checkComponentExist(ComponentUtil.COMPONENT_TYPE_HTTP);
return DTargetFactory.getInstance() return DTargetFactory.getInstance()
@ -99,7 +95,6 @@ public class DownloadReceiver extends AbsReceiver {
* *
* @param urls 组合任务只任务列被如果任务组的中的下载地址改变了则任务从新的一个任务组 * @param urls 组合任务只任务列被如果任务组的中的下载地址改变了则任务从新的一个任务组
*/ */
@CheckResult
public GroupBuilderTarget loadGroup(List<String> urls) { public GroupBuilderTarget loadGroup(List<String> urls) {
ComponentUtil.getInstance().checkComponentExist(ComponentUtil.COMPONENT_TYPE_HTTP); ComponentUtil.getInstance().checkComponentExist(ComponentUtil.COMPONENT_TYPE_HTTP);
return DTargetFactory.getInstance().generateGroupBuilderTarget(urls); return DTargetFactory.getInstance().generateGroupBuilderTarget(urls);
@ -111,7 +106,7 @@ public class DownloadReceiver extends AbsReceiver {
* @param taskId 任务id可从{@link AbsBuilderTarget#create()}{@link AbsBuilderTarget#add()}{@link * @param taskId 任务id可从{@link AbsBuilderTarget#create()}{@link AbsBuilderTarget#add()}{@link
* * AbsEntity#getId()}读取任务id * * AbsEntity#getId()}读取任务id
*/ */
@CheckResult
public GroupNormalTarget loadGroup(long taskId) { public GroupNormalTarget loadGroup(long taskId) {
ComponentUtil.getInstance().checkComponentExist(ComponentUtil.COMPONENT_TYPE_HTTP); ComponentUtil.getInstance().checkComponentExist(ComponentUtil.COMPONENT_TYPE_HTTP);
return DTargetFactory.getInstance() return DTargetFactory.getInstance()
@ -121,8 +116,8 @@ public class DownloadReceiver extends AbsReceiver {
/** /**
* 加载ftp单任务下载地址用于任务第一次下载如果需要控制任务停止或删除等操作请使用{@link #loadFtp(long)} * 加载ftp单任务下载地址用于任务第一次下载如果需要控制任务停止或删除等操作请使用{@link #loadFtp(long)}
*/ */
@CheckResult
public FtpBuilderTarget loadFtp(@NonNull String url) { public FtpBuilderTarget loadFtp(String url) {
ComponentUtil.getInstance().checkComponentExist(ComponentUtil.COMPONENT_TYPE_FTP); ComponentUtil.getInstance().checkComponentExist(ComponentUtil.COMPONENT_TYPE_FTP);
return DTargetFactory.getInstance() return DTargetFactory.getInstance()
.generateBuilderTarget(FtpBuilderTarget.class, url); .generateBuilderTarget(FtpBuilderTarget.class, url);
@ -134,7 +129,7 @@ public class DownloadReceiver extends AbsReceiver {
* @param taskId 任务id可从{@link AbsBuilderTarget#create()}{@link AbsBuilderTarget#add()}{@link * @param taskId 任务id可从{@link AbsBuilderTarget#create()}{@link AbsBuilderTarget#add()}{@link
* AbsEntity#getId()}读取任务id * AbsEntity#getId()}读取任务id
*/ */
@CheckResult
public FtpNormalTarget loadFtp(long taskId) { public FtpNormalTarget loadFtp(long taskId) {
ComponentUtil.getInstance().checkComponentExist(ComponentUtil.COMPONENT_TYPE_FTP); ComponentUtil.getInstance().checkComponentExist(ComponentUtil.COMPONENT_TYPE_FTP);
return DTargetFactory.getInstance() return DTargetFactory.getInstance()
@ -144,8 +139,8 @@ public class DownloadReceiver extends AbsReceiver {
/** /**
* 加载ftp文件夹下载地址用于任务第一次下载如果需要控制任务停止或删除等操作请使用{@link #loadFtpDir(long)} * 加载ftp文件夹下载地址用于任务第一次下载如果需要控制任务停止或删除等操作请使用{@link #loadFtpDir(long)}
*/ */
@CheckResult
public FtpDirBuilderTarget loadFtpDir(@NonNull String dirUrl) { public FtpDirBuilderTarget loadFtpDir(String dirUrl) {
ComponentUtil.getInstance().checkComponentExist(ComponentUtil.COMPONENT_TYPE_FTP); ComponentUtil.getInstance().checkComponentExist(ComponentUtil.COMPONENT_TYPE_FTP);
return DTargetFactory.getInstance().generateDirBuilderTarget(dirUrl); return DTargetFactory.getInstance().generateDirBuilderTarget(dirUrl);
} }
@ -156,7 +151,7 @@ public class DownloadReceiver extends AbsReceiver {
* @param taskId 任务id可从{@link AbsBuilderTarget#create()}{@link AbsBuilderTarget#add()}{@link * @param taskId 任务id可从{@link AbsBuilderTarget#create()}{@link AbsBuilderTarget#add()}{@link
* AbsEntity#getId()}读取任务id * AbsEntity#getId()}读取任务id
*/ */
@CheckResult
public FtpDirNormalTarget loadFtpDir(long taskId) { public FtpDirNormalTarget loadFtpDir(long taskId) {
ComponentUtil.getInstance().checkComponentExist(ComponentUtil.COMPONENT_TYPE_FTP); ComponentUtil.getInstance().checkComponentExist(ComponentUtil.COMPONENT_TYPE_FTP);
return DTargetFactory.getInstance() return DTargetFactory.getInstance()

@ -16,9 +16,7 @@
package com.arialyy.aria.core.download.target; package com.arialyy.aria.core.download.target;
import android.text.TextUtils; import android.text.TextUtils;
import androidx.annotation.CheckResult;
import com.arialyy.aria.core.common.AbsNormalTarget; import com.arialyy.aria.core.common.AbsNormalTarget;
import com.arialyy.aria.core.common.ErrorCode;
import com.arialyy.aria.core.download.DGTaskWrapper; import com.arialyy.aria.core.download.DGTaskWrapper;
import com.arialyy.aria.core.download.DownloadGroupEntity; import com.arialyy.aria.core.download.DownloadGroupEntity;
import com.arialyy.aria.core.event.ErrorEvent; import com.arialyy.aria.core.event.ErrorEvent;
@ -66,7 +64,6 @@ abstract class AbsGroupConfigHandler<TARGET extends AbsTarget> implements IConfi
* *
* @return 子任务管理器 * @return 子任务管理器
*/ */
@CheckResult
SubTaskManager getSubTaskManager() { SubTaskManager getSubTaskManager() {
if (mSubTaskManager == null) { if (mSubTaskManager == null) {
mSubTaskManager = new SubTaskManager(getTaskWrapper()); mSubTaskManager = new SubTaskManager(getTaskWrapper());
@ -89,7 +86,6 @@ abstract class AbsGroupConfigHandler<TARGET extends AbsTarget> implements IConfi
return task != null && task.isRunning(); return task != null && task.isRunning();
} }
@CheckResult
TARGET setDirPath(String dirPath) { TARGET setDirPath(String dirPath) {
mWrapper.setDirPathTemp(dirPath); mWrapper.setDirPathTemp(dirPath);
return mTarget; return mTarget;

@ -15,12 +15,9 @@
*/ */
package com.arialyy.aria.core.download.target; package com.arialyy.aria.core.download.target;
import androidx.annotation.CheckResult;
import androidx.annotation.NonNull;
import com.arialyy.aria.core.common.AbsBuilderTarget; import com.arialyy.aria.core.common.AbsBuilderTarget;
import com.arialyy.aria.core.common.FtpOption; import com.arialyy.aria.core.common.FtpOption;
import com.arialyy.aria.core.download.DownloadEntity; import com.arialyy.aria.core.download.DownloadEntity;
import com.arialyy.aria.core.inf.Suggest;
import com.arialyy.aria.core.wrapper.ITaskWrapper; import com.arialyy.aria.core.wrapper.ITaskWrapper;
import com.arialyy.aria.util.CommonUtil; import com.arialyy.aria.util.CommonUtil;
@ -40,7 +37,6 @@ public class FtpBuilderTarget extends AbsBuilderTarget<FtpBuilderTarget> {
/** /**
* 设置登陆字符串编码ftps等参数 * 设置登陆字符串编码ftps等参数
*/ */
@CheckResult(suggest = Suggest.TASK_CONTROLLER)
public FtpBuilderTarget option(FtpOption option) { public FtpBuilderTarget option(FtpOption option) {
if (option == null) { if (option == null) {
throw new NullPointerException("ftp 任务配置为空"); throw new NullPointerException("ftp 任务配置为空");
@ -56,8 +52,7 @@ public class FtpBuilderTarget extends AbsBuilderTarget<FtpBuilderTarget> {
* 1如果保存路径是该文件的保存路径/mnt/sdcard/file.zip则使用路径中的文件名file.zip * 1如果保存路径是该文件的保存路径/mnt/sdcard/file.zip则使用路径中的文件名file.zip
* 2如果保存路径是文件夹路径/mnt/sdcard/则使用FTP服务器该文件的文件名 * 2如果保存路径是文件夹路径/mnt/sdcard/则使用FTP服务器该文件的文件名
*/ */
@CheckResult(suggest = Suggest.TASK_CONTROLLER) public FtpBuilderTarget setFilePath(String filePath) {
public FtpBuilderTarget setFilePath(@NonNull String filePath) {
int lastIndex = mConfigHandler.getUrl().lastIndexOf("/"); int lastIndex = mConfigHandler.getUrl().lastIndexOf("/");
getEntity().setFileName(mConfigHandler.getUrl().substring(lastIndex + 1)); getEntity().setFileName(mConfigHandler.getUrl().substring(lastIndex + 1));
mConfigHandler.setTempFilePath(filePath); mConfigHandler.setTempFilePath(filePath);
@ -74,8 +69,7 @@ public class FtpBuilderTarget extends AbsBuilderTarget<FtpBuilderTarget> {
* @deprecated 使用 {@link #ignoreFilePathOccupy()} * @deprecated 使用 {@link #ignoreFilePathOccupy()}
*/ */
@Deprecated @Deprecated
@CheckResult(suggest = Suggest.TASK_CONTROLLER) public FtpBuilderTarget setFilePath(String filePath, boolean forceDownload) {
public FtpBuilderTarget setFilePath(@NonNull String filePath, boolean forceDownload) {
mConfigHandler.setTempFilePath(filePath); mConfigHandler.setTempFilePath(filePath);
mConfigHandler.setForceDownload(forceDownload); mConfigHandler.setForceDownload(forceDownload);
return this; return this;

@ -15,11 +15,9 @@
*/ */
package com.arialyy.aria.core.download.target; package com.arialyy.aria.core.download.target;
import androidx.annotation.CheckResult;
import com.arialyy.aria.core.common.AbsBuilderTarget; import com.arialyy.aria.core.common.AbsBuilderTarget;
import com.arialyy.aria.core.common.FtpOption; import com.arialyy.aria.core.common.FtpOption;
import com.arialyy.aria.core.download.DownloadGroupEntity; import com.arialyy.aria.core.download.DownloadGroupEntity;
import com.arialyy.aria.core.inf.Suggest;
import com.arialyy.aria.core.manager.SubTaskManager; import com.arialyy.aria.core.manager.SubTaskManager;
import com.arialyy.aria.util.CommonUtil; import com.arialyy.aria.util.CommonUtil;
@ -57,7 +55,6 @@ public class FtpDirBuilderTarget extends AbsBuilderTarget<FtpDirBuilderTarget> {
* *
* @param dirPath 任务组保存文件夹路径 * @param dirPath 任务组保存文件夹路径
*/ */
@CheckResult(suggest = Suggest.TASK_CONTROLLER)
public FtpDirBuilderTarget setDirPath(String dirPath) { public FtpDirBuilderTarget setDirPath(String dirPath) {
return mConfigHandler.setDirPath(dirPath); return mConfigHandler.setDirPath(dirPath);
} }
@ -65,7 +62,6 @@ public class FtpDirBuilderTarget extends AbsBuilderTarget<FtpDirBuilderTarget> {
/** /**
* 设置任务组别名 * 设置任务组别名
*/ */
@CheckResult(suggest = Suggest.TASK_CONTROLLER)
public FtpDirBuilderTarget setGroupAlias(String alias) { public FtpDirBuilderTarget setGroupAlias(String alias) {
mConfigHandler.setGroupAlias(alias); mConfigHandler.setGroupAlias(alias);
return this; return this;
@ -74,7 +70,6 @@ public class FtpDirBuilderTarget extends AbsBuilderTarget<FtpDirBuilderTarget> {
/** /**
* 设置登陆字符串编码ftps等参数 * 设置登陆字符串编码ftps等参数
*/ */
@CheckResult(suggest = Suggest.TASK_CONTROLLER)
public FtpDirBuilderTarget option(FtpOption option) { public FtpDirBuilderTarget option(FtpOption option) {
if (option == null) { if (option == null) {
throw new NullPointerException("ftp 任务配置为空"); throw new NullPointerException("ftp 任务配置为空");
@ -93,7 +88,6 @@ public class FtpDirBuilderTarget extends AbsBuilderTarget<FtpDirBuilderTarget> {
* *
* @return 子任务管理器 * @return 子任务管理器
*/ */
@CheckResult(suggest = Suggest.TASK_CONTROLLER)
public SubTaskManager getSubTaskManager() { public SubTaskManager getSubTaskManager() {
return mConfigHandler.getSubTaskManager(); return mConfigHandler.getSubTaskManager();
} }

@ -15,11 +15,9 @@
*/ */
package com.arialyy.aria.core.download.target; package com.arialyy.aria.core.download.target;
import androidx.annotation.CheckResult;
import com.arialyy.aria.core.common.AbsNormalTarget; import com.arialyy.aria.core.common.AbsNormalTarget;
import com.arialyy.aria.core.common.FtpOption; import com.arialyy.aria.core.common.FtpOption;
import com.arialyy.aria.core.download.DownloadGroupEntity; import com.arialyy.aria.core.download.DownloadGroupEntity;
import com.arialyy.aria.core.inf.Suggest;
import com.arialyy.aria.core.manager.SubTaskManager; import com.arialyy.aria.core.manager.SubTaskManager;
import com.arialyy.aria.util.CommonUtil; import com.arialyy.aria.util.CommonUtil;
@ -62,7 +60,6 @@ public class FtpDirNormalTarget extends AbsNormalTarget<FtpDirNormalTarget> {
* *
* @param dirPath 任务组保存文件夹路径 * @param dirPath 任务组保存文件夹路径
*/ */
@CheckResult(suggest = Suggest.TASK_CONTROLLER)
public FtpDirNormalTarget modifyDirPath(String dirPath) { public FtpDirNormalTarget modifyDirPath(String dirPath) {
return mConfigHandler.setDirPath(dirPath); return mConfigHandler.setDirPath(dirPath);
} }
@ -70,7 +67,6 @@ public class FtpDirNormalTarget extends AbsNormalTarget<FtpDirNormalTarget> {
/** /**
* 设置登陆字符串编码ftps等参数 * 设置登陆字符串编码ftps等参数
*/ */
@CheckResult(suggest = Suggest.TASK_CONTROLLER)
public FtpDirNormalTarget option(FtpOption option) { public FtpDirNormalTarget option(FtpOption option) {
if (option == null) { if (option == null) {
throw new NullPointerException("ftp 任务配置为空"); throw new NullPointerException("ftp 任务配置为空");
@ -89,7 +85,6 @@ public class FtpDirNormalTarget extends AbsNormalTarget<FtpDirNormalTarget> {
* *
* @return 子任务管理器 * @return 子任务管理器
*/ */
@CheckResult(suggest = Suggest.TASK_CONTROLLER)
public SubTaskManager getSubTaskManager() { public SubTaskManager getSubTaskManager() {
return mConfigHandler.getSubTaskManager(); return mConfigHandler.getSubTaskManager();
} }

@ -15,12 +15,9 @@
*/ */
package com.arialyy.aria.core.download.target; package com.arialyy.aria.core.download.target;
import androidx.annotation.CheckResult;
import androidx.annotation.NonNull;
import com.arialyy.aria.core.common.AbsNormalTarget; import com.arialyy.aria.core.common.AbsNormalTarget;
import com.arialyy.aria.core.common.FtpOption; import com.arialyy.aria.core.common.FtpOption;
import com.arialyy.aria.core.download.DownloadEntity; import com.arialyy.aria.core.download.DownloadEntity;
import com.arialyy.aria.core.inf.Suggest;
import com.arialyy.aria.core.wrapper.ITaskWrapper; import com.arialyy.aria.core.wrapper.ITaskWrapper;
import com.arialyy.aria.util.CommonUtil; import com.arialyy.aria.util.CommonUtil;
@ -40,7 +37,6 @@ public class FtpNormalTarget extends AbsNormalTarget<FtpNormalTarget> {
/** /**
* 设置登陆字符串编码ftps等参数 * 设置登陆字符串编码ftps等参数
*/ */
@CheckResult(suggest = Suggest.TASK_CONTROLLER)
public FtpNormalTarget option(FtpOption option) { public FtpNormalTarget option(FtpOption option) {
if (option == null) { if (option == null) {
throw new NullPointerException("ftp 任务配置为空"); throw new NullPointerException("ftp 任务配置为空");
@ -56,8 +52,7 @@ public class FtpNormalTarget extends AbsNormalTarget<FtpNormalTarget> {
* 1如果保存路径是该文件的保存路径/mnt/sdcard/file.zip则使用路径中的文件名file.zip * 1如果保存路径是该文件的保存路径/mnt/sdcard/file.zip则使用路径中的文件名file.zip
* 2如果保存路径是文件夹路径/mnt/sdcard/则使用FTP服务器该文件的文件名 * 2如果保存路径是文件夹路径/mnt/sdcard/则使用FTP服务器该文件的文件名
*/ */
@CheckResult(suggest = Suggest.TASK_CONTROLLER) public FtpNormalTarget modifyFilePath(String filePath) {
public FtpNormalTarget modifyFilePath(@NonNull String filePath) {
int lastIndex = mConfigHandler.getUrl().lastIndexOf("/"); int lastIndex = mConfigHandler.getUrl().lastIndexOf("/");
getEntity().setFileName(mConfigHandler.getUrl().substring(lastIndex + 1)); getEntity().setFileName(mConfigHandler.getUrl().substring(lastIndex + 1));
mConfigHandler.setTempFilePath(filePath); mConfigHandler.setTempFilePath(filePath);
@ -67,7 +62,6 @@ public class FtpNormalTarget extends AbsNormalTarget<FtpNormalTarget> {
/** /**
* 更新下载地址 * 更新下载地址
*/ */
@CheckResult(suggest = Suggest.TASK_CONTROLLER)
public FtpNormalTarget updateUrl(String newUrl) { public FtpNormalTarget updateUrl(String newUrl) {
return mConfigHandler.updateUrl(newUrl); return mConfigHandler.updateUrl(newUrl);
} }

@ -15,11 +15,9 @@
*/ */
package com.arialyy.aria.core.download.target; package com.arialyy.aria.core.download.target;
import androidx.annotation.CheckResult;
import com.arialyy.aria.core.common.AbsBuilderTarget; import com.arialyy.aria.core.common.AbsBuilderTarget;
import com.arialyy.aria.core.common.HttpOption; import com.arialyy.aria.core.common.HttpOption;
import com.arialyy.aria.core.download.DGTaskWrapper; import com.arialyy.aria.core.download.DGTaskWrapper;
import com.arialyy.aria.core.inf.Suggest;
import com.arialyy.aria.core.manager.SubTaskManager; import com.arialyy.aria.core.manager.SubTaskManager;
import com.arialyy.aria.core.wrapper.ITaskWrapper; import com.arialyy.aria.core.wrapper.ITaskWrapper;
import com.arialyy.aria.util.ALog; import com.arialyy.aria.util.ALog;
@ -42,7 +40,6 @@ public class GroupBuilderTarget extends AbsBuilderTarget<GroupBuilderTarget> {
/** /**
* 设置http请求参数header等信息 * 设置http请求参数header等信息
*/ */
@CheckResult(suggest = Suggest.TASK_CONTROLLER)
public GroupBuilderTarget option(HttpOption option) { public GroupBuilderTarget option(HttpOption option) {
if (option == null) { if (option == null) {
throw new NullPointerException("任务配置为空"); throw new NullPointerException("任务配置为空");
@ -59,7 +56,6 @@ public class GroupBuilderTarget extends AbsBuilderTarget<GroupBuilderTarget> {
* *
* @param fileSize 任务组总大小 * @param fileSize 任务组总大小
*/ */
@CheckResult(suggest = Suggest.TASK_CONTROLLER)
public GroupBuilderTarget setFileSize(long fileSize) { public GroupBuilderTarget setFileSize(long fileSize) {
if (fileSize <= 0) { if (fileSize <= 0) {
ALog.e(TAG, "文件大小不能小于 0"); ALog.e(TAG, "文件大小不能小于 0");
@ -78,7 +74,6 @@ public class GroupBuilderTarget extends AbsBuilderTarget<GroupBuilderTarget> {
* 2如果你的知道组合任务的总长度请使用{@link #setFileSize(long)}设置组合任务的长度 * 2如果你的知道组合任务的总长度请使用{@link #setFileSize(long)}设置组合任务的长度
* 3由于网络或其它原因的存在这种方式获取的组合任务大小有可能是不准确的 * 3由于网络或其它原因的存在这种方式获取的组合任务大小有可能是不准确的
*/ */
@CheckResult(suggest = Suggest.TASK_CONTROLLER)
public GroupBuilderTarget unknownSize() { public GroupBuilderTarget unknownSize() {
((DGTaskWrapper) getTaskWrapper()).setUnknownSize(true); ((DGTaskWrapper) getTaskWrapper()).setUnknownSize(true);
return this; return this;
@ -89,7 +84,6 @@ public class GroupBuilderTarget extends AbsBuilderTarget<GroupBuilderTarget> {
* *
* @return 子任务管理器 * @return 子任务管理器
*/ */
@CheckResult(suggest = Suggest.TASK_CONTROLLER)
public SubTaskManager getSubTaskManager() { public SubTaskManager getSubTaskManager() {
return mConfigHandler.getSubTaskManager(); return mConfigHandler.getSubTaskManager();
} }
@ -99,7 +93,6 @@ public class GroupBuilderTarget extends AbsBuilderTarget<GroupBuilderTarget> {
* *
* @deprecated {@link #setSubFileName(List)} 请使用该api * @deprecated {@link #setSubFileName(List)} 请使用该api
*/ */
@CheckResult(suggest = Suggest.TASK_CONTROLLER)
@Deprecated public GroupBuilderTarget setSubTaskFileName(List<String> subTaskFileName) { @Deprecated public GroupBuilderTarget setSubTaskFileName(List<String> subTaskFileName) {
return setSubFileName(subTaskFileName); return setSubFileName(subTaskFileName);
} }
@ -107,7 +100,6 @@ public class GroupBuilderTarget extends AbsBuilderTarget<GroupBuilderTarget> {
/** /**
* 设置任务组别名 * 设置任务组别名
*/ */
@CheckResult(suggest = Suggest.TASK_CONTROLLER)
public GroupBuilderTarget setGroupAlias(String alias) { public GroupBuilderTarget setGroupAlias(String alias) {
mConfigHandler.setGroupAlias(alias); mConfigHandler.setGroupAlias(alias);
return this; return this;
@ -132,7 +124,6 @@ public class GroupBuilderTarget extends AbsBuilderTarget<GroupBuilderTarget> {
* *
* @param dirPath 任务组保存文件夹路径 * @param dirPath 任务组保存文件夹路径
*/ */
@CheckResult(suggest = Suggest.TASK_CONTROLLER)
public GroupBuilderTarget setDirPath(String dirPath) { public GroupBuilderTarget setDirPath(String dirPath) {
return mConfigHandler.setDirPath(dirPath); return mConfigHandler.setDirPath(dirPath);
} }
@ -140,7 +131,6 @@ public class GroupBuilderTarget extends AbsBuilderTarget<GroupBuilderTarget> {
/** /**
* 设置子任务文件名该方法必须在{@link #setDirPath(String)}之后调用否则不生效 * 设置子任务文件名该方法必须在{@link #setDirPath(String)}之后调用否则不生效
*/ */
@CheckResult(suggest = Suggest.TASK_CONTROLLER)
public GroupBuilderTarget setSubFileName(List<String> subTaskFileName) { public GroupBuilderTarget setSubFileName(List<String> subTaskFileName) {
return mConfigHandler.setSubFileName(subTaskFileName); return mConfigHandler.setSubFileName(subTaskFileName);
} }

@ -15,10 +15,8 @@
*/ */
package com.arialyy.aria.core.download.target; package com.arialyy.aria.core.download.target;
import androidx.annotation.CheckResult;
import com.arialyy.aria.core.common.AbsNormalTarget; import com.arialyy.aria.core.common.AbsNormalTarget;
import com.arialyy.aria.core.common.HttpOption; import com.arialyy.aria.core.common.HttpOption;
import com.arialyy.aria.core.inf.Suggest;
import com.arialyy.aria.core.manager.SubTaskManager; import com.arialyy.aria.core.manager.SubTaskManager;
import com.arialyy.aria.core.wrapper.ITaskWrapper; import com.arialyy.aria.core.wrapper.ITaskWrapper;
import java.util.List; import java.util.List;
@ -39,7 +37,6 @@ public class GroupNormalTarget extends AbsNormalTarget<GroupNormalTarget> {
/** /**
* 设置http请求参数header等信息 * 设置http请求参数header等信息
*/ */
@CheckResult(suggest = Suggest.TASK_CONTROLLER)
public GroupNormalTarget option(HttpOption option) { public GroupNormalTarget option(HttpOption option) {
if (option == null) { if (option == null) {
throw new NullPointerException("任务配置为空"); throw new NullPointerException("任务配置为空");
@ -53,7 +50,6 @@ public class GroupNormalTarget extends AbsNormalTarget<GroupNormalTarget> {
* *
* @return 子任务管理器 * @return 子任务管理器
*/ */
@CheckResult(suggest = Suggest.TASK_CONTROLLER)
public SubTaskManager getSubTaskManager() { public SubTaskManager getSubTaskManager() {
return mConfigHandler.getSubTaskManager(); return mConfigHandler.getSubTaskManager();
} }
@ -61,7 +57,6 @@ public class GroupNormalTarget extends AbsNormalTarget<GroupNormalTarget> {
/** /**
* 设置任务组别名 * 设置任务组别名
*/ */
@CheckResult(suggest = Suggest.TASK_CONTROLLER)
public GroupNormalTarget setGroupAlias(String alias) { public GroupNormalTarget setGroupAlias(String alias) {
mConfigHandler.setGroupAlias(alias); mConfigHandler.setGroupAlias(alias);
return this; return this;
@ -72,7 +67,6 @@ public class GroupNormalTarget extends AbsNormalTarget<GroupNormalTarget> {
* *
* @param urls 新的组合任务下载地址列表 * @param urls 新的组合任务下载地址列表
*/ */
@CheckResult(suggest = Suggest.TASK_CONTROLLER)
public GroupNormalTarget updateUrls(List<String> urls) { public GroupNormalTarget updateUrls(List<String> urls) {
return mConfigHandler.updateUrls(urls); return mConfigHandler.updateUrls(urls);
} }
@ -96,7 +90,6 @@ public class GroupNormalTarget extends AbsNormalTarget<GroupNormalTarget> {
* *
* @param dirPath 任务组保存文件夹路径 * @param dirPath 任务组保存文件夹路径
*/ */
@CheckResult(suggest = Suggest.TASK_CONTROLLER)
public GroupNormalTarget modifyDirPath(String dirPath) { public GroupNormalTarget modifyDirPath(String dirPath) {
return mConfigHandler.setDirPath(dirPath); return mConfigHandler.setDirPath(dirPath);
} }
@ -104,7 +97,6 @@ public class GroupNormalTarget extends AbsNormalTarget<GroupNormalTarget> {
/** /**
* 更新子任务文件名该方法必须在{@link #modifyDirPath(String)}之后调用否则不生效 * 更新子任务文件名该方法必须在{@link #modifyDirPath(String)}之后调用否则不生效
*/ */
@CheckResult(suggest = Suggest.TASK_CONTROLLER)
public GroupNormalTarget modifySubFileName(List<String> subTaskFileName) { public GroupNormalTarget modifySubFileName(List<String> subTaskFileName) {
return mConfigHandler.setSubFileName(subTaskFileName); return mConfigHandler.setSubFileName(subTaskFileName);
} }

@ -15,14 +15,11 @@
*/ */
package com.arialyy.aria.core.download.target; package com.arialyy.aria.core.download.target;
import androidx.annotation.CheckResult;
import androidx.annotation.NonNull;
import com.arialyy.aria.core.common.AbsBuilderTarget; import com.arialyy.aria.core.common.AbsBuilderTarget;
import com.arialyy.aria.core.common.HttpOption; import com.arialyy.aria.core.common.HttpOption;
import com.arialyy.aria.core.download.DTaskWrapper; import com.arialyy.aria.core.download.DTaskWrapper;
import com.arialyy.aria.core.download.m3u8.M3U8LiveOption; import com.arialyy.aria.core.download.m3u8.M3U8LiveOption;
import com.arialyy.aria.core.download.m3u8.M3U8VodOption; import com.arialyy.aria.core.download.m3u8.M3U8VodOption;
import com.arialyy.aria.core.inf.Suggest;
import com.arialyy.aria.core.wrapper.AbsTaskWrapper; import com.arialyy.aria.core.wrapper.AbsTaskWrapper;
import com.arialyy.aria.core.wrapper.ITaskWrapper; import com.arialyy.aria.core.wrapper.ITaskWrapper;
@ -37,7 +34,6 @@ public class HttpBuilderTarget extends AbsBuilderTarget<HttpBuilderTarget> {
getTaskWrapper().setNewTask(true); getTaskWrapper().setNewTask(true);
} }
@CheckResult(suggest = Suggest.TASK_CONTROLLER)
public HttpBuilderTarget m3u8VodOption(M3U8VodOption m3U8VodOption) { public HttpBuilderTarget m3u8VodOption(M3U8VodOption m3U8VodOption) {
if (m3U8VodOption == null) { if (m3U8VodOption == null) {
throw new NullPointerException("m3u8任务设置为空"); throw new NullPointerException("m3u8任务设置为空");
@ -48,7 +44,6 @@ public class HttpBuilderTarget extends AbsBuilderTarget<HttpBuilderTarget> {
return this; return this;
} }
@CheckResult(suggest = Suggest.TASK_CONTROLLER)
public HttpBuilderTarget m3u8LiveOption(M3U8LiveOption m3U8LiveOption) { public HttpBuilderTarget m3u8LiveOption(M3U8LiveOption m3U8LiveOption) {
if (m3U8LiveOption == null) { if (m3U8LiveOption == null) {
throw new NullPointerException("m3u8任务设置为空"); throw new NullPointerException("m3u8任务设置为空");
@ -61,7 +56,6 @@ public class HttpBuilderTarget extends AbsBuilderTarget<HttpBuilderTarget> {
/** /**
* 设置http请求参数header等信息 * 设置http请求参数header等信息
*/ */
@CheckResult(suggest = Suggest.TASK_CONTROLLER)
public HttpBuilderTarget option(HttpOption option) { public HttpBuilderTarget option(HttpOption option) {
if (option == null) { if (option == null) {
throw new NullPointerException("任务配置为空"); throw new NullPointerException("任务配置为空");
@ -77,8 +71,7 @@ public class HttpBuilderTarget extends AbsBuilderTarget<HttpBuilderTarget> {
* *
* @param filePath 路径必须为文件路径不能为文件夹路径 * @param filePath 路径必须为文件路径不能为文件夹路径
*/ */
@CheckResult(suggest = Suggest.TASK_CONTROLLER) public HttpBuilderTarget setFilePath(String filePath) {
public HttpBuilderTarget setFilePath(@NonNull String filePath) {
mConfigHandler.setTempFilePath(filePath); mConfigHandler.setTempFilePath(filePath);
return this; return this;
} }
@ -93,8 +86,7 @@ public class HttpBuilderTarget extends AbsBuilderTarget<HttpBuilderTarget> {
* @deprecated 使用 {@link #ignoreFilePathOccupy()} * @deprecated 使用 {@link #ignoreFilePathOccupy()}
*/ */
@Deprecated @Deprecated
@CheckResult(suggest = Suggest.TASK_CONTROLLER) public HttpBuilderTarget setFilePath(String filePath, boolean forceDownload) {
public HttpBuilderTarget setFilePath(@NonNull String filePath, boolean forceDownload) {
mConfigHandler.setTempFilePath(filePath); mConfigHandler.setTempFilePath(filePath);
mConfigHandler.setForceDownload(forceDownload); mConfigHandler.setForceDownload(forceDownload);
return this; return this;

@ -15,7 +15,6 @@
*/ */
package com.arialyy.aria.core.download.target; package com.arialyy.aria.core.download.target;
import androidx.annotation.CheckResult;
import com.arialyy.aria.core.download.DTaskWrapper; import com.arialyy.aria.core.download.DTaskWrapper;
import com.arialyy.aria.core.download.DownloadEntity; import com.arialyy.aria.core.download.DownloadEntity;
import com.arialyy.aria.core.inf.AbsTarget; import com.arialyy.aria.core.inf.AbsTarget;
@ -69,7 +68,6 @@ class HttpGroupConfigHandler<TARGET extends AbsTarget> extends AbsGroupConfigHan
/** /**
* 设置子任务文件名该方法必须在{@link #setDirPath(String)}之后调用否则不生效 * 设置子任务文件名该方法必须在{@link #setDirPath(String)}之后调用否则不生效
*/ */
@CheckResult
TARGET setSubFileName(List<String> subTaskFileName) { TARGET setSubFileName(List<String> subTaskFileName) {
if (subTaskFileName == null || subTaskFileName.isEmpty()) { if (subTaskFileName == null || subTaskFileName.isEmpty()) {
ALog.w(TAG, "修改子任务的文件名失败:列表为null"); ALog.w(TAG, "修改子任务的文件名失败:列表为null");
@ -90,7 +88,6 @@ class HttpGroupConfigHandler<TARGET extends AbsTarget> extends AbsGroupConfigHan
* *
* @param urls 新的组合任务下载地址列表 * @param urls 新的组合任务下载地址列表
*/ */
@CheckResult
TARGET updateUrls(List<String> urls) { TARGET updateUrls(List<String> urls) {
if (urls == null || urls.isEmpty()) { if (urls == null || urls.isEmpty()) {
throw new NullPointerException("下载地址列表为空"); throw new NullPointerException("下载地址列表为空");

@ -15,14 +15,12 @@
*/ */
package com.arialyy.aria.core.download.target; package com.arialyy.aria.core.download.target;
import androidx.annotation.CheckResult;
import com.arialyy.aria.core.common.AbsNormalTarget; import com.arialyy.aria.core.common.AbsNormalTarget;
import com.arialyy.aria.core.common.HttpOption; import com.arialyy.aria.core.common.HttpOption;
import com.arialyy.aria.core.download.DTaskWrapper; import com.arialyy.aria.core.download.DTaskWrapper;
import com.arialyy.aria.core.download.DownloadEntity; import com.arialyy.aria.core.download.DownloadEntity;
import com.arialyy.aria.core.download.m3u8.M3U8LiveOption; import com.arialyy.aria.core.download.m3u8.M3U8LiveOption;
import com.arialyy.aria.core.download.m3u8.M3U8VodOption; import com.arialyy.aria.core.download.m3u8.M3U8VodOption;
import com.arialyy.aria.core.inf.Suggest;
import com.arialyy.aria.core.wrapper.AbsTaskWrapper; import com.arialyy.aria.core.wrapper.AbsTaskWrapper;
/** /**
@ -38,7 +36,6 @@ public class HttpNormalTarget extends AbsNormalTarget<HttpNormalTarget> {
getTaskWrapper().setNewTask(false); getTaskWrapper().setNewTask(false);
} }
@CheckResult(suggest = Suggest.TASK_CONTROLLER)
public M3U8NormalTarget m3u8VodOption(M3U8VodOption m3U8VodOption) { public M3U8NormalTarget m3u8VodOption(M3U8VodOption m3U8VodOption) {
if (m3U8VodOption == null) { if (m3U8VodOption == null) {
throw new NullPointerException("m3u8任务设置为空"); throw new NullPointerException("m3u8任务设置为空");
@ -49,12 +46,10 @@ public class HttpNormalTarget extends AbsNormalTarget<HttpNormalTarget> {
return new M3U8NormalTarget((DTaskWrapper) getTaskWrapper()); return new M3U8NormalTarget((DTaskWrapper) getTaskWrapper());
} }
@CheckResult(suggest = Suggest.TASK_CONTROLLER)
public M3U8NormalTarget m3u8VodOption() { public M3U8NormalTarget m3u8VodOption() {
return new M3U8NormalTarget((DTaskWrapper) getTaskWrapper()); return new M3U8NormalTarget((DTaskWrapper) getTaskWrapper());
} }
@CheckResult(suggest = Suggest.TASK_CONTROLLER)
public HttpNormalTarget m3u8LiveOption(M3U8LiveOption m3U8LiveOption) { public HttpNormalTarget m3u8LiveOption(M3U8LiveOption m3U8LiveOption) {
if (m3U8LiveOption == null) { if (m3U8LiveOption == null) {
throw new NullPointerException("m3u8任务设置为空"); throw new NullPointerException("m3u8任务设置为空");
@ -67,7 +62,6 @@ public class HttpNormalTarget extends AbsNormalTarget<HttpNormalTarget> {
/** /**
* 设置http请求参数header等信息 * 设置http请求参数header等信息
*/ */
@CheckResult(suggest = Suggest.TASK_CONTROLLER)
public HttpNormalTarget option(HttpOption option) { public HttpNormalTarget option(HttpOption option) {
if (option == null) { if (option == null) {
throw new NullPointerException("任务配置为空"); throw new NullPointerException("任务配置为空");
@ -81,7 +75,6 @@ public class HttpNormalTarget extends AbsNormalTarget<HttpNormalTarget> {
* 原文件路径 /mnt/sdcard/test.zip * 原文件路径 /mnt/sdcard/test.zip
* 如果需要将test.zip改为game.zip只需要重新设置文件路径为/mnt/sdcard/game.zip * 如果需要将test.zip改为game.zip只需要重新设置文件路径为/mnt/sdcard/game.zip
*/ */
@CheckResult(suggest = Suggest.TASK_CONTROLLER)
public HttpNormalTarget modifyFilePath(String filePath) { public HttpNormalTarget modifyFilePath(String filePath) {
mConfigHandler.setTempFilePath(filePath); mConfigHandler.setTempFilePath(filePath);
return this; return this;
@ -97,7 +90,6 @@ public class HttpNormalTarget extends AbsNormalTarget<HttpNormalTarget> {
/** /**
* 更新下载地址 * 更新下载地址
*/ */
@CheckResult(suggest = Suggest.TASK_CONTROLLER)
public HttpNormalTarget updateUrl(String newUrl) { public HttpNormalTarget updateUrl(String newUrl) {
return mConfigHandler.updateUrl(newUrl); return mConfigHandler.updateUrl(newUrl);
} }

@ -15,11 +15,7 @@
*/ */
package com.arialyy.aria.core.download.target; package com.arialyy.aria.core.download.target;
import androidx.annotation.CheckResult;
import androidx.annotation.NonNull;
import com.arialyy.aria.core.common.AbsBuilderTarget; import com.arialyy.aria.core.common.AbsBuilderTarget;
import com.arialyy.aria.core.inf.Suggest;
import com.arialyy.aria.core.download.tcp.TcpDelegate;
import com.arialyy.aria.core.wrapper.ITaskWrapper; import com.arialyy.aria.core.wrapper.ITaskWrapper;
/** /**
@ -51,10 +47,8 @@ public class TcpBuilderTarget extends AbsBuilderTarget<TcpBuilderTarget> {
* *
* @param filePath 路径必须为文件路径不能为文件夹路径 * @param filePath 路径必须为文件路径不能为文件夹路径
*/ */
@CheckResult(suggest = Suggest.TASK_CONTROLLER) public TcpBuilderTarget setFilePath(String filePath) {
public TcpBuilderTarget setFilePath(@NonNull String filePath) {
mConfigHandler.setTempFilePath(filePath); mConfigHandler.setTempFilePath(filePath);
return this; return this;
} }
} }

@ -16,11 +16,10 @@
package com.arialyy.aria.core.inf; package com.arialyy.aria.core.inf;
import android.text.TextUtils; import android.text.TextUtils;
import androidx.annotation.CheckResult;
import com.arialyy.aria.core.common.AbsEntity; import com.arialyy.aria.core.common.AbsEntity;
import com.arialyy.aria.core.wrapper.AbsTaskWrapper;
import com.arialyy.aria.core.common.controller.BuilderController; import com.arialyy.aria.core.common.controller.BuilderController;
import com.arialyy.aria.core.common.controller.NormalController; import com.arialyy.aria.core.common.controller.NormalController;
import com.arialyy.aria.core.wrapper.AbsTaskWrapper;
import com.arialyy.aria.util.ALog; import com.arialyy.aria.util.ALog;
import com.arialyy.aria.util.CommonUtil; import com.arialyy.aria.util.CommonUtil;
@ -61,7 +60,6 @@ public abstract class AbsTarget<TARGET extends AbsTarget> {
* *
* @param str 扩展数据 * @param str 扩展数据
*/ */
@CheckResult(suggest = Suggest.TASK_CONTROLLER)
public TARGET setExtendField(String str) { public TARGET setExtendField(String str) {
if (TextUtils.isEmpty(str)) return (TARGET) this; if (TextUtils.isEmpty(str)) return (TARGET) this;
if (TextUtils.isEmpty(mEntity.getStr()) || !mEntity.getStr().equals(str)) { if (TextUtils.isEmpty(mEntity.getStr()) || !mEntity.getStr().equals(str)) {
@ -80,7 +78,6 @@ public abstract class AbsTarget<TARGET extends AbsTarget> {
* BuilderController#add()} * BuilderController#add()}
* 等操作任务的方法那么你需要调用{@link NormalController#save()}才能将修改保存到数据库 * 等操作任务的方法那么你需要调用{@link NormalController#save()}才能将修改保存到数据库
*/ */
@CheckResult(suggest = "after use #create()、#stop()、#cancel()、#resume()、#save()?")
public TARGET resetState() { public TARGET resetState() {
getTaskWrapper().getEntity().setState(IEntity.STATE_WAIT); getTaskWrapper().getEntity().setState(IEntity.STATE_WAIT);
getTaskWrapper().setRefreshInfo(true); getTaskWrapper().setRefreshInfo(true);

@ -49,5 +49,5 @@ public interface IReceiver {
* *
* @return {@link ReceiverType} * @return {@link ReceiverType}
*/ */
@ReceiverType String getType(); String getType();
} }

@ -15,19 +15,10 @@
*/ */
package com.arialyy.aria.core.inf; package com.arialyy.aria.core.inf;
import androidx.annotation.StringDef;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/** /**
* {@link AbsReceiver}类型 * {@link AbsReceiver}类型
*/ */
@StringDef({ public interface ReceiverType {
ReceiverType.DOWNLOAD,
ReceiverType.UPLOAD,
})
@Retention(RetentionPolicy.SOURCE)
public @interface ReceiverType {
String DOWNLOAD = "download"; String DOWNLOAD = "download";
String UPLOAD = "upload"; String UPLOAD = "upload";
} }

@ -15,11 +15,11 @@
*/ */
package com.arialyy.aria.core.manager; package com.arialyy.aria.core.manager;
import androidx.collection.LruCache; import android.util.LruCache;
import com.arialyy.aria.core.download.DGTaskWrapper; import com.arialyy.aria.core.download.DGTaskWrapper;
import com.arialyy.aria.core.download.DTaskWrapper; import com.arialyy.aria.core.download.DTaskWrapper;
import com.arialyy.aria.core.wrapper.AbsTaskWrapper;
import com.arialyy.aria.core.upload.UTaskWrapper; import com.arialyy.aria.core.upload.UTaskWrapper;
import com.arialyy.aria.core.wrapper.AbsTaskWrapper;
import com.arialyy.aria.util.ALog; import com.arialyy.aria.util.ALog;
import com.arialyy.aria.util.CommonUtil; import com.arialyy.aria.util.CommonUtil;
import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.Lock;

@ -16,8 +16,6 @@
package com.arialyy.aria.core.upload; package com.arialyy.aria.core.upload;
import android.text.TextUtils; import android.text.TextUtils;
import androidx.annotation.CheckResult;
import androidx.annotation.NonNull;
import com.arialyy.annotations.TaskEnum; import com.arialyy.annotations.TaskEnum;
import com.arialyy.aria.core.AriaConfig; import com.arialyy.aria.core.AriaConfig;
import com.arialyy.aria.core.AriaManager; import com.arialyy.aria.core.AriaManager;
@ -68,8 +66,8 @@ public class UploadReceiver extends AbsReceiver {
* *
* @param filePath 文件路径 * @param filePath 文件路径
*/ */
@CheckResult
public HttpBuilderTarget load(@NonNull String filePath) { public HttpBuilderTarget load(String filePath) {
ComponentUtil.getInstance().checkComponentExist(ComponentUtil.COMPONENT_TYPE_HTTP); ComponentUtil.getInstance().checkComponentExist(ComponentUtil.COMPONENT_TYPE_HTTP);
CheckUtil.checkUploadPathIsEmpty(filePath); CheckUtil.checkUploadPathIsEmpty(filePath);
return UTargetFactory.getInstance() return UTargetFactory.getInstance()
@ -82,7 +80,7 @@ public class UploadReceiver extends AbsReceiver {
* @param taskId 任务id可从{@link AbsBuilderTarget#create()}{@link AbsBuilderTarget#add()}{@link * @param taskId 任务id可从{@link AbsBuilderTarget#create()}{@link AbsBuilderTarget#add()}{@link
* AbsEntity#getId()}读取任务id * AbsEntity#getId()}读取任务id
*/ */
@CheckResult
public HttpNormalTarget load(long taskId) { public HttpNormalTarget load(long taskId) {
ComponentUtil.getInstance().checkComponentExist(ComponentUtil.COMPONENT_TYPE_HTTP); ComponentUtil.getInstance().checkComponentExist(ComponentUtil.COMPONENT_TYPE_HTTP);
return UTargetFactory.getInstance() return UTargetFactory.getInstance()
@ -94,8 +92,8 @@ public class UploadReceiver extends AbsReceiver {
* *
* @param filePath 文件路径 * @param filePath 文件路径
*/ */
@CheckResult
public FtpBuilderTarget loadFtp(@NonNull String filePath) { public FtpBuilderTarget loadFtp(String filePath) {
ComponentUtil.getInstance().checkComponentExist(ComponentUtil.COMPONENT_TYPE_FTP); ComponentUtil.getInstance().checkComponentExist(ComponentUtil.COMPONENT_TYPE_FTP);
CheckUtil.checkUploadPathIsEmpty(filePath); CheckUtil.checkUploadPathIsEmpty(filePath);
return UTargetFactory.getInstance() return UTargetFactory.getInstance()
@ -108,7 +106,7 @@ public class UploadReceiver extends AbsReceiver {
* @param taskId 任务id可从{@link AbsBuilderTarget#create()}{@link AbsBuilderTarget#add()}{@link * @param taskId 任务id可从{@link AbsBuilderTarget#create()}{@link AbsBuilderTarget#add()}{@link
* AbsEntity#getId()}读取任务id * AbsEntity#getId()}读取任务id
*/ */
@CheckResult
public FtpNormalTarget loadFtp(long taskId) { public FtpNormalTarget loadFtp(long taskId) {
ComponentUtil.getInstance().checkComponentExist(ComponentUtil.COMPONENT_TYPE_FTP); ComponentUtil.getInstance().checkComponentExist(ComponentUtil.COMPONENT_TYPE_FTP);
return UTargetFactory.getInstance() return UTargetFactory.getInstance()

@ -15,11 +15,8 @@
*/ */
package com.arialyy.aria.core.upload.target; package com.arialyy.aria.core.upload.target;
import androidx.annotation.CheckResult;
import com.arialyy.aria.core.common.AbsBuilderTarget; import com.arialyy.aria.core.common.AbsBuilderTarget;
import com.arialyy.aria.core.common.FtpOption; import com.arialyy.aria.core.common.FtpOption;
import com.arialyy.aria.core.inf.Suggest;
import com.arialyy.aria.core.upload.UTaskWrapper;
import com.arialyy.aria.core.wrapper.ITaskWrapper; import com.arialyy.aria.core.wrapper.ITaskWrapper;
import com.arialyy.aria.util.CommonUtil; import com.arialyy.aria.util.CommonUtil;
@ -43,7 +40,6 @@ public class FtpBuilderTarget extends AbsBuilderTarget<FtpBuilderTarget> {
* *
* @param tempUrl 上传路径 * @param tempUrl 上传路径
*/ */
@CheckResult(suggest = Suggest.TASK_CONTROLLER)
public FtpBuilderTarget setUploadUrl(String tempUrl) { public FtpBuilderTarget setUploadUrl(String tempUrl) {
url = tempUrl; url = tempUrl;
mConfigHandler.setTempUrl(tempUrl); mConfigHandler.setTempUrl(tempUrl);
@ -64,7 +60,6 @@ public class FtpBuilderTarget extends AbsBuilderTarget<FtpBuilderTarget> {
/** /**
* 设置登陆字符串编码ftps等参数 * 设置登陆字符串编码ftps等参数
*/ */
@CheckResult(suggest = Suggest.TASK_CONTROLLER)
public FtpBuilderTarget option(FtpOption option) { public FtpBuilderTarget option(FtpOption option) {
if (option == null) { if (option == null) {
throw new NullPointerException("ftp 任务配置为空"); throw new NullPointerException("ftp 任务配置为空");

@ -15,10 +15,8 @@
*/ */
package com.arialyy.aria.core.upload.target; package com.arialyy.aria.core.upload.target;
import androidx.annotation.CheckResult;
import com.arialyy.aria.core.common.AbsNormalTarget; import com.arialyy.aria.core.common.AbsNormalTarget;
import com.arialyy.aria.core.common.FtpOption; import com.arialyy.aria.core.common.FtpOption;
import com.arialyy.aria.core.inf.Suggest;
import com.arialyy.aria.core.upload.UploadEntity; import com.arialyy.aria.core.upload.UploadEntity;
import com.arialyy.aria.core.wrapper.ITaskWrapper; import com.arialyy.aria.core.wrapper.ITaskWrapper;
import com.arialyy.aria.util.CommonUtil; import com.arialyy.aria.util.CommonUtil;
@ -39,7 +37,6 @@ public class FtpNormalTarget extends AbsNormalTarget<FtpNormalTarget> {
/** /**
* 设置登陆字符串编码ftps等参数 * 设置登陆字符串编码ftps等参数
*/ */
@CheckResult(suggest = Suggest.TASK_CONTROLLER)
public FtpNormalTarget option(FtpOption option) { public FtpNormalTarget option(FtpOption option) {
if (option == null) { if (option == null) {
throw new NullPointerException("ftp 任务配置为空"); throw new NullPointerException("ftp 任务配置为空");

@ -15,10 +15,8 @@
*/ */
package com.arialyy.aria.core.upload.target; package com.arialyy.aria.core.upload.target;
import androidx.annotation.CheckResult;
import com.arialyy.aria.core.common.AbsBuilderTarget; import com.arialyy.aria.core.common.AbsBuilderTarget;
import com.arialyy.aria.core.common.HttpOption; import com.arialyy.aria.core.common.HttpOption;
import com.arialyy.aria.core.inf.Suggest;
import com.arialyy.aria.core.wrapper.AbsTaskWrapper; import com.arialyy.aria.core.wrapper.AbsTaskWrapper;
/** /**
@ -42,7 +40,6 @@ public class HttpBuilderTarget extends AbsBuilderTarget<HttpBuilderTarget> {
* *
* @param tempUrl 上传路径 * @param tempUrl 上传路径
*/ */
@CheckResult(suggest = Suggest.TASK_CONTROLLER)
public HttpBuilderTarget setUploadUrl(String tempUrl) { public HttpBuilderTarget setUploadUrl(String tempUrl) {
mConfigHandler.setTempUrl(tempUrl); mConfigHandler.setTempUrl(tempUrl);
return this; return this;
@ -51,7 +48,6 @@ public class HttpBuilderTarget extends AbsBuilderTarget<HttpBuilderTarget> {
/** /**
* 设置http请求参数header等信息 * 设置http请求参数header等信息
*/ */
@CheckResult(suggest = Suggest.TASK_CONTROLLER)
public HttpBuilderTarget option(HttpOption option) { public HttpBuilderTarget option(HttpOption option) {
if (option == null) { if (option == null) {

@ -15,10 +15,8 @@
*/ */
package com.arialyy.aria.core.upload.target; package com.arialyy.aria.core.upload.target;
import androidx.annotation.CheckResult;
import com.arialyy.aria.core.common.AbsNormalTarget; import com.arialyy.aria.core.common.AbsNormalTarget;
import com.arialyy.aria.core.common.HttpOption; import com.arialyy.aria.core.common.HttpOption;
import com.arialyy.aria.core.inf.Suggest;
import com.arialyy.aria.core.wrapper.AbsTaskWrapper; import com.arialyy.aria.core.wrapper.AbsTaskWrapper;
import com.arialyy.aria.util.ALog; import com.arialyy.aria.util.ALog;
@ -41,7 +39,6 @@ public class HttpNormalTarget extends AbsNormalTarget<HttpNormalTarget> {
* *
* @param tempUrl 上传路径 * @param tempUrl 上传路径
*/ */
@CheckResult(suggest = Suggest.TASK_CONTROLLER)
public HttpNormalTarget setUploadUrl(String tempUrl) { public HttpNormalTarget setUploadUrl(String tempUrl) {
mConfigHandler.setTempUrl(tempUrl); mConfigHandler.setTempUrl(tempUrl);
return this; return this;
@ -50,7 +47,6 @@ public class HttpNormalTarget extends AbsNormalTarget<HttpNormalTarget> {
/** /**
* 设置http请求参数header等信息 * 设置http请求参数header等信息
*/ */
@CheckResult(suggest = Suggest.TASK_CONTROLLER)
public HttpNormalTarget option(HttpOption option) { public HttpNormalTarget option(HttpOption option) {
if (option == null) { if (option == null) {
throw new NullPointerException("任务配置为空"); throw new NullPointerException("任务配置为空");

@ -1,4 +1,7 @@
## 开发日志 ## 开发日志
+ v_3.8
- 移除androidx和support的依赖,现在无论是哪个版本的appcompat包都可以使用本框架
- 修复一个在xml中使用fragment导致的内存泄漏问题
+ v_3.7.10 (2019/12/3) + v_3.7.10 (2019/12/3)
- fix bug https://github.com/AriaLyy/Aria/issues/543#issuecomment-559733124 - fix bug https://github.com/AriaLyy/Aria/issues/543#issuecomment-559733124
- fix bug https://github.com/AriaLyy/Aria/issues/542 - fix bug https://github.com/AriaLyy/Aria/issues/542

@ -25,8 +25,6 @@ android {
dependencies { dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar']) implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "androidx.appcompat:appcompat:${rootProject.ext.XAppcompatVersion}"
implementation project(path: ':PublicComponent') implementation project(path: ':PublicComponent')
} }

@ -15,7 +15,6 @@
*/ */
package com.arialyy.aria.ftp.upload; package com.arialyy.aria.ftp.upload;
import androidx.annotation.NonNull;
import com.arialyy.aria.util.BufferedRandomAccessFile; import com.arialyy.aria.util.BufferedRandomAccessFile;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
@ -34,12 +33,12 @@ final class FtpFISAdapter extends InputStream {
void onProgressCallback(byte[] buffer, int byteOffset, int byteCount) throws IOException; void onProgressCallback(byte[] buffer, int byteOffset, int byteCount) throws IOException;
} }
FtpFISAdapter(@NonNull BufferedRandomAccessFile is, @NonNull ProgressCallback callback) { FtpFISAdapter(BufferedRandomAccessFile is, ProgressCallback callback) {
mIs = is; mIs = is;
mCallback = callback; mCallback = callback;
} }
FtpFISAdapter(@NonNull BufferedRandomAccessFile is) { FtpFISAdapter(BufferedRandomAccessFile is) {
mIs = is; mIs = is;
} }
@ -51,7 +50,7 @@ final class FtpFISAdapter extends InputStream {
return mIs.read(); return mIs.read();
} }
@Override public int read(@NonNull byte[] buffer) throws IOException { @Override public int read(byte[] buffer) throws IOException {
count = mIs.read(buffer); count = mIs.read(buffer);
if (mCallback != null) { if (mCallback != null) {
mCallback.onProgressCallback(buffer, 0, count); mCallback.onProgressCallback(buffer, 0, count);
@ -59,7 +58,7 @@ final class FtpFISAdapter extends InputStream {
return count; return count;
} }
@Override public int read(@NonNull byte[] buffer, int byteOffset, int byteCount) @Override public int read(byte[] buffer, int byteOffset, int byteCount)
throws IOException { throws IOException {
count = mIs.read(buffer, byteOffset, byteCount); count = mIs.read(buffer, byteOffset, byteCount);
if (mCallback != null) { if (mCallback != null) {

@ -10,7 +10,6 @@ android {
versionCode rootProject.ext.versionCode versionCode rootProject.ext.versionCode
versionName rootProject.ext.versionName versionName rootProject.ext.versionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro' consumerProguardFiles 'consumer-rules.pro'
} }
@ -25,9 +24,6 @@ android {
dependencies { dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar']) implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "androidx.appcompat:appcompat:${rootProject.ext.XAppcompatVersion}"
testImplementation 'junit:junit:4.12'
implementation project(path: ':PublicComponent') implementation project(path: ':PublicComponent')
} }

@ -25,7 +25,6 @@ android {
dependencies { dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar']) implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "androidx.appcompat:appcompat:${rootProject.ext.XAppcompatVersion}"
implementation project(path: ':HttpComponent') implementation project(path: ':HttpComponent')
implementation project(path: ':PublicComponent') implementation project(path: ':PublicComponent')
} }

@ -24,7 +24,6 @@ android {
dependencies { dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar']) implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "androidx.appcompat:appcompat:${rootProject.ext.XAppcompatVersion}"
testImplementation 'junit:junit:4.12' testImplementation 'junit:junit:4.12'
} }

@ -92,7 +92,6 @@ public class FtpUrlEntity implements Cloneable {
* 连接协议 * 连接协议
* {@link ProtocolType} * {@link ProtocolType}
*/ */
@ProtocolType
public String protocol = ProtocolType.Default; public String protocol = ProtocolType.Default;
/** /**

@ -15,20 +15,7 @@
*/ */
package com.arialyy.aria.core; package com.arialyy.aria.core;
import androidx.annotation.StringDef; public interface ProtocolType {
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@StringDef({
ProtocolType.Default,
ProtocolType.SSL,
ProtocolType.SSLv3,
ProtocolType.TLS,
ProtocolType.TLSv1,
ProtocolType.TLSv1_1,
ProtocolType.TLSv1_2
})
@Retention(RetentionPolicy.SOURCE) public @interface ProtocolType {
String Default = "TLS"; String Default = "TLS";
String SSL = "SSL"; String SSL = "SSL";
String SSLv3 = "SSLv3"; String SSLv3 = "SSLv3";

@ -15,17 +15,7 @@
*/ */
package com.arialyy.aria.core.config; package com.arialyy.aria.core.config;
import androidx.annotation.IntDef; public interface ConfigType {
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@IntDef({
ConfigType.DOWNLOAD,
ConfigType.UPLOAD,
ConfigType.APP,
ConfigType.D_GROUP
})
@Retention(RetentionPolicy.SOURCE) @interface ConfigType {
int DOWNLOAD = 1; int DOWNLOAD = 1;
int UPLOAD = 2; int UPLOAD = 2;
int APP = 3; int APP = 3;

@ -33,7 +33,7 @@ public class XMLReader extends DefaultHandler {
private UploadConfig mUploadConfig = Configuration.getInstance().uploadCfg; private UploadConfig mUploadConfig = Configuration.getInstance().uploadCfg;
private AppConfig mAppConfig = Configuration.getInstance().appCfg; private AppConfig mAppConfig = Configuration.getInstance().appCfg;
private DGroupConfig mDGroupConfig = Configuration.getInstance().dGroupCfg; private DGroupConfig mDGroupConfig = Configuration.getInstance().dGroupCfg;
private @ConfigType int mType; private int mType;
@Override public void startDocument() throws SAXException { @Override public void startDocument() throws SAXException {
super.startDocument(); super.startDocument();

@ -1,17 +1,6 @@
package com.arialyy.aria.core.inf; package com.arialyy.aria.core.inf;
import androidx.annotation.IntDef; public interface TaskSchedulerType {
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@IntDef({
TaskSchedulerType.TYPE_DEFAULT,
TaskSchedulerType.TYPE_STOP_NOT_NEXT,
TaskSchedulerType.TYPE_STOP_AND_WAIT,
TaskSchedulerType.TYPE_CANCEL_AND_NOT_NOTIFY,
TaskSchedulerType.TYPE_START_AND_RESET_STATE
})
@Retention(RetentionPolicy.SOURCE) public @interface TaskSchedulerType {
int TYPE_DEFAULT = 1; int TYPE_DEFAULT = 1;
/** /**
* 停止当前任务并且不自动启动下一任务 * 停止当前任务并且不自动启动下一任务

@ -15,7 +15,6 @@
*/ */
package com.arialyy.aria.core.processor; package com.arialyy.aria.core.processor;
import androidx.annotation.Nullable;
import com.arialyy.aria.core.download.M3U8Entity; import com.arialyy.aria.core.download.M3U8Entity;
import com.arialyy.aria.core.inf.IEventHandler; import com.arialyy.aria.core.inf.IEventHandler;
import java.util.List; import java.util.List;
@ -33,5 +32,5 @@ public interface ITsMergeHandler extends IEventHandler {
* @param tsPath ts文件列表 * @param tsPath ts文件列表
* @return {@code true} 合并成功 * @return {@code true} 合并成功
*/ */
boolean merge(@Nullable M3U8Entity m3U8Entity, List<String> tsPath); boolean merge(M3U8Entity m3U8Entity, List<String> tsPath);
} }

@ -52,7 +52,6 @@ public abstract class AbsTask<TASK_WRAPPER extends AbsTaskWrapper>
/** /**
* 该任务的调度类型 * 该任务的调度类型
*/ */
@TaskSchedulerType
private int mSchedulerType = TaskSchedulerType.TYPE_DEFAULT; private int mSchedulerType = TaskSchedulerType.TYPE_DEFAULT;
protected IEventListener mListener; protected IEventListener mListener;
@ -193,7 +192,7 @@ public abstract class AbsTask<TASK_WRAPPER extends AbsTaskWrapper>
start(TaskSchedulerType.TYPE_DEFAULT); start(TaskSchedulerType.TYPE_DEFAULT);
} }
@Override public void start(@TaskSchedulerType int type) { @Override public void start(int type) {
mSchedulerType = type; mSchedulerType = type;
if (type == TaskSchedulerType.TYPE_START_AND_RESET_STATE) { if (type == TaskSchedulerType.TYPE_START_AND_RESET_STATE) {
if (getUtil().isRunning()) { if (getUtil().isRunning()) {
@ -216,7 +215,7 @@ public abstract class AbsTask<TASK_WRAPPER extends AbsTaskWrapper>
stop(TaskSchedulerType.TYPE_DEFAULT); stop(TaskSchedulerType.TYPE_DEFAULT);
} }
@Override public void stop(@TaskSchedulerType int type) { @Override public void stop(int type) {
isStop = true; isStop = true;
mSchedulerType = type; mSchedulerType = type;
getUtil().stop(); getUtil().stop();
@ -226,7 +225,7 @@ public abstract class AbsTask<TASK_WRAPPER extends AbsTaskWrapper>
cancel(TaskSchedulerType.TYPE_DEFAULT); cancel(TaskSchedulerType.TYPE_DEFAULT);
} }
@Override public void cancel(@TaskSchedulerType int type) { @Override public void cancel(int type) {
isCancel = true; isCancel = true;
mSchedulerType = type; mSchedulerType = type;
getUtil().cancel(); getUtil().cancel();

@ -91,7 +91,7 @@ public interface ITask<TASK_WRAPPER extends AbsTaskWrapper> {
* *
* @param type {@link TaskSchedulerType} * @param type {@link TaskSchedulerType}
*/ */
void start(@TaskSchedulerType int type); void start(int type);
/** /**
* 停止任务 * 停止任务
@ -103,7 +103,7 @@ public interface ITask<TASK_WRAPPER extends AbsTaskWrapper> {
* *
* @param type {@link TaskSchedulerType} * @param type {@link TaskSchedulerType}
*/ */
void stop(@TaskSchedulerType int type); void stop(int type);
/** /**
* 删除任务 * 删除任务
@ -115,7 +115,7 @@ public interface ITask<TASK_WRAPPER extends AbsTaskWrapper> {
* *
* @param type {@link TaskSchedulerType} * @param type {@link TaskSchedulerType}
*/ */
void cancel(@TaskSchedulerType int type); void cancel(int type);
/** /**
* 读取扩展数据 * 读取扩展数据

@ -16,7 +16,6 @@
package com.arialyy.aria.core.task; package com.arialyy.aria.core.task;
import android.os.Bundle; import android.os.Bundle;
import androidx.annotation.Nullable;
import com.arialyy.aria.core.inf.IThreadState; import com.arialyy.aria.core.inf.IThreadState;
import com.arialyy.aria.exception.BaseException; import com.arialyy.aria.exception.BaseException;
@ -33,7 +32,7 @@ public interface IThreadTaskObserver {
* *
* @param state state {@link IThreadState#STATE_STOP}.. * @param state state {@link IThreadState#STATE_STOP}..
*/ */
void updateState(int state, @Nullable Bundle bundle); void updateState(int state, Bundle bundle);
/** /**
* 更新完成的状态 * 更新完成的状态
@ -45,7 +44,7 @@ public interface IThreadTaskObserver {
* *
* @param needRetry 是否需要重试一般是网络错误才需要重试 * @param needRetry 是否需要重试一般是网络错误才需要重试
*/ */
void updateFailState(@Nullable BaseException e, boolean needRetry); void updateFailState(BaseException e, boolean needRetry);
/** /**
* 更新进度 * 更新进度

@ -20,7 +20,6 @@ import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.Message; import android.os.Message;
import android.os.Process; import android.os.Process;
import androidx.annotation.Nullable;
import com.arialyy.aria.core.AriaConfig; import com.arialyy.aria.core.AriaConfig;
import com.arialyy.aria.core.ThreadRecord; import com.arialyy.aria.core.ThreadRecord;
import com.arialyy.aria.core.common.SubThreadConfig; import com.arialyy.aria.core.common.SubThreadConfig;
@ -259,7 +258,7 @@ public class ThreadTask implements IThreadTask, IThreadTaskObserver {
* @param bundle 而外数据 * @param bundle 而外数据
*/ */
@Override @Override
public synchronized void updateState(int state, @Nullable Bundle bundle) { public synchronized void updateState(int state, Bundle bundle) {
Message msg = mStateHandler.obtainMessage(); Message msg = mStateHandler.obtainMessage();
msg.what = state; msg.what = state;
if (state != IThreadState.STATE_UPDATE_PROGRESS) { if (state != IThreadState.STATE_UPDATE_PROGRESS) {
@ -297,7 +296,7 @@ public class ThreadTask implements IThreadTask, IThreadTaskObserver {
* *
* @param needRetry 是否需要重试一般是网络错误才需要重试 * @param needRetry 是否需要重试一般是网络错误才需要重试
*/ */
@Override public synchronized void updateFailState(@Nullable BaseException e, boolean needRetry) { @Override public synchronized void updateFailState(BaseException e, boolean needRetry) {
fail(mRangeProgress, e, needRetry); fail(mRangeProgress, e, needRetry);
} }
@ -448,7 +447,7 @@ public class ThreadTask implements IThreadTask, IThreadTaskObserver {
/** /**
* 发送失败信息 * 发送失败信息
*/ */
private void sendFailMsg(@Nullable BaseException e,boolean needRetry) { private void sendFailMsg(BaseException e, boolean needRetry) {
Bundle b = new Bundle(); Bundle b = new Bundle();
b.putBoolean(IThreadState.KEY_RETRY, needRetry); b.putBoolean(IThreadState.KEY_RETRY, needRetry);
if (e != null) { if (e != null) {

@ -56,8 +56,7 @@ public class SSLContextUtil {
* @param caPath 保存在assets目录下的CA证书完整路径 * @param caPath 保存在assets目录下的CA证书完整路径
* @param protocol 连接协议 * @param protocol 连接协议
*/ */
public static SSLContext getSSLContextFromAssets(String caAlias, String caPath, public static SSLContext getSSLContextFromAssets(String caAlias, String caPath, String protocol) {
@ProtocolType String protocol) {
if (TextUtils.isEmpty(caAlias) || TextUtils.isEmpty(caPath)) { if (TextUtils.isEmpty(caAlias) || TextUtils.isEmpty(caPath)) {
return null; return null;
} }
@ -83,8 +82,7 @@ public class SSLContextUtil {
* @param caPath CA证书路径 * @param caPath CA证书路径
* @param protocol 连接协议 * @param protocol 连接协议
*/ */
public static SSLContext getSSLContext(String caAlias, String caPath, public static SSLContext getSSLContext(String caAlias, String caPath, String protocol) {
@ProtocolType String protocol) {
if (TextUtils.isEmpty(caAlias) || TextUtils.isEmpty(caPath)) { if (TextUtils.isEmpty(caAlias) || TextUtils.isEmpty(caPath)) {
return null; return null;
} }
@ -105,8 +103,8 @@ public class SSLContextUtil {
/** /**
* @param cacheKey 别名 + 证书路径然后取md5 * @param cacheKey 别名 + 证书路径然后取md5
*/ */
private static SSLContext createContext(String caAlias, Certificate ca, private static SSLContext createContext(String caAlias, Certificate ca, String protocol,
@ProtocolType String protocol, String cacheKey) { String cacheKey) {
try { try {
String keyStoreType = KeyStore.getDefaultType(); String keyStoreType = KeyStore.getDefaultType();
KeyStore keyStore = KeyStore.getInstance(keyStoreType); KeyStore keyStore = KeyStore.getInstance(keyStoreType);
@ -154,7 +152,7 @@ public class SSLContextUtil {
/** /**
* 服务器证书不是由 CA 签署的而是自签署时获取默认的SSL * 服务器证书不是由 CA 签署的而是自签署时获取默认的SSL
*/ */
public static SSLContext getDefaultSLLContext(@ProtocolType String protocol) { public static SSLContext getDefaultSLLContext(String protocol) {
SSLContext sslContext = null; SSLContext sslContext = null;
try { try {
sslContext = sslContext =

@ -27,9 +27,6 @@ package com.arialyy.aria.util;
import android.os.Handler; import android.os.Handler;
import android.os.Looper; import android.os.Looper;
import android.os.Message; import android.os.Message;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock; import java.util.concurrent.locks.ReentrantLock;
@ -51,7 +48,7 @@ import java.util.concurrent.locks.ReentrantLock;
// hard reference to Callback. We need to keep callback in memory // hard reference to Callback. We need to keep callback in memory
private final ExecHandler mExec; private final ExecHandler mExec;
private Lock mLock = new ReentrantLock(); private Lock mLock = new ReentrantLock();
@SuppressWarnings("ConstantConditions") @VisibleForTesting final ChainedRef mRunnables = @SuppressWarnings("ConstantConditions") final ChainedRef mRunnables =
new ChainedRef(mLock, null); new ChainedRef(mLock, null);
/** /**
@ -76,7 +73,7 @@ import java.util.concurrent.locks.ReentrantLock;
* *
* @param callback The callback interface in which to handle messages, or null. * @param callback The callback interface in which to handle messages, or null.
*/ */
public WeakHandler(@Nullable Handler.Callback callback) { public WeakHandler(Handler.Callback callback) {
mCallback = callback; // Hard referencing body mCallback = callback; // Hard referencing body
mExec = new ExecHandler(new WeakReference<>(callback)); // Weak referencing inside ExecHandler mExec = new ExecHandler(new WeakReference<>(callback)); // Weak referencing inside ExecHandler
} }
@ -86,7 +83,7 @@ import java.util.concurrent.locks.ReentrantLock;
* *
* @param looper The looper, must not be null. * @param looper The looper, must not be null.
*/ */
public WeakHandler(@NonNull Looper looper) { public WeakHandler(Looper looper) {
mCallback = null; mCallback = null;
mExec = new ExecHandler(looper); mExec = new ExecHandler(looper);
} }
@ -98,7 +95,7 @@ import java.util.concurrent.locks.ReentrantLock;
* @param looper The looper, must not be null. * @param looper The looper, must not be null.
* @param callback The callback interface in which to handle messages, or null. * @param callback The callback interface in which to handle messages, or null.
*/ */
public WeakHandler(@NonNull Looper looper, @NonNull Handler.Callback callback) { public WeakHandler(Looper looper, Handler.Callback callback) {
mCallback = callback; mCallback = callback;
mExec = new ExecHandler(looper, new WeakReference<>(callback)); mExec = new ExecHandler(looper, new WeakReference<>(callback));
} }
@ -113,7 +110,7 @@ import java.util.concurrent.locks.ReentrantLock;
* message queue. Returns false on failure, usually because the * message queue. Returns false on failure, usually because the
* looper processing the message queue is exiting. * looper processing the message queue is exiting.
*/ */
public final boolean post(@NonNull Runnable r) { public final boolean post(Runnable r) {
return mExec.post(wrapRunnable(r)); return mExec.post(wrapRunnable(r));
} }
@ -133,7 +130,7 @@ import java.util.concurrent.locks.ReentrantLock;
* the looper is quit before the delivery time of the message * the looper is quit before the delivery time of the message
* occurs then the message will be dropped. * occurs then the message will be dropped.
*/ */
public final boolean postAtTime(@NonNull Runnable r, long uptimeMillis) { public final boolean postAtTime(Runnable r, long uptimeMillis) {
return mExec.postAtTime(wrapRunnable(r), uptimeMillis); return mExec.postAtTime(wrapRunnable(r), uptimeMillis);
} }
@ -367,7 +364,7 @@ import java.util.concurrent.locks.ReentrantLock;
return mExec.getLooper(); return mExec.getLooper();
} }
private WeakRunnable wrapRunnable(@NonNull Runnable r) { private WeakRunnable wrapRunnable(Runnable r) {
//noinspection ConstantConditions //noinspection ConstantConditions
if (r == null) { if (r == null) {
throw new NullPointerException("Runnable can't be null"); throw new NullPointerException("Runnable can't be null");
@ -398,7 +395,7 @@ import java.util.concurrent.locks.ReentrantLock;
mCallback = callback; mCallback = callback;
} }
@Override public void handleMessage(@NonNull Message msg) { @Override public void handleMessage(Message msg) {
if (mCallback == null) { if (mCallback == null) {
return; return;
} }
@ -432,14 +429,14 @@ import java.util.concurrent.locks.ReentrantLock;
} }
static class ChainedRef { static class ChainedRef {
@Nullable ChainedRef next; ChainedRef next;
@Nullable ChainedRef prev; ChainedRef prev;
@NonNull final Runnable runnable; final Runnable runnable;
@NonNull final WeakRunnable wrapper; final WeakRunnable wrapper;
@NonNull Lock lock; Lock lock;
public ChainedRef(@NonNull Lock lock, @NonNull Runnable r) { public ChainedRef(Lock lock, Runnable r) {
this.runnable = r; this.runnable = r;
this.lock = lock; this.lock = lock;
this.wrapper = new WeakRunnable(new WeakReference<>(r), new WeakReference<>(this)); this.wrapper = new WeakRunnable(new WeakReference<>(r), new WeakReference<>(this));
@ -462,7 +459,7 @@ import java.util.concurrent.locks.ReentrantLock;
return wrapper; return wrapper;
} }
public void insertAfter(@NonNull ChainedRef candidate) { public void insertAfter(ChainedRef candidate) {
lock.lock(); lock.lock();
try { try {
if (this.next != null) { if (this.next != null) {
@ -477,7 +474,7 @@ import java.util.concurrent.locks.ReentrantLock;
} }
} }
@Nullable public WeakRunnable remove(Runnable obj) { public WeakRunnable remove(Runnable obj) {
lock.lock(); lock.lock();
try { try {
ChainedRef curr = this.next; // Skipping head ChainedRef curr = this.next; // Skipping head

@ -25,7 +25,6 @@ android {
dependencies { dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar']) implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "androidx.appcompat:appcompat:${rootProject.ext.XAppcompatVersion}"
implementation "com.jcraft:jsch:0.1.55" implementation "com.jcraft:jsch:0.1.55"
implementation "com.jcraft:jzlib:1.1.3" implementation "com.jcraft:jzlib:1.1.3"
implementation project(path: ':FtpComponent') implementation project(path: ':FtpComponent')

@ -35,7 +35,7 @@ public class UploadModule extends BaseViewModule {
* 获取Ftp上传信息 * 获取Ftp上传信息
*/ */
LiveData<UploadEntity> getFtpInfo(Context context) { LiveData<UploadEntity> getFtpInfo(Context context) {
String url = AppUtil.getConfigValue(context, FTP_URL_KEY, "ftp://9.9.9.72:2121/aa/你好"); String url = AppUtil.getConfigValue(context, FTP_URL_KEY, "ftp://9.9.9.72:2121/aab/你好");
String filePath = AppUtil.getConfigValue(context, FTP_PATH_KEY, String filePath = AppUtil.getConfigValue(context, FTP_PATH_KEY,
Environment.getExternalStorageDirectory().getPath() + "/Download/AndroidAria.db"); Environment.getExternalStorageDirectory().getPath() + "/Download/AndroidAria.db");

Loading…
Cancel
Save