am 82496fa1: Merge "DO NOT MERGE: Logging for the VoiceSearch alternates" into gingerbread

* commit '82496fa100b38ad73910545c6a0e9244cf0ee6e0':
  DO NOT MERGE: Logging for the VoiceSearch alternates
main
Maryam Garrett 2010-12-20 11:30:03 -08:00 committed by Android Git Automerger
commit 65864d9ea2
3 changed files with 22 additions and 19 deletions

View File

@ -1864,13 +1864,14 @@ public class LatinIME extends InputMethodService
} }
public void pickSuggestionManually(int index, CharSequence suggestion) { public void pickSuggestionManually(int index, CharSequence suggestion) {
if (mAfterVoiceInput && mShowingVoiceSuggestions) mVoiceInput.logNBestChoose(index);
List<CharSequence> suggestions = mCandidateView.getSuggestions(); List<CharSequence> suggestions = mCandidateView.getSuggestions();
if (mAfterVoiceInput && !mShowingVoiceSuggestions) { if (mAfterVoiceInput && mShowingVoiceSuggestions) {
mVoiceInput.flushAllTextModificationCounters(); mVoiceInput.flushAllTextModificationCounters();
// send this intent AFTER logging any prior aggregated edits. // send this intent AFTER logging any prior aggregated edits.
mVoiceInput.logTextModifiedByChooseSuggestion(suggestion.length()); mVoiceInput.logTextModifiedByChooseSuggestion(suggestion.toString(), index,
mWordSeparators,
getCurrentInputConnection());
} }
final boolean correcting = TextEntryState.isCorrecting(); final boolean correcting = TextEntryState.isCorrecting();

View File

@ -16,6 +16,7 @@
package com.android.inputmethod.voice; package com.android.inputmethod.voice;
import com.android.inputmethod.latin.EditingUtil;
import com.android.inputmethod.latin.R; import com.android.inputmethod.latin.R;
import android.content.ContentResolver; import android.content.ContentResolver;
@ -30,6 +31,7 @@ import android.speech.RecognitionListener;
import android.speech.SpeechRecognizer; import android.speech.SpeechRecognizer;
import android.speech.RecognizerIntent; import android.speech.RecognizerIntent;
import android.util.Log; import android.util.Log;
import android.view.inputmethod.InputConnection;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
@ -423,8 +425,14 @@ public class VoiceInput implements OnClickListener {
mLogger.textModifiedByTypingDeletion(length); mLogger.textModifiedByTypingDeletion(length);
} }
public void logTextModifiedByChooseSuggestion(int length) { public void logTextModifiedByChooseSuggestion(String suggestion, int index,
mLogger.textModifiedByChooseSuggestion(length); String wordSeparators, InputConnection ic) {
EditingUtil.Range range = new EditingUtil.Range();
String wordToBeReplaced = EditingUtil.getWordAtCursor(ic, wordSeparators, range);
// If we enable phrase-based alternatives, only send up the first word
// in suggestion and wordToBeReplaced.
mLogger.textModifiedByChooseSuggestion(suggestion.length(), wordToBeReplaced.length(),
index, wordToBeReplaced, suggestion);
} }
public void logKeyboardWarningDialogShown() { public void logKeyboardWarningDialogShown() {
@ -455,10 +463,6 @@ public class VoiceInput implements OnClickListener {
mLogger.voiceInputDelivered(length); mLogger.voiceInputDelivered(length);
} }
public void logNBestChoose(int index) {
mLogger.nBestChoose(index);
}
public void logInputEnded() { public void logInputEnded() {
mLogger.inputEnded(); mLogger.inputEnded();
} }

View File

@ -205,22 +205,20 @@ public class VoiceInputLogger {
mContext.sendBroadcast(i); mContext.sendBroadcast(i);
} }
public void textModifiedByChooseSuggestion(int length) { public void textModifiedByChooseSuggestion(int suggestionLength, int replacedPhraseLength,
int index, String before, String after) {
setHasLoggingInfo(true); setHasLoggingInfo(true);
Intent i = newLoggingBroadcast(LoggingEvents.VoiceIme.TEXT_MODIFIED); Intent i = newLoggingBroadcast(LoggingEvents.VoiceIme.TEXT_MODIFIED);
i.putExtra(LoggingEvents.VoiceIme.EXTRA_TEXT_MODIFIED_LENGTH, length);
i.putExtra(LoggingEvents.VoiceIme.EXTRA_TEXT_MODIFIED_TYPE, i.putExtra(LoggingEvents.VoiceIme.EXTRA_TEXT_MODIFIED_TYPE,
LoggingEvents.VoiceIme.TEXT_MODIFIED_TYPE_CHOOSE_SUGGESTION); LoggingEvents.VoiceIme.TEXT_MODIFIED_TYPE_CHOOSE_SUGGESTION);
i.putExtra(LoggingEvents.VoiceIme.EXTRA_TEXT_MODIFIED_LENGTH, suggestionLength);
i.putExtra(LoggingEvents.VoiceIme.EXTRA_TEXT_REPLACED_LENGTH, replacedPhraseLength);
i.putExtra(LoggingEvents.VoiceIme.EXTRA_N_BEST_CHOOSE_INDEX, index);
i.putExtra(LoggingEvents.VoiceIme.EXTRA_BEFORE_N_BEST_CHOOSE, before);
i.putExtra(LoggingEvents.VoiceIme.EXTRA_AFTER_N_BEST_CHOOSE, after);
mContext.sendBroadcast(i); mContext.sendBroadcast(i);
} }
public void nBestChoose(int index) {
setHasLoggingInfo(true);
Intent i = newLoggingBroadcast(LoggingEvents.VoiceIme.N_BEST_CHOOSE);
i.putExtra(LoggingEvents.VoiceIme.EXTRA_N_BEST_CHOOSE_INDEX, index);
mContext.sendBroadcast(i);
}
public void inputEnded() { public void inputEnded() {
setHasLoggingInfo(true); setHasLoggingInfo(true);
mContext.sendBroadcast(newLoggingBroadcast(LoggingEvents.VoiceIme.INPUT_ENDED)); mContext.sendBroadcast(newLoggingBroadcast(LoggingEvents.VoiceIme.INPUT_ENDED));