From 7ee5c422e36cf3d40cbd24bbb5b87754b4820d02 Mon Sep 17 00:00:00 2001 From: Yorke Lee Date: Tue, 4 Nov 2014 10:29:32 -0800 Subject: Improve Dialer analytics * Send screen view for first fragment loaded inside ListsFragment * Send screen view for voicemail playback fragment * Send screen view for currently active fragment when activity is restarted * Don't send spurious screen views on rotation * Send screen views for call log fragments in call log activity, and differentiate between them with a tag Bug: 18158037 Change-Id: I09fda53db33f6a6acc4a3b477de992aa94921c71 --- src/com/android/dialer/DialtactsActivity.java | 28 +++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'src/com/android/dialer/DialtactsActivity.java') diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java index 241080fa5..9c8137e1c 100644 --- a/src/com/android/dialer/DialtactsActivity.java +++ b/src/com/android/dialer/DialtactsActivity.java @@ -182,6 +182,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O * be commited. */ private boolean mStateSaved; + private boolean mIsRestarting; private boolean mInDialpadSearch; private boolean mInRegularSearch; private boolean mClearSearchOnPause; @@ -477,11 +478,26 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O mShowDialpadOnResume = false; } mFirstLaunch = false; + + if (mIsRestarting) { + // 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) { + AnalyticsUtil.sendScreenView(mDialpadFragment, this); + } + mIsRestarting = false; + } prepareVoiceSearchButton(); mDialerDatabaseHelper.startSmartDialUpdateThread(); updateFloatingActionButtonControllerAlignment(false /* animate */); } + @Override + protected void onRestart() { + super.onRestart(); + mIsRestarting = true; + } + @Override protected void onPause() { if (mClearSearchOnPause) { @@ -624,6 +640,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O } mIsDialpadShown = true; mDialpadFragment.setAnimate(animate); + mListsFragment.setUserVisibleHint(false); AnalyticsUtil.sendScreenView(mDialpadFragment); final FragmentTransaction ft = getFragmentManager().beginTransaction(); @@ -672,6 +689,8 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O } mIsDialpadShown = false; mDialpadFragment.setAnimate(animate); + mListsFragment.setUserVisibleHint(true); + mListsFragment.sendScreenViewForCurrentPosition(); updateSearchFragmentPosition(); @@ -898,6 +917,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O transaction.commit(); mListsFragment.getView().animate().alpha(0).withLayer(); + mListsFragment.setUserVisibleHint(false); } /** @@ -923,6 +943,14 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O transaction.commit(); mListsFragment.getView().animate().alpha(1).withLayer(); + if (!mDialpadFragment.isVisible()) { + // If the dialpad fragment wasn't previously visible, then send a screen view because + // we are exiting regular search. Otherwise, the screen view will be sent by + // {@link #hideDialpadFragment}. + mListsFragment.sendScreenViewForCurrentPosition(); + mListsFragment.setUserVisibleHint(true); + } + mActionBarController.onSearchUiExited(); } -- cgit v1.2.3