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 17 package com.android.quicksearchbox; 18 19 import java.util.Collection; 20 import java.util.List; 21 22 23 /** 24 * Interface for logging implementations. 25 */ 26 public interface Logger { 27 28 public static final int SEARCH_METHOD_BUTTON = 0; 29 public static final int SEARCH_METHOD_KEYBOARD = 1; 30 31 /** 32 * Called when QSB has started. 33 * 34 * @param latency User-visible start-up latency in milliseconds. 35 */ 36 void logStart(int latency, String intentSource, Corpus corpus, 37 List<Corpus> orderedCorpora); 38 39 /** 40 * Called when a suggestion is clicked. 41 * 42 * @param position 0-based position of the suggestion in the UI. 43 * @param suggestionCursor all the suggestions shown in the UI. 44 * @param queriedCorpora all corpora that were queried to produce the suggestions in 45 * {@code suggestionCursor}, ordered by rank. 46 */ 47 void logSuggestionClick(int position, SuggestionCursor suggestionCursor, 48 Collection<Corpus> queriedCorpora); 49 50 /** 51 * The user launched a search. 52 * 53 * @param startMethod One of {@link #SEARCH_METHOD_BUTTON} or {@link #SEARCH_METHOD_KEYBOARD}. 54 * @param numChars The number of characters in the query. 55 */ 56 void logSearch(Corpus corpus, int startMethod, int numChars); 57 58 /** 59 * The user launched a voice search. 60 */ 61 void logVoiceSearch(Corpus corpus); 62 63 /** 64 * The user left QSB without performing any action (click suggestions, search or voice search). 65 * 66 * @param suggestionCursor all the suggestions shown in the UI when the user left 67 * @param numChars The number of characters in the query typed when the user left. 68 */ 69 void logExit(SuggestionCursor suggestionCursor, int numChars); 70 71 /** 72 * Logs the latency of a suggestion query to a specific source. 73 * 74 * @param result The result of the query. 75 */ 76 void logLatency(CorpusResult result); 77 78 } 79