Merge change 22178 into eclair
* changes: - add a reset to EntityIterator to allow it to go back to the beginning - clean up the debug printing of SyncResult
This commit is contained in:
@@ -25311,6 +25311,19 @@
|
||||
visibility="public"
|
||||
>
|
||||
</method>
|
||||
<method name="reset"
|
||||
return="void"
|
||||
abstract="false"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
static="false"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<exception name="RemoteException" type="android.os.RemoteException">
|
||||
</exception>
|
||||
</method>
|
||||
</class>
|
||||
<class name="ActivityNotFoundException"
|
||||
extends="java.lang.RuntimeException"
|
||||
@@ -31226,6 +31239,19 @@
|
||||
<exception name="RemoteException" type="android.os.RemoteException">
|
||||
</exception>
|
||||
</method>
|
||||
<method name="reset"
|
||||
return="void"
|
||||
abstract="true"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
static="false"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<exception name="RemoteException" type="android.os.RemoteException">
|
||||
</exception>
|
||||
</method>
|
||||
</interface>
|
||||
<class name="Intent"
|
||||
extends="java.lang.Object"
|
||||
|
||||
@@ -87,6 +87,14 @@ public abstract class AbstractCursorEntityIterator implements EntityIterator {
|
||||
}
|
||||
}
|
||||
|
||||
public void reset() throws RemoteException {
|
||||
if (mIsClosed) {
|
||||
throw new IllegalStateException("calling reset() when the iterator is closed");
|
||||
}
|
||||
mEntityCursor.moveToPosition(-1);
|
||||
mNextEntity = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes this iterator making it invalid. If is invalid for the user to call any public
|
||||
* method on the iterator once it has been closed.
|
||||
|
||||
@@ -281,6 +281,10 @@ abstract public class ContentProviderNative extends Binder implements IContentPr
|
||||
return mEntityIterator.next();
|
||||
}
|
||||
|
||||
public void reset() throws RemoteException {
|
||||
mEntityIterator.reset();
|
||||
}
|
||||
|
||||
public void close() throws RemoteException {
|
||||
mEntityIterator.close();
|
||||
}
|
||||
@@ -406,6 +410,10 @@ final class ContentProviderProxy implements IContentProvider
|
||||
return mEntityIterator.next();
|
||||
}
|
||||
|
||||
public void reset() throws RemoteException {
|
||||
mEntityIterator.reset();
|
||||
}
|
||||
|
||||
public void close() {
|
||||
try {
|
||||
mEntityIterator.close();
|
||||
|
||||
@@ -244,6 +244,13 @@ public abstract class ContentResolver {
|
||||
return mInner.next();
|
||||
}
|
||||
|
||||
public void reset() throws RemoteException {
|
||||
if (mClientReleased) {
|
||||
throw new IllegalStateException("this iterator is already closed");
|
||||
}
|
||||
mInner.reset();
|
||||
}
|
||||
|
||||
public void close() {
|
||||
mClient.release();
|
||||
mInner.close();
|
||||
|
||||
@@ -41,6 +41,8 @@ public interface EntityIterator {
|
||||
*/
|
||||
public Entity next() throws RemoteException;
|
||||
|
||||
public void reset() throws RemoteException;
|
||||
|
||||
/**
|
||||
* Indicates that this iterator is no longer needed and that any associated resources
|
||||
* may be released (such as a SQLite cursor).
|
||||
|
||||
@@ -98,6 +98,20 @@ public interface IEntityIterator extends IInterface {
|
||||
return true;
|
||||
}
|
||||
|
||||
case TRANSACTION_reset:
|
||||
{
|
||||
data.enforceInterface(DESCRIPTOR);
|
||||
try {
|
||||
this.reset();
|
||||
} catch (RemoteException e) {
|
||||
Log.e(TAG, "caught exception in next()", e);
|
||||
reply.writeException(e);
|
||||
return true;
|
||||
}
|
||||
reply.writeNoException();
|
||||
return true;
|
||||
}
|
||||
|
||||
case TRANSACTION_close:
|
||||
{
|
||||
data.enforceInterface(DESCRIPTOR);
|
||||
@@ -157,6 +171,19 @@ public interface IEntityIterator extends IInterface {
|
||||
}
|
||||
}
|
||||
|
||||
public void reset() throws RemoteException {
|
||||
Parcel _data = Parcel.obtain();
|
||||
Parcel _reply = Parcel.obtain();
|
||||
try {
|
||||
_data.writeInterfaceToken(DESCRIPTOR);
|
||||
mRemote.transact(Stub.TRANSACTION_reset, _data, _reply, 0);
|
||||
_reply.readException();
|
||||
} finally {
|
||||
_reply.recycle();
|
||||
_data.recycle();
|
||||
}
|
||||
}
|
||||
|
||||
public void close() throws RemoteException {
|
||||
Parcel _data = Parcel.obtain();
|
||||
Parcel _reply = Parcel.obtain();
|
||||
@@ -174,8 +201,10 @@ public interface IEntityIterator extends IInterface {
|
||||
static final int TRANSACTION_hasNext = (IBinder.FIRST_CALL_TRANSACTION + 0);
|
||||
static final int TRANSACTION_next = (IBinder.FIRST_CALL_TRANSACTION + 1);
|
||||
static final int TRANSACTION_close = (IBinder.FIRST_CALL_TRANSACTION + 2);
|
||||
static final int TRANSACTION_reset = (IBinder.FIRST_CALL_TRANSACTION + 3);
|
||||
}
|
||||
public boolean hasNext() throws RemoteException;
|
||||
public Entity next() throws RemoteException;
|
||||
public void reset() throws RemoteException;
|
||||
public void close() throws RemoteException;
|
||||
}
|
||||
|
||||
@@ -113,14 +113,19 @@ public final class SyncResult implements Parcelable {
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(" syncAlreadyInProgress: ").append(syncAlreadyInProgress);
|
||||
sb.append(" tooManyDeletions: ").append(tooManyDeletions);
|
||||
sb.append(" tooManyRetries: ").append(tooManyRetries);
|
||||
sb.append(" databaseError: ").append(databaseError);
|
||||
sb.append(" fullSyncRequested: ").append(fullSyncRequested);
|
||||
sb.append(" partialSyncUnavailable: ").append(partialSyncUnavailable);
|
||||
sb.append(" moreRecordsToGet: ").append(moreRecordsToGet);
|
||||
sb.append(" stats: ").append(stats);
|
||||
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);
|
||||
sb.append(stats);
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
@@ -60,15 +60,18 @@ public class SyncStats implements Parcelable {
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("numAuthExceptions: ").append(numAuthExceptions);
|
||||
sb.append(" numIoExceptions: ").append(numIoExceptions);
|
||||
sb.append(" numParseExceptions: ").append(numParseExceptions);
|
||||
sb.append(" numConflictDetectedExceptions: ").append(numConflictDetectedExceptions);
|
||||
sb.append(" numInserts: ").append(numInserts);
|
||||
sb.append(" numUpdates: ").append(numUpdates);
|
||||
sb.append(" numDeletes: ").append(numDeletes);
|
||||
sb.append(" numEntries: ").append(numEntries);
|
||||
sb.append(" numSkippedEntries: ").append(numSkippedEntries);
|
||||
sb.append(" stats [");
|
||||
if (numAuthExceptions > 0) sb.append(" numAuthExceptions: ").append(numAuthExceptions);
|
||||
if (numIoExceptions > 0) sb.append(" numIoExceptions: ").append(numIoExceptions);
|
||||
if (numParseExceptions > 0) sb.append(" numParseExceptions: ").append(numParseExceptions);
|
||||
if (numConflictDetectedExceptions > 0)
|
||||
sb.append(" numConflictDetectedExceptions: ").append(numConflictDetectedExceptions);
|
||||
if (numInserts > 0) sb.append(" numInserts: ").append(numInserts);
|
||||
if (numUpdates > 0) sb.append(" numUpdates: ").append(numUpdates);
|
||||
if (numDeletes > 0) sb.append(" numDeletes: ").append(numDeletes);
|
||||
if (numEntries > 0) sb.append(" numEntries: ").append(numEntries);
|
||||
if (numSkippedEntries > 0) sb.append(" numSkippedEntries: ").append(numSkippedEntries);
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user