projects
/
pub
/
Android
/
ownCloud.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge remote-tracking branch 'origin/operations_service' into operations_service
[pub/Android/ownCloud.git]
/
src
/
com
/
owncloud
/
android
/
services
/
OperationsService.java
diff --git
a/src/com/owncloud/android/services/OperationsService.java
b/src/com/owncloud/android/services/OperationsService.java
index
81a4ade
..
798c371
100644
(file)
--- a/
src/com/owncloud/android/services/OperationsService.java
+++ b/
src/com/owncloud/android/services/OperationsService.java
@@
-156,7
+156,16
@@
public class OperationsService extends Service {
return START_NOT_STICKY;
}
return START_NOT_STICKY;
}
-
+ @Override
+ public void onDestroy() {
+ //Log.wtf(TAG, "onDestroy init" );
+ super.onDestroy();
+ //Log.wtf(TAG, "Clear mOperationResults" );
+ mOperationResults.clear();
+ //Log.wtf(TAG, "onDestroy end" );
+ }
+
+
/**
* Provides a binder object that clients can use to perform actions on the queue of operations,
* except the addition of new operations.
/**
* Provides a binder object that clients can use to perform actions on the queue of operations,
* except the addition of new operations.
@@
-338,9
+347,9
@@
public class OperationsService extends Service {
}
}
}
}
- public RemoteOperationResult getOperationResultIfFinished(int
mDetectAuthOp
Id) {
- //Log_OC.wtf(TAG, "Searching result for operation with id " +
mDetectAuthOp
Id);
- return mOperationResults.remove(
mDetectAuthOp
Id);
+ public RemoteOperationResult getOperationResultIfFinished(int
operation
Id) {
+ //Log_OC.wtf(TAG, "Searching result for operation with id " +
operation
Id);
+ return mOperationResults.remove(
operation
Id);
}
}
}
}
@@
-443,12
+452,11
@@
public class OperationsService extends Service {
} finally {
synchronized(mPendingOperations) {
mPendingOperations.poll();
} finally {
synchronized(mPendingOperations) {
mPendingOperations.poll();
- mOperationResults.put(mCurrentOperation.hashCode(), result);
}
}
//sendBroadcastOperationFinished(mLastTarget, mCurrentOperation, result);
}
}
//sendBroadcastOperationFinished(mLastTarget, mCurrentOperation, result);
-
callback
OperationListeners(mLastTarget, mCurrentOperation, result);
+
dispatch
OperationListeners(mLastTarget, mCurrentOperation, result);
}
}
}
}
@@
-506,7
+514,7
@@
public class OperationsService extends Service {
* @param operation Finished operation.
* @param result Result of the operation.
*/
* @param operation Finished operation.
* @param result Result of the operation.
*/
- private void
callback
OperationListeners(
+ private void
dispatch
OperationListeners(
Target target, final RemoteOperation operation, final RemoteOperationResult result) {
int count = 0;
Iterator<OnRemoteOperationListener> listeners = mBinder.mBoundListeners.keySet().iterator();
Target target, final RemoteOperation operation, final RemoteOperationResult result) {
int count = 0;
Iterator<OnRemoteOperationListener> listeners = mBinder.mBoundListeners.keySet().iterator();
@@
-523,6
+531,9
@@
public class OperationsService extends Service {
count += 1;
}
}
count += 1;
}
}
+ if (count == 0) {
+ mOperationResults.put(operation.hashCode(), result);
+ }
Log_OC.d(TAG, "Called " + count + " listeners");
}
Log_OC.d(TAG, "Called " + count + " listeners");
}