Home | History | Annotate | Download | only in quicksearchbox
      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 
     20 
     21 /**
     22  * Interface for logging implementations.
     23  */
     24 public interface Logger {
     25 
     26     public static final int SEARCH_METHOD_BUTTON = 0;
     27     public static final int SEARCH_METHOD_KEYBOARD = 1;
     28 
     29     public static final int SUGGESTION_CLICK_TYPE_LAUNCH = 0;
     30     public static final int SUGGESTION_CLICK_TYPE_REFINE = 1;
     31     public static final int SUGGESTION_CLICK_TYPE_QUICK_CONTACT = 2;
     32 
     33     /**
     34      * Called when QSB has started.
     35      *
     36      * @param latency User-visible start-up latency in milliseconds.
     37      */
     38     void logStart(int onCreateLatency, int latency, String intentSource);
     39 
     40     /**
     41      * Called when a suggestion is clicked.
     42      *
     43      * @param suggestionId Suggestion ID; 0-based position of the suggestion in the UI if the list
     44      *      is flat.
     45      * @param suggestionCursor all the suggestions shown in the UI.
     46      * @param clickType One of the SUGGESTION_CLICK_TYPE constants.
     47      */
     48     void logSuggestionClick(long suggestionId, SuggestionCursor suggestionCursor,  int clickType);
     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(int startMethod, int numChars);
     57 
     58     /**
     59      * The user launched a voice search.
     60      */
     61     void logVoiceSearch();
     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(SourceResult result);
     77 
     78 }
     79