• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1  /*
2   * Copyright (C) 2018 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.dialer.metrics;
18  
19  import android.app.Application;
20  import android.support.annotation.Nullable;
21  
22  /** Logs metrics. */
23  public interface Metrics {
24  
25    String APPLICATION_ON_CREATE_EVENT_NAME = "Application.onCreate";
26    String DIALTACTS_ON_CREATE_EVENT_NAME = "GoogleDialtactsActivity.onCreate";
27    String MAIN_ACTIVITY_ON_CREATE_EVENT_NAME = "GoogleMainActivity.onCreate";
28    String ON_CALL_ADDED_TO_ON_INCALL_UI_SHOWN_INCOMING =
29        "CallList.onCallAdded_To_InCallActivity.onCreate_Incoming";
30    String ON_CALL_ADDED_TO_ON_INCALL_UI_SHOWN_OUTGOING =
31        "CallList.onCallAdded_To_InCallActivity.onCreate_Outgoing";
32    String DIALTACTS_ON_RESUME_MEMORY_EVENT_NAME = "GoogleDialtactsActivity.onResume";
33    String OLD_MAIN_ACTIVITY_PEER_ON_RESUME_MEMORY_EVENT_NAME = "OldMainActivityPeer.onResume";
34    String INCALL_ACTIVITY_ON_RESUME_MEMORY_EVENT_NAME = "IncallActivity.OnResume";
35    String INCALL_ACTIVITY_ON_STOP_MEMORY_EVENT_NAME = "IncallActivity.OnStop";
36    String OLD_CALL_LOG_JANK_EVENT_NAME = "OldCallLog.Jank";
37    String NEW_CALL_LOG_JANK_EVENT_NAME = "NewCallLog.Jank";
38  
39    // Events related to refreshing the annotated call log.
40    String NEW_CALL_LOG_COALESCE = "NewCallLog.Coalesce";
41    String ANNOTATED_CALL_LOG_NOT_DIRTY = "RefreshAnnotatedCallLogReceiver.NotDirty";
42    String ANNOTATED_CALL_LOG_CHANGES_NEEDED = "RefreshAnnotatedCallLogReceiver.ChangesNeeded";
43    String ANNOTATED_LOG_NO_CHANGES_NEEDED = "RefreshAnnotatedCallLogReceiver.NoChangesNeeded";
44    String ANNOTATED_CALL_LOG_FORCE_REFRESH_CHANGES_NEEDED =
45        "RefreshAnnotatedCallLogReceiver.ForceRefreshChangesNeeded";
46    String NEW_CALL_LOG_FORCE_REFRESH_NO_CHANGES_NEEDED =
47        "RefreshAnnotatedCallLogReceiver.ForceRefreshNoChangesNeeded";
48  
49    String INITIAL_FILL_EVENT_NAME = "RefreshAnnotatedCallLog.Initial.Fill";
50    String INITIAL_ON_SUCCESSFUL_FILL_EVENT_NAME = "RefreshAnnotatedCallLog.Initial.OnSuccessfulFill";
51    String INITIAL_APPLY_MUTATIONS_EVENT_NAME = "RefreshAnnotatedCallLog.Initial.ApplyMutations";
52  
53    String IS_DIRTY_EVENT_NAME = "RefreshAnnotatedCallLog.IsDirty";
54    String FILL_EVENT_NAME = "RefreshAnnotatedCallLog.Fill";
55    String ON_SUCCESSFUL_FILL_EVENT_NAME = "RefreshAnnotatedCallLog.OnSuccessfulFill";
56    String APPLY_MUTATIONS_EVENT_NAME = "RefreshAnnotatedCallLog.ApplyMutations";
57  
58    // These templates are prefixed with a CallLogDataSource or PhoneLookup simple class name.
59    String INITIAL_FILL_TEMPLATE = "%s.Initial.Fill";
60    String INITIAL_GET_MOST_RECENT_INFO_TEMPLATE = "%s.Initial.GetMostRecentInfo";
61    String INITIAL_ON_SUCCESSFUL_FILL_TEMPLATE = "%s.Initial.OnSuccessfulFill";
62    String INITIAL_ON_SUCCESSFUL_BULK_UPDATE_TEMPLATE = "%s.Initial.OnSuccessfulBulkUpdate";
63  
64    String IS_DIRTY_TEMPLATE = "%s.IsDirty";
65    String FILL_TEMPLATE = "%s.Fill";
66    String GET_MOST_RECENT_INFO_TEMPLATE = "%s.GetMostRecentInfo";
67    String ON_SUCCESSFUL_FILL_TEMPLATE = "%s.OnSuccessfulFill";
68    String ON_SUCCESSFUL_BULK_UPDATE_TEMPLATE = "%s.OnSuccessfulBulkUpdate";
69    String LOOKUP_FOR_CALL_TEMPLATE = "%s.LookupForCall";
70    String LOOKUP_FOR_NUMBER_TEMPLATE = "%s.LookupForNumber";
71  
72    /** Start a timer. */
startTimer(String timerEventName)73    void startTimer(String timerEventName);
74  
75    /**
76     * Starts a timer for which the name is not yet known.
77     *
78     * @return opaque identifier for the event which should be provided back to {@link
79     *     #stopUnnamedTimer(int, String)} to stop the timer. Null if the timer cannot be started, for
80     *     example because the user is locked.
81     */
82    @Nullable
startUnnamedTimer()83    Integer startUnnamedTimer();
84  
85    /**
86     * Stop a timer which was started with {@link #startUnnamedTimer()}.
87     *
88     * @param timerId the value returned in the corresponding call to {@link #startUnnamedTimer()}
89     */
stopUnnamedTimer(int timerId, String timerEventName)90    void stopUnnamedTimer(int timerId, String timerEventName);
91  
92    /** Stop a timer. */
stopTimer(String timerEventName)93    void stopTimer(String timerEventName);
94  
95    /** Start a jank recorder. */
startJankRecorder(String eventName)96    void startJankRecorder(String eventName);
97  
98    /** Stop a jank recorder. */
stopJankRecorder(String eventName)99    void stopJankRecorder(String eventName);
100  
101    /** Record memory. */
recordMemory(String memoryEventName)102    void recordMemory(String memoryEventName);
103  
104    /** Record battery. */
recordBattery(String batteryEventName)105    void recordBattery(String batteryEventName);
106  
107    /** Initiazer for metrics. */
108    interface Initializer {
109      /** Initialize metrics for the application . */
initialize(Application application)110      void initialize(Application application);
111    }
112  }
113