summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/com/android/dialer/DialtactsActivity.java28
1 files changed, 21 insertions, 7 deletions
diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java
index 560fb26a2..5494b7b54 100644
--- a/src/com/android/dialer/DialtactsActivity.java
+++ b/src/com/android/dialer/DialtactsActivity.java
@@ -176,6 +176,11 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
*/
private ListsFragment mListsFragment;
+ /**
+ * Tracks whether onSaveInstanceState has been called. If true, no fragment transactions can
+ * be commited.
+ */
+ private boolean mStateSaved;
private boolean mInDialpadSearch;
private boolean mInRegularSearch;
private boolean mClearSearchOnPause;
@@ -460,6 +465,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
@Override
protected void onResume() {
super.onResume();
+ mStateSaved = false;
if (mFirstLaunch) {
displayFragment(getIntent());
} else if (!phoneIsInUse() && mInCallDialpadUp) {
@@ -481,6 +487,9 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
hideDialpadAndSearchUi();
mClearSearchOnPause = false;
}
+ if (mSlideOut.hasStarted() && !mSlideOut.hasEnded()) {
+ commitDialpadFragmentHide();
+ }
super.onPause();
}
@@ -493,6 +502,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
outState.putBoolean(KEY_FIRST_LAUNCH, mFirstLaunch);
outState.putBoolean(KEY_IS_DIALPAD_SHOWN, mIsDialpadShown);
mActionBarController.saveInstanceState(outState);
+ mStateSaved = true;
}
@Override
@@ -608,7 +618,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
* @see #onDialpadShown
*/
private void showDialpadFragment(boolean animate) {
- if (mIsDialpadShown) {
+ if (mIsDialpadShown || mStateSaved) {
return;
}
mIsDialpadShown = true;
@@ -684,10 +694,11 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
* Finishes hiding the dialpad fragment after any animations are completed.
*/
private void commitDialpadFragmentHide() {
- final FragmentTransaction ft = getFragmentManager().beginTransaction();
- ft.hide(mDialpadFragment);
- ft.commit();
-
+ if (!mStateSaved && !mDialpadFragment.isHidden()) {
+ final FragmentTransaction ft = getFragmentManager().beginTransaction();
+ ft.hide(mDialpadFragment);
+ ft.commit();
+ }
mFloatingActionButtonController.scaleIn(AnimUtils.NO_DELAY);
}
@@ -840,7 +851,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
* Shows the search fragment
*/
private void enterSearchUi(boolean smartDialSearch, String query) {
- if (getFragmentManager().isDestroyed()) {
+ if (mStateSaved || getFragmentManager().isDestroyed()) {
// Weird race condition where fragment is doing work after the activity is destroyed
// due to talkback being on (b/10209937). Just return since we can't do any
// constructive here.
@@ -893,7 +904,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
*/
private void exitSearchUi() {
// See related bug in enterSearchUI();
- if (getFragmentManager().isDestroyed()) {
+ if (getFragmentManager().isDestroyed() || mStateSaved) {
return;
}
@@ -916,6 +927,9 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
@Override
public void onBackPressed() {
+ if (mStateSaved) {
+ return;
+ }
if (mIsDialpadShown) {
if (TextUtils.isEmpty(mSearchQuery) ||
(mSmartDialSearchFragment != null && mSmartDialSearchFragment.isVisible()