Logger.java revision fde948e69f59589cf0d217ea414af7947de600bb
1/* 2 * Copyright (C) 2009 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of 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, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17package com.android.quicksearchbox; 18 19import java.util.ArrayList; 20 21 22/** 23 * Interface for logging implementations. 24 */ 25public interface Logger { 26 27 public static final int SEARCH_METHOD_BUTTON = 0; 28 public static final int SEARCH_METHOD_KEYBOARD = 1; 29 30 /** 31 * Called when QSB has started. 32 * 33 * @param latency User-visible start-up latency in milliseconds. 34 */ 35 void logStart(int latency, String intentSource, Corpus corpus, 36 ArrayList<Corpus> orderedCorpora); 37 38 /** 39 * Called when a suggestion is clicked. 40 * 41 * @param position 0-based position of the suggestion in the UI. 42 * @param suggestionCursor all the suggestions shown in the UI. 43 * @param queriedCorpora all corpora that were queried to produce the suggestions in 44 * {@code suggestionCursor}, ordered by rank. 45 */ 46 void logSuggestionClick(int position, SuggestionCursor suggestionCursor, 47 ArrayList<Corpus> queriedCorpora); 48 49 /** 50 * The user launched a search. 51 * 52 * @param startMethod One of {@link #SEARCH_METHOD_BUTTON} or {@link #SEARCH_METHOD_KEYBOARD}. 53 * @param numChars The number of characters in the query. 54 */ 55 void logSearch(Corpus corpus, int startMethod, int numChars); 56 57 /** 58 * The user launched a voice search. 59 */ 60 void logVoiceSearch(Corpus corpus); 61 62 /** 63 * The user left QSB without performing any action (click suggestions, search or voice search). 64 * 65 * @param suggestionCursor all the suggestions shown in the UI when the user left 66 * @param numChars The number of characters in the query typed when the user left. 67 */ 68 void logExit(SuggestionCursor suggestionCursor, int numChars); 69 70 void logWebLatency(); 71 72} 73