Bug 1534488 - Cleanup previous state before entering editing mode for search; r=VladBaicu
authorPetru Lingurar <petru.lingurar@softvision.ro>
Thu, 14 Mar 2019 12:48:04 +0000
changeset 521885 ca6cad38cbaf
parent 521884 c1dfac003eb7
child 521886 0ec93de240d9
push id10870
push usernbeleuzu@mozilla.com
push dateFri, 15 Mar 2019 20:00:07 +0000
treeherdermozilla-beta@c594aee5b7a4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersVladBaicu
bugs1534488
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1534488 - Cleanup previous state before entering editing mode for search; r=VladBaicu We need to ensure that nothing from the previous app state would prevent a smooth flow for the search widget UX. As such, in the event that they were left open, we will close the options menu and the tabs tray before entering in tab editing mode for search. Differential Revision: https://phabricator.services.mozilla.com/D23477
mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
--- a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
+++ b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
@@ -892,28 +892,35 @@ public class BrowserApp extends GeckoApp
             return false;
         }
 
         MmaDelegate.track(INTERACT_WITH_SEARCH_WIDGET_URL_AREA);
         Telemetry.sendUIEvent(TelemetryContract.Event.SEARCH, TelemetryContract.Method.WIDGET);
 
         switch (input) {
             case TEXT:
+                cleanupForNewTabEditing();
                 handleTabEditingMode(false);
                 return true;
             case VOICE:
+                cleanupForNewTabEditing();
                 handleTabEditingMode(true);
                 return true;
             default:
                 // Can't handle this input type, where did it came from though?
                 Log.e(LOGTAG, "can't handle search action :: input == " + input);
                 return false;
         }
     }
 
+    private void cleanupForNewTabEditing() {
+        closeOptionsMenu();
+        autoHideTabs();
+    }
+
     private synchronized void handleTabEditingMode(boolean isVoice) {
         final Tabs.OnTabsChangedListener tabsChangedListener = new Tabs.OnTabsChangedListener() {
             @Override
             public void onTabChanged(Tab tab, TabEvents msg, String data) {
                 // Listening for THUMBNAIL, while entailing a small delay
                 // allows for fully loading the "about:home" screen and finishing all related operations
                 // so that we can safely enter editing mode.
                 if (tab != null && tab.getURL().equals("about:home") && (THUMBNAIL.equals(msg))) {