From f5554ceb3c152949b4b6278b7f5e1522148a574c Mon Sep 17 00:00:00 2001 From: Yorke Lee Date: Tue, 27 Jan 2015 14:46:02 -0800 Subject: Add systrace events to track Dialer startup performance Bug: 18431193 Change-Id: I92db4ae61405d8d8445b72e7ac0daa0794af8335 --- src/com/android/dialer/dialpad/DialpadFragment.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src/com/android/dialer/dialpad/DialpadFragment.java') diff --git a/src/com/android/dialer/dialpad/DialpadFragment.java b/src/com/android/dialer/dialpad/DialpadFragment.java index f1112f175..71b9ae822 100644 --- a/src/com/android/dialer/dialpad/DialpadFragment.java +++ b/src/com/android/dialer/dialpad/DialpadFragment.java @@ -36,6 +36,7 @@ import android.media.AudioManager; import android.media.ToneGenerator; import android.net.Uri; import android.os.Bundle; +import android.os.Trace; import android.provider.Contacts.People; import android.provider.Contacts.Phones; import android.provider.Contacts.PhonesColumns; @@ -102,7 +103,7 @@ public class DialpadFragment extends Fragment AdapterView.OnItemClickListener, TextWatcher, PopupMenu.OnMenuItemClickListener, DialpadKeyButton.OnPressedListener { - private static final String TAG = DialpadFragment.class.getSimpleName(); + private static final String TAG = "DialpadFragment"; /** * LinearLayout with getter and setter methods for the translationY property using floats, @@ -315,6 +316,7 @@ public class DialpadFragment extends Fragment @Override public void onCreate(Bundle state) { + Trace.beginSection(TAG + " onCreate"); super.onCreate(state); mFirstLaunch = true; mCurrentCountryIso = GeoUtil.getCurrentCountryIso(getActivity()); @@ -341,14 +343,21 @@ public class DialpadFragment extends Fragment mCallStateReceiver = new CallStateReceiver(); ((Context) getActivity()).registerReceiver(mCallStateReceiver, callStateIntentFilter); } + Trace.endSection(); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedState) { + Trace.beginSection(TAG + " onCreateView"); + Trace.beginSection(TAG + " inflate view"); final View fragmentView = inflater.inflate(R.layout.dialpad_fragment, container, false); + Trace.endSection(); + Trace.beginSection(TAG + " buildLayer"); fragmentView.buildLayer(); + Trace.endSection(); + Trace.beginSection(TAG + " setup views"); Resources r = getResources(); mDialpadView = (DialpadView) fragmentView.findViewById(R.id.dialpad_view); @@ -399,7 +408,8 @@ public class DialpadFragment extends Fragment floatingActionButton.setOnClickListener(this); mFloatingActionButtonController = new FloatingActionButtonController(getActivity(), floatingActionButtonContainer, floatingActionButton); - + Trace.endSection(); + Trace.endSection(); return fragmentView; } @@ -582,6 +592,7 @@ public class DialpadFragment extends Fragment @Override public void onStart() { + Trace.beginSection(TAG + " onStart"); super.onStart(); // if the mToneGenerator creation fails, just continue without it. It is // a local audio signal, and is not as important as the dtmf tone itself. @@ -600,10 +611,12 @@ public class DialpadFragment extends Fragment if (total > 50) { Log.i(TAG, "Time for ToneGenerator creation: " + total); } + Trace.endSection(); }; @Override public void onResume() { + Trace.beginSection(TAG + " onResume"); super.onResume(); final DialtactsActivity activity = (DialtactsActivity) getActivity(); @@ -661,6 +674,7 @@ public class DialpadFragment extends Fragment mOverflowMenuButton.setOnTouchListener(mOverflowPopupMenu.getDragToOpenListener()); mOverflowMenuButton.setOnClickListener(this); mOverflowMenuButton.setVisibility(isDigitsEmpty() ? View.INVISIBLE : View.VISIBLE); + Trace.endSection(); } @Override -- cgit v1.2.3