X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/92080afefcab6de830d6a5c099b04e3c3a7db47f..e7b5284983869ab254c176f4f034a3bc37819d75:/src/com/owncloud/android/files/services/FileObserverService.java diff --git a/src/com/owncloud/android/files/services/FileObserverService.java b/src/com/owncloud/android/files/services/FileObserverService.java index 88bf0b91..4cb16de1 100644 --- a/src/com/owncloud/android/files/services/FileObserverService.java +++ b/src/com/owncloud/android/files/services/FileObserverService.java @@ -50,7 +50,7 @@ public class FileObserverService extends Service implements FileObserverStatusLi public final static int CMD_DEL_OBSERVED_FILE = 3; public final static int CMD_ADD_DOWNLOADING_FILE = 4; - private static String TAG = "FileObserverService"; + private static String TAG = FileObserverService.class.getSimpleName(); private static List mObservers; private static List mDownloadReceivers; private static Object mReceiverListLock = new Object(); @@ -181,17 +181,16 @@ public class FileObserverService extends Service implements FileObserverStatusLi if (path == null) return; if (mObservers == null) { initializeObservedList(); - return; } for (int i = 0; i < mObservers.size(); ++i) { OwnCloudFileObserver observer = mObservers.get(i); if (observer.getPath().equals(path)) { observer.stopWatching(); mObservers.remove(i); + Log.d(TAG, "Stopped watching " + path); break; } } - Log.d(TAG, "Stopped watching " + path); } private void addDownloadingFile(String remotePath) { @@ -229,6 +228,7 @@ public class FileObserverService extends Service implements FileObserverStatusLi switch (status) { case CONFLICT: { + // ISSUE 5: if the user is not running the app (this is a service!), this can be very intrusive; a notification should be preferred Intent i = new Intent(getApplicationContext(), ConflictsResolveActivity.class); i.setFlags(i.getFlags() | Intent.FLAG_ACTIVITY_NEW_TASK); i.putExtra("remotepath", remotePath); @@ -257,7 +257,7 @@ public class FileObserverService extends Service implements FileObserverStatusLi @Override public void onReceive(Context context, Intent intent) { - if (mPath.equals(intent.getStringExtra(FileDownloader.EXTRA_FILE_PATH))) { + if (mPath.equals(intent.getStringExtra(FileDownloader.EXTRA_FILE_PATH))) { // ISSUE 3: this condition will be false if the download failed; in that case, the download won't ever be retried context.unregisterReceiver(this); removeReceiverFromList(this); mObserver.startWatching();