X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/a0efedc99d0421554b8f8e93ef631e54a4cb05cd..d38a69abc1ba78df70fee65fc2434fc80b6be93b:/src/com/owncloud/android/syncadapter/FileSyncAdapter.java?ds=sidebyside diff --git a/src/com/owncloud/android/syncadapter/FileSyncAdapter.java b/src/com/owncloud/android/syncadapter/FileSyncAdapter.java index 7a00b2ef..f0bc8709 100644 --- a/src/com/owncloud/android/syncadapter/FileSyncAdapter.java +++ b/src/com/owncloud/android/syncadapter/FileSyncAdapter.java @@ -26,17 +26,17 @@ import java.util.Map; import org.apache.jackrabbit.webdav.DavException; -import com.owncloud.android.Log_OC; import com.owncloud.android.MainApp; import com.owncloud.android.R; import com.owncloud.android.authentication.AuthenticatorActivity; import com.owncloud.android.datamodel.FileDataStorageManager; import com.owncloud.android.datamodel.OCFile; -import com.owncloud.android.operations.RemoteOperationResult; +import com.owncloud.android.oc_framework.operations.RemoteOperationResult; import com.owncloud.android.operations.SynchronizeFolderOperation; import com.owncloud.android.operations.UpdateOCVersionOperation; -import com.owncloud.android.operations.RemoteOperationResult.ResultCode; +import com.owncloud.android.oc_framework.operations.RemoteOperationResult.ResultCode; import com.owncloud.android.ui.activity.ErrorsWhileCopyingHandlerActivity; +import com.owncloud.android.utils.Log_OC; import android.accounts.Account; @@ -98,7 +98,7 @@ public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter { /** - * Creates an {@link FileSyncAdapter} + * Creates a {@link FileSyncAdapter} * * {@inheritDoc} */ @@ -108,11 +108,21 @@ public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter { /** + * Creates a {@link FileSyncAdapter} + * + * {@inheritDoc} + */ + public FileSyncAdapter(Context context, boolean autoInitialize, boolean allowParallelSyncs) { + super(context, autoInitialize, allowParallelSyncs); + } + + + /** * {@inheritDoc} */ @Override public synchronized void onPerformSync(Account account, Bundle extras, - String authority, ContentProviderClient provider, + String authority, ContentProviderClient providerClient, SyncResult syncResult) { mCancellation = false; @@ -127,8 +137,8 @@ public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter { mSyncResult.delayUntil = 60*60*24; // avoid too many automatic synchronizations this.setAccount(account); - this.setContentProvider(provider); - this.setStorageManager(new FileDataStorageManager(account, provider)); + this.setContentProviderClient(providerClient); + this.setStorageManager(new FileDataStorageManager(account, providerClient)); try { this.initClientForCurrentAccount(); } catch (IOException e) { @@ -269,8 +279,9 @@ public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter { } else { // in failures, the statistics for the global result are updated if (result.getCode() == RemoteOperationResult.ResultCode.UNAUTHORIZED || - ( result.isIdPRedirection() && - MainApp.getAuthTokenTypeSamlSessionCookie().equals(getClient().getAuthTokenType()))) { + ( result.isIdPRedirection() && + getClient().getCredentials() == null )) { + //MainApp.getAuthTokenTypeSamlSessionCookie().equals(getClient().getAuthTokenType()))) { mSyncResult.stats.numAuthExceptions++; } else if (result.getException() instanceof DavException) { @@ -361,9 +372,9 @@ public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter { notification.flags |= Notification.FLAG_AUTO_CANCEL; boolean needsToUpdateCredentials = (mLastFailedResult != null && ( mLastFailedResult.getCode() == ResultCode.UNAUTHORIZED || - // (mLastFailedResult.isTemporalRedirection() && mLastFailedResult.isIdPRedirection() && ( mLastFailedResult.isIdPRedirection() && - MainApp.getAuthTokenTypeSamlSessionCookie().equals(getClient().getAuthTokenType())) + getClient().getCredentials() == null ) + //MainApp.getAuthTokenTypeSamlSessionCookie().equals(getClient().getAuthTokenType())) ) ); // TODO put something smart in the contentIntent below for all the possible errors