2 * Copyright (C) 2009 The Android Open Source Project
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package android
.widget
;
19 import android
.app
.SearchDialog
;
20 import android
.app
.SearchManager
;
21 import android
.app
.SearchableInfo
;
22 import android
.content
.ComponentName
;
23 import android
.content
.ContentResolver
;
24 import android
.content
.Context
;
25 import android
.content
.ContentResolver
.OpenResourceIdResult
;
26 import android
.content
.pm
.ActivityInfo
;
27 import android
.content
.pm
.PackageManager
;
28 import android
.content
.pm
.PackageManager
.NameNotFoundException
;
29 import android
.content
.res
.ColorStateList
;
30 import android
.content
.res
.Resources
;
31 import android
.database
.Cursor
;
32 import android
.graphics
.drawable
.Drawable
;
33 import android
.net
.Uri
;
34 import android
.os
.Bundle
;
35 import android
.text
.Spannable
;
36 import android
.text
.SpannableString
;
37 import android
.text
.TextUtils
;
38 import android
.text
.style
.TextAppearanceSpan
;
39 import android
.util
.Log
;
40 import android
.util
.TypedValue
;
41 import android
.view
.View
;
42 import android
.view
.ViewGroup
;
43 import android
.view
.View
.OnClickListener
;
45 import com
.android
.internal
.R
;
47 import java
.io
.FileNotFoundException
;
48 import java
.io
.IOException
;
49 import java
.io
.InputStream
;
50 import java
.util
.WeakHashMap
;
53 * Provides the contents for the suggestion drop-down list.in {@link SearchDialog}.
57 class SuggestionsAdapter
extends ResourceCursorAdapter
implements OnClickListener
{
59 private static final boolean DBG
= false;
60 private static final String LOG_TAG
= "SuggestionsAdapter";
61 private static final int QUERY_LIMIT
= 50;
63 static final int REFINE_NONE
= 0;
64 static final int REFINE_BY_ENTRY
= 1;
65 static final int REFINE_ALL
= 2;
67 private final SearchManager mSearchManager
;
68 private final SearchView mSearchView
;
69 private final SearchableInfo mSearchable
;
70 private final Context mProviderContext
;
71 private final WeakHashMap
<String
, Drawable
.ConstantState
> mOutsideDrawablesCache
;
72 private final int mCommitIconResId
;
74 private boolean mClosed
= false;
75 private int mQueryRefinement
= REFINE_BY_ENTRY
;
78 private ColorStateList mUrlColor
;
80 static final int INVALID_INDEX
= -1;
82 // Cached column indexes, updated when the cursor changes.
83 private int mText1Col
= INVALID_INDEX
;
84 private int mText2Col
= INVALID_INDEX
;
85 private int mText2UrlCol
= INVALID_INDEX
;
86 private int mIconName1Col
= INVALID_INDEX
;
87 private int mIconName2Col
= INVALID_INDEX
;
88 private int mFlagsCol
= INVALID_INDEX
;
90 // private final Runnable mStartSpinnerRunnable;
91 // private final Runnable mStopSpinnerRunnable;
94 * The amount of time we delay in the filter when the user presses the delete key.
95 * @see Filter#setDelayer(android.widget.Filter.Delayer).
97 private static final long DELETE_KEY_POST_DELAY
= 500L;
99 public SuggestionsAdapter(Context context
, SearchView searchView
, SearchableInfo searchable
,
100 WeakHashMap
<String
, Drawable
.ConstantState
> outsideDrawablesCache
) {
101 super(context
, searchView
.getSuggestionRowLayout(), null /* no initial cursor */,
102 true /* auto-requery */);
104 mSearchManager
= (SearchManager
) mContext
.getSystemService(Context
.SEARCH_SERVICE
);
105 mSearchView
= searchView
;
106 mSearchable
= searchable
;
107 mCommitIconResId
= searchView
.getSuggestionCommitIconResId();
109 // set up provider resources (gives us icons, etc.)
110 final Context activityContext
= mSearchable
.getActivityContext(mContext
);
111 mProviderContext
= mSearchable
.getProviderContext(mContext
, activityContext
);
113 mOutsideDrawablesCache
= outsideDrawablesCache
;
115 // mStartSpinnerRunnable = new Runnable() {
116 // public void run() {
117 // // mSearchView.setWorking(true); // TODO:
121 // mStopSpinnerRunnable = new Runnable() {
122 // public void run() {
123 // // mSearchView.setWorking(false); // TODO:
127 // delay 500ms when deleting
128 getFilter().setDelayer(new Filter
.Delayer() {
130 private int mPreviousLength
= 0;
132 public long getPostingDelay(CharSequence constraint
) {
133 if (constraint
== null) return 0;
135 long delay
= constraint
.length() < mPreviousLength ? DELETE_KEY_POST_DELAY
: 0;
136 mPreviousLength
= constraint
.length();
143 * Enables query refinement for all suggestions. This means that an additional icon
144 * will be shown for each entry. When clicked, the suggested text on that line will be
145 * copied to the query text field.
148 * @param refineWhat which queries to refine. Possible values are
149 * {@link #REFINE_NONE}, {@link #REFINE_BY_ENTRY}, and
150 * {@link #REFINE_ALL}.
152 public void setQueryRefinement(int refineWhat
) {
153 mQueryRefinement
= refineWhat
;
157 * Returns the current query refinement preference.
158 * @return value of query refinement preference
160 public int getQueryRefinement() {
161 return mQueryRefinement
;
165 * Overridden to always return <code>false</code>, since we cannot be sure that
166 * suggestion sources return stable IDs.
169 public boolean hasStableIds() {
174 * Use the search suggestions provider to obtain a live cursor. This will be called
175 * in a worker thread, so it's OK if the query is slow (e.g. round trip for suggestions).
176 * The results will be processed in the UI thread and changeCursor() will be called.
179 public Cursor
runQueryOnBackgroundThread(CharSequence constraint
) {
180 if (DBG
) Log
.d(LOG_TAG
, "runQueryOnBackgroundThread(" + constraint
+ ")");
181 String query
= (constraint
== null) ?
"" : constraint
.toString();
183 * for in app search we show the progress spinner until the cursor is returned with
186 Cursor cursor
= null;
187 if (mSearchView
.getVisibility() != View
.VISIBLE
188 || mSearchView
.getWindowVisibility() != View
.VISIBLE
) {
191 //mSearchView.getWindow().getDecorView().post(mStartSpinnerRunnable); // TODO:
193 cursor
= mSearchManager
.getSuggestions(mSearchable
, query
, QUERY_LIMIT
);
194 // trigger fill window so the spinner stays up until the results are copied over and
195 // closer to being ready
196 if (cursor
!= null) {
200 } catch (RuntimeException e
) {
201 Log
.w(LOG_TAG
, "Search suggestions query threw an exception.", e
);
203 // If cursor is null or an exception was thrown, stop the spinner and return null.
204 // changeCursor doesn't get called if cursor is null
205 // mSearchView.getWindow().getDecorView().post(mStopSpinnerRunnable); // TODO:
209 public void close() {
210 if (DBG
) Log
.d(LOG_TAG
, "close()");
216 public void notifyDataSetChanged() {
217 if (DBG
) Log
.d(LOG_TAG
, "notifyDataSetChanged");
218 super.notifyDataSetChanged();
220 // mSearchView.onDataSetChanged(); // TODO:
222 updateSpinnerState(getCursor());
226 public void notifyDataSetInvalidated() {
227 if (DBG
) Log
.d(LOG_TAG
, "notifyDataSetInvalidated");
228 super.notifyDataSetInvalidated();
230 updateSpinnerState(getCursor());
233 private void updateSpinnerState(Cursor cursor
) {
234 Bundle extras
= cursor
!= null ? cursor
.getExtras() : null;
236 Log
.d(LOG_TAG
, "updateSpinnerState - extra = "
238 ? extras
.getBoolean(SearchManager
.CURSOR_EXTRA_KEY_IN_PROGRESS
)
241 // Check if the Cursor indicates that the query is not complete and show the spinner
243 && extras
.getBoolean(SearchManager
.CURSOR_EXTRA_KEY_IN_PROGRESS
)) {
244 // mSearchView.getWindow().getDecorView().post(mStartSpinnerRunnable); // TODO:
247 // If cursor is null or is done, stop the spinner
248 // mSearchView.getWindow().getDecorView().post(mStopSpinnerRunnable); // TODO:
255 public void changeCursor(Cursor c
) {
256 if (DBG
) Log
.d(LOG_TAG
, "changeCursor(" + c
+ ")");
259 Log
.w(LOG_TAG
, "Tried to change cursor after adapter was closed.");
260 if (c
!= null) c
.close();
265 super.changeCursor(c
);
268 mText1Col
= c
.getColumnIndex(SearchManager
.SUGGEST_COLUMN_TEXT_1
);
269 mText2Col
= c
.getColumnIndex(SearchManager
.SUGGEST_COLUMN_TEXT_2
);
270 mText2UrlCol
= c
.getColumnIndex(SearchManager
.SUGGEST_COLUMN_TEXT_2_URL
);
271 mIconName1Col
= c
.getColumnIndex(SearchManager
.SUGGEST_COLUMN_ICON_1
);
272 mIconName2Col
= c
.getColumnIndex(SearchManager
.SUGGEST_COLUMN_ICON_2
);
273 mFlagsCol
= c
.getColumnIndex(SearchManager
.SUGGEST_COLUMN_FLAGS
);
275 } catch (Exception e
) {
276 Log
.e(LOG_TAG
, "error changing cursor and caching columns", e
);
281 * Tags the view with cached child view look-ups.
284 public View
newView(Context context
, Cursor cursor
, ViewGroup parent
) {
285 final View v
= super.newView(context
, cursor
, parent
);
286 v
.setTag(new ChildViewCache(v
));
289 final ImageView iconRefine
= (ImageView
) v
.findViewById(R
.id
.edit_query
);
290 iconRefine
.setImageResource(mCommitIconResId
);
296 * Cache of the child views of drop-drown list items, to avoid looking up the children
297 * each time the contents of a list item are changed.
299 private final static class ChildViewCache
{
300 public final TextView mText1
;
301 public final TextView mText2
;
302 public final ImageView mIcon1
;
303 public final ImageView mIcon2
;
304 public final ImageView mIconRefine
;
306 public ChildViewCache(View v
) {
307 mText1
= (TextView
) v
.findViewById(com
.android
.internal
.R
.id
.text1
);
308 mText2
= (TextView
) v
.findViewById(com
.android
.internal
.R
.id
.text2
);
309 mIcon1
= (ImageView
) v
.findViewById(com
.android
.internal
.R
.id
.icon1
);
310 mIcon2
= (ImageView
) v
.findViewById(com
.android
.internal
.R
.id
.icon2
);
311 mIconRefine
= (ImageView
) v
.findViewById(com
.android
.internal
.R
.id
.edit_query
);
316 public void bindView(View view
, Context context
, Cursor cursor
) {
317 ChildViewCache views
= (ChildViewCache
) view
.getTag();
320 if (mFlagsCol
!= INVALID_INDEX
) {
321 flags
= cursor
.getInt(mFlagsCol
);
323 if (views
.mText1
!= null) {
324 String text1
= getStringOrNull(cursor
, mText1Col
);
325 setViewText(views
.mText1
, text1
);
327 if (views
.mText2
!= null) {
328 // First check TEXT_2_URL
329 CharSequence text2
= getStringOrNull(cursor
, mText2UrlCol
);
331 text2
= formatUrl(context
, text2
);
333 text2
= getStringOrNull(cursor
, mText2Col
);
336 // If no second line of text is indicated, allow the first line of text
337 // to be up to two lines if it wants to be.
338 if (TextUtils
.isEmpty(text2
)) {
339 if (views
.mText1
!= null) {
340 views
.mText1
.setSingleLine(false);
341 views
.mText1
.setMaxLines(2);
344 if (views
.mText1
!= null) {
345 views
.mText1
.setSingleLine(true);
346 views
.mText1
.setMaxLines(1);
349 setViewText(views
.mText2
, text2
);
352 if (views
.mIcon1
!= null) {
353 setViewDrawable(views
.mIcon1
, getIcon1(cursor
), View
.INVISIBLE
);
355 if (views
.mIcon2
!= null) {
356 setViewDrawable(views
.mIcon2
, getIcon2(cursor
), View
.GONE
);
358 if (mQueryRefinement
== REFINE_ALL
359 || (mQueryRefinement
== REFINE_BY_ENTRY
360 && (flags
& SearchManager
.FLAG_QUERY_REFINEMENT
) != 0)) {
361 views
.mIconRefine
.setVisibility(View
.VISIBLE
);
362 views
.mIconRefine
.setTag(views
.mText1
.getText());
363 views
.mIconRefine
.setOnClickListener(this);
365 views
.mIconRefine
.setVisibility(View
.GONE
);
369 public void onClick(View v
) {
370 Object tag
= v
.getTag();
371 if (tag
instanceof CharSequence
) {
372 mSearchView
.onQueryRefine((CharSequence
) tag
);
376 private CharSequence
formatUrl(Context context
, CharSequence url
) {
377 if (mUrlColor
== null) {
378 // Lazily get the URL color from the current theme.
379 TypedValue colorValue
= new TypedValue();
380 context
.getTheme().resolveAttribute(R
.attr
.textColorSearchUrl
, colorValue
, true);
381 mUrlColor
= context
.getColorStateList(colorValue
.resourceId
);
384 SpannableString text
= new SpannableString(url
);
385 text
.setSpan(new TextAppearanceSpan(null, 0, 0, mUrlColor
, null),
387 Spannable
.SPAN_EXCLUSIVE_EXCLUSIVE
);
391 private void setViewText(TextView v
, CharSequence text
) {
392 // Set the text even if it's null, since we need to clear any previous text.
395 if (TextUtils
.isEmpty(text
)) {
396 v
.setVisibility(View
.GONE
);
398 v
.setVisibility(View
.VISIBLE
);
402 private Drawable
getIcon1(Cursor cursor
) {
403 if (mIconName1Col
== INVALID_INDEX
) {
406 String value
= cursor
.getString(mIconName1Col
);
407 Drawable drawable
= getDrawableFromResourceValue(value
);
408 if (drawable
!= null) {
411 return getDefaultIcon1(cursor
);
414 private Drawable
getIcon2(Cursor cursor
) {
415 if (mIconName2Col
== INVALID_INDEX
) {
418 String value
= cursor
.getString(mIconName2Col
);
419 return getDrawableFromResourceValue(value
);
423 * Sets the drawable in an image view, makes sure the view is only visible if there
426 private void setViewDrawable(ImageView v
, Drawable drawable
, int nullVisibility
) {
427 // Set the icon even if the drawable is null, since we need to clear any
429 v
.setImageDrawable(drawable
);
431 if (drawable
== null) {
432 v
.setVisibility(nullVisibility
);
434 v
.setVisibility(View
.VISIBLE
);
436 // This is a hack to get any animated drawables (like a 'working' spinner)
437 // to animate. You have to setVisible true on an AnimationDrawable to get
438 // it to start animating, but it must first have been false or else the
439 // call to setVisible will be ineffective. We need to clear up the story
440 // about animated drawables in the future, see http://b/1878430.
441 drawable
.setVisible(false, false);
442 drawable
.setVisible(true, false);
447 * Gets the text to show in the query field when a suggestion is selected.
449 * @param cursor The Cursor to read the suggestion data from. The Cursor should already
450 * be moved to the suggestion that is to be read from.
451 * @return The text to show, or <code>null</code> if the query should not be
452 * changed when selecting this suggestion.
455 public CharSequence
convertToString(Cursor cursor
) {
456 if (cursor
== null) {
460 String query
= getColumnString(cursor
, SearchManager
.SUGGEST_COLUMN_QUERY
);
465 if (mSearchable
.shouldRewriteQueryFromData()) {
466 String data
= getColumnString(cursor
, SearchManager
.SUGGEST_COLUMN_INTENT_DATA
);
472 if (mSearchable
.shouldRewriteQueryFromText()) {
473 String text1
= getColumnString(cursor
, SearchManager
.SUGGEST_COLUMN_TEXT_1
);
483 * This method is overridden purely to provide a bit of protection against
484 * flaky content providers.
486 * @see android.widget.ListAdapter#getView(int, View, ViewGroup)
489 public View
getView(int position
, View convertView
, ViewGroup parent
) {
491 return super.getView(position
, convertView
, parent
);
492 } catch (RuntimeException e
) {
493 Log
.w(LOG_TAG
, "Search suggestions cursor threw exception.", e
);
494 // Put exception string in item title
495 View v
= newView(mContext
, mCursor
, parent
);
497 ChildViewCache views
= (ChildViewCache
) v
.getTag();
498 TextView tv
= views
.mText1
;
499 tv
.setText(e
.toString());
506 * This method is overridden purely to provide a bit of protection against
507 * flaky content providers.
509 * @see android.widget.CursorAdapter#getDropDownView(int, View, ViewGroup)
512 public View
getDropDownView(int position
, View convertView
, ViewGroup parent
) {
514 return super.getDropDownView(position
, convertView
, parent
);
515 } catch (RuntimeException e
) {
516 Log
.w(LOG_TAG
, "Search suggestions cursor threw exception.", e
);
517 // Put exception string in item title
518 final Context context
= mDropDownContext
== null ? mContext
: mDropDownContext
;
519 final View v
= newDropDownView(context
, mCursor
, parent
);
521 final ChildViewCache views
= (ChildViewCache
) v
.getTag();
522 final TextView tv
= views
.mText1
;
523 tv
.setText(e
.toString());
530 * Gets a drawable given a value provided by a suggestion provider.
532 * This value could be just the string value of a resource id
533 * (e.g., "2130837524"), in which case we will try to retrieve a drawable from
534 * the provider's resources. If the value is not an integer, it is
535 * treated as a Uri and opened with
536 * {@link ContentResolver#openOutputStream(android.net.Uri, String)}.
538 * All resources and URIs are read using the suggestion provider's context.
540 * If the string is not formatted as expected, or no drawable can be found for
541 * the provided value, this method returns null.
543 * @param drawableId a string like "2130837524",
544 * "android.resource://com.android.alarmclock/2130837524",
545 * or "content://contacts/photos/253".
546 * @return a Drawable, or null if none found
548 private Drawable
getDrawableFromResourceValue(String drawableId
) {
549 if (drawableId
== null || drawableId
.length() == 0 || "0".equals(drawableId
)) {
553 // First, see if it's just an integer
554 int resourceId
= Integer
.parseInt(drawableId
);
555 // It's an int, look for it in the cache
556 String drawableUri
= ContentResolver
.SCHEME_ANDROID_RESOURCE
557 + "://" + mProviderContext
.getPackageName() + "/" + resourceId
;
558 // Must use URI as cache key, since ints are app-specific
559 Drawable drawable
= checkIconCache(drawableUri
);
560 if (drawable
!= null) {
563 // Not cached, find it by resource ID
564 drawable
= mProviderContext
.getDrawable(resourceId
);
565 // Stick it in the cache, using the URI as key
566 storeInIconCache(drawableUri
, drawable
);
568 } catch (NumberFormatException nfe
) {
569 // It's not an integer, use it as a URI
570 Drawable drawable
= checkIconCache(drawableId
);
571 if (drawable
!= null) {
574 Uri uri
= Uri
.parse(drawableId
);
575 drawable
= getDrawable(uri
);
576 storeInIconCache(drawableId
, drawable
);
578 } catch (Resources
.NotFoundException nfe
) {
579 // It was an integer, but it couldn't be found, bail out
580 Log
.w(LOG_TAG
, "Icon resource not found: " + drawableId
);
586 * Gets a drawable by URI, without using the cache.
588 * @return A drawable, or {@code null} if the drawable could not be loaded.
590 private Drawable
getDrawable(Uri uri
) {
592 String scheme
= uri
.getScheme();
593 if (ContentResolver
.SCHEME_ANDROID_RESOURCE
.equals(scheme
)) {
594 // Load drawables through Resources, to get the source density information
595 OpenResourceIdResult r
=
596 mProviderContext
.getContentResolver().getResourceId(uri
);
598 return r
.r
.getDrawable(r
.id
, mProviderContext
.getTheme());
599 } catch (Resources
.NotFoundException ex
) {
600 throw new FileNotFoundException("Resource does not exist: " + uri
);
603 // Let the ContentResolver handle content and file URIs.
604 InputStream stream
= mProviderContext
.getContentResolver().openInputStream(uri
);
605 if (stream
== null) {
606 throw new FileNotFoundException("Failed to open " + uri
);
609 return Drawable
.createFromStream(stream
, null);
613 } catch (IOException ex
) {
614 Log
.e(LOG_TAG
, "Error closing icon stream for " + uri
, ex
);
618 } catch (FileNotFoundException fnfe
) {
619 Log
.w(LOG_TAG
, "Icon not found: " + uri
+ ", " + fnfe
.getMessage());
624 private Drawable
checkIconCache(String resourceUri
) {
625 Drawable
.ConstantState cached
= mOutsideDrawablesCache
.get(resourceUri
);
626 if (cached
== null) {
629 if (DBG
) Log
.d(LOG_TAG
, "Found icon in cache: " + resourceUri
);
630 return cached
.newDrawable();
633 private void storeInIconCache(String resourceUri
, Drawable drawable
) {
634 if (drawable
!= null) {
635 mOutsideDrawablesCache
.put(resourceUri
, drawable
.getConstantState());
640 * Gets the left-hand side icon that will be used for the current suggestion
641 * if the suggestion contains an icon column but no icon or a broken icon.
643 * @param cursor A cursor positioned at the current suggestion.
644 * @return A non-null drawable.
646 private Drawable
getDefaultIcon1(Cursor cursor
) {
647 // Check the component that gave us the suggestion
648 Drawable drawable
= getActivityIconWithCache(mSearchable
.getSearchActivity());
649 if (drawable
!= null) {
653 // Fall back to a default icon
654 return mContext
.getPackageManager().getDefaultActivityIcon();
658 * Gets the activity or application icon for an activity.
659 * Uses the local icon cache for fast repeated lookups.
661 * @param component Name of an activity.
662 * @return A drawable, or {@code null} if neither the activity nor the application
665 private Drawable
getActivityIconWithCache(ComponentName component
) {
666 // First check the icon cache
667 String componentIconKey
= component
.flattenToShortString();
668 // Using containsKey() since we also store null values.
669 if (mOutsideDrawablesCache
.containsKey(componentIconKey
)) {
670 Drawable
.ConstantState cached
= mOutsideDrawablesCache
.get(componentIconKey
);
671 return cached
== null ?
null : cached
.newDrawable(mProviderContext
.getResources());
673 // Then try the activity or application icon
674 Drawable drawable
= getActivityIcon(component
);
675 // Stick it in the cache so we don't do this lookup again.
676 Drawable
.ConstantState toCache
= drawable
== null ?
null : drawable
.getConstantState();
677 mOutsideDrawablesCache
.put(componentIconKey
, toCache
);
682 * Gets the activity or application icon for an activity.
684 * @param component Name of an activity.
685 * @return A drawable, or {@code null} if neither the acitivy or the application
688 private Drawable
getActivityIcon(ComponentName component
) {
689 PackageManager pm
= mContext
.getPackageManager();
690 final ActivityInfo activityInfo
;
692 activityInfo
= pm
.getActivityInfo(component
, PackageManager
.GET_META_DATA
);
693 } catch (NameNotFoundException ex
) {
694 Log
.w(LOG_TAG
, ex
.toString());
697 int iconId
= activityInfo
.getIconResource();
698 if (iconId
== 0) return null;
699 String pkg
= component
.getPackageName();
700 Drawable drawable
= pm
.getDrawable(pkg
, iconId
, activityInfo
.applicationInfo
);
701 if (drawable
== null) {
702 Log
.w(LOG_TAG
, "Invalid icon resource " + iconId
+ " for "
703 + component
.flattenToShortString());
710 * Gets the value of a string column by name.
712 * @param cursor Cursor to read the value from.
713 * @param columnName The name of the column to read.
714 * @return The value of the given column, or <code>null</null>
715 * if the cursor does not contain the given column.
717 public static String
getColumnString(Cursor cursor
, String columnName
) {
718 int col
= cursor
.getColumnIndex(columnName
);
719 return getStringOrNull(cursor
, col
);
722 private static String
getStringOrNull(Cursor cursor
, int col
) {
723 if (col
== INVALID_INDEX
) {
727 return cursor
.getString(col
);
728 } catch (Exception e
) {
730 "unexpected error retrieving valid column from cursor, "
731 + "did the remote process die?", e
);