HTTPS clone URL
Subversion checkout URL
Please sign in to comment.
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
- Loading branch information...
Showing with 376 additions and 310 deletions.
- +3 −20 core/java/android/content/ContentProvider.java
- +77 −101 core/java/android/content/ContentProviderNative.java
- +0 −10 core/java/android/content/IContentProvider.java
- +4 −6 core/java/android/database/AbstractCursor.java
- +26 −0 core/java/android/database/AbstractWindowedCursor.java
- +4 −4 core/java/android/database/BulkCursorNative.java
- +59 −53 core/java/android/database/BulkCursorToCursorAdaptor.java
- +1 −1 core/java/android/database/CrossProcessCursor.java
- +159 −54 core/java/android/database/CursorToBulkCursorAdaptor.java
- +16 −0 core/java/android/database/CursorWindow.java
- +1 −16 core/java/android/database/sqlite/SQLiteCursor.java
- +13 −26 test-runner/src/android/test/mock/MockContentProvider.java
- +0 −9 test-runner/src/android/test/mock/MockIContentProvider.java
- +13 −10 tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContentProvider.java