From 8bea0950ff04891b7aaf58bb4ca758010c813fb4 Mon Sep 17 00:00:00 2001 From: Yorke Lee Date: Fri, 6 Nov 2015 10:35:30 -0800 Subject: More work to hook up screen event logging * Replace inlined strings with consolidated string constants * Log event when import/export to contacts dialog is shown Bug: 23164804 Change-Id: I45ba0663f28bd7ea41c5c33c8a5106dc83cd41f3 --- src/com/android/dialer/DialtactsActivity.java | 8 ++- .../android/dialer/calllog/CallLogActivity.java | 7 ++- src/com/android/dialer/list/ListsFragment.java | 5 +- .../android/dialer/logging/ScreenTagConstants.java | 73 ++++++++++++++++++++++ 4 files changed, 86 insertions(+), 7 deletions(-) create mode 100644 src/com/android/dialer/logging/ScreenTagConstants.java (limited to 'src/com/android') diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java index 4fa4bc2d7..3cae8a19d 100644 --- a/src/com/android/dialer/DialtactsActivity.java +++ b/src/com/android/dialer/DialtactsActivity.java @@ -82,6 +82,7 @@ import com.android.dialer.list.SearchFragment; import com.android.dialer.list.SmartDialSearchFragment; import com.android.dialer.list.SpeedDialFragment; import com.android.dialer.logging.Logger; +import com.android.dialer.logging.ScreenTagConstants; import com.android.dialer.settings.DialerSettingsActivity; import com.android.dialer.util.DialerUtils; import com.android.dialer.util.IntentUtil; @@ -527,7 +528,8 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O // This is only called when the activity goes from resumed -> paused -> resumed, so it // will not cause an extra view to be sent out on rotation if (mIsDialpadShown) { - Logger.logFragmentView(mDialpadFragment); + Logger.logScreenView(ScreenTagConstants.DIALPAD, this, + ScreenTagConstants.DIALPAD_DIALER); } mIsRestarting = false; } @@ -682,6 +684,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O ImportExportDialogFragment.show(getFragmentManager(), true, DialtactsActivity.class, ImportExportDialogFragment.EXPORT_MODE_DEFAULT); } + Logger.logScreenView(ScreenTagConstants.IMPORT_EXPORT_CONTACTS, this, null); return true; case R.id.menu_clear_frequents: ClearFrequentsDialog.show(getFragmentManager()); @@ -744,7 +747,8 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O mDialpadFragment.setAnimate(animate); // logScreenView is used here explicitly to provide the activity as the DialpadFragment // might not have been attached yet. - Logger.logScreenView(DialpadFragment.class.getSimpleName(), this, null); + Logger.logScreenView(ScreenTagConstants.DIALPAD, this, + ScreenTagConstants.DIALPAD_DIALER); ft.commit(); if (animate) { diff --git a/src/com/android/dialer/calllog/CallLogActivity.java b/src/com/android/dialer/calllog/CallLogActivity.java index f6defcfd9..fb1a4fb0f 100644 --- a/src/com/android/dialer/calllog/CallLogActivity.java +++ b/src/com/android/dialer/calllog/CallLogActivity.java @@ -41,6 +41,7 @@ import com.android.dialer.DialtactsActivity; import com.android.dialer.R; import com.android.dialer.TransactionSafeActivity; import com.android.dialer.logging.Logger; +import com.android.dialer.logging.ScreenTagConstants; import com.android.dialer.util.DialerUtils; public class CallLogActivity extends TransactionSafeActivity implements ViewPager.OnPageChangeListener { @@ -223,7 +224,7 @@ public class CallLogActivity extends TransactionSafeActivity implements ViewPage } private void sendScreenViewForChildFragment(int position) { - Logger.logScreenView(CallLogFragment.class.getSimpleName(), this, + Logger.logScreenView(ScreenTagConstants.CALL_LOG, this, getFragmentTagForPosition(position)); } @@ -234,9 +235,9 @@ public class CallLogActivity extends TransactionSafeActivity implements ViewPage private String getFragmentTagForPosition(int position) { switch (position) { case TAB_INDEX_ALL: - return "All"; + return ScreenTagConstants.CALL_LOG_ALL; case TAB_INDEX_MISSED: - return "Missed"; + return ScreenTagConstants.CALL_LOG_MISSED; } return null; } diff --git a/src/com/android/dialer/list/ListsFragment.java b/src/com/android/dialer/list/ListsFragment.java index 08a23732f..f3edd4501 100644 --- a/src/com/android/dialer/list/ListsFragment.java +++ b/src/com/android/dialer/list/ListsFragment.java @@ -46,6 +46,7 @@ import com.android.dialer.calllog.CallLogFragment; import com.android.dialer.calllog.CallLogQueryHandler; import com.android.dialer.calllog.ContactInfoHelper; import com.android.dialer.logging.Logger; +import com.android.dialer.logging.ScreenTagConstants; import com.android.dialer.util.DialerUtils; import com.android.dialer.voicemail.VoicemailStatusHelper; import com.android.dialer.voicemail.VoicemailStatusHelperImpl; @@ -411,14 +412,14 @@ public class ListsFragment extends Fragment break; case TAB_INDEX_HISTORY: fragmentName = CallLogFragment.class.getSimpleName(); - tag = "History"; + tag = ScreenTagConstants.CALL_LOG_HISTORY; break; case TAB_INDEX_ALL_CONTACTS: fragmentName = AllContactsFragment.class.getSimpleName(); break; case TAB_INDEX_VOICEMAIL: fragmentName = CallLogFragment.class.getSimpleName(); - tag = "Voicemail"; + tag = ScreenTagConstants.CALL_LOG_VOICEMAIL; default: return; } diff --git a/src/com/android/dialer/logging/ScreenTagConstants.java b/src/com/android/dialer/logging/ScreenTagConstants.java new file mode 100644 index 000000000..5175cc56f --- /dev/null +++ b/src/com/android/dialer/logging/ScreenTagConstants.java @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2015 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.android.dialer.logging; + +import com.google.android.dialer.settings.GoogleDialerSettingsActivity; + +import com.android.contacts.common.dialog.ClearFrequentsDialog; +import com.android.contacts.common.interactions.ImportExportDialogFragment; +import com.android.dialer.calllog.CallLogFragment; +import com.android.dialer.dialpad.DialpadFragment; +import com.android.dialer.list.AllContactsFragment; +import com.android.dialer.list.RegularSearchFragment; +import com.android.dialer.list.SmartDialSearchFragment; +import com.android.dialer.list.SpeedDialFragment; +import com.android.incallui.AnswerFragment; +import com.android.incallui.CallCardFragment; +import com.android.incallui.ConferenceManagerFragment; + +/** + * Central repository of all string constants used to identify screens/fragments/dialogs for + * logging purposes. + */ +public class ScreenTagConstants { + /** + * Unique identifiers for each screen that is displayed in the Dialer + */ + public static final String DIALPAD = DialpadFragment.class.getSimpleName(); + public static final String SPEED_DIAL = SpeedDialFragment.class.getSimpleName(); + public static final String CALL_LOG = CallLogFragment.class.getSimpleName(); + public static final String ALL_CONTACTS = AllContactsFragment.class.getSimpleName(); + public static final String REGULAR_SEARCH = RegularSearchFragment.class.getSimpleName(); + public static final String SMART_DIAL_SEARCH = SmartDialSearchFragment.class.getSimpleName(); + public static final String SETTINGS = GoogleDialerSettingsActivity.class.getSimpleName(); + public static final String IMPORT_EXPORT_CONTACTS = + ImportExportDialogFragment.class.getSimpleName(); + public static final String CLEAR_FREQUENTS = ClearFrequentsDialog.class.getSimpleName(); + public static final String SEND_FEEDBACK = "SendFeedback"; + public static final String INCALL = CallCardFragment.class.getSimpleName(); + public static final String INCOMING_CALL = AnswerFragment.class.getSimpleName(); + public static final String CONFERENCE_MANAGEMENT = + ConferenceManagerFragment.class.getSimpleName(); + + /** + * Additional constants that allow disambiguation between similar fragments in different + * activities. + */ + // The dialpad in DialtactsActivity + public static final String DIALPAD_DIALER = "Dialer"; + // The dialpad in InCallActivity + public static final String DIALPAD_INCALL = "InCall"; + + // The HISTORY tab in DialtactsActivity + public static final String CALL_LOG_HISTORY = "History"; + // The VOICEMAIL tab in DialtactsActivity + public static final String CALL_LOG_VOICEMAIL = "Voicemail"; + // The ALL tab in CallLogActivity + public static final String CALL_LOG_ALL = "All"; + // The MISSED tab in CallLogActivity + public static final String CALL_LOG_MISSED = "Missed"; +} -- cgit v1.2.3