aboutsummaryrefslogtreecommitdiffstats
path: root/src/com/android/inputmethod/voice/LoggingEvents.java
diff options
context:
space:
mode:
authorMike LeBeau <mlebeau@android.com>2010-01-16 12:21:23 -0800
committerMike LeBeau <mlebeau@android.com>2010-01-17 02:42:58 -0500
commit466741d8a78965b8509bf527344f289e50873092 (patch)
treea391762c52cee87df8e0482cbd3bdc5aed87d988 /src/com/android/inputmethod/voice/LoggingEvents.java
parent388ce92ab8a635c5ad44620dad59baf05dfea510 (diff)
downloadlatinime-466741d8a78965b8509bf527344f289e50873092.tar.gz
latinime-466741d8a78965b8509bf527344f289e50873092.tar.xz
latinime-466741d8a78965b8509bf527344f289e50873092.zip
Migrate voice features into the open-source LatinIME. This includes
the change to logging to remove any private dependencies and use broadcast intents to VoiceSearch instead. I have audited this code and it appears good to go for open-source, but would appreciate a second pair of eyes. Still to do after submitting this CL: * Reintroduce Amith's memory leak fix (37557) which was the only CL added to LatinIME since the last merge over to the private copy. * Make some changes to allow LatinIME to work without voice search installed. Currently I believe it will show the mic but fail if you press it. We need to base the visibility on the mic on the availability of the service. * Fix this code to use the new Gservices framework, it's still trying to use the old one.
Diffstat (limited to 'src/com/android/inputmethod/voice/LoggingEvents.java')
-rw-r--r--src/com/android/inputmethod/voice/LoggingEvents.java96
1 files changed, 96 insertions, 0 deletions
diff --git a/src/com/android/inputmethod/voice/LoggingEvents.java b/src/com/android/inputmethod/voice/LoggingEvents.java
new file mode 100644
index 000000000..b63229186
--- /dev/null
+++ b/src/com/android/inputmethod/voice/LoggingEvents.java
@@ -0,0 +1,96 @@
+/*
+ * Copyright (C) 2010 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.android.inputmethod.voice;
+
+/**
+ * Logging event constants used for Voice Search and VoiceIME. These are the keys and values of
+ * extras to be specified in logging broadcast intents to the {@link LoggingReceiver}.
+ *
+ * This class is duplicated between VoiceSearch and LatinIME. Please keep both versions
+ * in sync.
+ */
+public class LoggingEvents {
+ // The name of the broadcast intent for logging.
+ public static final String ACTION_LOG_EVENT = "com.google.android.voicesearch.LOG_EVENT";
+
+ // The extra key used for the name of the app being logged.
+ public static final String EXTRA_APP_NAME = "app_name";
+
+ // The extra key used for the event value. The possible event values depend on the
+ // app being logged for, and are defined in the subclasses below.
+ public static final String EXTRA_EVENT = "extra_event";
+
+ // The extra key used (with a boolean value of 'true') as a way to trigger a flush
+ // of the log events to the server.
+ public static final String EXTRA_FLUSH = "flush";
+
+ /**
+ * Logging event constants for VoiceIME. Below are the extra values for
+ * {@link LoggingEvents#EXTRA_EVENT}, clustered with keys to additional extras
+ * for some events that need to be included as additional fields in the event.
+ */
+ public class VoiceIme {
+ // The app name to be used for logging VoiceIME events.
+ public static final String APP_NAME = "voiceime";
+
+ public static final int KEYBOARD_WARNING_DIALOG_SHOWN = 0;
+
+ public static final int KEYBOARD_WARNING_DIALOG_DISMISSED = 1;
+
+ public static final int KEYBOARD_WARNING_DIALOG_OK = 2;
+
+ public static final int KEYBOARD_WARNING_DIALOG_CANCEL = 3;
+
+ public static final int SETTINGS_WARNING_DIALOG_SHOWN = 4;
+
+ public static final int SETTINGS_WARNING_DIALOG_DISMISSED = 5;
+
+ public static final int SETTINGS_WARNING_DIALOG_OK = 6;
+
+ public static final int SETTINGS_WARNING_DIALOG_CANCEL = 7;
+
+ public static final int SWIPE_HINT_DISPLAYED = 8;
+
+ public static final int PUNCTUATION_HINT_DISPLAYED = 9;
+
+ public static final int CANCEL_DURING_LISTENING = 10;
+
+ public static final int CANCEL_DURING_WORKING = 11;
+
+ public static final int CANCEL_DURING_ERROR = 12;
+
+ public static final int ERROR = 13;
+ public static final String EXTRA_ERROR_CODE = "code"; // value should be int
+
+ public static final int START = 14;
+ public static final String EXTRA_START_LOCALE = "locale"; // value should be String
+ public static final String EXTRA_START_SWIPE = "swipe"; // value should be boolean
+
+ public static final int VOICE_INPUT_DELIVERED = 15;
+
+ public static final int N_BEST_CHOOSE = 16;
+ public static final String EXTRA_N_BEST_CHOOSE_INDEX = "index"; // value should be int
+
+ public static final int TEXT_MODIFIED = 17;
+
+ public static final int INPUT_ENDED = 18;
+
+ public static final int VOICE_INPUT_SETTING_ENABLED = 19;
+
+ public static final int VOICE_INPUT_SETTING_DISABLED = 20;
+ }
+}