• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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     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      */
logStart(int onCreateLatency, int latency, String intentSource, Corpus corpus, List<Corpus> orderedCorpora)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 suggestionId Suggestion ID; 0-based position of the suggestion in the UI if the list
47      *      is flat.
48      * @param suggestionCursor all the suggestions shown in the UI.
49      * @param queriedCorpora all corpora that were queried to produce the suggestions in
50      *        {@code suggestionCursor}, ordered by rank.
51      * @param clickType One of the SUGGESTION_CLICK_TYPE constants.
52      */
logSuggestionClick(long suggestionId, SuggestionCursor suggestionCursor, Collection<Corpus> queriedCorpora, int clickType)53     void logSuggestionClick(long suggestionId, SuggestionCursor suggestionCursor,
54             Collection<Corpus> queriedCorpora, int clickType);
55 
56     /**
57      * The user launched a search.
58      *
59      * @param startMethod One of {@link #SEARCH_METHOD_BUTTON} or {@link #SEARCH_METHOD_KEYBOARD}.
60      * @param numChars The number of characters in the query.
61      */
logSearch(Corpus corpus, int startMethod, int numChars)62     void logSearch(Corpus corpus, int startMethod, int numChars);
63 
64     /**
65      * The user launched a voice search.
66      */
logVoiceSearch(Corpus corpus)67     void logVoiceSearch(Corpus corpus);
68 
69     /**
70      * The user left QSB without performing any action (click suggestions, search or voice search).
71      *
72      * @param suggestionCursor all the suggestions shown in the UI when the user left
73      * @param numChars The number of characters in the query typed when the user left.
74      */
logExit(SuggestionCursor suggestionCursor, int numChars)75     void logExit(SuggestionCursor suggestionCursor, int numChars);
76 
77     /**
78      * Logs the latency of a suggestion query to a specific source.
79      *
80      * @param result The result of the query.
81      */
logLatency(CorpusResult result)82     void logLatency(CorpusResult result);
83 
84 }
85