@Test public void hideNotificationOnMandatoryUpdate() { when(mReleaseDetails.isMandatoryUpdate()).thenReturn(true); mRequestTask.doInBackground(); verify(mDownloadManagerRequest).setNotificationVisibility(DownloadManager.Request.VISIBILITY_HIDDEN); verify(mDownloadManagerRequest).setVisibleInDownloadsUi(false); verify(mDownloader).onDownloadStarted(eq(DOWNLOAD_ID), anyLong()); }
@Override protected Void doInBackground(Void... params) { ReleaseDetails releaseDetails = mDownloader.getReleaseDetails(); Uri downloadUrl = releaseDetails.getDownloadUrl(); AppCenterLog.debug(LOG_TAG, "Start downloading new release from " + downloadUrl); DownloadManager downloadManager = mDownloader.getDownloadManager(); DownloadManager.Request request = createRequest(downloadUrl); if (releaseDetails.isMandatoryUpdate()) { request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_HIDDEN); request.setVisibleInDownloadsUi(false); } long enqueueTime = System.currentTimeMillis(); long downloadId = downloadManager.enqueue(request); if (isCancelled()) { return null; } mDownloader.onDownloadStarted(downloadId, enqueueTime); return null; }
DownloadManagerRequestTask extends AsyncTask<Void, Void, Void> { @Override protected Void doInBackground(Void... params) { ReleaseDetails releaseDetails = mDownloader.getReleaseDetails(); Uri downloadUrl = releaseDetails.getDownloadUrl(); AppCenterLog.debug(LOG_TAG, "Start downloading new release from " + downloadUrl); DownloadManager downloadManager = mDownloader.getDownloadManager(); DownloadManager.Request request = createRequest(downloadUrl); if (releaseDetails.isMandatoryUpdate()) { request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_HIDDEN); request.setVisibleInDownloadsUi(false); } long enqueueTime = System.currentTimeMillis(); long downloadId = downloadManager.enqueue(request); if (isCancelled()) { return null; } mDownloader.onDownloadStarted(downloadId, enqueueTime); return null; } }
DownloadManagerRequestTask extends AsyncTask<Void, Void, Void> { @Override protected Void doInBackground(Void... params) { ReleaseDetails releaseDetails = mDownloader.getReleaseDetails(); Uri downloadUrl = releaseDetails.getDownloadUrl(); AppCenterLog.debug(LOG_TAG, "Start downloading new release from " + downloadUrl); DownloadManager downloadManager = mDownloader.getDownloadManager(); DownloadManager.Request request = createRequest(downloadUrl); if (releaseDetails.isMandatoryUpdate()) { request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_HIDDEN); request.setVisibleInDownloadsUi(false); } long enqueueTime = System.currentTimeMillis(); long downloadId = downloadManager.enqueue(request); if (isCancelled()) { return null; } mDownloader.onDownloadStarted(downloadId, enqueueTime); return null; } DownloadManagerRequestTask(DownloadManagerReleaseDownloader downloader); }
DownloadManagerRequestTask extends AsyncTask<Void, Void, Void> { @Override protected Void doInBackground(Void... params) { ReleaseDetails releaseDetails = mDownloader.getReleaseDetails(); Uri downloadUrl = releaseDetails.getDownloadUrl(); AppCenterLog.debug(LOG_TAG, "Start downloading new release from " + downloadUrl); DownloadManager downloadManager = mDownloader.getDownloadManager(); DownloadManager.Request request = createRequest(downloadUrl); if (releaseDetails.isMandatoryUpdate()) { request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_HIDDEN); request.setVisibleInDownloadsUi(false); } long enqueueTime = System.currentTimeMillis(); long downloadId = downloadManager.enqueue(request); if (isCancelled()) { return null; } mDownloader.onDownloadStarted(downloadId, enqueueTime); return null; } DownloadManagerRequestTask(DownloadManagerReleaseDownloader downloader);  }
DownloadManagerRequestTask extends AsyncTask<Void, Void, Void> { @Override protected Void doInBackground(Void... params) { ReleaseDetails releaseDetails = mDownloader.getReleaseDetails(); Uri downloadUrl = releaseDetails.getDownloadUrl(); AppCenterLog.debug(LOG_TAG, "Start downloading new release from " + downloadUrl); DownloadManager downloadManager = mDownloader.getDownloadManager(); DownloadManager.Request request = createRequest(downloadUrl); if (releaseDetails.isMandatoryUpdate()) { request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_HIDDEN); request.setVisibleInDownloadsUi(false); } long enqueueTime = System.currentTimeMillis(); long downloadId = downloadManager.enqueue(request); if (isCancelled()) { return null; } mDownloader.onDownloadStarted(downloadId, enqueueTime); return null; } DownloadManagerRequestTask(DownloadManagerReleaseDownloader downloader);   }