Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 56f67d21 authored by Fred Quintana's avatar Fred Quintana
Browse files

add the ability to specify yieldpoints in a ContentProviderOperation

parent cc927375
Loading
Loading
Loading
Loading
+57 −0
Original line number Diff line number Diff line
@@ -27066,6 +27066,17 @@
 visibility="public"
>
</method>
<method name="isYieldAllowed"
 return="boolean"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="newAssertQuery"
 return="android.content.ContentProviderOperation.Builder"
 abstract="false"
@@ -27292,6 +27303,19 @@
<parameter name="values" type="android.content.ContentValues">
</parameter>
</method>
<method name="withYieldAllowed"
 return="android.content.ContentProviderOperation.Builder"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="yieldAllowed" type="boolean">
</parameter>
</method>
</class>
<class name="ContentProviderResult"
 extends="java.lang.Object"
@@ -35833,6 +35857,39 @@
<parameter name="cause" type="java.lang.Throwable">
</parameter>
</constructor>
<constructor name="OperationApplicationException"
 type="android.content.OperationApplicationException"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="numSuccessfulYieldPoints" type="int">
</parameter>
</constructor>
<constructor name="OperationApplicationException"
 type="android.content.OperationApplicationException"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="message" type="java.lang.String">
</parameter>
<parameter name="numSuccessfulYieldPoints" type="int">
</parameter>
</constructor>
<method name="getNumSuccessfulYieldPoints"
 return="int"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
</class>
<class name="ReceiverCallNotAllowedException"
 extends="android.util.AndroidRuntimeException"
+14 −1
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ public class ContentProviderOperation implements Parcelable {
    private final Integer mExpectedCount;
    private final ContentValues mValuesBackReferences;
    private final Map<Integer, Integer> 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<Integer, Integer> 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;
        }
    }
}
+18 −0
Original line number Diff line number Diff line
@@ -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;
    }
}