[AA+] Add LAUNCHER_ALLAPPS_KEYBOARD_CLOSED event.

Also adds Launcher.allAppsLogger method to simplify AllApps specific user events logging.

Bug: 178562918
Change-Id: I57520fe1504079091f0ff2c4c74268f727ffe14f
This commit is contained in:
thiruram committed 2021-02-09 16:45:52 -08:00
1 parent 9012515fef
commit aafa8a44a3
4 files changed
+30 -4

No files matched your search

@@ -213,10 +213,14 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo
if (insets == null) return; if (insets == null) return;
if (insets.isVisible(WindowInsets.Type.ime())) { 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. * Returns whether the view itself will handle the touch event or not.
*/ */
@@ -15,6 +15,8 @@
*/ */
package com.android.launcher3.allapps; package com.android.launcher3.allapps;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_KEYBOARD_CLOSED;
import android.content.Context; import android.content.Context;
import android.graphics.Rect; import android.graphics.Rect;
import android.util.AttributeSet; 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);
}
} }
@@ -153,15 +153,15 @@ public class LiveSearchManager implements StateListener<LauncherState> {
clearWidgetHost(); clearWidgetHost();
} }
StatsLogger logger = mLauncher.getStatsLogManager().logger();
if (finalState.equals(ALL_APPS)) { if (finalState.equals(ALL_APPS)) {
// creates new instance ID since new all apps session is started.
mLogInstanceId = new InstanceIdSequence().newInstanceId(); mLogInstanceId = new InstanceIdSequence().newInstanceId();
logger.withInstanceId(mLogInstanceId).log(LAUNCHER_ALLAPPS_ENTRY); allAppsLogger().log(LAUNCHER_ALLAPPS_ENTRY);
} else if (mPrevLauncherState.equals(ALL_APPS) } else if (mPrevLauncherState.equals(ALL_APPS)
// Check if mLogInstanceId is not null; to avoid NPE when LAUNCHER_ALLAPPS_EXIT is // Check if mLogInstanceId is not null; to avoid NPE when LAUNCHER_ALLAPPS_EXIT is
// triggered multiple times // triggered multiple times
&& mLogInstanceId != null) { && mLogInstanceId != null) {
logger.withInstanceId(mLogInstanceId).log(LAUNCHER_ALLAPPS_EXIT); allAppsLogger().log(LAUNCHER_ALLAPPS_EXIT);
mLogInstanceId = null; mLogInstanceId = null;
} }
} }
@@ -316,4 +316,15 @@ public class LiveSearchManager implements StateListener<LauncherState> {
@Override @Override
public void onActivitySaveInstanceState(Activity activity, Bundle bundle) { } 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());
}
} }
@@ -350,6 +350,9 @@ public class StatsLogManager implements ResourceBasedOverride {
@UiEvent(doc = "Launcher exited from AllApps state.") @UiEvent(doc = "Launcher exited from AllApps state.")
LAUNCHER_ALLAPPS_EXIT(693), LAUNCHER_ALLAPPS_EXIT(693),
@UiEvent(doc = "User closed the AllApps keyboard.")
LAUNCHER_ALLAPPS_KEYBOARD_CLOSED(694),
; ;
// ADD MORE // ADD MORE