1 /* 2 * Copyright (C) 2010 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 * use this file except in compliance with the License. You may obtain a copy of 6 * the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 * License for the specific language governing permissions and limitations under 14 * the License. 15 */ 16 17 package com.android.common.speech; 18 19 /** 20 * Logging event constants used for Voice Search and VoiceIME. These are the 21 * keys and values of extras to be specified in logging broadcast intents. 22 * This class is used by clients of the android.speech APIs to log how the 23 * user interacts with the IME settings and speech recognition result. 24 */ 25 public class LoggingEvents { 26 // The name of the broadcast intent for logging. 27 public static final String ACTION_LOG_EVENT = "com.android.common.speech.LOG_EVENT"; 28 29 // The extra key used for the name of the app being logged. 30 public static final String EXTRA_APP_NAME = "app_name"; 31 32 // The extra key used for the name of the app issuing the VoiceSearch 33 // or VoiceIME request 34 public static final String EXTRA_CALLING_APP_NAME = ""; 35 36 // The extra key used for the event value. The possible event values depend 37 // on the app being logged for, and are defined in the subclasses below. 38 public static final String EXTRA_EVENT = "extra_event"; 39 40 // The extra key used to log the time in milliseconds at which the EXTRA_EVENT 41 // occurred in the client. 42 public static final String EXTRA_TIMESTAMP = "timestamp"; 43 44 // The extra key used (with a boolean value of 'true') as a way to trigger a 45 // flush of the log events to the server. 46 public static final String EXTRA_FLUSH = "flush"; 47 48 /** 49 * Logging event constants for voice search. Below are the extra values for 50 * {@link LoggingEvents#EXTRA_EVENT}, clustered with keys to additional 51 * extras for some events that need to be included as additional fields in 52 * the event. Note that this is not representative of *all* voice search 53 * events - only the ones that need to be reported from outside the voice 54 * search app, such as from Browser. 55 */ 56 public class VoiceSearch { 57 // The app name to be used for logging VoiceSearch events. 58 public static final String APP_NAME = "googlemobile"; 59 60 public static final int RETRY = 0; 61 62 public static final int N_BEST_REVEAL = 1; 63 64 public static final int N_BEST_CHOOSE = 2; 65 public static final String EXTRA_N_BEST_CHOOSE_INDEX = "index"; // value should be int 66 67 public static final int QUERY_UPDATED = 3; 68 public static final String EXTRA_QUERY_UPDATED_VALUE = "value"; // value should be String 69 } 70 71 /** 72 * Logging event constants for VoiceIME. Below are the extra values for 73 * {@link LoggingEvents#EXTRA_EVENT}, clustered with keys to additional 74 * extras for some events that need to be included as additional fields in 75 * the event. 76 */ 77 public class VoiceIme { 78 // The app name to be used for logging VoiceIME events. 79 public static final String APP_NAME = "voiceime"; 80 81 public static final int KEYBOARD_WARNING_DIALOG_SHOWN = 0; 82 83 public static final int KEYBOARD_WARNING_DIALOG_DISMISSED = 1; 84 85 public static final int KEYBOARD_WARNING_DIALOG_OK = 2; 86 87 public static final int KEYBOARD_WARNING_DIALOG_CANCEL = 3; 88 89 public static final int SETTINGS_WARNING_DIALOG_SHOWN = 4; 90 91 public static final int SETTINGS_WARNING_DIALOG_DISMISSED = 5; 92 93 public static final int SETTINGS_WARNING_DIALOG_OK = 6; 94 95 public static final int SETTINGS_WARNING_DIALOG_CANCEL = 7; 96 97 public static final int SWIPE_HINT_DISPLAYED = 8; 98 99 public static final int PUNCTUATION_HINT_DISPLAYED = 9; 100 101 public static final int CANCEL_DURING_LISTENING = 10; 102 103 public static final int CANCEL_DURING_WORKING = 11; 104 105 public static final int CANCEL_DURING_ERROR = 12; 106 107 public static final int ERROR = 13; 108 public static final String EXTRA_ERROR_CODE = "code"; // value should be int 109 110 public static final int START = 14; 111 public static final String EXTRA_START_LOCALE = "locale"; // value should be String 112 public static final String EXTRA_START_SWIPE = "swipe"; // value should be boolean 113 114 public static final int VOICE_INPUT_DELIVERED = 15; 115 116 public static final int N_BEST_CHOOSE = 16; 117 public static final String EXTRA_N_BEST_CHOOSE_INDEX = "index"; // value should be int 118 119 public static final int TEXT_MODIFIED = 17; 120 public static final String EXTRA_TEXT_MODIFIED_LENGTH = "length"; // value should be int 121 public static final String EXTRA_TEXT_MODIFIED_TYPE = "type"; // value should be int below 122 public static final int TEXT_MODIFIED_TYPE_CHOOSE_SUGGESTION = 1; 123 public static final int TEXT_MODIFIED_TYPE_TYPING_DELETION = 2; 124 public static final int TEXT_MODIFIED_TYPE_TYPING_INSERTION = 3; 125 public static final int TEXT_MODIFIED_TYPE_TYPING_INSERTION_PUNCTUATION = 4; 126 127 public static final int INPUT_ENDED = 18; 128 129 public static final int VOICE_INPUT_SETTING_ENABLED = 19; 130 131 public static final int VOICE_INPUT_SETTING_DISABLED = 20; 132 133 public static final int IME_TEXT_ACCEPTED = 21; 134 } 135 136 } 137