FileDownloader.java 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548
  1. /* ownCloud Android client application
  2. * Copyright (C) 2012 Bartek Przybylski
  3. * Copyright (C) 2012-2013 ownCloud Inc.
  4. *
  5. * This program is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License version 2,
  7. * as published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. *
  17. */
  18. package com.owncloud.android.files.services;
  19. import java.io.File;
  20. import java.io.IOException;
  21. import java.util.AbstractList;
  22. import java.util.HashMap;
  23. import java.util.Iterator;
  24. import java.util.Map;
  25. import java.util.Vector;
  26. import java.util.concurrent.ConcurrentHashMap;
  27. import java.util.concurrent.ConcurrentMap;
  28. import com.owncloud.android.authentication.AuthenticatorActivity;
  29. import com.owncloud.android.datamodel.FileDataStorageManager;
  30. import com.owncloud.android.datamodel.OCFile;
  31. import eu.alefzero.webdav.OnDatatransferProgressListener;
  32. import com.owncloud.android.network.OwnCloudClientUtils;
  33. import com.owncloud.android.operations.DownloadFileOperation;
  34. import com.owncloud.android.operations.RemoteOperationResult;
  35. import com.owncloud.android.operations.RemoteOperationResult.ResultCode;
  36. import com.owncloud.android.ui.activity.FileActivity;
  37. import com.owncloud.android.ui.activity.FileDisplayActivity;
  38. import com.owncloud.android.ui.preview.PreviewImageActivity;
  39. import com.owncloud.android.ui.preview.PreviewImageFragment;
  40. import android.accounts.Account;
  41. import android.accounts.AccountsException;
  42. import android.app.Notification;
  43. import android.app.NotificationManager;
  44. import android.app.PendingIntent;
  45. import android.app.Service;
  46. import android.content.Intent;
  47. import android.os.Binder;
  48. import android.os.Handler;
  49. import android.os.HandlerThread;
  50. import android.os.IBinder;
  51. import android.os.Looper;
  52. import android.os.Message;
  53. import android.os.Process;
  54. import android.widget.RemoteViews;
  55. import com.owncloud.android.Log_OC;
  56. import com.owncloud.android.MainApp;
  57. import com.owncloud.android.R;
  58. import eu.alefzero.webdav.WebdavClient;
  59. public class FileDownloader extends Service implements OnDatatransferProgressListener {
  60. public static final String EXTRA_ACCOUNT = "ACCOUNT";
  61. public static final String EXTRA_FILE = "FILE";
  62. private static final String DOWNLOAD_ADDED_MESSAGE = "DOWNLOAD_ADDED";
  63. private static final String DOWNLOAD_FINISH_MESSAGE = "DOWNLOAD_FINISH";
  64. public static final String EXTRA_DOWNLOAD_RESULT = "RESULT";
  65. public static final String EXTRA_FILE_PATH = "FILE_PATH";
  66. public static final String EXTRA_REMOTE_PATH = "REMOTE_PATH";
  67. public static final String ACCOUNT_NAME = "ACCOUNT_NAME";
  68. private static final String TAG = "FileDownloader";
  69. private Looper mServiceLooper;
  70. private ServiceHandler mServiceHandler;
  71. private IBinder mBinder;
  72. private WebdavClient mDownloadClient = null;
  73. private Account mLastAccount = null;
  74. private FileDataStorageManager mStorageManager;
  75. private ConcurrentMap<String, DownloadFileOperation> mPendingDownloads = new ConcurrentHashMap<String, DownloadFileOperation>();
  76. private DownloadFileOperation mCurrentDownload = null;
  77. private NotificationManager mNotificationManager;
  78. private Notification mNotification;
  79. private int mLastPercent;
  80. public String getDownloadAddedMessage() {
  81. return getClass().getName().toString() + DOWNLOAD_ADDED_MESSAGE;
  82. }
  83. public String getDownloadFinishMessage() {
  84. return getClass().getName().toString() + DOWNLOAD_FINISH_MESSAGE;
  85. }
  86. /**
  87. * Builds a key for mPendingDownloads from the account and file to download
  88. *
  89. * @param account Account where the file to download is stored
  90. * @param file File to download
  91. */
  92. private String buildRemoteName(Account account, OCFile file) {
  93. return account.name + file.getRemotePath();
  94. }
  95. /**
  96. * Service initialization
  97. */
  98. @Override
  99. public void onCreate() {
  100. super.onCreate();
  101. mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
  102. HandlerThread thread = new HandlerThread("FileDownloaderThread",
  103. Process.THREAD_PRIORITY_BACKGROUND);
  104. thread.start();
  105. mServiceLooper = thread.getLooper();
  106. mServiceHandler = new ServiceHandler(mServiceLooper, this);
  107. mBinder = new FileDownloaderBinder();
  108. }
  109. /**
  110. * Entry point to add one or several files to the queue of downloads.
  111. *
  112. * New downloads are added calling to startService(), resulting in a call to this method. This ensures the service will keep on working
  113. * although the caller activity goes away.
  114. */
  115. @Override
  116. public int onStartCommand(Intent intent, int flags, int startId) {
  117. if ( !intent.hasExtra(EXTRA_ACCOUNT) ||
  118. !intent.hasExtra(EXTRA_FILE)
  119. /*!intent.hasExtra(EXTRA_FILE_PATH) ||
  120. !intent.hasExtra(EXTRA_REMOTE_PATH)*/
  121. ) {
  122. Log_OC.e(TAG, "Not enough information provided in intent");
  123. return START_NOT_STICKY;
  124. }
  125. Account account = intent.getParcelableExtra(EXTRA_ACCOUNT);
  126. OCFile file = intent.getParcelableExtra(EXTRA_FILE);
  127. AbstractList<String> requestedDownloads = new Vector<String>(); // dvelasco: now this always contains just one element, but that can change in a near future (download of multiple selection)
  128. String downloadKey = buildRemoteName(account, file);
  129. try {
  130. DownloadFileOperation newDownload = new DownloadFileOperation(account, file);
  131. mPendingDownloads.putIfAbsent(downloadKey, newDownload);
  132. newDownload.addDatatransferProgressListener(this);
  133. newDownload.addDatatransferProgressListener((FileDownloaderBinder)mBinder);
  134. requestedDownloads.add(downloadKey);
  135. sendBroadcastNewDownload(newDownload);
  136. } catch (IllegalArgumentException e) {
  137. Log_OC.e(TAG, "Not enough information provided in intent: " + e.getMessage());
  138. return START_NOT_STICKY;
  139. }
  140. if (requestedDownloads.size() > 0) {
  141. Message msg = mServiceHandler.obtainMessage();
  142. msg.arg1 = startId;
  143. msg.obj = requestedDownloads;
  144. mServiceHandler.sendMessage(msg);
  145. }
  146. return START_NOT_STICKY;
  147. }
  148. /**
  149. * Provides a binder object that clients can use to perform operations on the queue of downloads, excepting the addition of new files.
  150. *
  151. * Implemented to perform cancellation, pause and resume of existing downloads.
  152. */
  153. @Override
  154. public IBinder onBind(Intent arg0) {
  155. return mBinder;
  156. }
  157. /**
  158. * Called when ALL the bound clients were onbound.
  159. */
  160. @Override
  161. public boolean onUnbind(Intent intent) {
  162. ((FileDownloaderBinder)mBinder).clearListeners();
  163. return false; // not accepting rebinding (default behaviour)
  164. }
  165. /**
  166. * Binder to let client components to perform operations on the queue of downloads.
  167. *
  168. * It provides by itself the available operations.
  169. */
  170. public class FileDownloaderBinder extends Binder implements OnDatatransferProgressListener {
  171. /**
  172. * Map of listeners that will be reported about progress of downloads from a {@link FileDownloaderBinder} instance
  173. */
  174. private Map<String, OnDatatransferProgressListener> mBoundListeners = new HashMap<String, OnDatatransferProgressListener>();
  175. /**
  176. * Cancels a pending or current download of a remote file.
  177. *
  178. * @param account Owncloud account where the remote file is stored.
  179. * @param file A file in the queue of pending downloads
  180. */
  181. public void cancel(Account account, OCFile file) {
  182. DownloadFileOperation download = null;
  183. synchronized (mPendingDownloads) {
  184. download = mPendingDownloads.remove(buildRemoteName(account, file));
  185. }
  186. if (download != null) {
  187. download.cancel();
  188. }
  189. }
  190. public void clearListeners() {
  191. mBoundListeners.clear();
  192. }
  193. /**
  194. * Returns True when the file described by 'file' in the ownCloud account 'account' is downloading or waiting to download.
  195. *
  196. * If 'file' is a directory, returns 'true' if some of its descendant files is downloading or waiting to download.
  197. *
  198. * @param account Owncloud account where the remote file is stored.
  199. * @param file A file that could be in the queue of downloads.
  200. */
  201. public boolean isDownloading(Account account, OCFile file) {
  202. if (account == null || file == null) return false;
  203. String targetKey = buildRemoteName(account, file);
  204. synchronized (mPendingDownloads) {
  205. if (file.isDirectory()) {
  206. // this can be slow if there are many downloads :(
  207. Iterator<String> it = mPendingDownloads.keySet().iterator();
  208. boolean found = false;
  209. while (it.hasNext() && !found) {
  210. found = it.next().startsWith(targetKey);
  211. }
  212. return found;
  213. } else {
  214. return (mPendingDownloads.containsKey(targetKey));
  215. }
  216. }
  217. }
  218. /**
  219. * Adds a listener interested in the progress of the download for a concrete file.
  220. *
  221. * @param listener Object to notify about progress of transfer.
  222. * @param account ownCloud account holding the file of interest.
  223. * @param file {@link OCfile} of interest for listener.
  224. */
  225. public void addDatatransferProgressListener (OnDatatransferProgressListener listener, Account account, OCFile file) {
  226. if (account == null || file == null || listener == null) return;
  227. String targetKey = buildRemoteName(account, file);
  228. mBoundListeners.put(targetKey, listener);
  229. }
  230. /**
  231. * Removes a listener interested in the progress of the download for a concrete file.
  232. *
  233. * @param listener Object to notify about progress of transfer.
  234. * @param account ownCloud account holding the file of interest.
  235. * @param file {@link OCfile} of interest for listener.
  236. */
  237. public void removeDatatransferProgressListener (OnDatatransferProgressListener listener, Account account, OCFile file) {
  238. if (account == null || file == null || listener == null) return;
  239. String targetKey = buildRemoteName(account, file);
  240. if (mBoundListeners.get(targetKey) == listener) {
  241. mBoundListeners.remove(targetKey);
  242. }
  243. }
  244. @Override
  245. public void onTransferProgress(long progressRate) {
  246. // old way, should not be in use any more
  247. }
  248. @Override
  249. public void onTransferProgress(long progressRate, long totalTransferredSoFar, long totalToTransfer,
  250. String fileName) {
  251. String key = buildRemoteName(mCurrentDownload.getAccount(), mCurrentDownload.getFile());
  252. OnDatatransferProgressListener boundListener = mBoundListeners.get(key);
  253. if (boundListener != null) {
  254. boundListener.onTransferProgress(progressRate, totalTransferredSoFar, totalToTransfer, fileName);
  255. }
  256. }
  257. }
  258. /**
  259. * Download worker. Performs the pending downloads in the order they were requested.
  260. *
  261. * Created with the Looper of a new thread, started in {@link FileUploader#onCreate()}.
  262. */
  263. private static class ServiceHandler extends Handler {
  264. // don't make it a final class, and don't remove the static ; lint will warn about a possible memory leak
  265. FileDownloader mService;
  266. public ServiceHandler(Looper looper, FileDownloader service) {
  267. super(looper);
  268. if (service == null)
  269. throw new IllegalArgumentException("Received invalid NULL in parameter 'service'");
  270. mService = service;
  271. }
  272. @Override
  273. public void handleMessage(Message msg) {
  274. @SuppressWarnings("unchecked")
  275. AbstractList<String> requestedDownloads = (AbstractList<String>) msg.obj;
  276. if (msg.obj != null) {
  277. Iterator<String> it = requestedDownloads.iterator();
  278. while (it.hasNext()) {
  279. mService.downloadFile(it.next());
  280. }
  281. }
  282. mService.stopSelf(msg.arg1);
  283. }
  284. }
  285. /**
  286. * Core download method: requests a file to download and stores it.
  287. *
  288. * @param downloadKey Key to access the download to perform, contained in mPendingDownloads
  289. */
  290. private void downloadFile(String downloadKey) {
  291. synchronized(mPendingDownloads) {
  292. mCurrentDownload = mPendingDownloads.get(downloadKey);
  293. }
  294. if (mCurrentDownload != null) {
  295. notifyDownloadStart(mCurrentDownload);
  296. RemoteOperationResult downloadResult = null;
  297. try {
  298. /// prepare client object to send the request to the ownCloud server
  299. if (mDownloadClient == null || !mLastAccount.equals(mCurrentDownload.getAccount())) {
  300. mLastAccount = mCurrentDownload.getAccount();
  301. mStorageManager = new FileDataStorageManager(mLastAccount, getContentResolver());
  302. mDownloadClient = OwnCloudClientUtils.createOwnCloudClient(mLastAccount, getApplicationContext());
  303. }
  304. /// perform the download
  305. downloadResult = mCurrentDownload.execute(mDownloadClient);
  306. if (downloadResult.isSuccess()) {
  307. saveDownloadedFile();
  308. }
  309. } catch (AccountsException e) {
  310. Log_OC.e(TAG, "Error while trying to get autorization for " + mLastAccount.name, e);
  311. downloadResult = new RemoteOperationResult(e);
  312. } catch (IOException e) {
  313. Log_OC.e(TAG, "Error while trying to get autorization for " + mLastAccount.name, e);
  314. downloadResult = new RemoteOperationResult(e);
  315. } finally {
  316. synchronized(mPendingDownloads) {
  317. mPendingDownloads.remove(downloadKey);
  318. }
  319. }
  320. /// notify result
  321. notifyDownloadResult(mCurrentDownload, downloadResult);
  322. sendBroadcastDownloadFinished(mCurrentDownload, downloadResult);
  323. }
  324. }
  325. /**
  326. * Updates the OC File after a successful download.
  327. */
  328. private void saveDownloadedFile() {
  329. OCFile file = mCurrentDownload.getFile();
  330. long syncDate = System.currentTimeMillis();
  331. file.setLastSyncDateForProperties(syncDate);
  332. file.setLastSyncDateForData(syncDate);
  333. file.setModificationTimestamp(mCurrentDownload.getModificationTimestamp());
  334. file.setModificationTimestampAtLastSyncForData(mCurrentDownload.getModificationTimestamp());
  335. // file.setEtag(mCurrentDownload.getEtag()); // TODO Etag, where available
  336. file.setMimetype(mCurrentDownload.getMimeType());
  337. file.setStoragePath(mCurrentDownload.getSavePath());
  338. file.setFileLength((new File(mCurrentDownload.getSavePath()).length()));
  339. mStorageManager.saveFile(file);
  340. }
  341. /**
  342. * Creates a status notification to show the download progress
  343. *
  344. * @param download Download operation starting.
  345. */
  346. private void notifyDownloadStart(DownloadFileOperation download) {
  347. /// create status notification with a progress bar
  348. mLastPercent = 0;
  349. mNotification = new Notification(R.drawable.icon, getString(R.string.downloader_download_in_progress_ticker), System.currentTimeMillis());
  350. mNotification.flags |= Notification.FLAG_ONGOING_EVENT;
  351. mNotification.contentView = new RemoteViews(getApplicationContext().getPackageName(), R.layout.progressbar_layout);
  352. mNotification.contentView.setProgressBar(R.id.status_progress, 100, 0, download.getSize() < 0);
  353. mNotification.contentView.setTextViewText(R.id.status_text, String.format(getString(R.string.downloader_download_in_progress_content), 0, new File(download.getSavePath()).getName()));
  354. mNotification.contentView.setImageViewResource(R.id.status_icon, R.drawable.icon);
  355. /// includes a pending intent in the notification showing the details view of the file
  356. Intent showDetailsIntent = null;
  357. if (PreviewImageFragment.canBePreviewed(download.getFile())) {
  358. showDetailsIntent = new Intent(this, PreviewImageActivity.class);
  359. } else {
  360. showDetailsIntent = new Intent(this, FileDisplayActivity.class);
  361. }
  362. showDetailsIntent.putExtra(FileActivity.EXTRA_FILE, download.getFile());
  363. showDetailsIntent.putExtra(FileActivity.EXTRA_ACCOUNT, download.getAccount());
  364. showDetailsIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
  365. mNotification.contentIntent = PendingIntent.getActivity(getApplicationContext(), (int)System.currentTimeMillis(), showDetailsIntent, 0);
  366. mNotificationManager.notify(R.string.downloader_download_in_progress_ticker, mNotification);
  367. }
  368. /**
  369. * Callback method to update the progress bar in the status notification.
  370. */
  371. @Override
  372. public void onTransferProgress(long progressRate, long totalTransferredSoFar, long totalToTransfer, String fileName) {
  373. int percent = (int)(100.0*((double)totalTransferredSoFar)/((double)totalToTransfer));
  374. if (percent != mLastPercent) {
  375. mNotification.contentView.setProgressBar(R.id.status_progress, 100, percent, totalToTransfer < 0);
  376. String text = String.format(getString(R.string.downloader_download_in_progress_content), percent, fileName);
  377. mNotification.contentView.setTextViewText(R.id.status_text, text);
  378. mNotificationManager.notify(R.string.downloader_download_in_progress_ticker, mNotification);
  379. }
  380. mLastPercent = percent;
  381. }
  382. /**
  383. * Callback method to update the progress bar in the status notification (old version)
  384. */
  385. @Override
  386. public void onTransferProgress(long progressRate) {
  387. // NOTHING TO DO HERE ANYMORE
  388. }
  389. /**
  390. * Updates the status notification with the result of a download operation.
  391. *
  392. * @param downloadResult Result of the download operation.
  393. * @param download Finished download operation
  394. */
  395. private void notifyDownloadResult(DownloadFileOperation download, RemoteOperationResult downloadResult) {
  396. mNotificationManager.cancel(R.string.downloader_download_in_progress_ticker);
  397. if (!downloadResult.isCancelled()) {
  398. int tickerId = (downloadResult.isSuccess()) ? R.string.downloader_download_succeeded_ticker : R.string.downloader_download_failed_ticker;
  399. int contentId = (downloadResult.isSuccess()) ? R.string.downloader_download_succeeded_content : R.string.downloader_download_failed_content;
  400. Notification finalNotification = new Notification(R.drawable.icon, getString(tickerId), System.currentTimeMillis());
  401. finalNotification.flags |= Notification.FLAG_AUTO_CANCEL;
  402. boolean needsToUpdateCredentials = (downloadResult.getCode() == ResultCode.UNAUTHORIZED ||
  403. // (downloadResult.isTemporalRedirection() && downloadResult.isIdPRedirection()
  404. (downloadResult.isIdPRedirection()
  405. && MainApp.getAuthTokenTypeSamlSessionCookie().equals(mDownloadClient.getAuthTokenType())));
  406. if (needsToUpdateCredentials) {
  407. // let the user update credentials with one click
  408. Intent updateAccountCredentials = new Intent(this, AuthenticatorActivity.class);
  409. updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ACCOUNT, download.getAccount());
  410. updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ENFORCED_UPDATE, true);
  411. updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ACTION, AuthenticatorActivity.ACTION_UPDATE_TOKEN);
  412. updateAccountCredentials.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  413. updateAccountCredentials.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
  414. updateAccountCredentials.addFlags(Intent.FLAG_FROM_BACKGROUND);
  415. finalNotification.contentIntent = PendingIntent.getActivity(this, (int)System.currentTimeMillis(), updateAccountCredentials, PendingIntent.FLAG_ONE_SHOT);
  416. finalNotification.setLatestEventInfo( getApplicationContext(),
  417. getString(tickerId),
  418. String.format(getString(contentId), new File(download.getSavePath()).getName()),
  419. finalNotification.contentIntent);
  420. mDownloadClient = null; // grant that future retries on the same account will get the fresh credentials
  421. } else {
  422. Intent showDetailsIntent = null;
  423. if (downloadResult.isSuccess()) {
  424. if (PreviewImageFragment.canBePreviewed(download.getFile())) {
  425. showDetailsIntent = new Intent(this, PreviewImageActivity.class);
  426. } else {
  427. showDetailsIntent = new Intent(this, FileDisplayActivity.class);
  428. }
  429. showDetailsIntent.putExtra(FileActivity.EXTRA_FILE, download.getFile());
  430. showDetailsIntent.putExtra(FileActivity.EXTRA_ACCOUNT, download.getAccount());
  431. showDetailsIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
  432. } else {
  433. // TODO put something smart in showDetailsIntent
  434. showDetailsIntent = new Intent();
  435. }
  436. finalNotification.contentIntent = PendingIntent.getActivity(getApplicationContext(), (int)System.currentTimeMillis(), showDetailsIntent, 0);
  437. finalNotification.setLatestEventInfo(getApplicationContext(), getString(tickerId), String.format(getString(contentId), new File(download.getSavePath()).getName()), finalNotification.contentIntent);
  438. }
  439. mNotificationManager.notify(tickerId, finalNotification);
  440. }
  441. }
  442. /**
  443. * Sends a broadcast when a download finishes in order to the interested activities can update their view
  444. *
  445. * @param download Finished download operation
  446. * @param downloadResult Result of the download operation
  447. */
  448. private void sendBroadcastDownloadFinished(DownloadFileOperation download, RemoteOperationResult downloadResult) {
  449. Intent end = new Intent(getDownloadFinishMessage());
  450. end.putExtra(EXTRA_DOWNLOAD_RESULT, downloadResult.isSuccess());
  451. end.putExtra(ACCOUNT_NAME, download.getAccount().name);
  452. end.putExtra(EXTRA_REMOTE_PATH, download.getRemotePath());
  453. end.putExtra(EXTRA_FILE_PATH, download.getSavePath());
  454. sendStickyBroadcast(end);
  455. }
  456. /**
  457. * Sends a broadcast when a new download is added to the queue.
  458. *
  459. * @param download Added download operation
  460. */
  461. private void sendBroadcastNewDownload(DownloadFileOperation download) {
  462. Intent added = new Intent(getDownloadAddedMessage());
  463. added.putExtra(ACCOUNT_NAME, download.getAccount().name);
  464. added.putExtra(EXTRA_REMOTE_PATH, download.getRemotePath());
  465. added.putExtra(EXTRA_FILE_PATH, download.getSavePath());
  466. sendStickyBroadcast(added);
  467. }
  468. }