• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2016 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5  * in compliance with the License. You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software distributed under the License
10  * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11  * or implied. See the License for the specific language governing permissions and limitations under
12  * the License.
13  */
14 
15 package com.android.dialer.logging;
16 
17 import android.app.Activity;
18 import android.widget.QuickContactBadge;
19 import com.google.auto.value.AutoValue;
20 import java.util.Collection;
21 
22 /** Allows the container application to gather analytics. */
23 public interface LoggingBindings {
24 
25   /**
26    * Logs an DialerImpression event that's not associated with a specific call.
27    *
28    * @param dialerImpression an integer representing what event occurred.
29    */
logImpression(DialerImpression.Type dialerImpression)30   void logImpression(DialerImpression.Type dialerImpression);
31 
32   /**
33    * Logs an impression for a general dialer event that's not associated with a specific call.
34    *
35    * @param dialerImpression an integer representing what event occurred.
36    */
37   @Deprecated
logImpression(int dialerImpression)38   void logImpression(int dialerImpression);
39 
40   /**
41    * Logs an impression for a general dialer event that's associated with a specific call.
42    *
43    * @param dialerImpression an integer representing what event occurred.
44    * @param callId unique ID of the call.
45    * @param callStartTimeMillis the absolute time when the call started.
46    */
logCallImpression( DialerImpression.Type dialerImpression, String callId, long callStartTimeMillis)47   void logCallImpression(
48       DialerImpression.Type dialerImpression, String callId, long callStartTimeMillis);
49 
50   /**
51    * Logs an interaction that occurred.
52    *
53    * @param interaction an integer representing what interaction occurred.
54    * @see com.android.dialer.logging.InteractionEvent
55    */
logInteraction(InteractionEvent.Type interaction)56   void logInteraction(InteractionEvent.Type interaction);
57 
58   /**
59    * Logs an event indicating that a screen was displayed.
60    *
61    * @param screenEvent an integer representing the displayed screen.
62    * @param activity Parent activity of the displayed screen.
63    * @see com.android.dialer.logging.ScreenEvent
64    */
logScreenView(com.android.dialer.logging.ScreenEvent.Type screenEvent, Activity activity)65   void logScreenView(com.android.dialer.logging.ScreenEvent.Type screenEvent, Activity activity);
66 
67   /** Logs the composition of contact tiles in the speed dial tab. */
logSpeedDialContactComposition( int counter, int starredContactsCount, int pinnedContactsCount, int multipleNumbersContactsCount, int contactsWithPhotoCount, int contactsWithNameCount, int lightbringerReachableContactsCount)68   void logSpeedDialContactComposition(
69       int counter,
70       int starredContactsCount,
71       int pinnedContactsCount,
72       int multipleNumbersContactsCount,
73       int contactsWithPhotoCount,
74       int contactsWithNameCount,
75       int lightbringerReachableContactsCount);
76 
77   /** Logs a hit event to the analytics server. */
sendHitEventAnalytics(String category, String action, String label, long value)78   void sendHitEventAnalytics(String category, String action, String label, long value);
79 
80   /** Logs where a quick contact badge is clicked */
logQuickContactOnTouch( QuickContactBadge quickContact, InteractionEvent.Type interactionEvent, boolean shouldPerformClick)81   void logQuickContactOnTouch(
82       QuickContactBadge quickContact,
83       InteractionEvent.Type interactionEvent,
84       boolean shouldPerformClick);
85 
86   /** Logs People Api lookup result with error */
logPeopleApiLookupReportWithError( long latency, int httpResponseCode, PeopleApiLookupError.Type errorType)87   void logPeopleApiLookupReportWithError(
88       long latency, int httpResponseCode, PeopleApiLookupError.Type errorType);
89 
90   /** Logs successful People Api lookup result */
logSuccessfulPeopleApiLookupReport(long latency, int httpResponseCode)91   void logSuccessfulPeopleApiLookupReport(long latency, int httpResponseCode);
92 
93   /** Logs a call auto-blocked in call screening. */
logAutoBlockedCall(String phoneNumber)94   void logAutoBlockedCall(String phoneNumber);
95 
96   /** Logs annotated call log metrics. */
logAnnotatedCallLogMetrics(int invalidNumbersInCallLog)97   void logAnnotatedCallLogMetrics(int invalidNumbersInCallLog);
98 
99   /** Logs annotated call log metrics. */
logAnnotatedCallLogMetrics(int numberRowsThatDidPop, int numberRowsThatDidNotPop)100   void logAnnotatedCallLogMetrics(int numberRowsThatDidPop, int numberRowsThatDidNotPop);
101 
102   /** Logs contacts provider metrics. */
logContactsProviderMetrics(Collection<ContactsProviderMatchInfo> matchInfos)103   void logContactsProviderMetrics(Collection<ContactsProviderMatchInfo> matchInfos);
104 
105   /** Input type for {@link #logContactsProviderMetrics(Collection)}. */
106   @AutoValue
107   abstract class ContactsProviderMatchInfo {
matchedContact()108     public abstract boolean matchedContact();
109 
inputNumberValid()110     public abstract boolean inputNumberValid();
111 
inputNumberLength()112     public abstract int inputNumberLength();
113 
matchedNumberLength()114     public abstract int matchedNumberLength();
115 
inputNumberHasPostdialDigits()116     public abstract boolean inputNumberHasPostdialDigits();
117 
matchedNumberHasPostdialDigits()118     public abstract boolean matchedNumberHasPostdialDigits();
119 
builder()120     public static Builder builder() {
121       return new AutoValue_LoggingBindings_ContactsProviderMatchInfo.Builder()
122           .setMatchedContact(false)
123           .setMatchedNumberLength(0)
124           .setMatchedNumberHasPostdialDigits(false);
125     }
126 
127     /** Builder. */
128     @AutoValue.Builder
129     public abstract static class Builder {
setMatchedContact(boolean value)130       public abstract Builder setMatchedContact(boolean value);
131 
setInputNumberValid(boolean value)132       public abstract Builder setInputNumberValid(boolean value);
133 
setInputNumberLength(int value)134       public abstract Builder setInputNumberLength(int value);
135 
setMatchedNumberLength(int value)136       public abstract Builder setMatchedNumberLength(int value);
137 
setInputNumberHasPostdialDigits(boolean value)138       public abstract Builder setInputNumberHasPostdialDigits(boolean value);
139 
setMatchedNumberHasPostdialDigits(boolean value)140       public abstract Builder setMatchedNumberHasPostdialDigits(boolean value);
141 
build()142       public abstract ContactsProviderMatchInfo build();
143     }
144   }
145 }
146