Merge change 24683 into eclair

* changes:
  Tell GlobalSearch about searches without a suggestion
This commit is contained in:
Android (Google) Code Review
2009-09-14 11:30:43 -04:00
3 changed files with 31 additions and 1 deletions

View File

@@ -1137,6 +1137,11 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS
String action = mGlobalSearchMode ? Intent.ACTION_WEB_SEARCH : Intent.ACTION_SEARCH;
Intent intent = createIntent(action, null, null, query, null,
actionKey, actionMsg);
// Allow GlobalSearch to log and create shortcut for searches launched by
// the search button, enter key or an action key.
if (mGlobalSearchMode) {
mSuggestionsAdapter.reportSearch(query);
}
launchIntent(intent);
}

View File

@@ -1350,6 +1350,14 @@ public class SearchManager
* When the threshold received in {@link #POST_REFRESH_RECEIVE_DISPLAY_NOTIFY} is displayed.
*/
public final static int THRESH_HIT = 3;
/**
* When a search is started without using a suggestion.
*/
public final static int SEARCH = 4;
public final static String SEARCH_SEND_MAX_DISPLAY_POS
= "DialogCursorProtocol.SEARCH.sendDisplayPosition";
public final static String SEARCH_SEND_QUERY = "DialogCursorProtocol.SEARCH.query";
}
/**

View File

@@ -290,7 +290,7 @@ class SuggestionsAdapter extends ResourceCursorAdapter {
*/
void callCursorOnClick(Cursor cursor, int position) {
if (!mGlobalSearchMode) return;
final Bundle request = new Bundle(1);
final Bundle request = new Bundle(3);
request.putInt(DialogCursorProtocol.METHOD, DialogCursorProtocol.CLICK);
request.putInt(DialogCursorProtocol.CLICK_SEND_POSITION, position);
request.putInt(DialogCursorProtocol.CLICK_SEND_MAX_DISPLAY_POS, mMaxDisplayed);
@@ -300,6 +300,23 @@ class SuggestionsAdapter extends ResourceCursorAdapter {
DialogCursorProtocol.CLICK_RECEIVE_SELECTED_POS, SuggestionsAdapter.NONE);
}
/**
* Tell the cursor that a search was started without using a suggestion.
*
* @param query The search query.
*/
void reportSearch(String query) {
if (!mGlobalSearchMode) return;
Cursor cursor = getCursor();
if (cursor == null) return;
final Bundle request = new Bundle(3);
request.putInt(DialogCursorProtocol.METHOD, DialogCursorProtocol.SEARCH);
request.putString(DialogCursorProtocol.SEARCH_SEND_QUERY, query);
request.putInt(DialogCursorProtocol.SEARCH_SEND_MAX_DISPLAY_POS, mMaxDisplayed);
// the response is always empty
cursor.respond(request);
}
/**
* Tags the view with cached child view look-ups.
*/