Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pauseDownload #9

Open
lindaojiang opened this issue Dec 10, 2014 · 0 comments
Open

pauseDownload #9

lindaojiang opened this issue Dec 10, 2014 · 0 comments

Comments

@lindaojiang
Copy link

DownloadInfo.java
void startIfReady(long now) a bug in this function
void startIfReady(long now) {
synchronized (this) {
if (!isReadyToStart(now)) { //set download paused will return
return;
}

        if (Constants.LOGV) {
            Log.v(Constants.TAG, "Service spawning thread to handle download " + mId + " mHasActiveThread=" + mHasActiveThread);
        }
        if (mHasActiveThread) {
            return;
            //throw new IllegalStateException("Multiple threads on same download");
        }
        if (mStatus != Downloads.STATUS_RUNNING) {
            mStatus = Downloads.STATUS_RUNNING;
            ContentValues values = new ContentValues();
            values.put(Downloads.COLUMN_STATUS, mStatus);
            mContext.getContentResolver().update(getAllDownloadsUri(), values, null, null);

            if (Constants.LOGV) {
                Log.v(Constants.TAG, "Service startIfReady return " + mId);
            }
            //click 'pause' button here, call pauseDownload(). After that, DownloadThread will never called for mId
            //return;
        }

        DownloadThread downloader = new DownloadThread(mContext, mSystemFacade, this);
        mHasActiveThread = true;
        mSystemFacade.startThread(downloader);
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant