summaryrefslogtreecommitdiff
path: root/core/java/android/content/ContentProvider.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/ContentProvider.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/ContentProvider.java')
-rw-r--r--core/java/android/content/ContentProvider.java37
1 files changed, 26 insertions, 11 deletions
diff --git a/core/java/android/content/ContentProvider.java b/core/java/android/content/ContentProvider.java
index 3eb0e7c9b504..85826fd4e669 100644
--- a/core/java/android/content/ContentProvider.java
+++ b/core/java/android/content/ContentProvider.java
@@ -1409,8 +1409,11 @@ public abstract class ContentProvider implements ContentInterface, ComponentCall
* @param uri The URI to query. This will be the full URI sent by the client.
* @param projection The list of columns to put into the cursor.
* If {@code null} provide a default set of columns.
- * @param queryArgs A Bundle containing all additional information necessary for the query.
- * Values in the Bundle may include SQL style arguments.
+ * @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 {@code null}.
* @return a Cursor or {@code null}.
@@ -1609,9 +1612,14 @@ public abstract class ContentProvider implements ContentInterface, ComponentCall
*
* @param uri The content:// URI of the insertion request.
* @param values A set of column_name/value pairs to add to the database.
- * @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 URI for the newly inserted item.
+ * @throws IllegalArgumentException if the provider doesn't support one of
+ * the requested Bundle arguments.
*/
@Override
public @Nullable Uri insert(@NonNull Uri uri, @Nullable ContentValues values,
@@ -1688,10 +1696,13 @@ public abstract class ContentProvider implements ContentInterface, ComponentCall
*
* @param uri The full URI to query, including a row ID (if a specific
* record is requested).
- * @param extras A Bundle containing all additional information necessary
- * for the delete. Values in the Bundle may include SQL style
- * arguments.
- * @return The number of rows affected.
+ * @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.
+ * @throws IllegalArgumentException if the provider doesn't support one of
+ * the requested Bundle arguments.
* @throws SQLException
*/
@Override
@@ -1734,10 +1745,14 @@ public abstract class ContentProvider implements ContentInterface, ComponentCall
* @param uri The URI to query. This can potentially have a record ID if
* this is an update request for a specific record.
* @param values A set of column_name/value pairs to update in the database.
- * @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 affected.
+ * @throws IllegalArgumentException if the provider doesn't support one of
+ * the requested Bundle arguments.
*/
@Override
public int update(@NonNull Uri uri, @Nullable ContentValues values,