From 56f67d21459ad3f136c73c8932904d4a495989c0 Mon Sep 17 00:00:00 2001 From: Fred Quintana Date: Fri, 28 Aug 2009 14:36:42 -0700 Subject: [PATCH] add the ability to specify yieldpoints in a ContentProviderOperation --- api/current.xml | 57 +++++++++++++++++++ .../content/ContentProviderOperation.java | 15 ++++- .../OperationApplicationException.java | 18 ++++++ 3 files changed, 89 insertions(+), 1 deletion(-) diff --git a/api/current.xml b/api/current.xml index 403a961ed4996..3e616a4c133e1 100644 --- a/api/current.xml +++ b/api/current.xml @@ -27066,6 +27066,17 @@ visibility="public" > + + + + + + + + + + + + + + + + + + mSelectionArgsBackReferences; + private final boolean mYieldAllowed; /** * Creates a {@link ContentProviderOperation} by copying the contents of a @@ -58,6 +59,7 @@ public class ContentProviderOperation implements Parcelable { mExpectedCount = builder.mExpectedCount; mSelectionArgsBackReferences = builder.mSelectionArgsBackReferences; mValuesBackReferences = builder.mValuesBackReferences; + mYieldAllowed = builder.mYieldAllowed; } private ContentProviderOperation(Parcel source) { @@ -68,7 +70,6 @@ public class ContentProviderOperation implements Parcelable { mSelectionArgs = source.readInt() != 0 ? source.readStringArray() : null; mExpectedCount = source.readInt() != 0 ? source.readInt() : null; mValuesBackReferences = source.readInt() != 0 - ? ContentValues.CREATOR.createFromParcel(source) : null; mSelectionArgsBackReferences = source.readInt() != 0 @@ -80,6 +81,7 @@ public class ContentProviderOperation implements Parcelable { mSelectionArgsBackReferences.put(source.readInt(), source.readInt()); } } + mYieldAllowed = source.readInt() != 0; } public void writeToParcel(Parcel dest, int flags) { @@ -125,6 +127,7 @@ public class ContentProviderOperation implements Parcelable { } else { dest.writeInt(0); } + dest.writeInt(mYieldAllowed ? 1 : 0); } /** @@ -167,6 +170,10 @@ public class ContentProviderOperation implements Parcelable { return mUri; } + public boolean isYieldAllowed() { + return mYieldAllowed; + } + /** @hide exposed for unit tests */ public int getType() { return mType; @@ -375,6 +382,7 @@ public class ContentProviderOperation implements Parcelable { private Integer mExpectedCount; private ContentValues mValuesBackReferences; private Map mSelectionArgsBackReferences; + private boolean mYieldAllowed; /** Create a {@link Builder} of a given type. The uri must not be null. */ private Builder(int type, Uri uri) { @@ -544,5 +552,10 @@ public class ContentProviderOperation implements Parcelable { mExpectedCount = count; return this; } + + public Builder withYieldAllowed(boolean yieldAllowed) { + mYieldAllowed = yieldAllowed; + return this; + } } } diff --git a/core/java/android/content/OperationApplicationException.java b/core/java/android/content/OperationApplicationException.java index d4101bf19c3b8..2fc19bb5ca69d 100644 --- a/core/java/android/content/OperationApplicationException.java +++ b/core/java/android/content/OperationApplicationException.java @@ -21,16 +21,34 @@ package android.content; * constraints. */ public class OperationApplicationException extends Exception { + private final int mNumSuccessfulYieldPoints; + public OperationApplicationException() { super(); + mNumSuccessfulYieldPoints = 0; } public OperationApplicationException(String message) { super(message); + mNumSuccessfulYieldPoints = 0; } public OperationApplicationException(String message, Throwable cause) { super(message, cause); + mNumSuccessfulYieldPoints = 0; } public OperationApplicationException(Throwable cause) { super(cause); + mNumSuccessfulYieldPoints = 0; + } + public OperationApplicationException(int numSuccessfulYieldPoints) { + super(); + mNumSuccessfulYieldPoints = numSuccessfulYieldPoints; + } + public OperationApplicationException(String message, int numSuccessfulYieldPoints) { + super(message); + mNumSuccessfulYieldPoints = numSuccessfulYieldPoints; + } + + public int getNumSuccessfulYieldPoints() { + return mNumSuccessfulYieldPoints; } }