/** Returns whether this download has a visible notification after completion. */ public boolean hasCompletionNotification() { if (!Downloads.isStatusCompleted(mStatus)) { return false; } if (mVisibility == Downloads.VISIBILITY_VISIBLE_NOTIFY_COMPLETED) { return true; } return false; }
/** * Returns the amount of time (as measured from the "now" parameter) at which a download will be * active. 0 = immediately - service should stick around to handle this download. -1 = never - * service can go away without ever waking up. positive value - service must wake up in the * future, as specified in ms from "now" */ long nextAction(long now) { if (Downloads.isStatusCompleted(mStatus)) { return -1; } if (mStatus != Downloads.STATUS_WAITING_TO_RETRY) { return 0; } long when = restartTime(now); if (when <= now) { return 0; } return when - now; }