Fields Summary |
---|
public final boolean | syncAlreadyInProgressUsed to indicate that the SyncAdapter is already performing a sync operation, though
not necessarily for the requested account and authority and that it wasn't able to
process this request. The SyncManager will reschedule the request to run later. |
public boolean | tooManyDeletionsUsed to indicate that the SyncAdapter determined that it would need to issue
too many delete operations to the server in order to satisfy the request
(as defined by the SyncAdapter). The SyncManager will record
that the sync request failed and will cause a System Notification to be created
asking the user what they want to do about this. It will give the user a chance to
choose between (1) go ahead even with those deletes, (2) revert the deletes,
or (3) take no action. If the user decides (1) or (2) the SyncManager will issue another
sync request with either {@link ContentResolver#SYNC_EXTRAS_OVERRIDE_TOO_MANY_DELETIONS}
or {@link ContentResolver#SYNC_EXTRAS_DISCARD_LOCAL_DELETIONS} set in the extras.
It is then up to the SyncAdapter to decide how to honor that request. |
public boolean | tooManyRetriesUsed to indicate that the SyncAdapter experienced a hard error due to trying the same
operation too many times (as defined by the SyncAdapter). The SyncManager will record
that the sync request failed and it will not reschedule the request. |
public boolean | databaseErrorUsed to indicate that the SyncAdapter experienced a hard error due to an error it
received from interacting with the storage layer. The SyncManager will record that
the sync request failed and it will not reschedule the request. |
public boolean | fullSyncRequestedIf set the SyncManager will request an immediate sync with the same Account and authority
(but empty extras Bundle) as was used in the sync request. |
public boolean | partialSyncUnavailableThis field is ignored by the SyncManager. |
public boolean | moreRecordsToGetThis field is ignored by the SyncManager. |
public long | delayUntilUsed to indicate to the SyncManager that future sync requests that match the request's
Account and authority should be delayed at least this many seconds. |
public final SyncStats | statsUsed to hold extras statistics about the sync operation. Some of these indicate that
the sync request resulted in a hard or soft error, others are for purely informational
purposes. |
public static final SyncResult | ALREADY_IN_PROGRESSThis instance of a SyncResult is returned by the SyncAdapter in response to a
sync request when a sync is already underway. The SyncManager will reschedule the
sync request to try again later. |
public static final Creator | CREATOR |
Methods Summary |
---|
public void | clear()Clears the SyncResult to a clean state. Throws an {@link UnsupportedOperationException}
if this is called when {@link #syncAlreadyInProgress} is set.
if (syncAlreadyInProgress) {
throw new UnsupportedOperationException(
"you are not allowed to clear the ALREADY_IN_PROGRESS SyncStats");
}
tooManyDeletions = false;
tooManyRetries = false;
databaseError = false;
fullSyncRequested = false;
partialSyncUnavailable = false;
moreRecordsToGet = false;
delayUntil = 0;
stats.clear();
|
public int | describeContents()
return 0;
|
public boolean | hasError()A convenience method for determining of the SyncResult indicates that an error occurred.
return hasSoftError() || hasHardError();
|
public boolean | hasHardError()Convenience method for determining if the SyncResult indicates that a hard error
occurred. See {@link #SyncResult()} for an explanation of what the SyncManager does
when it sees a hard error.
A hard error is indicated when any of the following is true:
|
public boolean | hasSoftError()Convenience method for determining if the SyncResult indicates that a soft error
occurred. See {@link #SyncResult()} for an explanation of what the SyncManager does
when it sees a soft error.
A soft error is indicated when any of the following is true:
- {@link SyncStats#numIoExceptions} > 0
- {@link #syncAlreadyInProgress}
return syncAlreadyInProgress || stats.numIoExceptions > 0;
|
public boolean | madeSomeProgress()Convenience method for determining if the Sync should be rescheduled after failing for some
reason.
return ((stats.numDeletes > 0) && !tooManyDeletions)
|| stats.numInserts > 0
|| stats.numUpdates > 0;
|
public java.lang.String | toDebugString()Generates a debugging string indicating the status.
The string consist of a sequence of code letter followed by the count.
Code letters are f - fullSyncRequested, r - partialSyncUnavailable,
X - hardError, e - numParseExceptions, c - numConflictDetectedExceptions,
a - numAuthExceptions, D - tooManyDeletions, R - tooManyRetries,
b - databaseError, x - softError, l - syncAlreadyInProgress,
I - numIoExceptions
StringBuffer sb = new StringBuffer();
if (fullSyncRequested) {
sb.append("f1");
}
if (partialSyncUnavailable) {
sb.append("r1");
}
if (hasHardError()) {
sb.append("X1");
}
if (stats.numParseExceptions > 0) {
sb.append("e").append(stats.numParseExceptions);
}
if (stats.numConflictDetectedExceptions > 0) {
sb.append("c").append(stats.numConflictDetectedExceptions);
}
if (stats.numAuthExceptions > 0) {
sb.append("a").append(stats.numAuthExceptions);
}
if (tooManyDeletions) {
sb.append("D1");
}
if (tooManyRetries) {
sb.append("R1");
}
if (databaseError) {
sb.append("b1");
}
if (hasSoftError()) {
sb.append("x1");
}
if (syncAlreadyInProgress) {
sb.append("l1");
}
if (stats.numIoExceptions > 0) {
sb.append("I").append(stats.numIoExceptions);
}
return sb.toString();
|
public java.lang.String | toString()
StringBuilder sb = new StringBuilder();
sb.append("SyncResult:");
if (syncAlreadyInProgress) {
sb.append(" syncAlreadyInProgress: ").append(syncAlreadyInProgress);
}
if (tooManyDeletions) sb.append(" tooManyDeletions: ").append(tooManyDeletions);
if (tooManyRetries) sb.append(" tooManyRetries: ").append(tooManyRetries);
if (databaseError) sb.append(" databaseError: ").append(databaseError);
if (fullSyncRequested) sb.append(" fullSyncRequested: ").append(fullSyncRequested);
if (partialSyncUnavailable) {
sb.append(" partialSyncUnavailable: ").append(partialSyncUnavailable);
}
if (moreRecordsToGet) sb.append(" moreRecordsToGet: ").append(moreRecordsToGet);
if (delayUntil > 0) sb.append(" delayUntil: ").append(delayUntil);
sb.append(stats);
return sb.toString();
|
public void | writeToParcel(android.os.Parcel parcel, int flags)
parcel.writeInt(syncAlreadyInProgress ? 1 : 0);
parcel.writeInt(tooManyDeletions ? 1 : 0);
parcel.writeInt(tooManyRetries ? 1 : 0);
parcel.writeInt(databaseError ? 1 : 0);
parcel.writeInt(fullSyncRequested ? 1 : 0);
parcel.writeInt(partialSyncUnavailable ? 1 : 0);
parcel.writeInt(moreRecordsToGet ? 1 : 0);
parcel.writeLong(delayUntil);
stats.writeToParcel(parcel, flags);
|