summaryrefslogtreecommitdiff
path: root/core/java/android/content/ContentProviderOperation.java
Commit message (Collapse)AuthorAgeFilesLines
* Revert "Revert "Migrate unsafe parcel APIs in framework-minus-apex""Bernardo Rufino2022-01-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 331be9a6431d6489f8d1e1b80cb510d0ee073c50. Reintroducing ag/16366278 since it seems unrelated to b/214053959 (more details on b/214053959#comment55). Original commit message: Migrate unsafe parcel APIs in framework-minus-apex Migrate the following unsafe parcel APIs in framework-minus-apex: * Parcel.readSerializable() * Parcel.readArrayList() * Parcel.readList() * Parcel.readParcelable() * Parcel.readParcelableList() * Parcel.readSparseArray() This CL was generated by applying lint fixes that infer the expected type from the caller code and provide that as the type parameter (ag/16365240). A few observations: * In some classes we couldn't migrate because the class also belonged to another build module whose min SDK wasn't current (as is the case for framework-minus-apex), hence I suppressed the lint check (since I'll eventually submit the lint check to the tree). * In some cases, I needed to do the cast in https://stackoverflow.com/a/1080525/5765705 to make the compiler happy since there isn't another way of providing a class of type Class<MyClassWithGenerics<T>>. * In the readSerializable() case, the new API also requires the class loader, that was inferred to by InferredClass.class.getClassLoader(). * Note that automatic formatting and import rely on running hooked up to the IDE, which wasn't the case here. Bug: 195622897 Change-Id: I272432e6e082a973f7a50492ec35d79c2b577c93 Test: TH passes
* Revert "Migrate unsafe parcel APIs in framework-minus-apex"Bernardo Rufino2022-01-121-1/+1
| | | | | | | | This reverts commit 90bb3709dc75f7e44914222114752de5bce133d4. Reason for revert: b/214053959 Change-Id: Ic271bab1d3eaf677a5989dda9deb944ee2ad6850
* Migrate unsafe parcel APIs in framework-minus-apexBernardo Rufino2021-12-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Migrate the following unsafe parcel APIs in framework-minus-apex: * Parcel.readSerializable() * Parcel.readArrayList() * Parcel.readList() * Parcel.readParcelable() * Parcel.readParcelableList() * Parcel.readSparseArray() This CL was generated by applying lint fixes that infer the expected type from the caller code and provide that as the type parameter (ag/16365240). A few observations: * In some classes we couldn't migrate because the class also belonged to another build module whose min SDK wasn't current (as is the case for framework-minus-apex), hence I suppressed the lint check (since I'll eventually submit the lint check to the tree). * In some cases, I needed to do the cast in https://stackoverflow.com/a/1080525/5765705 to make the compiler happy since there isn't another way of providing a class of type Class<MyClassWithGenerics<T>>. * In the readSerializable() case, the new API also requires the class loader, that was inferred to by InferredClass.class.getClassLoader(). * Note that automatic formatting and import rely on running hooked up to the IDE, which wasn't the case here. Bug: 195622897 Test: TH passes Change-Id: I11a27b9bdab7959ee86e90aa1e1cbebd7aaf883c
* Apply fixes for EfficientStrings.Jeff Sharkey2020-10-201-6/+6
| | | | | | | | | | Refactoring to avoid paying the cost of extra StringBuilder that are quickly disposed. Bug: 170978902 Test: none Exempt-From-Owner-Approval: trivial refactoring Change-Id: Icd914a63cdadf8123c1e5a5073f85245f0791f0b
* Update some Parcelables to send Strings UTF-8.Jeff Sharkey2020-04-211-8/+8
| | | | | | | | | | | | | | | | | | An earlier CL with benchmarks has shown that sending strings as UTF-8 is 50% faster for US-ASCII strings, and still 68% faster for complex strings referencing higher Unicode planes. (So an improvement in both cases!) Since code across the OS still makes heavy assumptions about Parcel strings typically being UTF-16, we need to carefully migrate Parcelables by hand, which is what this CLs begins doing. This is a purely mechanical refactoring with no functional changes. Bug: 154436100 Test: manual Exempt-From-Owner-Approval: trivial refactoring Change-Id: Ia9e581efd7c40269342b7528ca07363deb843c0f
* Use new UnsupportedAppUsage annotation.Artur Satayev2020-01-081-1/+1
| | | | | | | | | | Existing annotations in libcore/ and frameworks/ will deleted after the migration. This also means that any java library that compiles @UnsupportedAppUsage requires a direct dependency on "unsupportedappusage" java_library. Bug: 145132366 Test: m && diff unsupportedappusage_index.csv \ git diff HEAD^ HEAD | grep '^[+-][^+-]' | grep -v '.import' Change-Id: I853372f3c6fef905553bb31be4f1bb48df735f7a
* Expand ContentProviderOperation support of extras.Jeff Sharkey2019-11-151-6/+21
| | | | | | | | | | | | Now that we allow extras in more ContentProvider calls, we should also allow CPO to define and pass those extras into a provider. We recently added flexible utility methods like withExtraBackReference(), so this change starts passing those values to insert, update, delete, and query. Bug: 131643582 Test: atest CtsContentTestCases Change-Id: I4a445c061bbd84f45bdb80d336a2d0928b7fbe9c
* Fix subtle bug when using empty withValues().Jeff Sharkey2019-08-281-7/+22
| | | | | | | | We still need to populate mValues when the ContentValues was empty. Bug: 139356941 Test: atest --test-mapping packages/providers/ContactsProvider Change-Id: Ice90afbb7994e1a1d10076a2aa48b4d1187abe9f
* Expand ContentProviderOperation to support call().Jeff Sharkey2019-08-081-269/+556
| | | | | | | | | | | | | | | | | | | | | | | | | ContentProviderOperation has long supported basic operations like insert(), update(), and delete(), but it was never extended to support the general-purpose call() method. This change adds support for call(), including configuration of the extras Bundle using back-references to other operations. In addition, the output Bundle from call() can be used for back-references from other operations. Clean up how back-references are handled internally; we now store either a literal value in each slot, or an explicit BackReference instance which we can "instanceof" check to resolve when needed. Also add withExceptionAllowed() capability, which can be used to catch and report the failure of a single operation while allowing any subsequent operations to proceed. Adds various nullability annotations to reflect the behavior of all existing logic. Bug: 131598520 Test: atest android.content.cts.ContentProviderOperationTest Test: atest android.content.cts.ContentProviderResultTest Change-Id: I1744bf8fc1ad048aa96460d487c2867c4c81d7b3
* Add nullability annotations for current behavior.Jeff Sharkey2019-08-081-21/+26
| | | | | | | | | | No behavior changes. This paves the way for a future CL that is will be adding a handful of new APIs. Bug: 131598520 Test: atest android.content.cts.ContentProviderOperationTest Test: atest android.content.cts.ContentProviderResultTest Change-Id: I1a6f53e79009ba88b13844a6c8ca8c09e33ee5b2
* Handle any exception when allowing failures.Jeff Sharkey2019-04-161-19/+24
| | | | | | Bug: 113518608 Test: atest --test-mapping packages/providers/MediaProvider Change-Id: I2f67b8016e6057cfd022899bbfba32c3db3a12aa
* Allow failures of applyBatch() operations.Jeff Sharkey2019-04-151-4/+29
| | | | | | | | | | | | | | | In some cases, the supplier of ContentProviderOperation is okay if certain operations fail, and they'd like ContentProviderResult to tell them about the failures instead of aborting the remainder of the transaction. Start using this for ModernMediaScanner, where we probably raced with someone when building an UPSERT-style operation. We'll pick up any changes to those files during the next scan. Bug: 128494336 Test: atest --test-mapping packages/providers/MediaProvider Change-Id: Ida8230ff2bbb3bab56eb83928e49e7097bfbc9fd
* All Parcelable CREATOR fields are @NonNull.Jeff Sharkey2019-02-281-1/+1
| | | | | | | | | If they were null, then the Parcelable would fail to work. Bug: 126726802 Test: manual Change-Id: I7929ffa2f20e5de1c8e68e8263cca99496e9d014 Exempt-From-Owner-Approval: Trivial API annotations
* docs: fixing errors found with lint checker am: 219f7dcb66kopriva2018-10-101-1/+1
|\ | | | | | | | | | | am: 003587b9a4 Change-Id: I056261f069ed679ed8a03bfc0791bfe59a405361
| * docs: fixing errors found with lint checkerkopriva2018-10-091-1/+1
| |\ | | | | | | | | | | | | | | | am: 219f7dcb66 Change-Id: Id38a4b2e21285d5d5e2a2124d76885febd3441c6
| | * docs: fixing errors found with lint checkerkopriva2018-10-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | through /bluetooth directory amending through /content directory Test: make ds-docs Bug: 117494359 Change-Id: I751e15d60f0b9cc441998b27560050bf62994fef Exempt-From-Owner-Approval: Docs-only change
| * | Add @UnsupportedAppUsage annotationsMathew Inwood2018-08-151-0/+8
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For packages: android.content.res android.content.pm.split android.content.pm.permission android.content.pm.dex android.content.pm android.content.om android.content This is an automatically generated CL. See go/UnsupportedAppUsage for more details. Exempted-From-Owner-Approval: Mechanical changes to the codebase which have been approved by Android API council and announced on android-eng@ Bug: 110868826 Test: m Change-Id: Ie932bb108f8e21aad8576e444d43e7a553a4d128 Merged-In: Ia79256a3d04e16dd78331a61af0dcddc5fc1599b
* | Recover shady content:// paths.Jeff Sharkey2018-09-251-14/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The path-permission element offers prefix or regex style matching of paths, but most providers internally use UriMatcher to decide what to do with an incoming Uri. This causes trouble because UriMatcher uses Uri.getPathSegments(), which quietly ignores "empty" paths. Consider this example: <path-permission android:pathPrefix="/private" ... /> uriMatcher.addURI("com.example", "/private", CODE_PRIVATE); content://com.example//private The Uri above will pass the security check, since it's not technically a prefix match. But the UriMatcher will then match it as CODE_PRIVATE, since it ignores the "//" zero-length path. Since we can't safely change the behavior of either path-permission or UriMatcher, we're left with recovering these shady paths by trimming away zero-length paths. Bug: 112555574 Test: atest android.appsecurity.cts.AppSecurityTests Test: atest FrameworksCoreTests:android.content.ContentProviderTest Change-Id: Ibadbfa4fc904ec54780c8102958735b03293fb9a
* | Add @UnsupportedAppUsage annotationsMathew Inwood2018-08-151-0/+8
|/ | | | | | | | | | | | | | | | | | | | | | For packages: android.content.res android.content.pm.split android.content.pm.permission android.content.pm.dex android.content.pm android.content.om android.content This is an automatically generated CL. See go/UnsupportedAppUsage for more details. Exempted-From-Owner-Approval: Mechanical changes to the codebase which have been approved by Android API council and announced on android-eng@ Bug: 110868826 Test: m Change-Id: Ia79256a3d04e16dd78331a61af0dcddc5fc1599b
* Replace possibly-expensive size() == 0 with isEmpty()Mike Tsao2017-03-241-4/+4
| | | | | | Bug: 36596458 Change-Id: Ieb0ea65be056bb8ce0613280e6213c330fbf783c Test: added ContentValuesTest
* Add docs for ContentProviderOperations.Jeff Brown2015-06-101-1/+53
| | | | | Bug: 21343769 Change-Id: Ia122b58785cf98f16664f82eb00a1f6bd9366885
* Expose ContentProviderOperation typeBrian Attwell2015-01-231-0/+16
| | | | | | | | | | | | | | | | | | | CHANGE isInsert, isDelete, isUpdate, isAssertQuery JUSTIFICATION The use of getType() in lots of unit tests means that ContentProviderOperation#getType() can't practically be removed. Why not make it public? This allows 3p to use getType() in unit tests. Plus it allows the unbundled contacts app to continue using getType() in order to handle TYPE_INSERT specially, without needing to awkwardly pass isInsert values around. Bug: 18777272 Change-Id: I6be5f325bbf6fbeb7817e9b1f7fa1a1ae2002e0b
* Revert "Expose ContentProviderOperation type"Brian Attwell2015-01-221-16/+0
| | | | | | This reverts commit 9986f8e85a095320afbdebb2d0dfee9a2e19e510. Change-Id: Icdcedf485a67fff4ab5e6bab9cc3e82aa7cc8760
* Expose ContentProviderOperation typeBrian Attwell2015-01-221-0/+16
| | | | | | | | | | | | | | | | | | | CHANGE isInsert, isDelete, isUpdate, isAssertQuery JUSTIFICATION The use of getType() in lots of unit tests means that ContentProviderOperation#getType() can't practically be removed. Why not make it public? This allows 3p to use getType() in unit tests. Plus it allows the unbundled contacts app to continue using getType() in order to handle TYPE_INSERT specially, without needing to awkwardly pass isInsert values around. Bug: 18777272 Change-Id: I3265193cda0c9405f6df896cd96a10df7225445a
* Resolving resources across users.Nicolas Prevot2014-05-131-1/+26
| | | | | | | | | | When an intent is sent to another profile: For content uris contained in this intent: The userId of the source user is added to the userInfo part. The ActivityManagerService has been modified to resolve resources in the user specified by the uri. The user id to which the uri belongs to is stored in the UriPermission. Change-Id: I43dc76895aba692bf148d276253aeaf9c75fce34
* Fix the rest of the javadoc warnings.Joe Onorato2010-09-161-4/+6
| | | | Change-Id: Ifbf422a2eb177858813d118f03ceddcd807e73b4
* Add error logging to ContentProviderOperation.Ken Shirriff2010-02-191-1/+20
| | | | | This will dump out the contents of the operation in some error cases to make debugging easier.
* Avoid NPE when callers send null selection args.Jeff Sharkey2009-10-291-2/+6
| | | | Fixes http://b/2226007
* Copy the selection args when creating a CPO since callers often reuse the ↵Jeff Hamilton2009-10-281-1/+2
| | | | | | | passed in array. Bug: 2221947 Change-Id: I3b7d5cbef61777d76ca7fc0d7c91c44553e609a9
* add the ability to do a newAssert with no valuesFred Quintana2009-09-151-18/+29
|
* add the ability to specify yieldpoints in a ContentProviderOperationFred Quintana2009-08-281-1/+14
|
* New ContentProviderOperation to assert values during batch.Jeff Sharkey2009-08-101-49/+58
| | | | | | | | | | | | When performing a set of batch operations, some callers need to enforce that a query has specific values. For example, when persisting edited Contact values, we need to assert that the RawContacts.VERSION matches the version we read out through queryEntities(). This change adds a new TYPE_ASSERT that uses withValues() and withSelection(), and checks all values when applying the batch operation, bailing if any values don't match.
* - add several common kinds and beef up some othersFred Quintana2009-08-061-5/+6
| | | | - change the ContentProviderOperation selection backref store the backref as a long instead of as a string
* Expose type constants and accessor for unit tests.Jeff Sharkey2009-07-281-6/+15
| | | | | | | | | | Internally, ContentProviderOperation maintains a "type", which correspond to builder methods, such as "newInsert()". Unit tests often need to assert which operations are being built, so this change adds a getType() accessor and esposes the internal constants used. They are marked with @hide so they are not exposed in the public API.
* add a data_version column to the data tableFred Quintana2009-06-111-0/+6
|
* - make it easier to add content values to the ContentProviderOperationFred Quintana2009-06-041-2/+49
| | | | - add the group membership common kind as well as some IM utilities to the ContactsContract
* - create a new generic ISyncAdapter implementation, SyncAdapterNewFred Quintana2009-06-011-50/+32
| | | | | | - change the applyBatch to take an ArrayList rather than an [] - change Entity to be a final flass that contains ContentValues - remove the ability to update/insert Entities by a ContentProviderOperation
* add ipc support to batchingFred Quintana2009-05-221-5/+141
|
* enhance ContentProvider with the ability to perform batch operationsFred Quintana2009-05-151-0/+358