Home | History | Annotate | Download | only in speech
      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         public static final int RESULT_CLICKED = 4;
     71     }
     72 
     73     /**
     74      * Logging event constants for VoiceIME. Below are the extra values for
     75      * {@link LoggingEvents#EXTRA_EVENT}, clustered with keys to additional
     76      * extras for some events that need to be included as additional fields in
     77      * the event.
     78      */
     79     public class VoiceIme {
     80         // The app name to be used for logging VoiceIME events.
     81         public static final String APP_NAME = "voiceime";
     82 
     83         public static final int KEYBOARD_WARNING_DIALOG_SHOWN = 0;
     84 
     85         public static final int KEYBOARD_WARNING_DIALOG_DISMISSED = 1;
     86 
     87         public static final int KEYBOARD_WARNING_DIALOG_OK = 2;
     88 
     89         public static final int KEYBOARD_WARNING_DIALOG_CANCEL = 3;
     90 
     91         public static final int SETTINGS_WARNING_DIALOG_SHOWN = 4;
     92 
     93         public static final int SETTINGS_WARNING_DIALOG_DISMISSED = 5;
     94 
     95         public static final int SETTINGS_WARNING_DIALOG_OK = 6;
     96 
     97         public static final int SETTINGS_WARNING_DIALOG_CANCEL = 7;
     98 
     99         public static final int SWIPE_HINT_DISPLAYED = 8;
    100 
    101         public static final int PUNCTUATION_HINT_DISPLAYED = 9;
    102 
    103         public static final int CANCEL_DURING_LISTENING = 10;
    104 
    105         public static final int CANCEL_DURING_WORKING = 11;
    106 
    107         public static final int CANCEL_DURING_ERROR = 12;
    108 
    109         public static final int ERROR = 13;
    110         public static final String EXTRA_ERROR_CODE = "code";  // value should be int
    111 
    112         public static final int START = 14;
    113         public static final String EXTRA_START_LOCALE = "locale";  // value should be String
    114         public static final String EXTRA_START_SWIPE = "swipe";  // value should be boolean
    115         // EXTRA_START_SWIPE is deprecated; switch to EXTRA_START_METHOD instead
    116         public static final String EXTRA_START_METHOD = "method";  // value should be int below
    117         public static final int START_METHOD_BUTTON = 1;
    118         public static final int START_METHOD_SWIPE = 2;
    119         public static final int START_METHOD_MOTION = 3;
    120 
    121         public static final int VOICE_INPUT_DELIVERED = 15;
    122 
    123         public static final int N_BEST_CHOOSE = 16;
    124         public static final String EXTRA_N_BEST_CHOOSE_INDEX = "index";  // value should be int
    125 
    126         public static final int TEXT_MODIFIED = 17;
    127         public static final String EXTRA_TEXT_MODIFIED_LENGTH = "length";  // value should be int
    128         public static final String EXTRA_TEXT_MODIFIED_TYPE = "type";  // value should be int below
    129         public static final int TEXT_MODIFIED_TYPE_CHOOSE_SUGGESTION = 1;
    130         public static final int TEXT_MODIFIED_TYPE_TYPING_DELETION = 2;
    131         public static final int TEXT_MODIFIED_TYPE_TYPING_INSERTION = 3;
    132         public static final int TEXT_MODIFIED_TYPE_TYPING_INSERTION_PUNCTUATION = 4;
    133 
    134         public static final int INPUT_ENDED = 18;
    135 
    136         public static final int VOICE_INPUT_SETTING_ENABLED = 19;
    137 
    138         public static final int VOICE_INPUT_SETTING_DISABLED = 20;
    139 
    140         public static final int IME_TEXT_ACCEPTED = 21;
    141     }
    142 
    143 }
    144