diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java index 20f7c231fb..505e6d82e9 100644 --- a/src/com/android/launcher3/allapps/AllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java @@ -213,10 +213,14 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo if (insets == null) return; if (insets.isVisible(WindowInsets.Type.ime())) { - getWindowInsetsController().hide(WindowInsets.Type.ime()); + hideIme(); } } + protected void hideIme() { + getWindowInsetsController().hide(WindowInsets.Type.ime()); + } + /** * Returns whether the view itself will handle the touch event or not. */ diff --git a/src/com/android/launcher3/allapps/LauncherAllAppsContainerView.java b/src/com/android/launcher3/allapps/LauncherAllAppsContainerView.java index a6bc6cf59f..03ce594731 100644 --- a/src/com/android/launcher3/allapps/LauncherAllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/LauncherAllAppsContainerView.java @@ -15,6 +15,8 @@ */ package com.android.launcher3.allapps; +import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_KEYBOARD_CLOSED; + import android.content.Context; import android.graphics.Rect; import android.util.AttributeSet; @@ -93,4 +95,10 @@ public class LauncherAllAppsContainerView extends AllAppsContainerView { } } } + + @Override + protected void hideIme() { + super.hideIme(); + mLauncher.getLiveSearchManager().allAppsLogger().log(LAUNCHER_ALLAPPS_KEYBOARD_CLOSED); + } } diff --git a/src/com/android/launcher3/allapps/search/LiveSearchManager.java b/src/com/android/launcher3/allapps/search/LiveSearchManager.java index 608affeb2b..d51c78653c 100644 --- a/src/com/android/launcher3/allapps/search/LiveSearchManager.java +++ b/src/com/android/launcher3/allapps/search/LiveSearchManager.java @@ -153,15 +153,15 @@ public class LiveSearchManager implements StateListener { clearWidgetHost(); } - StatsLogger logger = mLauncher.getStatsLogManager().logger(); if (finalState.equals(ALL_APPS)) { + // creates new instance ID since new all apps session is started. mLogInstanceId = new InstanceIdSequence().newInstanceId(); - logger.withInstanceId(mLogInstanceId).log(LAUNCHER_ALLAPPS_ENTRY); + allAppsLogger().log(LAUNCHER_ALLAPPS_ENTRY); } else if (mPrevLauncherState.equals(ALL_APPS) // Check if mLogInstanceId is not null; to avoid NPE when LAUNCHER_ALLAPPS_EXIT is // triggered multiple times && mLogInstanceId != null) { - logger.withInstanceId(mLogInstanceId).log(LAUNCHER_ALLAPPS_EXIT); + allAppsLogger().log(LAUNCHER_ALLAPPS_EXIT); mLogInstanceId = null; } } @@ -316,4 +316,15 @@ public class LiveSearchManager implements StateListener { @Override public void onActivitySaveInstanceState(Activity activity, Bundle bundle) { } } + + /** + * Returns new instance of {@link StatsLogger} pre-populated with details required to log + * AllApps specific user events. + */ + public StatsLogger allAppsLogger() { + return getLogInstanceId() + .map(instanceId -> mLauncher.getStatsLogManager().logger() + .withInstanceId(instanceId)) + .orElse(mLauncher.getStatsLogManager().logger()); + } } diff --git a/src/com/android/launcher3/logging/StatsLogManager.java b/src/com/android/launcher3/logging/StatsLogManager.java index 0292d20ef5..0d07e0d171 100644 --- a/src/com/android/launcher3/logging/StatsLogManager.java +++ b/src/com/android/launcher3/logging/StatsLogManager.java @@ -350,6 +350,9 @@ public class StatsLogManager implements ResourceBasedOverride { @UiEvent(doc = "Launcher exited from AllApps state.") LAUNCHER_ALLAPPS_EXIT(693), + + @UiEvent(doc = "User closed the AllApps keyboard.") + LAUNCHER_ALLAPPS_KEYBOARD_CLOSED(694), ; // ADD MORE