X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/994e81d7ce72734e4ec55c3afd4789c2b3a807be..2dc5cc57f12cf2832f6b19ee52f87e9f1f313eaa:/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 380ae1ac..0ae6d775 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; @@ -220,8 +221,12 @@ 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() && + AccountAuthenticator.AUTH_TOKEN_TYPE_SAML_WEB_SSO_SESSION_COOKIE.equals(getClient().getAuthTokenType()))) { mSyncResult.stats.numAuthExceptions++; } else if (result.getException() instanceof DavException) { @@ -267,8 +272,7 @@ public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter { fetchData(newFile.getRemotePath(), newFile.getFileId()); // Update folder size on DB - FileDataStorageManager storageManager = new FileDataStorageManager(getAccount(), getContext().getContentResolver()); - FileStorageUtils.saveFolderSize(newFile.getFileId(), storageManager); + getStorageManager().calculateFolderSize(newFile.getFileId()); } } @@ -303,13 +307,19 @@ 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() && + 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) { // let the user update credentials with one click Intent updateAccountCredentials = new Intent(getContext(), AuthenticatorActivity.class); updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ACCOUNT, getAccount()); + updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ENFORCED_UPDATE, true); updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ACTION, AuthenticatorActivity.ACTION_UPDATE_TOKEN); updateAccountCredentials.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); updateAccountCredentials.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);