Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0a4730f8 authored by Android (Google) Code Review's avatar Android (Google) Code Review
Browse files

Merge change 8443 into donut

* changes:
  add some more defensiveness to SuggestionsAdapter to avoid system process crashes.
parents 589cebe2 92f461ea
Loading
Loading
Loading
Loading
+14 −8
Original line number Diff line number Diff line
@@ -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,6 +198,7 @@ class SuggestionsAdapter extends ResourceCursorAdapter {
            callCursorPreClose(mCursor);
        }

        try {
            super.changeCursor(c);
            if (c != null) {
                mFormatCol = c.getColumnIndex(SearchManager.SUGGEST_COLUMN_FORMAT);
@@ -205,6 +208,9 @@ class SuggestionsAdapter extends ResourceCursorAdapter {
                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);
        }
    }

    /**