import android.accounts.AccountManagerCallback;
import com.android.common.Patterns;
+import com.android.common.speech.LoggingEvents;
import com.google.android.gsf.GoogleLoginServiceConstants;
// search, so do nothing.
return;
}
+ if (Intent.ACTION_SEARCH.equals(action)
+ && current.voiceSearchSourceIsGoogle()) {
+ Intent logIntent = new Intent(
+ LoggingEvents.ACTION_LOG_EVENT);
+ logIntent.putExtra(LoggingEvents.EXTRA_EVENT,
+ LoggingEvents.VoiceSearch.QUERY_UPDATED);
+ logIntent.putExtra(
+ LoggingEvents.VoiceSearch.EXTRA_QUERY_UPDATED_VALUE,
+ intent.getDataString());
+ sendBroadcast(logIntent);
+ // Note, onPageStarted will revert the voice title bar
+ // When http://b/issue?id=2379215 is fixed, we should update
+ // the title bar here.
+ }
}
// If this was a search request (e.g. search query directly typed into the address bar),
// pass it on to the default web search provider.
import android.widget.LinearLayout;
import android.widget.TextView;
+import com.android.common.speech.LoggingEvents;
+
/**
* Class for maintaining Tabs with a main WebView and a subwindow.
*/
return mVoiceSearchData != null;
}
/**
+ * Return true if the voice search Intent came with a String identifying
+ * that Google provided the Intent.
+ */
+ public boolean voiceSearchSourceIsGoogle() {
+ return mVoiceSearchData != null && mVoiceSearchData.mSourceIsGoogle;
+ }
+ /**
* Get the title to display for the current voice search page. If the Tab
* is not in voice search mode, return null.
*/
}
mVoiceSearchData = new VoiceSearchData(results, urls, htmls,
baseUrls);
+ mVoiceSearchData.mSourceIsGoogle = intent.getBooleanExtra(
+ VoiceSearchData.SOURCE_IS_GOOGLE, false);
} else {
String extraData = intent.getStringExtra(
SearchManager.EXTRA_DATA_KEY);
throw new AssertionError("index must be less than "
+ " size of mVoiceSearchResults");
}
+ if (mVoiceSearchData.mSourceIsGoogle) {
+ Intent logIntent = new Intent(
+ LoggingEvents.ACTION_LOG_EVENT);
+ logIntent.putExtra(LoggingEvents.EXTRA_EVENT,
+ LoggingEvents.VoiceSearch.N_BEST_CHOOSE);
+ logIntent.putExtra(
+ LoggingEvents.VoiceSearch.EXTRA_N_BEST_CHOOSE_INDEX,
+ index);
+ mActivity.sendBroadcast(logIntent);
+ }
}
}
mVoiceSearchData.mLastVoiceSearchTitle
* when switching tabs.
*/
public String mLastVoiceSearchTitle;
+ /**
+ * Whether the Intent which turned on voice search mode contained the
+ * String signifying that Google was the source.
+ */
+ public boolean mSourceIsGoogle;
+ /**
+ * String used to identify Google as the source of voice search.
+ */
+ public static String SOURCE_IS_GOOGLE
+ = "android.speech.extras.SOURCE_IS_GOOGLE";
}
// Container class for the next error dialog that needs to be displayed
mLoadStartTime = SystemClock.uptimeMillis();
if (mVoiceSearchData != null
&& !url.equals(mVoiceSearchData.mLastVoiceSearchUrl)) {
+ if (mVoiceSearchData.mSourceIsGoogle) {
+ Intent i = new Intent(LoggingEvents.ACTION_LOG_EVENT);
+ i.putExtra(LoggingEvents.EXTRA_FLUSH, true);
+ mActivity.sendBroadcast(i);
+ }
mVoiceSearchData = null;
if (mInForeground) {
mActivity.revertVoiceTitleBar();
import android.widget.ProgressBar;
import android.widget.TextView;
+import com.android.common.speech.LoggingEvents;
+
/**
* This class represents a title bar for a particular "tab" or "window" in the
* browser.
case MotionEvent.ACTION_UP:
if (mRtButton.isPressed()) {
if (mInVoiceMode) {
+ if (mBrowserActivity.getTabControl().getCurrentTab()
+ .voiceSearchSourceIsGoogle()) {
+ Intent i = new Intent(
+ LoggingEvents.ACTION_LOG_EVENT);
+ i.putExtra(LoggingEvents.EXTRA_EVENT,
+ LoggingEvents.VoiceSearch.RETRY);
+ mBrowserActivity.sendBroadcast(i);
+ }
mBrowserActivity.startActivity(mVoiceSearchIntent);
} else if (mInLoad) {
mBrowserActivity.stopLoading();
} else if (mTitleBg.isPressed()) {
mHandler.removeMessages(LONG_PRESS);
if (mInVoiceMode) {
+ if (mBrowserActivity.getTabControl().getCurrentTab()
+ .voiceSearchSourceIsGoogle()) {
+ Intent i = new Intent(
+ LoggingEvents.ACTION_LOG_EVENT);
+ i.putExtra(LoggingEvents.EXTRA_EVENT,
+ LoggingEvents.VoiceSearch.N_BEST_REVEAL);
+ mBrowserActivity.sendBroadcast(i);
+ }
mBrowserActivity.showVoiceSearchResults(
mTitle.getText().toString().trim());
} else {