summaryrefslogtreecommitdiff
path: root/core/java/android/content/ContentResolver.java
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2020-01-08 11:00:23 -0700
committerJeff Sharkey <jsharkey@android.com>2020-01-08 11:44:44 -0700
commitc192ca5a54723247d2d2b449eeaaffb71c88b9de (patch)
tree7ed7bc0fc3fa6381860b2be972d70ef216b34c88 /core/java/android/content/ContentResolver.java
parent197fe1f90fd5b77185bedb6fe2fbdf39a0dfaf5a (diff)
Respond to API council feedback.
Adjust Exception to more general Throwable, and add docs for new ContentResolver and ContentProvider overloads. Also add docs for default state of strict query options. Bug: 131598520, 141227540, 147287177 Test: atest --test-mapping packages/providers/MediaProvider Change-Id: Icb0153b8c8a352db39de301074e948bfaa676ddb
Diffstat (limited to 'core/java/android/content/ContentResolver.java')
-rw-r--r--core/java/android/content/ContentResolver.java32
1 files changed, 26 insertions, 6 deletions
diff --git a/core/java/android/content/ContentResolver.java b/core/java/android/content/ContentResolver.java
index 592190e0ec11..6cd1cd3354c2 100644
--- a/core/java/android/content/ContentResolver.java
+++ b/core/java/android/content/ContentResolver.java
@@ -984,7 +984,11 @@ public abstract class ContentResolver implements ContentInterface {
* retrieve.
* @param projection A list of which columns to return. Passing null will
* return all columns, which is inefficient.
- * @param queryArgs A Bundle containing any arguments to the query.
+ * @param queryArgs A Bundle containing additional information necessary for
+ * the operation. Arguments may include SQL style arguments, such
+ * as {@link ContentResolver#QUERY_ARG_SQL_LIMIT}, but note that
+ * the documentation for each individual provider will indicate
+ * which arguments they support.
* @param cancellationSignal A signal to cancel the operation in progress, or null if none.
* If the operation is canceled, then {@link OperationCanceledException} will be thrown
* when the query is executed.
@@ -1925,9 +1929,15 @@ public abstract class ContentResolver implements ContentInterface {
* @param url The URL of the table to insert into.
* @param values The initial values for the newly inserted row. The key is the column name for
* the field. Passing an empty ContentValues will create an empty row.
- * @param extras A Bundle containing all additional information necessary for the insert.
+ * @param extras A Bundle containing additional information necessary for
+ * the operation. Arguments may include SQL style arguments, such
+ * as {@link ContentResolver#QUERY_ARG_SQL_LIMIT}, but note that
+ * the documentation for each individual provider will indicate
+ * which arguments they support.
* @return the URL of the newly created row. May return <code>null</code> if the underlying
* content provider returns <code>null</code>, or if it crashes.
+ * @throws IllegalArgumentException if the provider doesn't support one of
+ * the requested Bundle arguments.
*/
@Override
public final @Nullable Uri insert(@RequiresPermission.Write @NonNull Uri url,
@@ -2061,9 +2071,14 @@ public abstract class ContentResolver implements ContentInterface {
* If the content provider supports transactions, the deletion will be atomic.
*
* @param url The URL of the row to delete.
- * @param extras A Bundle containing all additional information necessary for the delete.
- * Values in the Bundle may include SQL style arguments.
+ * @param extras A Bundle containing additional information necessary for
+ * the operation. Arguments may include SQL style arguments, such
+ * as {@link ContentResolver#QUERY_ARG_SQL_LIMIT}, but note that
+ * the documentation for each individual provider will indicate
+ * which arguments they support.
* @return The number of rows deleted.
+ * @throws IllegalArgumentException if the provider doesn't support one of
+ * the requested Bundle arguments.
*/
@Override
public final int delete(@RequiresPermission.Write @NonNull Uri url, @Nullable Bundle extras) {
@@ -2121,10 +2136,15 @@ public abstract class ContentResolver implements ContentInterface {
* @param uri The URI to modify.
* @param values The new field values. The key is the column name for the field.
A null value will remove an existing field value.
- * @param extras A Bundle containing all additional information necessary for the update.
- * Values in the Bundle may include SQL style arguments.
+ * @param extras A Bundle containing additional information necessary for
+ * the operation. Arguments may include SQL style arguments, such
+ * as {@link ContentResolver#QUERY_ARG_SQL_LIMIT}, but note that
+ * the documentation for each individual provider will indicate
+ * which arguments they support.
* @return the number of rows updated.
* @throws NullPointerException if uri or values are null
+ * @throws IllegalArgumentException if the provider doesn't support one of
+ * the requested Bundle arguments.
*/
@Override
public final int update(@RequiresPermission.Write @NonNull Uri uri,