Просмотр исходного кода

Checking Uploads with the same name

masensio 9 лет назад
Родитель
Сommit
44f2894731

+ 1 - 0
res/values/strings.xml

@@ -127,6 +127,7 @@
     <string name="uploads_view_upload_status_failed_folder_error">Folder error</string>
     <string name="uploads_view_upload_status_failed_file_error">File error</string>
     <string name="uploads_view_upload_status_failed_priviledges_error">Priviledges error</string>
+    <string name="uploads_view_upload_status_failed"> Upload failed</string>
     <string name="downloader_download_in_progress_ticker">Downloading &#8230;</string>
     <string name="downloader_download_in_progress_content">%1$d%% Downloading %2$s</string>
     <string name="downloader_download_succeeded_ticker">Download succeeded</string>

+ 59 - 14
src/com/owncloud/android/datamodel/UploadsStorageManager.java

@@ -119,9 +119,9 @@ public class UploadsStorageManager extends Observable {
      * Stores an upload object in DB.
      * 
      * @param ocUpload
-     * @return true on success.
+     * @return upload id, -1 if the insert process fails.
      */
-    public boolean storeUpload(OCUpload ocUpload) {
+    public long storeUpload(OCUpload ocUpload) {
         Log_OC.e(TAG, "Inserting " + ocUpload.getLocalPath() + " with status=" + ocUpload.getUploadStatus());
         
         ContentValues cv = new ContentValues();
@@ -141,10 +141,12 @@ public class UploadsStorageManager extends Observable {
         Log_OC.d(TAG, "storeUpload returns with: " + result + " for file: " + ocUpload.getLocalPath());
         if (result == null) {
             Log_OC.e(TAG, "Failed to insert item " + ocUpload.getLocalPath() + " into upload db.");
-            return false;
+            return -1;
         } else {
+            long new_id = Long.parseLong(result.getPathSegments().get(1));
+            ocUpload.setUploadId(new_id);
             notifyObserversNow();
-            return true;
+            return new_id;
         }
     }
 
@@ -164,8 +166,8 @@ public class UploadsStorageManager extends Observable {
 
         int result = getDB().update(ProviderTableMeta.CONTENT_URI_UPLOADS,
                 cv,
-                ProviderTableMeta.UPLOADS_FILE_ID + "=?",
-                new String[]{ String.valueOf(ocUpload.getOCFile().getFileId()) }
+                ProviderTableMeta._ID + "=?",
+                new String[]{String.valueOf(ocUpload.getUploadId())}
         );
 
         Log_OC.d(TAG, "updateUpload returns with: " + result + " for file: " + ocUpload.getLocalPath());
@@ -184,7 +186,7 @@ public class UploadsStorageManager extends Observable {
      * @return 1 if file status was updated, else 0.
      */
     public int updateUploadStatus(OCUpload ocUpload) {
-        return updateUploadStatus(ocUpload.getLocalPath(), ocUpload.getUploadStatus(),
+        return updateUploadStatus(ocUpload.getUploadId(), ocUpload.getUploadStatus(),
                 ocUpload.getLastResult());
     }
 
@@ -214,26 +216,26 @@ public class UploadsStorageManager extends Observable {
     }
 
     /**
-     * Update upload status of file uniquely referenced by filepath.
+     * Update upload status of file uniquely referenced by id.
      * 
-     * @param filepath filepath local file path to file. used as identifier.
+     * @param id     upload id.
      * @param status new status.
      * @param result new result of upload operation
      * @return 1 if file status was updated, else 0.
      */
-    public int updateUploadStatus(String filepath, UploadStatus status, UploadResult result) {
+    public int updateUploadStatus(long id, UploadStatus status, UploadResult result) {
         //Log_OC.e(TAG, "Updating "+filepath+" with uploadStatus="+status +" and result="+result);
         
         Cursor c = getDB().query(
                 ProviderTableMeta.CONTENT_URI_UPLOADS,
                 null,
-                ProviderTableMeta.UPLOADS_PATH + "=?",
-                new String[] { filepath },
+                ProviderTableMeta._ID + "=?",
+                new String[] { String.valueOf(id) },
                 null
         );
 
         if (c.getCount() != 1) {
-            Log_OC.e(TAG, c.getCount() + " items for path=" + filepath
+            Log_OC.e(TAG, c.getCount() + " items for id=" + id
                     + " available in UploadDb. Expected 1. Failed to update upload db.");
 
             c.close();
@@ -241,7 +243,30 @@ public class UploadsStorageManager extends Observable {
         }
         return updateUploadInternal(c, status, result);
     }
-    
+
+
+    public int updateFileIdUpload(long uploadId, long fileId) {
+        Log_OC.e(TAG, "Updating " + uploadId + " with fileId= " + fileId);
+
+        ContentValues cv = new ContentValues();
+        cv.put(ProviderTableMeta.UPLOADS_FILE_ID, fileId);
+
+        int result = getDB().update(ProviderTableMeta.CONTENT_URI_UPLOADS,
+                cv,
+                ProviderTableMeta._ID + "=?",
+                new String[]{String.valueOf(uploadId)}
+        );
+
+        Log_OC.d(TAG, "updateUpload returns with: " + result + " for fileId: " + fileId);
+        if (result != 1) {
+            Log_OC.e(TAG, "Failed to update item " + uploadId + " into upload db.");
+        } else {
+            notifyObserversNow();
+        }
+
+        return result;
+    }
+
     /**
      * Should be called when some value of this DB was changed. All observers
      * are informed.
@@ -272,6 +297,26 @@ public class UploadsStorageManager extends Observable {
         return result;
     }
 
+    /**
+     * Remove upload from upload list. Should be called when cleaning up upload
+     * list.
+     *
+     * @param  id
+     * @return true when one or more upload entries were removed
+     */
+    public int removeUpload(long id) {
+        int result = getDB().delete(
+                ProviderTableMeta.CONTENT_URI_UPLOADS,
+                ProviderTableMeta._ID + "=?",
+                new String[]{String.valueOf(id)}
+        );
+        Log_OC.d(TAG, "delete returns with: " + result + " for file: " + id);
+        if(result > 0) {
+            notifyObserversNow();
+        }
+        return result;
+    }
+
     public OCUpload[] getAllStoredUploads() {
         return getUploads(null, null);
     }

+ 1 - 2
src/com/owncloud/android/files/FileOperationsHelper.java

@@ -522,10 +522,9 @@ public class FileOperationsHelper {
      * Remove upload from upload list.
      */
     public void removeUploadFromList(OCUpload upload) {
-        Account account = mFileActivity.getAccount();
         FileUploaderBinder uploaderBinder = mFileActivity.getFileUploaderBinder();
         if (uploaderBinder != null) {
-            uploaderBinder.remove(account, upload.getOCFile());            
+            uploaderBinder.remove(upload);
         }  else {
             Log_OC.w(TAG, "uploaderBinder not set. Cannot remove " + upload.getOCFile());            
         }

+ 1 - 1
src/com/owncloud/android/files/services/FileDownloader.java

@@ -172,7 +172,7 @@ public class FileDownloader extends Service
                 newDownload.addDatatransferProgressListener(this);
                 newDownload.addDatatransferProgressListener((FileDownloaderBinder) mBinder);
                 Pair<String, String> putResult = mPendingDownloads.putIfAbsent(
-                        account, file.getRemotePath(), newDownload
+                        account, file.getRemotePath(), newDownload, null
                 );
                 if (putResult != null) {
                     String downloadKey = putResult.first;

+ 59 - 35
src/com/owncloud/android/files/services/FileUploadService.java

@@ -2,6 +2,7 @@
  *   ownCloud Android client application
  *
  *   @author LukeOwncloud
+ *   @author masensio
  *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
@@ -418,7 +419,6 @@ public class FileUploadService extends Service implements OnDatatransferProgress
                 mStorageManager = new FileDataStorageManager(account, getContentResolver());
 
                 boolean forceOverwrite = intent.getBooleanExtra(KEY_FORCE_OVERWRITE, false);
-                //   boolean isInstant = intent.getBooleanExtra(KEY_INSTANT_UPLOAD, false);
                 int localAction = intent.getIntExtra(KEY_LOCAL_BEHAVIOUR, LOCAL_BEHAVIOUR_FORGET);
 
                 boolean isCreateRemoteFolder = intent.getBooleanExtra(KEY_CREATE_REMOTE_FOLDER, false);
@@ -469,9 +469,8 @@ public class FileUploadService extends Service implements OnDatatransferProgress
                                 account,
                                 files[i],
                                 chunked,
-                                //isInstant,
                                 forceOverwrite,
-                                localAction, // Change for compilation
+                                localAction,
                                 getApplicationContext()
                         );
                         if (isCreateRemoteFolder) {
@@ -479,28 +478,34 @@ public class FileUploadService extends Service implements OnDatatransferProgress
                         }
                         newUpload.addDatatransferProgressListener(this);
                         newUpload.addDatatransferProgressListener((FileUploaderBinder) mBinder);
+
+                        // Save upload in database
+                        OCUpload ocUpload = new OCUpload(files[i]);
+                        ocUpload.setAccountName(account.name);
+                        ocUpload.setForceOverwrite(forceOverwrite);
+                        ocUpload.setCreateRemoteFolder(isCreateRemoteFolder);
+                        ocUpload.setLocalAction(localAction);
+                        ocUpload.setUseWifiOnly(isUseWifiOnly);
+                        ocUpload.setWhileChargingOnly(isWhileChargingOnly);
+//                    ocUpload.setUploadTimestamp(uploadTimestamp);
+                        ocUpload.setUploadStatus(UploadStatus.UPLOAD_LATER);
+
+                        // storagePath inside upload is the temporary path. file
+                        // contains the correct path used as db reference.
+                        ocUpload.getOCFile().setStoragePath(localPaths[i]);
+                        long id = mUploadsStorageManager.storeUpload(ocUpload);
+                        newUpload.setOCUploadId(id);
+
                         Pair<String, String> putResult = mPendingUploads.putIfAbsent(
-                                account, files[i].getRemotePath(), newUpload
+                                account, files[i].getRemotePath(), newUpload, String.valueOf(id)
                         );
                         if (putResult != null) {
                             uploadKey = putResult.first;
                             requestedUploads.add(uploadKey);
-                            // Save upload in database
-                            OCUpload ocUpload = new OCUpload(files[i]);
-                            ocUpload.setAccountName(account.name);
-                            ocUpload.setForceOverwrite(forceOverwrite);
-                            ocUpload.setCreateRemoteFolder(isCreateRemoteFolder);
-                            ocUpload.setLocalAction(localAction);
-                            ocUpload.setUseWifiOnly(isUseWifiOnly);
-                            ocUpload.setWhileChargingOnly(isWhileChargingOnly);
-//                    ocUpload.setUploadTimestamp(uploadTimestamp);
-                            ocUpload.setUploadStatus(UploadStatus.UPLOAD_LATER);
-
-                            // storagePath inside upload is the temporary path. file
-                            // contains the correct path used as db reference.
-                            ocUpload.getOCFile().setStoragePath(localPaths[i]);
-                            mUploadsStorageManager.storeUpload(ocUpload);
-                        }   // else, file already in the queue of uploads; don't repeat the request
+                        } else {
+                            mUploadsStorageManager.removeUpload(id);
+                        }
+                        // else, file already in the queue of uploads; don't repeat the request
                     }
 
                 } catch (IllegalArgumentException e) {
@@ -536,9 +541,10 @@ public class FileUploadService extends Service implements OnDatatransferProgress
                 }
                 newUpload.addDatatransferProgressListener(this);
                 newUpload.addDatatransferProgressListener((FileUploaderBinder) mBinder);
+                newUpload.setOCUploadId(upload.getUploadId());
 
                 Pair<String, String> putResult = mPendingUploads.putIfAbsent(
-                        account, upload.getOCFile().getRemotePath(), newUpload
+                        account, upload.getOCFile().getRemotePath(), newUpload, String.valueOf(upload.getUploadId())
                 );
                 if (putResult != null) {
                     String uploadKey = putResult.first;
@@ -680,7 +686,7 @@ public class FileUploadService extends Service implements OnDatatransferProgress
             UploadFileOperation upload = removeResult.first;
             //OCUpload upload = mPendingUploads.remove(buildRemoteName(account, file));
             if(upload == null) {
-                Log_OC.e(TAG, "Could not delete upload "+ file +" from mPendingUploads.");
+                Log_OC.e(TAG, "Could not delete upload " + file + " from mPendingUploads.");
             }
             int d = mUploadsStorageManager.removeUpload(upload.getStoragePath());
             if(d == 0) {
@@ -688,13 +694,20 @@ public class FileUploadService extends Service implements OnDatatransferProgress
             }
         }
 
+        public void remove(OCUpload upload) {
+            int d = mUploadsStorageManager.removeUpload(upload.getUploadId());
+            if(d == 0) {
+                Log_OC.e(TAG, "Could not delete upload "+ upload.getRemotePath() +" from database.");
+            }
+        }
+
         // TODO: Review: Method from FileUploadService with some changes because the merge with FileUploader
         // TODO Complete operation to retry the upload
         /**
          * Puts upload in upload list and tell FileUploadService to upload items in list.
          */
         public void retry(Account account, OCUpload upload) {
-            String uploadKey = buildRemoteName(account, upload.getOCFile());
+//            String uploadKey = buildRemoteName(account, upload.getOCFile());
 //            mPendingUploads.put(uploadKey, upload);
             FileUploadService.retry(getApplicationContext(), account, upload);
         }
@@ -747,10 +760,10 @@ public class FileUploadService extends Service implements OnDatatransferProgress
          * @param file      {@link OCFile} of interest for listener.
          */
         public void addDatatransferProgressListener(OnDatatransferProgressListener listener, Account account,
-                                                    OCFile file) {
+                                                    OCFile file, long uploadId) {
             if (account == null || file == null || listener == null)
                 return;
-            String targetKey = buildRemoteName(account, file);
+            String targetKey = buildRemoteName(account, file, uploadId);
             mBoundListeners.put(targetKey, listener);
         }
 
@@ -763,10 +776,10 @@ public class FileUploadService extends Service implements OnDatatransferProgress
          * @param file      {@link OCFile} of interest for listener.
          */
         public void removeDatatransferProgressListener(OnDatatransferProgressListener listener, Account account,
-                                                       OCFile file) {
+                                                       OCFile file, long uploadId) {
             if (account == null || file == null || listener == null)
                 return;
-            String targetKey = buildRemoteName(account, file);
+            String targetKey = buildRemoteName(account, file, uploadId);
             if (mBoundListeners.get(targetKey) == listener) {
                 mBoundListeners.remove(targetKey);
             }
@@ -778,7 +791,12 @@ public class FileUploadService extends Service implements OnDatatransferProgress
         public void onTransferProgress(long progressRate, long totalTransferredSoFar, long totalToTransfer,
                                        String fileName) {
 
-            String key = buildRemoteName(mCurrentUpload.getAccount(), mCurrentUpload.getFile());
+            OCFile uploadFileKey = mCurrentUpload.getFile();
+            if(mCurrentUpload.wasRenamed()){
+                uploadFileKey = mCurrentUpload.getOldFile();
+            }
+            String key = buildRemoteName(mCurrentUpload.getAccount(), uploadFileKey,
+                    mCurrentUpload.getOCUploadId());
             OnDatatransferProgressListener boundListener = mBoundListeners.get(key);
             if (boundListener != null) {
                 boundListener.onTransferProgress(progressRate, totalTransferredSoFar,
@@ -808,8 +826,12 @@ public class FileUploadService extends Service implements OnDatatransferProgress
          * @param file          File to upload
          * @return              Key
          */
-        private String buildRemoteName(Account account, OCFile file) {
-            return account.name + file.getRemotePath();
+        private String buildRemoteName(Account account, OCFile file, long uploadId) {
+            String suffix = String.valueOf(uploadId);
+            if (uploadId != -1) {
+                suffix = "";
+            }
+            return account.name + file.getRemotePath() + suffix;
         }
 
     }
@@ -921,6 +943,8 @@ public class FileUploadService extends Service implements OnDatatransferProgress
                                 mCurrentAccount,
                                 mCurrentUpload.getOldFile().getRemotePath()
                         );
+                        mUploadsStorageManager.updateFileIdUpload(mCurrentUpload.getOCUploadId(),
+                                mCurrentUpload.getFile().getFileId());
                     } else {
                         removeResult = mPendingUploads.removePayload(
                                 mCurrentAccount,
@@ -1391,7 +1415,7 @@ public class FileUploadService extends Service implements OnDatatransferProgress
         Log_OC.d(TAG, "updateDataseUploadResult uploadResult: " + uploadResult + " upload: " + upload);
         if (uploadResult.isCancelled()) {
             mUploadsStorageManager.updateUploadStatus(
-                    upload.getOriginalStoragePath(),
+                    upload.getOCUploadId(),
                     UploadStatus.UPLOAD_CANCELLED,
                     UploadResult.CANCELLED
             );
@@ -1399,7 +1423,7 @@ public class FileUploadService extends Service implements OnDatatransferProgress
 
             if (uploadResult.isSuccess()) {
                 mUploadsStorageManager.updateUploadStatus(
-                        upload.getOriginalStoragePath(),
+                        upload.getOCUploadId(),
                         UploadStatus.UPLOAD_SUCCEEDED,
                         UploadResult.UPLOADED
                 );
@@ -1407,10 +1431,10 @@ public class FileUploadService extends Service implements OnDatatransferProgress
                 // TODO: Disable for testing of menu actions in uploads view
                 if (shouldRetryFailedUpload(uploadResult)) {
                     mUploadsStorageManager.updateUploadStatus(
-                            upload.getOriginalStoragePath(), UploadStatus.UPLOAD_FAILED_RETRY,
+                            upload.getOCUploadId(), UploadStatus.UPLOAD_FAILED_RETRY,
                             UploadResult.fromOperationResult(uploadResult));
                 } else {
-                    mUploadsStorageManager.updateUploadStatus(upload.getOriginalStoragePath(),
+                    mUploadsStorageManager.updateUploadStatus(upload.getOCUploadId(),
                             UploadsStorageManager.UploadStatus.UPLOAD_FAILED_GIVE_UP,
                             UploadResult.fromOperationResult(uploadResult));
                 }
@@ -1445,7 +1469,7 @@ public class FileUploadService extends Service implements OnDatatransferProgress
      */
     private void updateDatabaseUploadStart(UploadFileOperation upload) {
         mUploadsStorageManager.updateUploadStatus(
-                upload.getOriginalStoragePath(),
+                upload.getOCUploadId(),
                 UploadStatus.UPLOAD_IN_PROGRESS,
                 UploadResult.UNKNOWN
         );

+ 1 - 2
src/com/owncloud/android/files/services/FileUploader.java

@@ -287,7 +287,6 @@ public class FileUploader extends Service
                         account,
                         files[i],
                         chunked,
-                        //isInstant,
                         forceOverwrite,
                         localAction, // Change for compilation
                         getApplicationContext()
@@ -298,7 +297,7 @@ public class FileUploader extends Service
                 newUpload.addDatatransferProgressListener(this);
                 newUpload.addDatatransferProgressListener((FileUploaderBinder) mBinder);
                 Pair<String, String> putResult = mPendingUploads.putIfAbsent(
-                        account, files[i].getRemotePath(), newUpload
+                        account, files[i].getRemotePath(), newUpload, null
                 );
                 if (putResult != null) {
                     uploadKey = putResult.first;

+ 5 - 1
src/com/owncloud/android/files/services/IndexedForest.java

@@ -98,8 +98,12 @@ public class IndexedForest<V> {
     }
 
 
-    public /* synchronized */ Pair<String, String> putIfAbsent(Account account, String remotePath, V value) {
+    public /* synchronized */ Pair<String, String> putIfAbsent(Account account, String remotePath, V value,
+                                                               String keySufix) {
         String targetKey = buildKey(account, remotePath);
+        if (keySufix != null){
+            targetKey = targetKey + keySufix;
+        }
         Node<V> valuedNode = new Node(targetKey, value);
         Node<V> previousValue = mMap.putIfAbsent(
             targetKey,

+ 8 - 0
src/com/owncloud/android/operations/UploadFileOperation.java

@@ -82,6 +82,7 @@ public class UploadFileOperation extends RemoteOperation {
     private int mLocalBehaviour = FileUploadService.LOCAL_BEHAVIOUR_COPY;
     private boolean mWasRenamed = false;
     private String mOriginalFileName = null;
+    private long mOCUploadId = -1;
     /**
      * Local path to file which is to be uploaded (before any possible renaming or moving).
      */
@@ -177,6 +178,13 @@ public class UploadFileOperation extends RemoteOperation {
         return mWasRenamed;
     }
 
+    public void setOCUploadId(long id){
+        mOCUploadId = id;
+    }
+    public long getOCUploadId() {
+        return mOCUploadId;
+    }
+
     public Set<OnDatatransferProgressListener> getDataTransferListeners() {
         return mDataTransferListeners;
     }

+ 1 - 1
src/com/owncloud/android/services/SyncFolderHandler.java

@@ -139,7 +139,7 @@ class SyncFolderHandler extends Handler {
     public void add(Account account, String remotePath,
                     SynchronizeFolderOperation syncFolderOperation){
         Pair<String, String> putResult =
-                mPendingOperations.putIfAbsent(account, remotePath, syncFolderOperation);
+                mPendingOperations.putIfAbsent(account, remotePath, syncFolderOperation, null);
         if (putResult != null) {
             sendBroadcastNewSyncFolder(account, remotePath);    // TODO upgrade!
         }

+ 9 - 5
src/com/owncloud/android/ui/adapter/ExpandableUploadListAdapter.java

@@ -183,7 +183,8 @@ public class ExpandableUploadListAdapter extends BaseExpandableListAdapter imple
             
             TextView localPath = (TextView) view.findViewById(R.id.upload_local_path);
             String path = uploadOCFile.getStoragePath();
-            path = path == null ? "" : path.substring(0, path.length() - fileName.length() - 1);
+            Log_OC.d(TAG, "PATH: "  + path);
+            path = (path == null || path.isEmpty()) ? "" : path.substring(0, path.length() - fileName.length() - 1);
             localPath.setText("Path: " + path);
 
             TextView fileSize = (TextView) view.findViewById(R.id.upload_file_size);
@@ -200,7 +201,7 @@ public class ExpandableUploadListAdapter extends BaseExpandableListAdapter imple
                     mProgressListener = new ProgressListener(progressBar);
                     if(mParentActivity.getFileUploaderBinder() != null) {
                         mParentActivity.getFileUploaderBinder().addDatatransferProgressListener(mProgressListener,
-                                mParentActivity.getAccount(), uploadOCFile);
+                                mParentActivity.getAccount(), uploadOCFile, upload.getUploadId());
                     } else {
                         Log_OC.e(TAG, "UploadBinder == null. It should have been created on creating mParentActivity"
                                 + " which inherits from FileActivity. Fix that!");
@@ -244,11 +245,14 @@ public class ExpandableUploadListAdapter extends BaseExpandableListAdapter imple
                                         R.string.uploads_view_upload_status_failed_priviledges_error);
                                 break;
                             default:
-                                status = "Upload failed: " + upload.getLastResult().toString();
+                                status = mParentActivity.getString(
+                                        R.string.uploads_view_upload_status_failed) + ": "
+                                        + upload.getLastResult().toString();
                                 break;
                         }
                     } else {
-                        status = "Upload failed.";
+                        status = mParentActivity.getString(
+                                R.string.uploads_view_upload_status_failed);;
                     }
                     break;
                 case UPLOAD_FAILED_RETRY:
@@ -289,7 +293,7 @@ public class ExpandableUploadListAdapter extends BaseExpandableListAdapter imple
                         && mCurrentUpload != null) {
                     OCFile currentOcFile = mCurrentUpload.getFile();
                     mParentActivity.getFileUploaderBinder().removeDatatransferProgressListener(mProgressListener,
-                            upload.getAccount(mParentActivity), currentOcFile);
+                            upload.getAccount(mParentActivity), currentOcFile, upload.getUploadId());
                     mProgressListener = null;
                     mCurrentUpload = null;
                 }            

+ 2 - 2
src/com/owncloud/android/ui/fragment/FileDetailFragment.java

@@ -547,7 +547,7 @@ public class FileDetailFragment extends FileFragment implements OnClickListener
             }
             if (mContainerActivity.getFileUploaderBinder() != null) {
                 mContainerActivity.getFileUploaderBinder().
-                        addDatatransferProgressListener(mProgressListener, mAccount, getFile());
+                        addDatatransferProgressListener(mProgressListener, mAccount, getFile(), 0);
             }
         } else {
             Log_OC.d(TAG, "mProgressListener == null");
@@ -563,7 +563,7 @@ public class FileDetailFragment extends FileFragment implements OnClickListener
             }
             if (mContainerActivity.getFileUploaderBinder() != null) {
                 mContainerActivity.getFileUploaderBinder().
-                        removeDatatransferProgressListener(mProgressListener, mAccount, getFile());
+                        removeDatatransferProgressListener(mProgressListener, mAccount, getFile(), 0);
             }
         }
     }