[AA+] Add LAUNCHER_ALLAPPS_SWITCHED_TO_WORK_TAB & LAUNCHER_ALLAPPS_SWITCHED_TO_MAIN_TAB events.
Bug: 178562918
Change-Id: I6ae1e034dc8fbbca6fa046104ab69c1ec9f4e6da
diff --git a/src/com/android/launcher3/allapps/LauncherAllAppsContainerView.java b/src/com/android/launcher3/allapps/LauncherAllAppsContainerView.java
index 03ce594..bb1a4c0 100644
--- a/src/com/android/launcher3/allapps/LauncherAllAppsContainerView.java
+++ b/src/com/android/launcher3/allapps/LauncherAllAppsContainerView.java
@@ -16,6 +16,8 @@
package com.android.launcher3.allapps;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_KEYBOARD_CLOSED;
+import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_SWITCHED_TO_MAIN_TAB;
+import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_SWITCHED_TO_WORK_TAB;
import android.content.Context;
import android.graphics.Rect;
@@ -88,6 +90,14 @@
public void onTabChanged(int pos) {
super.onTabChanged(pos);
if (mUsingTabs) {
+
+ // Log tab switches only when the launcher is in AllApps state
+ if (mLauncher.getStateManager().getCurrentStableState() == LauncherState.ALL_APPS) {
+ mLauncher.getLiveSearchManager().allAppsLogger()
+ .log(pos == AdapterHolder.WORK ? LAUNCHER_ALLAPPS_SWITCHED_TO_WORK_TAB
+ : LAUNCHER_ALLAPPS_SWITCHED_TO_MAIN_TAB);
+ }
+
if (pos == AdapterHolder.WORK) {
WorkEduView.showWorkEduIfNeeded(mLauncher);
} else {
diff --git a/src/com/android/launcher3/logging/StatsLogManager.java b/src/com/android/launcher3/logging/StatsLogManager.java
index 0d07e0d..071b263 100644
--- a/src/com/android/launcher3/logging/StatsLogManager.java
+++ b/src/com/android/launcher3/logging/StatsLogManager.java
@@ -353,6 +353,12 @@
@UiEvent(doc = "User closed the AllApps keyboard.")
LAUNCHER_ALLAPPS_KEYBOARD_CLOSED(694),
+
+ @UiEvent(doc = "User switched to Main tab in AllApps screen.")
+ LAUNCHER_ALLAPPS_SWITCHED_TO_MAIN_TAB(695),
+
+ @UiEvent(doc = "User switched to Work tab in AllApps screen.")
+ LAUNCHER_ALLAPPS_SWITCHED_TO_WORK_TAB(696),
;
// ADD MORE