- add a reset to EntityIterator to allow it to go back to the beginning
- clean up the debug printing of SyncResult
diff --git a/api/current.xml b/api/current.xml
index 6059946..1b2080c 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -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"
diff --git a/core/java/android/content/AbstractCursorEntityIterator.java b/core/java/android/content/AbstractCursorEntityIterator.java
index bf3c4de..c2b13a4 100644
--- a/core/java/android/content/AbstractCursorEntityIterator.java
+++ b/core/java/android/content/AbstractCursorEntityIterator.java
@@ -87,6 +87,14 @@
         }
     }
 
+    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.
diff --git a/core/java/android/content/ContentProviderNative.java b/core/java/android/content/ContentProviderNative.java
index a4c217b..e367ceb 100644
--- a/core/java/android/content/ContentProviderNative.java
+++ b/core/java/android/content/ContentProviderNative.java
@@ -281,6 +281,10 @@
             return mEntityIterator.next();
         }
 
+        public void reset() throws RemoteException {
+            mEntityIterator.reset();
+        }
+
         public void close() throws RemoteException {
             mEntityIterator.close();
         }
@@ -406,6 +410,10 @@
             return mEntityIterator.next();
         }
 
+        public void reset() throws RemoteException {
+            mEntityIterator.reset();
+        }
+
         public void close() {
             try {
                 mEntityIterator.close();
diff --git a/core/java/android/content/ContentResolver.java b/core/java/android/content/ContentResolver.java
index 239b3de..b915803 100644
--- a/core/java/android/content/ContentResolver.java
+++ b/core/java/android/content/ContentResolver.java
@@ -244,6 +244,13 @@
             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();
diff --git a/core/java/android/content/EntityIterator.java b/core/java/android/content/EntityIterator.java
index 5e5f14c..3cc1040 100644
--- a/core/java/android/content/EntityIterator.java
+++ b/core/java/android/content/EntityIterator.java
@@ -41,6 +41,8 @@
      */
     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).
diff --git a/core/java/android/content/IEntityIterator.java b/core/java/android/content/IEntityIterator.java
index 1c478b3..068581e 100644
--- a/core/java/android/content/IEntityIterator.java
+++ b/core/java/android/content/IEntityIterator.java
@@ -98,6 +98,20 @@
                     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 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 @@
         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;
 }
diff --git a/core/java/android/content/SyncResult.java b/core/java/android/content/SyncResult.java
index f3260f3..4c201e6 100644
--- a/core/java/android/content/SyncResult.java
+++ b/core/java/android/content/SyncResult.java
@@ -113,14 +113,19 @@
     @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();
     }
 
diff --git a/core/java/android/content/SyncStats.java b/core/java/android/content/SyncStats.java
index b561b05..cc544c0 100644
--- a/core/java/android/content/SyncStats.java
+++ b/core/java/android/content/SyncStats.java
@@ -60,15 +60,18 @@
     @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();
     }