From 62287c1de6069716c782ac3e517f4573f94e9fe9 Mon Sep 17 00:00:00 2001 From: calderwoodra Date: Wed, 4 Apr 2018 16:26:10 -0700 Subject: Added some logging for mysterious bugs. Bug: 74196353,77485680,77486095,77540395 Test: tap PiperOrigin-RevId: 191666270 Change-Id: Ia56ca2636d4f3bbf37e54f33752ea678eb787705 --- .../dialer/main/impl/MainSearchController.java | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/java/com/android/dialer/main/impl/MainSearchController.java b/java/com/android/dialer/main/impl/MainSearchController.java index 7b4bc3569..2279d56a7 100644 --- a/java/com/android/dialer/main/impl/MainSearchController.java +++ b/java/com/android/dialer/main/impl/MainSearchController.java @@ -184,7 +184,7 @@ public class MainSearchController implements SearchBarListener { */ private void hideDialpad(boolean animate) { LogUtil.enterBlock("MainSearchController.hideDialpad"); - Assert.checkArgument(isDialpadVisible()); + assertDialpadVisible(); fab.show(); toolbar.slideDown(animate, fragmentContainer); @@ -291,7 +291,7 @@ public class MainSearchController implements SearchBarListener { /** Calls {@link #hideDialpad(boolean)}, removes the search fragment and clears the dialpad. */ private void closeSearch(boolean animate) { LogUtil.enterBlock("MainSearchController.closeSearch"); - Assert.checkArgument(isSearchVisible()); + assertSearchIsVisible(); if (isDialpadVisible()) { hideDialpad(animate); } else if (!fab.isShown()) { @@ -337,11 +337,26 @@ public class MainSearchController implements SearchBarListener { && fragment.isDialpadSlideUp(); } + private void assertDialpadVisible() { + DialpadFragment fragment = getDialpadFragment(); + Assert.checkArgument(fragment != null, "Dialpad Fragment is null"); + Assert.checkArgument(fragment.isAdded(), "Dialpad Fragment is no added"); + Assert.checkArgument(!fragment.isHidden(), "Dialpad Fragment is hidden"); + Assert.checkArgument(fragment.isDialpadSlideUp(), "Dialpad Fragment is slide down"); + } + private boolean isSearchVisible() { NewSearchFragment fragment = getSearchFragment(); return fragment != null && fragment.isAdded() && !fragment.isHidden(); } + private void assertSearchIsVisible() { + NewSearchFragment fragment = getSearchFragment(); + Assert.checkArgument(fragment != null, "Search Fragment is null"); + Assert.checkArgument(fragment.isAdded(), "Search Fragment is not added"); + Assert.checkArgument(!fragment.isHidden(), "Search Fragment is hidden."); + } + /** Returns true if the search UI is visible. */ public boolean isInSearch() { return isSearchVisible(); -- cgit v1.2.3