Merge change 8443 into donut
* changes: add some more defensiveness to SuggestionsAdapter to avoid system process crashes.
This commit is contained in:
@@ -136,6 +136,8 @@ class SuggestionsAdapter extends ResourceCursorAdapter {
|
|||||||
private int mPreviousLength = 0;
|
private int mPreviousLength = 0;
|
||||||
|
|
||||||
public long getPostingDelay(CharSequence constraint) {
|
public long getPostingDelay(CharSequence constraint) {
|
||||||
|
if (constraint == null) return 0;
|
||||||
|
|
||||||
long delay = constraint.length() < mPreviousLength ? DELETE_KEY_POST_DELAY : 0;
|
long delay = constraint.length() < mPreviousLength ? DELETE_KEY_POST_DELAY : 0;
|
||||||
mPreviousLength = constraint.length();
|
mPreviousLength = constraint.length();
|
||||||
return delay;
|
return delay;
|
||||||
@@ -196,14 +198,18 @@ class SuggestionsAdapter extends ResourceCursorAdapter {
|
|||||||
callCursorPreClose(mCursor);
|
callCursorPreClose(mCursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
super.changeCursor(c);
|
try {
|
||||||
if (c != null) {
|
super.changeCursor(c);
|
||||||
mFormatCol = c.getColumnIndex(SearchManager.SUGGEST_COLUMN_FORMAT);
|
if (c != null) {
|
||||||
mText1Col = c.getColumnIndex(SearchManager.SUGGEST_COLUMN_TEXT_1);
|
mFormatCol = c.getColumnIndex(SearchManager.SUGGEST_COLUMN_FORMAT);
|
||||||
mText2Col = c.getColumnIndex(SearchManager.SUGGEST_COLUMN_TEXT_2);
|
mText1Col = c.getColumnIndex(SearchManager.SUGGEST_COLUMN_TEXT_1);
|
||||||
mIconName1Col = c.getColumnIndex(SearchManager.SUGGEST_COLUMN_ICON_1);
|
mText2Col = c.getColumnIndex(SearchManager.SUGGEST_COLUMN_TEXT_2);
|
||||||
mIconName2Col = c.getColumnIndex(SearchManager.SUGGEST_COLUMN_ICON_2);
|
mIconName1Col = c.getColumnIndex(SearchManager.SUGGEST_COLUMN_ICON_1);
|
||||||
mBackgroundColorCol = c.getColumnIndex(SearchManager.SUGGEST_COLUMN_BACKGROUND_COLOR);
|
mIconName2Col = c.getColumnIndex(SearchManager.SUGGEST_COLUMN_ICON_2);
|
||||||
|
mBackgroundColorCol = c.getColumnIndex(SearchManager.SUGGEST_COLUMN_BACKGROUND_COLOR);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.e(LOG_TAG, "error changing cursor and caching columns", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user