From beab3bbc2c977a48e3affc3e61cc2fdbb22c4ae2 Mon Sep 17 00:00:00 2001 From: Brian Attwell Date: Mon, 27 Oct 2014 12:24:49 -0700 Subject: Use improved analytics in Dialer Remove dependencies on old analytics code. Initialize analytics inside DialerApplication. Improving analytics CL #4/4 Bug: 18039620 Change-Id: I52f68e50297db2aae61d67d9bdbe66cb1d75aafc --- src/com/android/dialer/CallDetailActivity.java | 4 ++-- src/com/android/dialer/DialerApplication.java | 2 ++ src/com/android/dialer/DialtactsActivity.java | 3 ++- src/com/android/dialer/calllog/CallLogActivity.java | 4 ++-- src/com/android/dialer/calllog/CallLogFragment.java | 4 ++-- src/com/android/dialer/dialpad/DialpadFragment.java | 4 ++-- src/com/android/dialer/list/ListsFragment.java | 10 +++++----- src/com/android/dialer/list/SearchFragment.java | 3 ++- src/com/android/dialer/list/SpeedDialFragment.java | 4 ++-- src/com/android/dialer/settings/DialerSettingsActivity.java | 5 ++--- .../android/dialer/voicemail/VoicemailPlaybackFragment.java | 4 ++-- 11 files changed, 25 insertions(+), 22 deletions(-) diff --git a/src/com/android/dialer/CallDetailActivity.java b/src/com/android/dialer/CallDetailActivity.java index 2c8d4fca1..6c576508c 100644 --- a/src/com/android/dialer/CallDetailActivity.java +++ b/src/com/android/dialer/CallDetailActivity.java @@ -16,6 +16,7 @@ package com.android.dialer; +import android.app.Activity; import android.content.ContentResolver; import android.content.ContentUris; import android.content.ContentValues; @@ -66,7 +67,6 @@ import com.android.dialer.voicemail.VoicemailPlaybackFragment; import com.android.dialer.voicemail.VoicemailStatusHelper; import com.android.dialer.voicemail.VoicemailStatusHelper.StatusMessage; import com.android.dialer.voicemail.VoicemailStatusHelperImpl; -import com.android.contacts.commonbind.analytics.AnalyticsActivity; import java.util.List; @@ -76,7 +76,7 @@ import java.util.List; * This activity can be either started with the URI of a single call log entry, or with the * {@link #EXTRA_CALL_LOG_IDS} extra to specify a group of call log entries. */ -public class CallDetailActivity extends AnalyticsActivity implements ProximitySensorAware { +public class CallDetailActivity extends Activity implements ProximitySensorAware { private static final String TAG = "CallDetail"; private static final char LEFT_TO_RIGHT_EMBEDDING = '\u202A'; diff --git a/src/com/android/dialer/DialerApplication.java b/src/com/android/dialer/DialerApplication.java index e7881441a..c64530829 100644 --- a/src/com/android/dialer/DialerApplication.java +++ b/src/com/android/dialer/DialerApplication.java @@ -20,6 +20,7 @@ import android.app.Application; import com.android.contacts.common.ContactPhotoManager; import com.android.contacts.common.extensions.ExtensionsFactory; +import com.android.contacts.commonbind.analytics.AnalyticsUtil; public class DialerApplication extends Application { @@ -29,6 +30,7 @@ public class DialerApplication extends Application { public void onCreate() { super.onCreate(); ExtensionsFactory.init(getApplicationContext()); + AnalyticsUtil.initialize(this); } @Override diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java index aacf20844..13b62e42f 100644 --- a/src/com/android/dialer/DialtactsActivity.java +++ b/src/com/android/dialer/DialtactsActivity.java @@ -65,6 +65,7 @@ import com.android.contacts.common.interactions.ImportExportDialogFragment; import com.android.contacts.common.interactions.TouchPointManager; import com.android.contacts.common.list.OnPhoneNumberPickerActionListener; import com.android.contacts.common.widget.FloatingActionButtonController; +import com.android.contacts.commonbind.analytics.AnalyticsUtil; import com.android.dialer.calllog.CallLogActivity; import com.android.dialer.database.DialerDatabaseHelper; import com.android.dialer.dialpad.DialpadFragment; @@ -613,7 +614,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O } mIsDialpadShown = true; mDialpadFragment.setAnimate(animate); - mDialpadFragment.sendScreenView(); + AnalyticsUtil.sendScreenView(mDialpadFragment); final FragmentTransaction ft = getFragmentManager().beginTransaction(); ft.show(mDialpadFragment); diff --git a/src/com/android/dialer/calllog/CallLogActivity.java b/src/com/android/dialer/calllog/CallLogActivity.java index 1de3da209..c7862aee6 100644 --- a/src/com/android/dialer/calllog/CallLogActivity.java +++ b/src/com/android/dialer/calllog/CallLogActivity.java @@ -16,6 +16,7 @@ package com.android.dialer.calllog; import android.app.ActionBar; +import android.app.Activity; import android.app.Fragment; import android.app.FragmentManager; import android.content.Intent; @@ -37,9 +38,8 @@ import com.android.dialer.DialtactsActivity; import com.android.dialer.R; import com.android.dialer.voicemail.VoicemailStatusHelper; import com.android.dialer.voicemail.VoicemailStatusHelperImpl; -import com.android.contacts.commonbind.analytics.AnalyticsActivity; -public class CallLogActivity extends AnalyticsActivity implements CallLogQueryHandler.Listener { +public class CallLogActivity extends Activity implements CallLogQueryHandler.Listener { private Handler mHandler; private ViewPager mViewPager; private ViewPagerTabs mViewPagerTabs; diff --git a/src/com/android/dialer/calllog/CallLogFragment.java b/src/com/android/dialer/calllog/CallLogFragment.java index f4db08068..96c2845d8 100644 --- a/src/com/android/dialer/calllog/CallLogFragment.java +++ b/src/com/android/dialer/calllog/CallLogFragment.java @@ -22,6 +22,7 @@ import android.animation.ValueAnimator; import android.app.Activity; import android.app.DialogFragment; import android.app.KeyguardManager; +import android.app.ListFragment; import android.content.Context; import android.content.Intent; import android.database.ContentObserver; @@ -52,7 +53,6 @@ import com.android.dialer.voicemail.VoicemailStatusHelper; import com.android.dialer.voicemail.VoicemailStatusHelper.StatusMessage; import com.android.dialer.voicemail.VoicemailStatusHelperImpl; import com.android.dialerbind.ObjectFactory; -import com.android.contacts.commonbind.analytics.AnalyticsListFragment; import java.util.List; @@ -60,7 +60,7 @@ import java.util.List; * Displays a list of call log entries. To filter for a particular kind of call * (all, missed or voicemails), specify it in the constructor. */ -public class CallLogFragment extends AnalyticsListFragment +public class CallLogFragment extends ListFragment implements CallLogQueryHandler.Listener, CallLogAdapter.OnReportButtonClickListener, CallLogAdapter.CallFetcher, CallLogAdapter.CallItemExpandedListener { diff --git a/src/com/android/dialer/dialpad/DialpadFragment.java b/src/com/android/dialer/dialpad/DialpadFragment.java index c9ea25a68..0f76bd6d9 100644 --- a/src/com/android/dialer/dialpad/DialpadFragment.java +++ b/src/com/android/dialer/dialpad/DialpadFragment.java @@ -20,6 +20,7 @@ import android.app.Activity; import android.app.AlertDialog; import android.app.Dialog; import android.app.DialogFragment; +import android.app.Fragment; import android.content.ComponentName; import android.content.ContentResolver; import android.content.Context; @@ -72,7 +73,6 @@ import com.android.contacts.common.GeoUtil; import com.android.contacts.common.util.PhoneNumberFormatter; import com.android.contacts.common.util.StopWatch; import com.android.contacts.common.widget.FloatingActionButtonController; -import com.android.contacts.commonbind.analytics.AnalyticsFragment; import com.android.dialer.DialtactsActivity; import com.android.dialer.NeededForReflection; import com.android.dialer.R; @@ -91,7 +91,7 @@ import java.util.HashSet; /** * Fragment that displays a twelve-key phone dialpad. */ -public class DialpadFragment extends AnalyticsFragment +public class DialpadFragment extends Fragment implements View.OnClickListener, View.OnLongClickListener, View.OnKeyListener, AdapterView.OnItemClickListener, TextWatcher, diff --git a/src/com/android/dialer/list/ListsFragment.java b/src/com/android/dialer/list/ListsFragment.java index de501f47e..81ff07a7c 100644 --- a/src/com/android/dialer/list/ListsFragment.java +++ b/src/com/android/dialer/list/ListsFragment.java @@ -20,7 +20,7 @@ import android.widget.ListView; import com.android.contacts.common.GeoUtil; import com.android.contacts.common.list.ViewPagerTabs; -import com.android.contacts.commonbind.analytics.AnalyticsFragment; +import com.android.contacts.commonbind.analytics.AnalyticsUtil; import com.android.dialer.DialtactsActivity; import com.android.dialer.R; import com.android.dialer.calllog.CallLogAdapter; @@ -44,7 +44,7 @@ import java.util.ArrayList; * ViewPager containing the lists up above the shortcut cards and pin it against the top of the * screen. */ -public class ListsFragment extends AnalyticsFragment implements CallLogQueryHandler.Listener, +public class ListsFragment extends Fragment implements CallLogQueryHandler.Listener, CallLogAdapter.CallFetcher, ViewPager.OnPageChangeListener { private static final boolean DEBUG = DialtactsActivity.DEBUG; @@ -359,11 +359,11 @@ public class ListsFragment extends AnalyticsFragment implements CallLogQueryHand @Override public void onPageSelected(int position) { if (position == TAB_INDEX_SPEED_DIAL && mSpeedDialFragment != null) { - mSpeedDialFragment.sendScreenView(); + AnalyticsUtil.sendScreenView(mSpeedDialFragment); } else if (position == TAB_INDEX_RECENTS && mRecentsFragment != null) { - mRecentsFragment.sendScreenView(); + AnalyticsUtil.sendScreenView(mRecentsFragment); } else if (position == TAB_INDEX_ALL_CONTACTS && mAllContactsFragment != null) { - mAllContactsFragment.sendScreenView(); + AnalyticsUtil.sendScreenView(mAllContactsFragment); } final int count = mOnPageChangeListeners.size(); for (int i = 0; i < count; i++) { diff --git a/src/com/android/dialer/list/SearchFragment.java b/src/com/android/dialer/list/SearchFragment.java index 3bea170aa..c655bbe5f 100644 --- a/src/com/android/dialer/list/SearchFragment.java +++ b/src/com/android/dialer/list/SearchFragment.java @@ -31,6 +31,7 @@ import com.android.contacts.common.list.ContactListItemView; import com.android.contacts.common.list.OnPhoneNumberPickerActionListener; import com.android.contacts.common.list.PhoneNumberPickerFragment; import com.android.contacts.common.util.ViewUtil; +import com.android.contacts.commonbind.analytics.AnalyticsUtil; import com.android.dialer.DialtactsActivity; import com.android.dialer.R; import com.android.dialer.util.DialerUtils; @@ -69,7 +70,7 @@ public class SearchFragment extends PhoneNumberPickerFragment { setDarkTheme(false); setPhotoPosition(ContactListItemView.getDefaultPhotoPosition(false /* opposite */)); setUseCallableUri(true); - sendScreenView(); + AnalyticsUtil.sendScreenView(this); try { mActivityScrollListener = (OnListFragmentScrolledListener) activity; diff --git a/src/com/android/dialer/list/SpeedDialFragment.java b/src/com/android/dialer/list/SpeedDialFragment.java index fd761b758..2ca16b701 100644 --- a/src/com/android/dialer/list/SpeedDialFragment.java +++ b/src/com/android/dialer/list/SpeedDialFragment.java @@ -19,6 +19,7 @@ import android.animation.Animator; import android.animation.AnimatorSet; import android.animation.ObjectAnimator; import android.app.Activity; +import android.app.Fragment; import android.app.LoaderManager; import android.content.CursorLoader; import android.content.Loader; @@ -46,7 +47,6 @@ import com.android.contacts.common.ContactPhotoManager; import com.android.contacts.common.ContactTileLoaderFactory; import com.android.contacts.common.list.ContactTileView; import com.android.contacts.common.list.OnPhoneNumberPickerActionListener; -import com.android.contacts.commonbind.analytics.AnalyticsFragment; import com.android.dialer.R; import com.android.dialer.util.DialerUtils; @@ -56,7 +56,7 @@ import java.util.HashMap; /** * This fragment displays the user's favorite/frequent contacts in a grid. */ -public class SpeedDialFragment extends AnalyticsFragment implements OnItemClickListener, +public class SpeedDialFragment extends Fragment implements OnItemClickListener, PhoneFavoritesTileAdapter.OnDataSetChangedForAnimationListener { /** diff --git a/src/com/android/dialer/settings/DialerSettingsActivity.java b/src/com/android/dialer/settings/DialerSettingsActivity.java index 7d80ac390..758169e2d 100644 --- a/src/com/android/dialer/settings/DialerSettingsActivity.java +++ b/src/com/android/dialer/settings/DialerSettingsActivity.java @@ -7,6 +7,7 @@ import android.content.SharedPreferences; import android.os.Bundle; import android.os.UserHandle; import android.os.UserManager; +import android.preference.PreferenceActivity; import android.preference.PreferenceManager; import android.text.TextUtils; import android.view.LayoutInflater; @@ -17,14 +18,12 @@ import android.widget.ArrayAdapter; import android.widget.ListAdapter; import android.widget.TextView; -import com.android.contacts.commonbind.analytics.AnalyticsPreferenceActivity; - import com.android.dialer.DialtactsActivity; import com.android.dialer.R; import java.util.List; -public class DialerSettingsActivity extends AnalyticsPreferenceActivity { +public class DialerSettingsActivity extends PreferenceActivity { protected SharedPreferences mPreferences; private HeaderAdapter mHeaderAdapter; diff --git a/src/com/android/dialer/voicemail/VoicemailPlaybackFragment.java b/src/com/android/dialer/voicemail/VoicemailPlaybackFragment.java index 2a76ed3e2..51c15f497 100644 --- a/src/com/android/dialer/voicemail/VoicemailPlaybackFragment.java +++ b/src/com/android/dialer/voicemail/VoicemailPlaybackFragment.java @@ -20,6 +20,7 @@ import static com.android.dialer.CallDetailActivity.EXTRA_VOICEMAIL_START_PLAYBA import static com.android.dialer.CallDetailActivity.EXTRA_VOICEMAIL_URI; import android.app.Activity; +import android.app.Fragment; import android.content.ContentResolver; import android.content.Context; import android.content.Intent; @@ -39,7 +40,6 @@ import android.widget.SeekBar; import android.widget.TextView; import com.android.common.io.MoreCloseables; -import com.android.contacts.commonbind.analytics.AnalyticsFragment; import com.android.dialer.ProximitySensorAware; import com.android.dialer.R; import com.android.dialer.util.AsyncTaskExecutors; @@ -65,7 +65,7 @@ import javax.annotation.concurrent.NotThreadSafe; * methods on this class are expected to come from the main ui thread. */ @NotThreadSafe -public class VoicemailPlaybackFragment extends AnalyticsFragment { +public class VoicemailPlaybackFragment extends Fragment { private static final String TAG = "VoicemailPlayback"; private static final int NUMBER_OF_THREADS_IN_POOL = 2; private static final String[] HAS_CONTENT_PROJECTION = new String[] { -- cgit v1.2.3