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