X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/4984d909f21ca2eb45d730b280249578cb766a06..e93016d7e01ba4917fbf89193ac37373350dbb52:/src/com/owncloud/android/files/services/FileUploader.java diff --git a/src/com/owncloud/android/files/services/FileUploader.java b/src/com/owncloud/android/files/services/FileUploader.java index c5b92171..3ce1aace 100644 --- a/src/com/owncloud/android/files/services/FileUploader.java +++ b/src/com/owncloud/android/files/services/FileUploader.java @@ -367,23 +367,19 @@ public class FileUploader extends Service implements OnDatatransferProgressListe if (mCurrentUpload != null) { Log_OC.d(TAG, "Current Upload Account= " + mCurrentUpload.getAccount().name); - if (mCurrentUpload.getAccount().name == account.name) { + if (mCurrentUpload.getAccount().name.equals(account.name)) { mCurrentUpload.cancel(); } } // Cancel pending uploads Iterator it = mPendingUploads.keySet().iterator(); - Log_OC.d(TAG, "Number of pending updloads= " + mPendingUploads.size()); + Log_OC.d(TAG, "Number of pending uploads= " + mPendingUploads.size()); while (it.hasNext()) { String key = it.next(); Log_OC.d(TAG, "mPendingUploads CANCELLED " + key); if (key.startsWith(account.name)) { - UploadFileOperation upload; synchronized (mPendingUploads) { - upload = mPendingUploads.remove(key); - } - if (upload != null) { - mCurrentUpload.cancel(); + mPendingUploads.remove(key); } } } @@ -463,6 +459,16 @@ public class FileUploader extends Service implements OnDatatransferProgressListe } } + /** + * Review uploads and cancel it if its account doesn't exist + */ + public void reviewUploads() { + if (mCurrentUpload != null && + !AccountUtils.exists(mCurrentUpload.getAccount(), getApplicationContext())) { + mCurrentUpload.cancel(); + } + // The rest of uploads are cancelled when they try to start + } } /**