diff options
author | Yorke Lee <yorkelee@google.com> | 2014-11-04 10:29:32 -0800 |
---|---|---|
committer | Yorke Lee <yorkelee@google.com> | 2014-11-05 15:28:52 -0800 |
commit | 7ee5c422e36cf3d40cbd24bbb5b87754b4820d02 (patch) | |
tree | faba7aa255fc2dee3e09b440eefc8d5991ec68d1 /src/com/android/dialer/DialtactsActivity.java | |
parent | bd421b68ec17cd33ee3dd1d2613f5637299e57d9 (diff) |
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
Diffstat (limited to 'src/com/android/dialer/DialtactsActivity.java')
-rw-r--r-- | src/com/android/dialer/DialtactsActivity.java | 28 |
1 files changed, 28 insertions, 0 deletions
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,12 +478,27 @@ 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) { hideDialpadAndSearchUi(); @@ -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(); } |