Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions demo/src/main/res/layout/activity_notification_entrance.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@ IQueuesHandler getQueuesHandler() {
private static final Object INIT_LOST_CONNECTED_HANDLER_LOCK = new Object();
private ILostServiceConnectedHandler mLostConnectedHandler;

public ILostServiceConnectedHandler getLostConnectedHandler() {
ILostServiceConnectedHandler getLostConnectedHandler() {
if (mLostConnectedHandler == null) {
synchronized (INIT_LOST_CONNECTED_HANDLER_LOCK) {
if (mLostConnectedHandler == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,4 @@ public interface ILostServiceConnectedHandler {
* @return {@code true} if the start action was dispatched.
*/
boolean dispatchTaskStart(BaseDownloadTask.IRunningTask task);

/**
* @return {@code true} if there is task in waiting list.
*/
boolean haveWaitingTask();
}
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,6 @@ public void taskWorkFine(BaseDownloadTask.IRunningTask task) {
}
}

@Override
public boolean haveWaitingTask() {
synchronized (mWaitingList) {
return !mWaitingList.isEmpty();
}
}

@Override
public boolean dispatchTaskStart(BaseDownloadTask.IRunningTask task) {
if (!FileDownloader.getImpl().isServiceConnected()) {
Expand All @@ -141,12 +134,12 @@ public boolean dispatchTaskStart(BaseDownloadTask.IRunningTask task) {
FileDownloadLog.d(this, "Waiting for connecting with the downloader "
+ "service... %d", task.getOrigin().getId());
}
FileDownloadServiceProxy.getImpl().
bindStartByContext(FileDownloadHelper.getAppContext());
if (!mWaitingList.contains(task)) {
task.free();
mWaitingList.add(task);
}
FileDownloadServiceProxy.getImpl().
bindStartByContext(FileDownloadHelper.getAppContext());
return true;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import android.os.RemoteException;

import com.liulishuo.filedownloader.FileDownloadEventPool;
import com.liulishuo.filedownloader.FileDownloader;
import com.liulishuo.filedownloader.IFileDownloadServiceProxy;
import com.liulishuo.filedownloader.event.DownloadServiceConnectChangedEvent;
import com.liulishuo.filedownloader.util.ExtraKeys;
Expand Down Expand Up @@ -158,10 +157,7 @@ public void bindStartByContext(final Context context, final Runnable connectedRu
bindContexts.add(context);
}

boolean needMakeServiceForeground = FileDownloadUtils.needMakeServiceForeground(context);
boolean haveWaitingTask =
FileDownloader.getImpl().getLostConnectedHandler().haveWaitingTask();
runServiceForeground = needMakeServiceForeground && haveWaitingTask;
runServiceForeground = FileDownloadUtils.needMakeServiceForeground(context);
i.putExtra(ExtraKeys.IS_FOREGROUND, runServiceForeground);
context.bindService(i, this, Context.BIND_AUTO_CREATE);
if (runServiceForeground) {
Expand Down