X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/6c32365704be635c38e0a338b727643fa76120f5..9aab2d26da38f26e7ff03a0b5db3bd01b51bce05:/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 dc533d13..2cae6f2d 100644 --- a/src/com/owncloud/android/files/services/FileObserverService.java +++ b/src/com/owncloud/android/files/services/FileObserverService.java @@ -1,3 +1,21 @@ +/* ownCloud Android client application + * Copyright (C) 2012 Bartek Przybylski + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package com.owncloud.android.files.services; import java.util.ArrayList; @@ -32,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(); @@ -163,7 +181,7 @@ public class FileObserverService extends Service implements FileObserverStatusLi if (path == null) return; if (mObservers == null) { initializeObservedList(); - return; + return; // ISSUE 2: why return? ; the file still has to be removed of the mObservers ! } for (int i = 0; i < mObservers.size(); ++i) { OwnCloudFileObserver observer = mObservers.get(i); @@ -211,6 +229,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); @@ -239,7 +258,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();