Home | History | Annotate | Download | only in analytics
      1 /*
      2  * Copyright (C) 2015 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.tv.analytics;
     18 
     19 import com.android.tv.TimeShiftManager;
     20 import com.android.tv.data.Channel;
     21 
     22 /**
     23  * Interface for sending user activity for analysis.
     24  */
     25 public interface Tracker {
     26 
     27     /**
     28      * Send the number of channels that doesn't change often.
     29      *
     30      * <p>Because the number of channels does not change often, this method should not be called
     31      * more than once a day.
     32      *
     33      * @param browsableChannelCount the number of browsable channels.
     34      * @param totalChannelCount the number of all channels.
     35      */
     36     void sendChannelCount(int browsableChannelCount, int totalChannelCount);
     37 
     38     /**
     39      * Send data that doesn't change often.
     40      *
     41      * <p>Because configuration info does not change often, this method should not be called more
     42      * than once a day.
     43      *
     44      * @param info the configuration info.
     45      */
     46     void sendConfigurationInfo(ConfigurationInfo info);
     47 
     48     /**
     49      * Sends tracking information for starting the MainActivity.
     50      */
     51     void sendMainStart();
     52 
     53     /**
     54      * Sends tracking for stopping MainActivity.
     55      *
     56      * @param durationMs The time main activity was "started" in milliseconds.
     57      */
     58     void sendMainStop( long durationMs);
     59 
     60     /**
     61      * Sets the screen name and sends a ScreenView hit.
     62      */
     63     void sendScreenView(String screenName);
     64 
     65     /**
     66      * Sends tracking information for starting to view a channel.
     67      *
     68      * @param channel the current channel
     69      * @param tunedByRecommendation True, if the channel was tuned by the recommendation.
     70      */
     71     void sendChannelViewStart(Channel channel, boolean tunedByRecommendation);
     72 
     73     /**
     74      * Sends tracking information for tuning to a channel.
     75      *
     76      * @param channel The channel that was being tuned.
     77      * @param durationMs The time the channel took to tune in milliseconds.
     78      */
     79     void sendChannelTuneTime(Channel channel, long durationMs);
     80 
     81     /**
     82      * Sends tracking information for stopping viewing a channel.
     83      *
     84      * @param channel The channel that was being watched.
     85      * @param durationMs The time the channel was watched in milliseconds.
     86      */
     87     void sendChannelViewStop(Channel channel, long durationMs);
     88 
     89     /**
     90      * Sends tracking information for pressing channel up.
     91      */
     92     void sendChannelUp();
     93 
     94     /**
     95      * Sends tracking information for pressing channel down.
     96      */
     97     void sendChannelDown();
     98 
     99     /**
    100      * Sends tracking information for showing the main menu.
    101      */
    102     void sendShowMenu();
    103 
    104     /**
    105      * Sends tracking for hiding the main menu.
    106      *
    107      * @param durationMs The duration the menu was shown in milliseconds.
    108      */
    109     void sendHideMenu(long durationMs);
    110 
    111     /**
    112      * Sends tracking for clicking a menu item.
    113      *
    114      * <p><strong>WARNING</strong> callers must ensure no PII is included in the label.
    115      *
    116      * @param label The label of the item clicked.
    117      */
    118     void sendMenuClicked(String label);
    119 
    120     /**
    121      * Sends tracking for clicking a menu item.
    122      *
    123      * <p>NOTE: the tracker will use the english version of the label.
    124      *
    125      * @param labelResId The resource Id of the label for the menu item.
    126      */
    127     void sendMenuClicked(int labelResId);
    128 
    129     /**
    130      * Sends tracking information for showing the Electronic Program Guide (EPG).
    131      */
    132     void sendShowEpg();
    133 
    134     /**
    135      * Sends tracking information for clicking an Electronic Program Guide (EPG) item.
    136      */
    137     void sendEpgItemClicked();
    138 
    139     /**
    140      * Sends tracking for hiding the Electronic Program Guide (EPG).
    141      *
    142      * @param durationMs The duration the EPG was shown in milliseconds.
    143      */
    144     void sendHideEpg(long durationMs);
    145 
    146     /**
    147      * Sends tracking information for showing the channel switch view.
    148      */
    149     void sendShowChannelSwitch();
    150 
    151     /**
    152      * Sends tracking for hiding the channel switch view.
    153      *
    154      * @param durationMs The duration the channel switch view was shown in milliseconds.
    155      */
    156     void sendHideChannelSwitch(long durationMs);
    157 
    158     /**
    159      * Sends tracking for each channel number or delimiter pressed.
    160      */
    161     void sendChannelNumberInput();
    162 
    163     /**
    164      * Sends tracking for navigating during channel number input.
    165      *
    166      * <p>This is sent once per channel input viewing.
    167      */
    168     void sendChannelInputNavigated();
    169 
    170     /**
    171      * Sends tracking for channel clicked.
    172      */
    173     void sendChannelNumberItemClicked();
    174 
    175     /**
    176      * Sends tracking for channel chosen (tuned) because the channel switch view timed out.
    177      */
    178     void sendChannelNumberItemChosenByTimeout();
    179 
    180     /**
    181      * Sends tracking for the reason video is unavailable on a channel.
    182      */
    183     void sendChannelVideoUnavailable(Channel channel, int reason);
    184 
    185     /**
    186      * Sends HDMI AC3 passthrough capabilities.
    187      *
    188      * @param isSupported {@code true} if the feature is supported; otherwise {@code false}.
    189      */
    190     void sendAc3PassthroughCapabilities(boolean isSupported);
    191 
    192     /**
    193      * Sends tracking for input a connection failure.
    194      * <p><strong>WARNING</strong> callers must ensure no PII is included in the inputId.
    195      *
    196      * @param inputId the input the failure happened on
    197      */
    198     void sendInputConnectionFailure(String inputId);
    199 
    200     /**
    201      * Sends tracking for input disconnected.
    202      * <p><strong>WARNING</strong> callers must ensure no PII is included in the inputId.
    203      *
    204      * @param inputId the input the failure happened on
    205      */
    206     void sendInputDisconnected(String inputId);
    207 
    208     /**
    209      * Sends tracking information for showing the input selection view.
    210      */
    211     void sendShowInputSelection();
    212 
    213     /**
    214      * Sends tracking for hiding the input selection view.
    215      *
    216      * @param durationMs The duration the input selection view was shown in milliseconds.
    217      */
    218     void sendHideInputSelection(long durationMs);
    219 
    220     /**
    221      * Sends tracking for input selected by the selection view.
    222      *
    223      * <p><strong>WARNING</strong> callers must ensure no PII is included in the label.
    224      *
    225      * @param inputLabel the label of the TV input selected
    226      */
    227     void sendInputSelected(String inputLabel);
    228 
    229     /**
    230      * Sends tracking information for showing a side panel.
    231      *
    232      * @param trackerLabel the label of the side panel.
    233      */
    234     void sendShowSidePanel(HasTrackerLabel trackerLabel);
    235 
    236     /**
    237      * Sends tracking for hiding a side panel.
    238      *
    239      * @param trackerLabel The label of the side panel
    240      * @param durationMs The duration the side panel was shown in milliseconds.
    241      */
    242     void sendHideSidePanel(HasTrackerLabel trackerLabel, long durationMs);
    243 
    244     /**
    245      * Sends time shift action (pause, ff, etc).
    246      *
    247      * @param actionId The {@link com.android.tv.TimeShiftManager.TimeShiftActionId}
    248      */
    249     void sendTimeShiftAction(@TimeShiftManager.TimeShiftActionId int actionId);
    250 }
    251