diff options
author | Yorke Lee <yorkelee@google.com> | 2015-01-27 14:46:02 -0800 |
---|---|---|
committer | Yorke Lee <yorkelee@google.com> | 2015-01-28 10:05:00 -0800 |
commit | f5554ceb3c152949b4b6278b7f5e1522148a574c (patch) | |
tree | d14525f281b24095428bccdbc1df3aea89a629c3 | |
parent | 85f54cc021834d41276c1cf80542da39f7919c58 (diff) |
Add systrace events to track Dialer startup performance
Bug: 18431193
Change-Id: I92db4ae61405d8d8445b72e7ac0daa0794af8335
-rw-r--r-- | src/com/android/dialer/DialerApplication.java | 8 | ||||
-rw-r--r-- | src/com/android/dialer/DialtactsActivity.java | 12 | ||||
-rw-r--r-- | src/com/android/dialer/dialpad/DialpadFragment.java | 18 | ||||
-rw-r--r-- | src/com/android/dialer/list/ListsFragment.java | 17 | ||||
-rw-r--r-- | src/com/android/dialer/list/SpeedDialFragment.java | 11 |
5 files changed, 60 insertions, 6 deletions
diff --git a/src/com/android/dialer/DialerApplication.java b/src/com/android/dialer/DialerApplication.java index c64530829..45457c648 100644 --- a/src/com/android/dialer/DialerApplication.java +++ b/src/com/android/dialer/DialerApplication.java @@ -17,6 +17,7 @@ package com.android.dialer; import android.app.Application; +import android.os.Trace; import com.android.contacts.common.ContactPhotoManager; import com.android.contacts.common.extensions.ExtensionsFactory; @@ -24,13 +25,20 @@ import com.android.contacts.commonbind.analytics.AnalyticsUtil; public class DialerApplication extends Application { + private static final String TAG = "DialerApplication"; private ContactPhotoManager mContactPhotoManager; @Override public void onCreate() { + Trace.beginSection(TAG + " onCreate"); super.onCreate(); + Trace.beginSection(TAG + " ExtensionsFactory initialization"); ExtensionsFactory.init(getApplicationContext()); + Trace.endSection(); + Trace.beginSection(TAG + " Analytics initialization"); AnalyticsUtil.initialize(this); + Trace.endSection(); + Trace.endSection(); } @Override diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java index 95b72157e..beec280f5 100644 --- a/src/com/android/dialer/DialtactsActivity.java +++ b/src/com/android/dialer/DialtactsActivity.java @@ -28,6 +28,7 @@ import android.content.res.Configuration; import android.content.res.Resources; import android.net.Uri; import android.os.Bundle; +import android.os.Trace; import android.provider.ContactsContract.Contacts; import android.provider.ContactsContract.Intents; import android.speech.RecognizerIntent; @@ -350,15 +351,19 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O @Override protected void onCreate(Bundle savedInstanceState) { + Trace.beginSection(TAG + " onCreate"); super.onCreate(savedInstanceState); mFirstLaunch = true; final Resources resources = getResources(); mActionBarHeight = resources.getDimensionPixelSize(R.dimen.action_bar_height_large); + Trace.beginSection(TAG + " setContentView"); setContentView(R.layout.dialtacts_activity); + Trace.endSection(); getWindow().setBackgroundDrawable(null); + Trace.beginSection(TAG + " setup Views"); final ActionBar actionBar = getActionBar(); actionBar.setCustomView(R.layout.search_edittext); actionBar.setDisplayShowCustomEnabled(true); @@ -453,8 +458,13 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O setupActivityOverlay(); + Trace.endSection(); + + Trace.beginSection(TAG + " initialize smart dialing"); mDialerDatabaseHelper = DatabaseHelperManager.getDatabaseHelper(this); SmartDialPrefix.initializeNanpSettings(this); + Trace.endSection(); + Trace.endSection(); } private void setupActivityOverlay() { @@ -472,6 +482,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O @Override protected void onResume() { + Trace.beginSection(TAG + " onResume"); super.onResume(); mStateSaved = false; if (mFirstLaunch) { @@ -506,6 +517,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O prepareVoiceSearchButton(); mDialerDatabaseHelper.startSmartDialUpdateThread(); updateFloatingActionButtonControllerAlignment(false /* animate */); + Trace.endSection(); } @Override 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 diff --git a/src/com/android/dialer/list/ListsFragment.java b/src/com/android/dialer/list/ListsFragment.java index af82e4075..7a5376c01 100644 --- a/src/com/android/dialer/list/ListsFragment.java +++ b/src/com/android/dialer/list/ListsFragment.java @@ -8,6 +8,7 @@ import android.content.Context; import android.content.SharedPreferences; import android.database.Cursor; import android.os.Bundle; +import android.os.Trace; import android.support.v13.app.FragmentPagerAdapter; import android.support.v4.view.ViewPager; import android.support.v4.view.ViewPager.OnPageChangeListener; @@ -237,19 +238,27 @@ public class ListsFragment extends Fragment implements CallLogQueryHandler.Liste @Override public void onCreate(Bundle savedInstanceState) { + Trace.beginSection(TAG + " onCreate"); super.onCreate(savedInstanceState); mCallLogQueryHandler = new CallLogQueryHandler(getActivity().getContentResolver(), this, 1); + Trace.beginSection(TAG + " getCurrentCountryIso"); final String currentCountryIso = GeoUtil.getCurrentCountryIso(getActivity()); + Trace.endSection(); + + Trace.beginSection(TAG + " create adapters"); mCallLogAdapter = ObjectFactory.newCallLogAdapter(getActivity(), this, new ContactInfoHelper(getActivity(), currentCountryIso), null, null, false); mMergedAdapter = new ShortcutCardsAdapter(getActivity(), this, mCallLogAdapter); + Trace.endSection(); + Trace.endSection(); } @Override public void onResume() { + Trace.beginSection(TAG + " onResume"); super.onResume(); final SharedPreferences prefs = getActivity().getSharedPreferences( DialtactsActivity.SHARED_PREFS_NAME, Context.MODE_PRIVATE); @@ -260,6 +269,7 @@ public class ListsFragment extends Fragment implements CallLogQueryHandler.Liste if (getUserVisibleHint()) { sendScreenViewForPosition(mViewPager.getCurrentItem()); } + Trace.endSection(); } @Override @@ -279,7 +289,11 @@ public class ListsFragment extends Fragment implements CallLogQueryHandler.Liste @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + Trace.beginSection(TAG + " onCreateView"); + Trace.beginSection(TAG + " inflate view"); final View parentView = inflater.inflate(R.layout.lists_fragment, container, false); + Trace.endSection(); + Trace.beginSection(TAG + " setup views"); mViewPager = (ViewPager) parentView.findViewById(R.id.lists_pager); mViewPagerAdapter = new ViewPagerAdapter(getChildFragmentManager()); mViewPager.setAdapter(mViewPagerAdapter); @@ -304,7 +318,8 @@ public class ListsFragment extends Fragment implements CallLogQueryHandler.Liste setupPaneLayout((OverlappingPaneLayout) parentView); mOverlappingPaneLayout = (OverlappingPaneLayout) parentView; - + Trace.endSection(); + Trace.endSection(); return parentView; } diff --git a/src/com/android/dialer/list/SpeedDialFragment.java b/src/com/android/dialer/list/SpeedDialFragment.java index 63f1f34c6..6de0759fa 100644 --- a/src/com/android/dialer/list/SpeedDialFragment.java +++ b/src/com/android/dialer/list/SpeedDialFragment.java @@ -28,6 +28,7 @@ import android.database.Cursor; import android.graphics.Rect; import android.net.Uri; import android.os.Bundle; +import android.os.Trace; import android.util.Log; import android.view.LayoutInflater; import android.view.View; @@ -68,7 +69,7 @@ public class SpeedDialFragment extends Fragment implements OnItemClickListener, */ private static final long KEY_REMOVED_ITEM_HEIGHT = Long.MAX_VALUE; - private static final String TAG = SpeedDialFragment.class.getSimpleName(); + private static final String TAG = "SpeedDialFragment"; private static final boolean DEBUG = false; private int mAnimationDuration; @@ -180,21 +181,26 @@ public class SpeedDialFragment extends Fragment implements OnItemClickListener, @Override public void onCreate(Bundle savedState) { if (DEBUG) Log.d(TAG, "onCreate()"); + Trace.beginSection(TAG + " onCreate"); super.onCreate(savedState); mAnimationDuration = getResources().getInteger(R.integer.fade_duration); + Trace.endSection(); } @Override public void onResume() { + Trace.beginSection(TAG + " onResume"); super.onResume(); getLoaderManager().getLoader(LOADER_ID_CONTACT_TILE).forceLoad(); + Trace.endSection(); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + Trace.beginSection(TAG + " onCreateView"); mParentView = inflater.inflate(R.layout.speed_dial_fragment, container, false); mListView = (PhoneFavoriteListView) mParentView.findViewById(R.id.contact_tile_list); @@ -208,7 +214,6 @@ public class SpeedDialFragment extends Fragment implements OnItemClickListener, (ImageView) getActivity().findViewById(R.id.contact_tile_drag_shadow_overlay); mListView.setDragShadowOverlay(dragShadowOverlay); - final Resources resources = getResources(); mEmptyView = mParentView.findViewById(R.id.empty_list_view); DialerUtils.configureEmptyListView( mEmptyView, R.drawable.empty_speed_dial, R.string.speed_dial_empty, getResources()); @@ -224,7 +229,7 @@ public class SpeedDialFragment extends Fragment implements OnItemClickListener, mListView.setOnScrollListener(mScrollListener); mListView.setFastScrollEnabled(false); mListView.setFastScrollAlwaysVisible(false); - + Trace.endSection(); return mParentView; } |