summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorAndroid (Google) Code Review <android-gerrit@google.com>2009-07-24 12:52:09 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2009-07-24 12:52:09 -0700
commitff899e40900bdec86d3835ebe5eecd430cd3ffe3 (patch)
tree4cd5b0810fd141dbd1e16c245d23ccfddfadeefd /core
parentb8af454a7f365f7c3e173c53aa11c5252e711bda (diff)
parent0a4730f8889bd98e272bd5e7e0fedb6a69d33f54 (diff)
downloadframeworks_base-ff899e40900bdec86d3835ebe5eecd430cd3ffe3.zip
frameworks_base-ff899e40900bdec86d3835ebe5eecd430cd3ffe3.tar.gz
frameworks_base-ff899e40900bdec86d3835ebe5eecd430cd3ffe3.tar.bz2
am 0a4730f8: Merge change 8443 into donut
Merge commit '0a4730f8889bd98e272bd5e7e0fedb6a69d33f54' * commit '0a4730f8889bd98e272bd5e7e0fedb6a69d33f54': add some more defensiveness to SuggestionsAdapter to avoid system process crashes.
Diffstat (limited to 'core')
-rw-r--r--core/java/android/app/SuggestionsAdapter.java22
1 files changed, 14 insertions, 8 deletions
diff --git a/core/java/android/app/SuggestionsAdapter.java b/core/java/android/app/SuggestionsAdapter.java
index 54061ae..17e6e50 100644
--- a/core/java/android/app/SuggestionsAdapter.java
+++ b/core/java/android/app/SuggestionsAdapter.java
@@ -136,6 +136,8 @@ class SuggestionsAdapter extends ResourceCursorAdapter {
private int mPreviousLength = 0;
public long getPostingDelay(CharSequence constraint) {
+ if (constraint == null) return 0;
+
long delay = constraint.length() < mPreviousLength ? DELETE_KEY_POST_DELAY : 0;
mPreviousLength = constraint.length();
return delay;
@@ -196,14 +198,18 @@ class SuggestionsAdapter extends ResourceCursorAdapter {
callCursorPreClose(mCursor);
}
- super.changeCursor(c);
- if (c != null) {
- mFormatCol = c.getColumnIndex(SearchManager.SUGGEST_COLUMN_FORMAT);
- mText1Col = c.getColumnIndex(SearchManager.SUGGEST_COLUMN_TEXT_1);
- mText2Col = c.getColumnIndex(SearchManager.SUGGEST_COLUMN_TEXT_2);
- mIconName1Col = c.getColumnIndex(SearchManager.SUGGEST_COLUMN_ICON_1);
- mIconName2Col = c.getColumnIndex(SearchManager.SUGGEST_COLUMN_ICON_2);
- mBackgroundColorCol = c.getColumnIndex(SearchManager.SUGGEST_COLUMN_BACKGROUND_COLOR);
+ try {
+ super.changeCursor(c);
+ if (c != null) {
+ mFormatCol = c.getColumnIndex(SearchManager.SUGGEST_COLUMN_FORMAT);
+ mText1Col = c.getColumnIndex(SearchManager.SUGGEST_COLUMN_TEXT_1);
+ mText2Col = c.getColumnIndex(SearchManager.SUGGEST_COLUMN_TEXT_2);
+ mIconName1Col = c.getColumnIndex(SearchManager.SUGGEST_COLUMN_ICON_1);
+ 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);
}
}