diff options
author | Jeff Sharkey <jsharkey@android.com> | 2013-11-18 17:41:33 -0800 |
---|---|---|
committer | Jeff Sharkey <jsharkey@android.com> | 2013-11-18 17:41:56 -0800 |
commit | e2515ac296d51e188b15790afd1e56b31d965ac8 (patch) | |
tree | 5f7e4de476051060f517de37fe731b3fe3961470 /packages/DocumentsUI | |
parent | 55d12486df5e801dc8e74d96abdf87a250bc0ba1 (diff) | |
download | frameworks_base-e2515ac296d51e188b15790afd1e56b31d965ac8.zip frameworks_base-e2515ac296d51e188b15790afd1e56b31d965ac8.tar.gz frameworks_base-e2515ac296d51e188b15790afd1e56b31d965ac8.tar.bz2 |
Mask OOBE when filtering recent documents.
There is a data ownership issue related to recent documents Cursors,
and the loader and UI threads can end up traversing the same Cursor
at runtime. This change masks OOBE crashes caused by this race until
we have time to fix cleanly.
Bug: 11736668
Change-Id: I2039a5edcf341fcaedacc2f08bde96fc5a271782
Diffstat (limited to 'packages/DocumentsUI')
-rw-r--r-- | packages/DocumentsUI/src/com/android/documentsui/FilteringCursorWrapper.java | 2 | ||||
-rw-r--r-- | packages/DocumentsUI/src/com/android/documentsui/RecentLoader.java | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/packages/DocumentsUI/src/com/android/documentsui/FilteringCursorWrapper.java b/packages/DocumentsUI/src/com/android/documentsui/FilteringCursorWrapper.java index 55d73f2..1cbc221 100644 --- a/packages/DocumentsUI/src/com/android/documentsui/FilteringCursorWrapper.java +++ b/packages/DocumentsUI/src/com/android/documentsui/FilteringCursorWrapper.java @@ -51,7 +51,7 @@ public class FilteringCursorWrapper extends AbstractCursor { mPosition = new int[count]; cursor.moveToPosition(-1); - while (cursor.moveToNext()) { + while (cursor.moveToNext() && mCount < count) { final String mimeType = getCursorString(cursor, Document.COLUMN_MIME_TYPE); final long lastModified = getCursorLong(cursor, Document.COLUMN_LAST_MODIFIED); if (rejectMimes != null && MimePredicate.mimeMatches(rejectMimes, mimeType)) { diff --git a/packages/DocumentsUI/src/com/android/documentsui/RecentLoader.java b/packages/DocumentsUI/src/com/android/documentsui/RecentLoader.java index 3a8a3fb..34ce42d 100644 --- a/packages/DocumentsUI/src/com/android/documentsui/RecentLoader.java +++ b/packages/DocumentsUI/src/com/android/documentsui/RecentLoader.java @@ -55,6 +55,10 @@ import java.util.concurrent.TimeUnit; public class RecentLoader extends AsyncTaskLoader<DirectoryResult> { private static final boolean LOGD = true; + // TODO: clean up cursor ownership so background thread doesn't traverse + // previously returned cursors for filtering/sorting; this currently races + // with the UI thread. + private static final int MAX_OUTSTANDING_RECENTS = 4; private static final int MAX_OUTSTANDING_RECENTS_SVELTE = 2; |