summaryrefslogtreecommitdiffstats
path: root/common/java/com
diff options
context:
space:
mode:
authorMaryam Garrett <mkamvar@google.com>2010-10-14 12:14:36 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2010-10-14 12:14:36 -0700
commit6d39f882df7f280e1aab0ccffad80181fd242247 (patch)
treed5265295d1f1d3d20aa02781870a967d57e820c2 /common/java/com
parentbf39450b962d91ec78af53db39826d55ddb39902 (diff)
parent66189d6156b4aa76f25bb1465d9e0e6f39668b9e (diff)
downloadandroid_frameworks_ex-6d39f882df7f280e1aab0ccffad80181fd242247.tar.gz
android_frameworks_ex-6d39f882df7f280e1aab0ccffad80181fd242247.tar.bz2
android_frameworks_ex-6d39f882df7f280e1aab0ccffad80181fd242247.zip
am 66189d61: Only call VoiceSearch if there are IME logging actions
Merge commit '66189d6156b4aa76f25bb1465d9e0e6f39668b9e' * commit '66189d6156b4aa76f25bb1465d9e0e6f39668b9e': Only call VoiceSearch if there are IME logging actions
Diffstat (limited to 'common/java/com')
-rw-r--r--common/java/com/android/common/userhappiness/UserHappinessSignals.java31
1 files changed, 24 insertions, 7 deletions
diff --git a/common/java/com/android/common/userhappiness/UserHappinessSignals.java b/common/java/com/android/common/userhappiness/UserHappinessSignals.java
index 347bdaa..0bc3e45 100644
--- a/common/java/com/android/common/userhappiness/UserHappinessSignals.java
+++ b/common/java/com/android/common/userhappiness/UserHappinessSignals.java
@@ -25,6 +25,20 @@ import com.android.common.speech.LoggingEvents;
* call these User Happiness metrics.
*/
public class UserHappinessSignals {
+ // So that we don't send logging events to VoiceSearch when there is nothing to
+ // log, IME will setHasVoiceLoggingInfo if there has been any voice activity,
+ // such as recognition results returned.
+ private static boolean mHasVoiceLoggingInfo = false;
+
+ /**
+ * Record whether or not there has been Voice-Input activity which
+ * needs to be logged. This is called with a value of true by the IME,
+ * when logging events (such as VoiceInputDelivered) occur, and is should
+ * be set to false after the logging broadcast is sent.
+ */
+ public static void setHasVoiceLoggingInfo(boolean hasVoiceLogging) {
+ mHasVoiceLoggingInfo = hasVoiceLogging;
+ }
/**
* Log when a user "accepted" IME text. Each application can define what
@@ -33,13 +47,16 @@ public class UserHappinessSignals {
* VoiceSearch LoggingEvents and use it to aggregate VoiceIME Happiness Metrics
*/
public static void userAcceptedImeText(Context context) {
- // Create a Voice IME Logging intent.
- Intent i = new Intent(LoggingEvents.ACTION_LOG_EVENT);
- i.putExtra(LoggingEvents.EXTRA_APP_NAME, LoggingEvents.VoiceIme.APP_NAME);
- i.putExtra(LoggingEvents.EXTRA_EVENT, LoggingEvents.VoiceIme.IME_TEXT_ACCEPTED);
- i.putExtra(LoggingEvents.EXTRA_CALLING_APP_NAME, context.getPackageName());
- i.putExtra(LoggingEvents.EXTRA_TIMESTAMP, System.currentTimeMillis());
- context.sendBroadcast(i);
+ // Create a Voice IME Logging intent only if there are logging actions
+ if (mHasVoiceLoggingInfo) {
+ Intent i = new Intent(LoggingEvents.ACTION_LOG_EVENT);
+ i.putExtra(LoggingEvents.EXTRA_APP_NAME, LoggingEvents.VoiceIme.APP_NAME);
+ i.putExtra(LoggingEvents.EXTRA_EVENT, LoggingEvents.VoiceIme.IME_TEXT_ACCEPTED);
+ i.putExtra(LoggingEvents.EXTRA_CALLING_APP_NAME, context.getPackageName());
+ i.putExtra(LoggingEvents.EXTRA_TIMESTAMP, System.currentTimeMillis());
+ context.sendBroadcast(i);
+ setHasVoiceLoggingInfo(false);
+ }
}
}