summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Android (Google) Code Review <android-gerrit@google.com> 2009-09-14 11:30:43 -0400
committer Android (Google) Code Review <android-gerrit@google.com> 2009-09-14 11:30:43 -0400
commit6cb1330d26d2fe8a01c33ab3fbaee2bfebb6f47e (patch)
tree42258a41c091ae251a415738ee820ada29f1c660
parent91e2d8651fe38a921b37a8bf8b3148c572cf9430 (diff)
parent2fcaf79a1856186e3823390c488e806c5955c8a6 (diff)
Merge change 24683 into eclair
* changes: Tell GlobalSearch about searches without a suggestion
-rw-r--r--core/java/android/app/SearchDialog.java5
-rw-r--r--core/java/android/app/SearchManager.java8
-rw-r--r--core/java/android/app/SuggestionsAdapter.java19
3 files changed, 31 insertions, 1 deletions
diff --git a/core/java/android/app/SearchDialog.java b/core/java/android/app/SearchDialog.java
index f474f06c973e..75e4669575f9 100644
--- a/core/java/android/app/SearchDialog.java
+++ b/core/java/android/app/SearchDialog.java
@@ -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);
}
diff --git a/core/java/android/app/SearchManager.java b/core/java/android/app/SearchManager.java
index 267d86a9c607..3a14f6f17c8e 100644
--- a/core/java/android/app/SearchManager.java
+++ b/core/java/android/app/SearchManager.java
@@ -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";
}
/**
diff --git a/core/java/android/app/SuggestionsAdapter.java b/core/java/android/app/SuggestionsAdapter.java
index 90f8c503607b..8730288b97a4 100644
--- a/core/java/android/app/SuggestionsAdapter.java
+++ b/core/java/android/app/SuggestionsAdapter.java
@@ -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);
@@ -301,6 +301,23 @@ class SuggestionsAdapter extends ResourceCursorAdapter {
}
/**
+ * 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.
*/
@Override