History log of /frameworks/base/core/java/android/content/ContentProviderNative.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
ff17024e583b170312d82089fd358d278ce16c9a 19-Nov-2014 Dianne Hackborn <hackbod@google.com> Fix issue with call backs from media process.

All but a few lines of this is for issue #16013164, which allowed
apps to do some operations as the media uid by having it call
back to them to open a file. The problem here is with the tempory
identity stuff in the activity manager, allowing us to make the open
call as the original caller... ideally we should figure out a way
to just get rid of all of that, but the solution here is actually
easier (even though it doesn't look it) -- we now hand a token over
to the openFile() call that it can use when doing permission checks
to say "yes I would like the check to be against whoever is responsible
for the open". This allows us to do the uid remapping for only this
one specific set of permission checks, and nothing else.

Also fix issue #17487348: Isolated services can access system services
they shouldn't be able to. Don't send any system service IBinder objects
down for the first initialization of an isolated process.

Change-Id: I3c70e16e0899d7eef0bae458e83958b41ed2b75e
/frameworks/base/core/java/android/content/ContentProviderNative.java
55eda43af9f71b098c434cab831795d7ca8842ac 28-Jun-2013 Peter Eliasson <peter.eliasson@sonymobile.com> Cursor leakage due to cancellation signal

If a query call was cancelled, the cursor adaptor might leak. The
adaptor is now closed if any exception is thrown during query.

Change-Id: Ic4c2edeaf2fcef56b4ef59484a36d3233aa12dbc
/frameworks/base/core/java/android/content/ContentProviderNative.java
38ed2a471a2291383821fb187bfa18450f0581c2 07-Sep-2013 Dianne Hackborn <hackbod@google.com> Work on issue #10130785: Restore silence and vibrate settings...

...in settings > sound

Add a new ContentProvider API to canonicalize URIs, so they can
be transported across backup/restore.

Change-Id: Ie5af3662f6822a32310e49c7f1e1ff084986c56e
/frameworks/base/core/java/android/content/ContentProviderNative.java
bd3b902567b09379e1b62c60b3319ad82102efad 21-Aug-2013 Jeff Sharkey <jsharkey@android.com> Add CancellationSignal support to file operations.

Since ContentProvider file operations can end up doing substantial
network I/O before returning the file, allow clients to cancel their
file requests with CancellationSignal.

Ideally this would only be needed for openFile(), but ContentResolver
heavily relies on openAssetFile() and openTypedAssetFile() for common
cases.

Also improve documentation to mention reliable ParcelFileDescriptors
and encourage developers to move away from "rw" combination modes,
since they restrict provider flexibility. Mention more about places
where pipes or socket pairs could be returned.

Improve DocumentsContract documentation.

Bug: 10329944
Change-Id: I49b2825ea433eb051624c4da3b77612fe3ffc99c
/frameworks/base/core/java/android/content/ContentProviderNative.java
35654b61e8fe7bc85afcb076ddbb590d51c5865f 15-Jan-2013 Dianne Hackborn <hackbod@google.com> More work on App Ops service.

Implemented reading and writing state to retain information
across boots, API to retrieve state from it, improved location
manager interaction to monitor both coarse and fine access
and only note operations when location data is being delivered
back to app (not when it is just registering to get the data at
some time in the future).

Also implement tracking of read/write ops on contacts and the
call log. This involved tweaking the content provider protocol
to pass over the name of the calling package, and some
infrastructure in the ContentProvider transport to note incoming
calls with the app ops service. The contacts provider and call
log provider turn this on for themselves.

This also implements some of the mechanics of being able to ignore
incoming provider calls... all that is left are some new APIs for
the real content provider implementation to be involved with
providing the correct behavior for query() (return an empty
cursor with the right columns) and insert() (need to figure out
what URI to return).

Change-Id: I36ebbcd63dee58264a480f3d3786891ca7cbdb4c
/frameworks/base/core/java/android/content/ContentProviderNative.java
c21b5a019c1da00b6d861cd2859e3c349a44b3a7 08-Jan-2013 Jeff Brown <jeffbrown@google.com> Fix cursor window leak when query execution fails.

Ensure that the Cursor object is closed if a query on a
content provider fails due to an error or is canceled during
execution. There are several places in the code where
similar problems can occur.

To further reduce the likelihood of leaks, close the cursor
window immediately when a query fails.

Bug: 7278577
Change-Id: I8c686c259de80a162b9086628a817d57f09fdd13
/frameworks/base/core/java/android/content/ContentProviderNative.java
a7771df3696954f0e279407e8894a916a7cb26cc 08-May-2012 Jeff Brown <jeffbrown@google.com> Move CancellationSignal to android.os package.

Bug: 6427830
Change-Id: I39451bb1e1d4a8d976ed1c671234f0c8c61658dd
/frameworks/base/core/java/android/content/ContentProviderNative.java
fb5a4964b8d402b39754f406dd2255035ff2148d 15-Mar-2012 Jeff Brown <jeffbrown@google.com> Prefetch column names in bulk cursor adaptor.

If the remote end of a bulk cursor died, then it was possible
for getColumnNames() to return null, violating the invariant
that it never returns null. As a result, the application could
crash in strange ways due to an NPE.

Since we are often interested in the column names anyhow, prefetch
them when setting up the bulk cursor adaptor. This way, a
remote cursor will never return null even if the remote end died.

It is possible for an application to continue to use a remote cursor
even after the provider has died unless it needs to requery it
for some reason. Of course at that point, bad things will
happen... but usually the app is better prepared for it than
if it just randomly encounters a null array of column names.

This change also optimizes the bulk cursor adaptor to return the
initial cursor window back to the client, potentially saving
an extra RPC. Because the communication protocol between
the CursorToBulkCursorAdaptor and BulkCursorToCursorAdaptor was
getting a little hard to follow, introduced a new type called
BulkCursorDescriptor to hold all of the necessary parameters.

Deleted several unnecessary IBulkCursor methods that are never
actually called remotely.

Bug: 6168809
Change-Id: I9aaf6f067c6434a575e2fdbf678243d5ad10755f
/frameworks/base/core/java/android/content/ContentProviderNative.java
4c1241df8f8b7fd5ec3dff6c7e0f66271248e76e 03-Feb-2012 Jeff Brown <jeffbrown@google.com> Rename CancellationSignal using preferred spelling.

Bug: 5943637
Change-Id: I12a339f285f4db58e79acb5fd8ec2fc1acda5265
/frameworks/base/core/java/android/content/ContentProviderNative.java
75ea64fc54f328d37b115cfb1ded1e45c30380ed 26-Jan-2012 Jeff Brown <jeffbrown@google.com> Implement a cancelation mechanism for queries.

Added new API to enable cancelation of SQLite and content provider
queries by means of a CancelationSignal object. The application
creates a CancelationSignal object and passes it as an argument
to the query. The cancelation signal can then be used to cancel
the query while it is executing.

If the cancelation signal is raised before the query is executed,
then it is immediately terminated.

Change-Id: If2c76e9a7e56ea5e98768b6d4f225f0a1ca61c61
/frameworks/base/core/java/android/content/ContentProviderNative.java
0cde89f5f025b7826be009ebb9673b970e180e32 10-Oct-2011 Jeff Brown <jeffbrown@google.com> Use ashmem for CursorWindows.
Bug: 5332296

The memory dealer introduces additional delays for reclaiming
the memory owned by CursorWindows because the Binder object must
be finalized. Using ashmem instead gives CursorWindow more
direct control over the lifetime of the shared memory region.

The provider now allocates the CursorWindows and returns them
to clients with a read-only protection bit set on the ashmem
region.

Improved the encapsulation of CursorWindow. Callers shouldn't
need to care about details like how string fields are allocated.

Removed the compile-time configuration of string and numeric
storage modes to remove some dead weight.

Change-Id: I07c2bc2a9c573d7e435dcaecd269d25ea9807acd
/frameworks/base/core/java/android/content/ContentProviderNative.java
d2183654e03d589b120467f4e98da1b178ceeadb 09-Oct-2011 Jeff Brown <jeffbrown@google.com> Fix ownership of CursorWindows across processes.
Bug: 5332296

Ensure that there is always an owner for each CursorWindow
and that references to each window are acquired/released
appropriately at all times.

Added synchronization to CursorToBulkCursorAdaptor to
prevent the underlying Cursor and CursorWindow from being
remotely accessed in ways that might violate invariants,
resulting in leaks or other problems.

Ensured that CursorToBulkCursorAdaptor promptly releases
its references to the Cursor and CursorWindow when closed
so they don't stick around longer than they should, even
if the remote end hangs onto the IBulkCursor for some reason.

CursorWindow respects Parcelable.FLAG_WRITE_RETURN_VALUE
as an indication that one reference to the CursorWindow is
being released. Correspondingly, CursorToBulkCursorAdaptor
acquires a reference to the CursorWindow before returning
it to the caller. This change also prevents races from
resulting in the transfer of an invalid CursorWindow over
the wire.

Ensured that BulkCursorToCursorAdaptor promptly releases
its reference to the IBulkCursor when closed and throws
on attempts to access the cursor while closed.

Modified ContentProviderNative to handle both parts of
the wrapping and unwrapping of Cursors into IBulkCursors.
This makes it a lot easier to ensure that the right
things happen on both ends. Also, it turns out that
the only caller of IContentProvider.bulkQuery was
ContentProviderNative itself so there was no need
to support bulkQuery on ContentProviderProxy and it was
just getting in the way.

Implement CloseGuard on CursorWindow.

Change-Id: Ib3c8305d3cc62322f38a06698d404a2989bb6ef9
/frameworks/base/core/java/android/content/ContentProviderNative.java
df6611d8c0cd69c3dcb93462eb138e0bbf137b88 09-Oct-2011 Jeff Brown <jeffbrown@google.com> Clean up handrolled Binder proxies.
Bug: 5332296

We can't replace these with AIDL generated proxies just yet, but
at least we can make them a little more conformant.

Change-Id: I1814f76d0f9c5e44a7fd85a12b2e3c2b7e3c9daa
/frameworks/base/core/java/android/content/ContentProviderNative.java
eca53640a863b40ea9f96f280a90ce8aa538f9d1 02-Dec-2010 Fabrice Di Meglio <fdimeglio@google.com> Add better SQL exception handling to the Sync framework (see bug #3202693)

- do the reply.writeNoException() only if there are NO exceptions
- before, the code could actually generate an exception when asking for the count or the index,
and then the exception could not be unmaarshalled because we previously calling reply.writeNoException()

Change-Id: I241120878c3fc10fea5fbaeb74f9124b1413a3d4
/frameworks/base/core/java/android/content/ContentProviderNative.java
23fdaf6fb62a9b5154b2508916a21c678462c5d0 06-Aug-2010 Dianne Hackborn <hackbod@google.com> Add new ContentProvider for doing conversions to data streams.

This introduces basic infrastructure that should allow content
providers holding complex data to perform on-demand conversion
of their data to streams of various types. It is achieved through
two new content provider APIs, one to interrogate the possible
stream MIME types the provider can return, and the other to
request a stream of data in a particular MIME type.

Because implementations of this will often need to do on-demand
data conversion, there is also a utility intoduced in ContentProvider
for subclasses to easily run a function to write data into a
pipe that is read by the client.

This feature is mostly intended for cut and paste and drag and
drop, as the complex data interchange allowing the source and
destination to negotiate data types and copy (possible large)
data between them. However because it is fundamental facility
of ContentProvider, it can be used in other places, such as for
more advanced GET_CONTENT data exchanges.

An example implementation of this would be in ContactsProvider,
which can now provider a data stream when a client opens certain
pieces of it data, to return data as flat text, a vcard, or other
format.

Change-Id: I58627ea4ed359aa7cf2c66274adb18306c209cb2
/frameworks/base/core/java/android/content/ContentProviderNative.java
9ffdfa0c238fce3b85741d7f6828fd484cd8f195 09-Mar-2010 Brad Fitzpatrick <bradfitz@android.com> Speed up ContentProvider.query() in simple case by ~30%

When query() uses bulkQuery() and we know we're going to need some
metadata right afterwards (number of rows and column index of _id, if
present), just asked for it in the initial binder transaction instead
of immediately fetching it again.

Also, this defers loading column names until the client asks for them.

This gets down the simpler (and very common) use cases of
ContentProvider.query() down to 3 binder calls:

QUERY_TRANSACTION to android.content.ContentProvider$Transport
GET_CURSOR_WINDOW_TRANSACTION to android.database.CursorToBulkCursorAdaptor
CLOSE_TRANSACTION to android.database.CursorToBulkCursorAdaptor

More can still be done, but this is a good bite-sized first piece.

Change-Id: I7ad45949f53e0097ff18c2478d659f0f36929693
/frameworks/base/core/java/android/content/ContentProviderNative.java
dfb437e17c6ba3b29f9e636d064125668d706249 09-Mar-2010 Brad Fitzpatrick <bradfitz@android.com> Fix Parcel leak in ContentProvider.call()

This manifested itself as memory allocation and Binder failures during
my load testing / benchmarking.

BUG=2498615

Change-Id: I260fd916f97777fc98bee98d10474f12deb21dee
/frameworks/base/core/java/android/content/ContentProviderNative.java
1877d0158b529663b8315482e7346a7bcaa96166 05-Mar-2010 Brad Fitzpatrick <bradfitz@android.com> Add "call" method on ContentProvider.

This permits implementing interfaces which are faster than using
remote Cursors. It then uses it for Settings & SettingProvider, which
together account for ~50% of total ContentProvider event loop stalls
across Froyo dogfooders.

For fetching Settings this looks like it should reduce average
Settings lookup from 10 ms to 0.4 ms on Sholes, once the
SettingsProvider serves most gets from in-memory cache. Currently it
brings the Sholes average down from 10ms to 2.5 ms while still using
SQLite queries on each get.
/frameworks/base/core/java/android/content/ContentProviderNative.java
2ec6c5699181316e5a5c2cd293c006ac4a8bb101 10-Dec-2009 Fred Quintana <fredq@google.com> am 328c0e79: - removed the concept of Entity from the ContentProvider APIs - removed the parcelling ability from Entity and EntityIterator and made them public - added an EntityIterator abstract implementation that allow easy wrapping of a Cursor - changed the VCard c

Merge commit '328c0e7986aa6bb7752ec6de3da9c999920bb55f' into eclair-mr2-plus-aosp

* commit '328c0e7986aa6bb7752ec6de3da9c999920bb55f':
- removed the concept of Entity from the ContentProvider APIs
/frameworks/base/core/java/android/content/ContentProviderNative.java
5bba632d877c2878384ff21566c8eb6a1a22f37b 05-Oct-2009 Fred Quintana <fredq@google.com> - hide Entity and all its references
- remove updateEntity and insertEntity, since they are not
used
- add the RawContacts.Entity class, which is used in lieu of the
android.content.Entity
/frameworks/base/core/java/android/content/ContentProviderNative.java
77709755b74bcc852cd511ff833c2827c0f0e1aa 21-Aug-2009 Fred Quintana <fredq@google.com> - add a reset to EntityIterator to allow it to go back to the beginning
- clean up the debug printing of SyncResult
/frameworks/base/core/java/android/content/ContentProviderNative.java
03d9490758c9318cee6d14d3cc5007556dce92d0 22-May-2009 Fred Quintana <fredq@google.com> - create a new generic ISyncAdapter implementation, SyncAdapterNew
- 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
/frameworks/base/core/java/android/content/ContentProviderNative.java
8943737692169f564cd34a9c8d471f3a5d438712 16-May-2009 Fred Quintana <fredq@google.com> add ipc support to batching
/frameworks/base/core/java/android/content/ContentProviderNative.java
6a8d5332f00bdfade6674b312e7166940aa28348 08-May-2009 Fred Quintana <fredq@google.com> content provider entities
/frameworks/base/core/java/android/content/ContentProviderNative.java
718d8a2d7ff3e864a73879eb646f46c14ab74d07 30-Apr-2009 Fred Quintana <fredq@google.com> decouple SyncAdapter from ContentProvider
/frameworks/base/core/java/android/content/ContentProviderNative.java
9066cfe9886ac131c34d59ed0e2d287b0e3c0087 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
/frameworks/base/core/java/android/content/ContentProviderNative.java
d83a98f4ce9cfa908f5c54bbd70f03eec07e7553 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
/frameworks/base/core/java/android/content/ContentProviderNative.java
076357b8567458d4b6dfdcf839ef751634cd2bfb 03-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@132589
/frameworks/base/core/java/android/content/ContentProviderNative.java
3dec7d563a2f3e1eb967ce2054a00b6620e3558c 03-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@137055
/frameworks/base/core/java/android/content/ContentProviderNative.java
54b6cfa9a9e5b861a9930af873580d6dc20f773c 21-Oct-2008 The Android Open Source Project <initial-contribution@android.com> Initial Contribution
/frameworks/base/core/java/android/content/ContentProviderNative.java