History log of /frameworks/base/core/java/android/database/BulkCursorToCursorAdaptor.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
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/database/BulkCursorToCursorAdaptor.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/database/BulkCursorToCursorAdaptor.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/database/BulkCursorToCursorAdaptor.java
7ce745248d4de0e6543a559c93423df899832100 07-Oct-2011 Jeff Brown <jeffbrown@google.com> Clean up CursorWindow lifetime.
Bug: 5332296

Removed dead code in SQLiteCursor related to the use of a background
query thread. This code could result in CursorWindows being modified
concurrently or used after free. This code is broken, unused and
is just in the way.

Added comments to explain how CursorWindow ownership is
supposed to work for AbstractWindowedCursors. (There are still cases
where cursor windows get dropped on the floor without being closed.
Those will be taken care of in a subsequent patch.)

Cleaned up SQLiteQuery.fillWindow to eliminate duplicate code and
remove bits that were only needed for background loading, like
returning -1.

Change-Id: I03e8e2e73ff0c11df76d63f57df4c5ada06ae1cb
/frameworks/base/core/java/android/database/BulkCursorToCursorAdaptor.java
0e453d1115d03b80c2779dfc600cf3a829b96435 06-Jan-2011 Vasu Nori <vnori@google.com> requery() should close cursorwindow insead of setting it to null.

just in case GC takes a while to kick in.

Change-Id: I3a00b52afe1303be0c7d6bb561e5c07734e4dcb3
/frameworks/base/core/java/android/database/BulkCursorToCursorAdaptor.java
7cd51efcbd2d083bf577696591ef1769034f7e2f 13-May-2010 Jeff Hamilton <jham@android.com> Remove the deprecated cursor methods.

Change-Id: Ie3571fea9f36996c31c327240b11086f8cc487f0
/frameworks/base/core/java/android/database/BulkCursorToCursorAdaptor.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/database/BulkCursorToCursorAdaptor.java
6dc0ef005d31f1aaf277164e8bc79be9068e8bf2 22-Jun-2009 Karl Rosaen <krosaen@google.com> BulkCursorToCursorAdaptor.respond no longer assumes RemoteException is impossible, fails more gracefully.

This fixes bug 1923131 which was crashing the system process in some cases when the search dialog
was calling respond on its cursor to GlobalSearch.
/frameworks/base/core/java/android/database/BulkCursorToCursorAdaptor.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/database/BulkCursorToCursorAdaptor.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/database/BulkCursorToCursorAdaptor.java
54b6cfa9a9e5b861a9930af873580d6dc20f773c 21-Oct-2008 The Android Open Source Project <initial-contribution@android.com> Initial Contribution
/frameworks/base/core/java/android/database/BulkCursorToCursorAdaptor.java