|
@@ -95,7 +95,7 @@ public class FileDownloader extends Service
|
|
|
private Account mCurrentAccount = null;
|
|
|
private FileDataStorageManager mStorageManager;
|
|
|
|
|
|
- private IndexedForest<DownloadFileOperation> mPendingDownloads = new IndexedForest<DownloadFileOperation>();
|
|
|
+ private IndexedForest<DownloadFileOperation> mPendingDownloads = new IndexedForest<>();
|
|
|
|
|
|
private DownloadFileOperation mCurrentDownload = null;
|
|
|
|
|
@@ -597,6 +597,7 @@ public class FileDownloader extends Service
|
|
|
if (mNotificationManager != null) {
|
|
|
mNotificationManager.cancel(R.string.downloader_download_in_progress_ticker);
|
|
|
}
|
|
|
+
|
|
|
if (!downloadResult.isCancelled()) {
|
|
|
int tickerId = (downloadResult.isSuccess()) ? R.string.downloader_download_succeeded_ticker :
|
|
|
R.string.downloader_download_failed_ticker;
|
|
@@ -613,20 +614,8 @@ public class FileDownloader extends Service
|
|
|
.setProgress(0, 0, false);
|
|
|
|
|
|
if (needsToUpdateCredentials) {
|
|
|
+ configureUpdateCredentialsNotification(download);
|
|
|
|
|
|
- // let the user update credentials with one click
|
|
|
- Intent updateAccountCredentials = new Intent(this, AuthenticatorActivity.class);
|
|
|
- updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ACCOUNT,
|
|
|
- download.getAccount());
|
|
|
- updateAccountCredentials.putExtra(
|
|
|
- AuthenticatorActivity.EXTRA_ACTION,
|
|
|
- AuthenticatorActivity.ACTION_UPDATE_EXPIRED_TOKEN
|
|
|
- );
|
|
|
- updateAccountCredentials.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
|
- updateAccountCredentials.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
|
|
|
- updateAccountCredentials.addFlags(Intent.FLAG_FROM_BACKGROUND);
|
|
|
- mNotificationBuilder.setContentIntent(PendingIntent.getActivity(this, (int) System.currentTimeMillis(),
|
|
|
- updateAccountCredentials, PendingIntent.FLAG_ONE_SHOT));
|
|
|
} else {
|
|
|
// TODO put something smart in showDetailsIntent
|
|
|
Intent showDetailsIntent = new Intent();
|
|
@@ -650,6 +639,22 @@ public class FileDownloader extends Service
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private void configureUpdateCredentialsNotification(DownloadFileOperation download) {
|
|
|
+ // let the user update credentials with one click
|
|
|
+ Intent updateAccountCredentials = new Intent(this, AuthenticatorActivity.class);
|
|
|
+ updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ACCOUNT,
|
|
|
+ download.getAccount());
|
|
|
+ updateAccountCredentials.putExtra(
|
|
|
+ AuthenticatorActivity.EXTRA_ACTION,
|
|
|
+ AuthenticatorActivity.ACTION_UPDATE_EXPIRED_TOKEN
|
|
|
+ );
|
|
|
+ updateAccountCredentials.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
|
+ updateAccountCredentials.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
|
|
|
+ updateAccountCredentials.addFlags(Intent.FLAG_FROM_BACKGROUND);
|
|
|
+ mNotificationBuilder.setContentIntent(PendingIntent.getActivity(this, (int) System.currentTimeMillis(),
|
|
|
+ updateAccountCredentials, PendingIntent.FLAG_ONE_SHOT));
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* Sends a broadcast when a download finishes in order to the interested activities can
|