通过广播发送下载进度事件时,限制在当前包发送广播

pull/709/head
陈斐 4 years ago
parent a3df4016ff
commit 1241bc5991
  1. 3
      Aria/src/main/java/com/arialyy/aria/core/scheduler/TaskSchedulers.java

@ -239,6 +239,7 @@ public class TaskSchedulers<TASK extends ITask> implements ISchedulers {
boolean canSend = mAriaConfig.getAConfig().isUseBroadcast(); boolean canSend = mAriaConfig.getAConfig().isUseBroadcast();
if (canSend) { if (canSend) {
Intent intent = new Intent(ISchedulers.ARIA_TASK_INFO_ACTION); Intent intent = new Intent(ISchedulers.ARIA_TASK_INFO_ACTION);
intent.setPackage(mAriaConfig.getAPP().getPackageName());
intent.putExtras(data); intent.putExtras(data);
mAriaConfig.getAPP().sendBroadcast(intent); mAriaConfig.getAPP().sendBroadcast(intent);
} }
@ -362,6 +363,7 @@ public class TaskSchedulers<TASK extends ITask> implements ISchedulers {
boolean canSend = mAriaConfig.getAConfig().isUseBroadcast(); boolean canSend = mAriaConfig.getAConfig().isUseBroadcast();
if (canSend) { if (canSend) {
Intent intent = new Intent(ISchedulers.ARIA_TASK_INFO_ACTION); Intent intent = new Intent(ISchedulers.ARIA_TASK_INFO_ACTION);
intent.setPackage(mAriaConfig.getAPP().getPackageName());
Bundle b = new Bundle(); Bundle b = new Bundle();
b.putInt(ISchedulers.TASK_TYPE, taskType); b.putInt(ISchedulers.TASK_TYPE, taskType);
b.putInt(ISchedulers.TASK_STATE, ISchedulers.FAIL); b.putInt(ISchedulers.TASK_STATE, ISchedulers.FAIL);
@ -501,6 +503,7 @@ public class TaskSchedulers<TASK extends ITask> implements ISchedulers {
*/ */
private Intent createData(int taskState, int taskType, AbsEntity entity) { private Intent createData(int taskState, int taskType, AbsEntity entity) {
Intent intent = new Intent(ISchedulers.ARIA_TASK_INFO_ACTION); Intent intent = new Intent(ISchedulers.ARIA_TASK_INFO_ACTION);
intent.setPackage(mAriaConfig.getAPP().getPackageName());
Bundle b = new Bundle(); Bundle b = new Bundle();
b.putInt(ISchedulers.TASK_TYPE, taskType); b.putInt(ISchedulers.TASK_TYPE, taskType);
b.putInt(ISchedulers.TASK_STATE, taskState); b.putInt(ISchedulers.TASK_STATE, taskState);

Loading…
Cancel
Save