diff options
author | Yorke Lee <yorkelee@google.com> | 2014-03-26 16:13:10 -0700 |
---|---|---|
committer | Yorke Lee <yorkelee@google.com> | 2014-03-26 16:39:28 -0700 |
commit | 8d5400093dc683030d3de2b1f4dce8fa0a9c9e10 (patch) | |
tree | b746afb707c3d610a174ee65b96c71cfe1ba2ac1 /src | |
parent | 06107886477be724c055b3e151d2988768839a6b (diff) |
Fix crash when recreating activity and receiving dial intent
* Initialize all member variable button references at onCreate to
avoid potential NPEs
* Make sure we call mDialpadFragment.buildOptionsMenu only when
it is guaranteed to have been attached.
Bug: 13653973
Change-Id: I407072503cebaf77ec9ef86d8a7ab23302eed6d6
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/dialer/DialtactsActivity.java | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java index 32a22c9b4..b8faaaf64 100644 --- a/src/com/android/dialer/DialtactsActivity.java +++ b/src/com/android/dialer/DialtactsActivity.java @@ -336,7 +336,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O } }); - + setupFakeActionBarItems(); prepareSearchView(); mDialerDatabaseHelper = DatabaseHelperManager.getDatabaseHelper(this); @@ -346,7 +346,6 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O @Override protected void onResume() { super.onResume(); - setupFakeActionBarItems(); if (mFirstLaunch) { displayFragment(getIntent()); } else if (!phoneIsInUse() && mInCallDialpadUp) { @@ -545,6 +544,11 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O ft.commit(); mDialButton.setVisibility(shouldShowOnscreenDialButton() ? View.VISIBLE : View.GONE); mDialpadButton.setVisibility(View.GONE); + + if (mDialpadOverflowMenu == null) { + mDialpadOverflowMenu = mDialpadFragment.buildOptionsMenu(mMenuButton); + } + mMenuButton.setOnTouchListener(mDialpadOverflowMenu.getDragToOpenListener()); } @@ -673,17 +677,12 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O if (mOverflowMenu == null) { mOverflowMenu = buildOptionsMenu(mMenuButton); } - if (mDialpadOverflowMenu == null) { - mDialpadOverflowMenu = mDialpadFragment.buildOptionsMenu(mMenuButton); - } - // Initial state is with dialpad fragment not shown mMenuButton.setOnTouchListener(mOverflowMenu.getDragToOpenListener()); } mFakeActionBar = findViewById(R.id.fake_action_bar); mCallHistoryButton = findViewById(R.id.call_history_button); - // mCallHistoryButton.setMinimumWidth(fakeMenuItemWidth); mCallHistoryButton.setOnClickListener(this); mDialButton = findViewById(R.id.dial_button); @@ -691,7 +690,6 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O mDialButton.setOnLongClickListener(this); mDialpadButton = findViewById(R.id.dialpad_button); - // DialpadButton.setMinimumWidth(fakeMenuItemWidth); mDialpadButton.setOnClickListener(this); } |