X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/72d9d63acb800adefdd32e63196e0434ec0f7d96..ebbc1793e23f67dc7aa2214a542fa2c037fcf4c2:/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 b7290c8b..919bedb3 100644 --- a/src/com/owncloud/android/services/OperationsService.java +++ b/src/com/owncloud/android/services/OperationsService.java @@ -42,7 +42,7 @@ import android.os.IBinder; import android.os.Looper; import android.os.Message; import android.os.Process; -import android.support.v4.content.LocalBroadcastManager; +//import android.support.v4.content.LocalBroadcastManager; import android.util.Pair; public class OperationsService extends Service { @@ -52,8 +52,9 @@ public class OperationsService extends Service { public static final String EXTRA_ACCOUNT = "ACCOUNT"; public static final String EXTRA_SERVER_URL = "SERVER_URL"; public static final String EXTRA_RESULT = "RESULT"; - private static final String ACTION_OPERATION_ADDED = OperationsService.class.getName() + ".OPERATION_ADDED"; - private static final String ACTION_OPERATION_FINISHED = OperationsService.class.getName() + ".OPERATION_FINISHED"; + + public static final String ACTION_OPERATION_ADDED = OperationsService.class.getName() + ".OPERATION_ADDED"; + public static final String ACTION_OPERATION_FINISHED = OperationsService.class.getName() + ".OPERATION_FINISHED"; private ConcurrentLinkedQueue> mPendingOperations = new ConcurrentLinkedQueue>(); @@ -227,7 +228,14 @@ public class OperationsService extends Service { Log_OC.e(TAG, "Error while trying to get autorization for " + mLastTarget.mAccount.name, e); } result = new RemoteOperationResult(e); - + } catch (Exception e) { + if (mLastTarget.mAccount == null) { + Log_OC.e(TAG, "Unexpected error for a NULL account", e); + } else { + Log_OC.e(TAG, "Unexpected error for " + mLastTarget.mAccount.name, e); + } + result = new RemoteOperationResult(e); + } finally { synchronized(mPendingOperations) { mPendingOperations.poll(); @@ -254,11 +262,14 @@ public class OperationsService extends Service { } else { intent.putExtra(EXTRA_SERVER_URL, target.mServerUrl); } - LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(this); - lbm.sendBroadcast(intent); + //LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(this); + //lbm.sendBroadcast(intent); + sendStickyBroadcast(intent); } + // TODO - maybe add a notification for real start of operations + /** * Sends a LOCAL broadcast when an operations finishes in order to the interested activities can update their view * @@ -276,8 +287,9 @@ public class OperationsService extends Service { } else { intent.putExtra(EXTRA_SERVER_URL, target.mServerUrl); } - LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(this); - lbm.sendBroadcast(intent); + //LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(this); + //lbm.sendBroadcast(intent); + sendStickyBroadcast(intent); }