Enable voice search
http://b/issue?id=3039695
send voice search intent
implement voice search title bar
also fixes another Urlbar focus handling bug
Change-Id: Icdcbec9ffff586d445545cc7fe86ca045022f381
diff --git a/src/com/android/browser/Controller.java b/src/com/android/browser/Controller.java
index e88a676..d49a778 100644
--- a/src/com/android/browser/Controller.java
+++ b/src/com/android/browser/Controller.java
@@ -36,7 +36,6 @@
import android.database.ContentObserver;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
-import android.database.sqlite.SQLiteException;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Picture;
@@ -51,10 +50,10 @@
import android.preference.PreferenceActivity;
import android.provider.Browser;
import android.provider.BrowserContract;
-import android.provider.BrowserContract.History;
import android.provider.BrowserContract.Images;
import android.provider.ContactsContract;
import android.provider.ContactsContract.Intents.Insert;
+import android.speech.RecognizerIntent;
import android.speech.RecognizerResultsIntent;
import android.text.TextUtils;
import android.util.Log;
@@ -94,6 +93,9 @@
implements WebViewController, UiController {
private static final String LOGTAG = "Controller";
+ private static final String SEND_APP_ID_EXTRA =
+ "android.speech.extras.SEND_APPLICATION_ID_EXTRA";
+
// public message ids
public final static int LOAD_URL = 1001;
@@ -1009,6 +1011,16 @@
null, false);
}
+ public void startVoiceSearch() {
+ Intent intent = new Intent(RecognizerIntent.ACTION_WEB_SEARCH);
+ intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
+ RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH);
+ intent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE,
+ mActivity.getComponentName().flattenToString());
+ intent.putExtra(SEND_APP_ID_EXTRA, false);
+ mActivity.startActivity(intent);
+ }
+
public void activateVoiceSearchMode(String title) {
mUi.showVoiceTitleBar(title);
}