diff options
author | Jeff Sharkey <jsharkey@android.com> | 2013-10-29 11:58:21 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2013-10-29 11:58:21 -0700 |
commit | 66d079bf25ff3f99dbba91e02d392c936238170b (patch) | |
tree | edfb2a8f107de1b2abc74f7f58b9937458d3f78d /packages/DocumentsUI | |
parent | b752c1b559a277675f90489eff4f7e7f9d03cc2f (diff) | |
parent | f7eb3398f16f4d76d2a342cf571040360d5a6df6 (diff) | |
download | frameworks_base-66d079bf25ff3f99dbba91e02d392c936238170b.zip frameworks_base-66d079bf25ff3f99dbba91e02d392c936238170b.tar.gz frameworks_base-66d079bf25ff3f99dbba91e02d392c936238170b.tar.bz2 |
am f7eb3398: am 19949b9d: Merge "Guard against missing document columns." into klp-dev
* commit 'f7eb3398f16f4d76d2a342cf571040360d5a6df6':
Guard against missing document columns.
Diffstat (limited to 'packages/DocumentsUI')
-rw-r--r-- | packages/DocumentsUI/src/com/android/documentsui/FilteringCursorWrapper.java | 8 | ||||
-rw-r--r-- | packages/DocumentsUI/src/com/android/documentsui/SortingCursorWrapper.java | 14 |
2 files changed, 11 insertions, 11 deletions
diff --git a/packages/DocumentsUI/src/com/android/documentsui/FilteringCursorWrapper.java b/packages/DocumentsUI/src/com/android/documentsui/FilteringCursorWrapper.java index 52d816f..55d73f2 100644 --- a/packages/DocumentsUI/src/com/android/documentsui/FilteringCursorWrapper.java +++ b/packages/DocumentsUI/src/com/android/documentsui/FilteringCursorWrapper.java @@ -17,6 +17,8 @@ package com.android.documentsui; import static com.android.documentsui.DocumentsActivity.TAG; +import static com.android.documentsui.model.DocumentInfo.getCursorLong; +import static com.android.documentsui.model.DocumentInfo.getCursorString; import android.database.AbstractCursor; import android.database.Cursor; @@ -50,10 +52,8 @@ public class FilteringCursorWrapper extends AbstractCursor { cursor.moveToPosition(-1); while (cursor.moveToNext()) { - final String mimeType = cursor.getString( - cursor.getColumnIndex(Document.COLUMN_MIME_TYPE)); - final long lastModified = cursor.getLong( - cursor.getColumnIndex(Document.COLUMN_LAST_MODIFIED)); + 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)) { continue; } diff --git a/packages/DocumentsUI/src/com/android/documentsui/SortingCursorWrapper.java b/packages/DocumentsUI/src/com/android/documentsui/SortingCursorWrapper.java index 19ad2e2..a23dd15 100644 --- a/packages/DocumentsUI/src/com/android/documentsui/SortingCursorWrapper.java +++ b/packages/DocumentsUI/src/com/android/documentsui/SortingCursorWrapper.java @@ -19,6 +19,8 @@ package com.android.documentsui; import static com.android.documentsui.DocumentsActivity.State.SORT_ORDER_DISPLAY_NAME; import static com.android.documentsui.DocumentsActivity.State.SORT_ORDER_LAST_MODIFIED; import static com.android.documentsui.DocumentsActivity.State.SORT_ORDER_SIZE; +import static com.android.documentsui.model.DocumentInfo.getCursorLong; +import static com.android.documentsui.model.DocumentInfo.getCursorString; import android.database.AbstractCursor; import android.database.Cursor; @@ -62,10 +64,9 @@ public class SortingCursorWrapper extends AbstractCursor { switch (sortOrder) { case SORT_ORDER_DISPLAY_NAME: - final String mimeType = cursor.getString( - cursor.getColumnIndex(Document.COLUMN_MIME_TYPE)); - final String displayName = cursor.getString( - cursor.getColumnIndex(Document.COLUMN_DISPLAY_NAME)); + final String mimeType = getCursorString(cursor, Document.COLUMN_MIME_TYPE); + final String displayName = getCursorString( + cursor, Document.COLUMN_DISPLAY_NAME); if (Document.MIME_TYPE_DIR.equals(mimeType)) { mValueString[i] = '\001' + displayName; } else { @@ -73,11 +74,10 @@ public class SortingCursorWrapper extends AbstractCursor { } break; case SORT_ORDER_LAST_MODIFIED: - mValueLong[i] = cursor.getLong( - cursor.getColumnIndex(Document.COLUMN_LAST_MODIFIED)); + mValueLong[i] = getCursorLong(cursor, Document.COLUMN_LAST_MODIFIED); break; case SORT_ORDER_SIZE: - mValueLong[i] = cursor.getLong(cursor.getColumnIndex(Document.COLUMN_SIZE)); + mValueLong[i] = getCursorLong(cursor, Document.COLUMN_SIZE); break; } } |