projects
/
pub
/
Android
/
ownCloud.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
OC-2332: rewrite getAvailableRemotePath from UpdateFileOperation, using ExistenceCehe...
[pub/Android/ownCloud.git]
/
src
/
com
/
owncloud
/
android
/
syncadapter
/
FileSyncService.java
diff --git
a/src/com/owncloud/android/syncadapter/FileSyncService.java
b/src/com/owncloud/android/syncadapter/FileSyncService.java
index
3c99975
..
1e1e11f
100644
(file)
--- a/
src/com/owncloud/android/syncadapter/FileSyncService.java
+++ b/
src/com/owncloud/android/syncadapter/FileSyncService.java
@@
-17,6
+17,8
@@
*/
\r
package com.owncloud.android.syncadapter;
\r
\r
*/
\r
package com.owncloud.android.syncadapter;
\r
\r
+import com.owncloud.android.utils.Log_OC;
\r
+
\r
import android.app.Service;
\r
import android.content.Intent;
\r
import android.os.IBinder;
\r
import android.app.Service;
\r
import android.content.Intent;
\r
import android.os.IBinder;
\r
@@
-37,6
+39,11
@@
public class FileSyncService extends Service {
public static final String ACCOUNT_NAME = "ACCOUNT_NAME";
\r
public static final String SYNC_RESULT = "SYNC_RESULT";
\r
\r
public static final String ACCOUNT_NAME = "ACCOUNT_NAME";
\r
public static final String SYNC_RESULT = "SYNC_RESULT";
\r
\r
+ // Storage for an instance of the sync adapter
\r
+ private static FileSyncAdapter sSyncAdapter = null;
\r
+ // Object to use as a thread-safe lock
\r
+ private static final Object sSyncAdapterLock = new Object();
\r
+
\r
public static String getSyncMessage(){
\r
return FileSyncService.class.getName().toString() + SYNC_MESSAGE;
\r
}
\r
public static String getSyncMessage(){
\r
return FileSyncService.class.getName().toString() + SYNC_MESSAGE;
\r
}
\r
@@
-45,6
+52,11
@@
public class FileSyncService extends Service {
*/
\r
@Override
\r
public void onCreate() {
\r
*/
\r
@Override
\r
public void onCreate() {
\r
+ synchronized (sSyncAdapterLock) {
\r
+ if (sSyncAdapter == null) {
\r
+ sSyncAdapter = new FileSyncAdapter(getApplicationContext(), true);
\r
+ }
\r
+ }
\r
}
\r
\r
/*
\r
}
\r
\r
/*
\r
@@
-52,7
+64,7
@@
public class FileSyncService extends Service {
*/
\r
@Override
\r
public IBinder onBind(Intent intent) {
\r
*/
\r
@Override
\r
public IBinder onBind(Intent intent) {
\r
- return
new FileSyncAdapter(getApplicationContext(), true)
.getSyncAdapterBinder();
\r
+ return
sSyncAdapter
.getSyncAdapterBinder();
\r
}
\r
\r
}
\r
}
\r
\r
}
\r