[AA+] Reset search manager when exiting all apps.

This is required to log search session exits properly, especially when exiting AllApps without clearing search query.

Bug: 178562918
Test: Manual
Change-Id: Id4c1007b051e9efd9ae5929c274a70cf3ae3cbf1
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 9aa7168..578379b 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -1076,9 +1076,10 @@
             getRotationHelper().setCurrentStateRequest(REQUEST_NONE);
         }
 
-        if (mPrevLauncherState != state && !ALL_APPS.equals(state)
+        if (ALL_APPS.equals(mPrevLauncherState) && !ALL_APPS.equals(state)
                 // Making sure mAllAppsSessionLogId is not null to avoid double logging.
                 && mAllAppsSessionLogId != null) {
+            getAppsView().getSearchUiManager().resetSearch();
             getStatsLogManager().logger().log(LAUNCHER_ALLAPPS_EXIT);
             mAllAppsSessionLogId = null;
         }