summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authortwyen <twyen@google.com>2018-04-04 18:06:08 -0700
committerCopybara-Service <copybara-piper@google.com>2018-04-04 18:11:56 -0700
commit213496d65651a79a484679f5a9be780f90d76958 (patch)
treebe89b8f2b283dc0fd19955d04ba030cfe87fb3a5 /java
parentda7771683a334db63b4503a291d3c67e7b4ca22e (diff)
Prevent crash when dialpad animation ends after activity is saved.
Bug: 77484989 Test: TAP PiperOrigin-RevId: 191677909 Change-Id: If49a357a9ba158cd740eb789befd2ff802f670d4
Diffstat (limited to 'java')
-rw-r--r--java/com/android/dialer/main/impl/MainSearchController.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/java/com/android/dialer/main/impl/MainSearchController.java b/java/com/android/dialer/main/impl/MainSearchController.java
index 2279d56a7..b04e7b11b 100644
--- a/java/com/android/dialer/main/impl/MainSearchController.java
+++ b/java/com/android/dialer/main/impl/MainSearchController.java
@@ -50,6 +50,7 @@ import com.android.dialer.main.impl.toolbar.SearchBarListener;
import com.android.dialer.searchfragment.list.NewSearchFragment;
import com.android.dialer.searchfragment.list.NewSearchFragment.SearchFragmentListener;
import com.android.dialer.smartdial.util.SmartDialNameMatcher;
+import com.android.dialer.util.TransactionSafeActivity;
import com.google.common.base.Optional;
import java.util.ArrayList;
import java.util.List;
@@ -78,7 +79,7 @@ public class MainSearchController implements SearchBarListener {
private static final String DIALPAD_FRAGMENT_TAG = "dialpad_fragment_tag";
private static final String SEARCH_FRAGMENT_TAG = "search_fragment_tag";
- private final AppCompatActivity activity;
+ private final TransactionSafeActivity activity;
private final BottomNavBar bottomNav;
private final FloatingActionButton fab;
private final MainToolbar toolbar;
@@ -97,7 +98,7 @@ public class MainSearchController implements SearchBarListener {
private boolean requestingPermission;
public MainSearchController(
- AppCompatActivity activity,
+ TransactionSafeActivity activity,
BottomNavBar bottomNav,
FloatingActionButton fab,
MainToolbar toolbar,
@@ -201,7 +202,8 @@ public class MainSearchController implements SearchBarListener {
@Override
public void onAnimationEnd(Animation animation) {
- if (!(activity.isFinishing() || activity.isDestroyed())) {
+ if (activity.isSafeToCommitTransactions()
+ && !(activity.isFinishing() || activity.isDestroyed())) {
activity.getFragmentManager().beginTransaction().hide(dialpadFragment).commit();
}
}