X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/b4a85deafc489c666363d38cb92b84156c141a31..ab3bcf6fe6f62add623a60405ef96ea77839f7a4:/src/com/owncloud/android/syncadapter/FileSyncAdapter.java diff --git a/src/com/owncloud/android/syncadapter/FileSyncAdapter.java b/src/com/owncloud/android/syncadapter/FileSyncAdapter.java index 44fe4014..8e7ac4c1 100644 --- a/src/com/owncloud/android/syncadapter/FileSyncAdapter.java +++ b/src/com/owncloud/android/syncadapter/FileSyncAdapter.java @@ -28,6 +28,7 @@ import org.apache.jackrabbit.webdav.DavException; import com.owncloud.android.Log_OC; import com.owncloud.android.R; +import com.owncloud.android.authentication.AccountAuthenticator; import com.owncloud.android.authentication.AuthenticatorActivity; import com.owncloud.android.datamodel.DataStorageManager; import com.owncloud.android.datamodel.FileDataStorageManager; @@ -37,7 +38,6 @@ import com.owncloud.android.operations.SynchronizeFolderOperation; import com.owncloud.android.operations.UpdateOCVersionOperation; import com.owncloud.android.operations.RemoteOperationResult.ResultCode; import com.owncloud.android.ui.activity.ErrorsWhileCopyingHandlerActivity; -import com.owncloud.android.utils.FileStorageUtils; import android.accounts.Account; import android.accounts.AccountsException; @@ -193,10 +193,14 @@ public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter { if (mFailedResultsCounter > MAX_FAILED_RESULTS || isFinisher(mLastFailedResult)) return; + boolean enforceMetadataUpdate = (parentId == DataStorageManager.ROOT_PARENT_ID); + // perform folder synchronization SynchronizeFolderOperation synchFolderOp = new SynchronizeFolderOperation( remotePath, mCurrentSyncTime, parentId, + enforceMetadataUpdate, + true, getStorageManager(), getAccount(), getContext() @@ -220,8 +224,13 @@ public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter { List children = synchFolderOp.getChildren(); fetchChildren(children); // beware of the 'hidden' recursion here! + sendStickyBroadcast(true, remotePath, null); + } else { - if (result.getCode() == RemoteOperationResult.ResultCode.UNAUTHORIZED) { + if (result.getCode() == RemoteOperationResult.ResultCode.UNAUTHORIZED || + // (result.isTemporalRedirection() && result.isIdPRedirection() && + ( result.isIdPRedirection() && + AccountAuthenticator.AUTH_TOKEN_TYPE_SAML_WEB_SSO_SESSION_COOKIE.equals(getClient().getAuthTokenType()))) { mSyncResult.stats.numAuthExceptions++; } else if (result.getException() instanceof DavException) { @@ -267,7 +276,7 @@ public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter { fetchData(newFile.getRemotePath(), newFile.getFileId()); // Update folder size on DB - getStorageManager().calculateFolderSize(newFile.getFileId()); + getStorageManager().calculateFolderSize(newFile.getFileId()); } } @@ -302,7 +311,13 @@ public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter { private void notifyFailedSynchronization() { Notification notification = new Notification(R.drawable.icon, getContext().getString(R.string.sync_fail_ticker), System.currentTimeMillis()); notification.flags |= Notification.FLAG_AUTO_CANCEL; - boolean needsToUpdateCredentials = (mLastFailedResult != null && mLastFailedResult.getCode() == ResultCode.UNAUTHORIZED); + boolean needsToUpdateCredentials = (mLastFailedResult != null && + ( mLastFailedResult.getCode() == ResultCode.UNAUTHORIZED || + // (mLastFailedResult.isTemporalRedirection() && mLastFailedResult.isIdPRedirection() && + ( mLastFailedResult.isIdPRedirection() && + AccountAuthenticator.AUTH_TOKEN_TYPE_SAML_WEB_SSO_SESSION_COOKIE.equals(getClient().getAuthTokenType())) + ) + ); // TODO put something smart in the contentIntent below for all the possible errors notification.contentIntent = PendingIntent.getActivity(getContext().getApplicationContext(), (int)System.currentTimeMillis(), new Intent(), 0); if (needsToUpdateCredentials) {