Move swipe actions on container logging to west world.
Test: manual
Bug: 137777105
Log result for swiping in and out of -1 screen.
data {
elapsed_timestamp_nanos: 597609736235111
atom {
launcher_event {
action: SWIPE_LEFT
src_state: HOME
dst_state: HOME
is_swipe_up_enabled: true
}
}
}
data {
elapsed_timestamp_nanos: 597610569783111
atom {
launcher_event {
action: SWIPE_RIGHT
src_state: HOME
dst_state: HOME
is_swipe_up_enabled: true
}
}
}
Change-Id: Ic84d3c32d1c9f780f13ec5cd6320e9f1d610f018
diff --git a/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java b/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java
index 13a8dc2..bf3cd8a 100644
--- a/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java
+++ b/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java
@@ -16,11 +16,6 @@
package com.android.quickstep.logging;
-import android.content.Context;
-import android.content.Intent;
-import android.stats.launcher.nano.LauncherExtension;
-import android.stats.launcher.nano.LauncherTarget;
-
import static android.stats.launcher.nano.Launcher.ALLAPPS;
import static android.stats.launcher.nano.Launcher.HOME;
import static android.stats.launcher.nano.Launcher.LAUNCH_APP;
@@ -29,6 +24,11 @@
import static android.stats.launcher.nano.Launcher.BACKGROUND;
import static android.stats.launcher.nano.Launcher.OVERVIEW;
+import android.content.Context;
+import android.content.Intent;
+import android.stats.launcher.nano.Launcher;
+import android.stats.launcher.nano.LauncherExtension;
+import android.stats.launcher.nano.LauncherTarget;
import android.view.View;
import com.android.launcher3.ItemInfo;
@@ -39,8 +39,6 @@
import com.android.systemui.shared.system.StatsLogCompat;
import com.google.protobuf.nano.MessageNano;
-import androidx.annotation.Nullable;
-
/**
* This method calls the StatsLog hidden method until they are made available public.
*
@@ -85,6 +83,17 @@
MessageNano.toByteArray(ext), true);
}
+ @Override
+ public void logSwipeOnContainer(boolean isSwipingToLeft, int pageId) {
+ LauncherExtension ext = new LauncherExtension();
+ ext.srcTarget = new LauncherTarget[1];
+ int srcState = mStateProvider.getCurrentState();
+ fillInLauncherExtensionWithPageId(ext, pageId);
+ int launcherAction = isSwipingToLeft ? Launcher.SWIPE_LEFT : Launcher.SWIPE_RIGHT;
+ StatsLogCompat.write(launcherAction, srcState, srcState,
+ MessageNano.toByteArray(ext), true);
+ }
+
public static boolean fillInLauncherExtension(View v, LauncherExtension extension) {
StatsLogUtils.LogContainerProvider provider = StatsLogUtils.getLaunchProviderRecursive(v);
if (v == null || !(v.getTag() instanceof ItemInfo) || provider == null) {
@@ -99,6 +108,13 @@
return true;
}
+ public static boolean fillInLauncherExtensionWithPageId(LauncherExtension ext, int pageId) {
+ Target target = new Target();
+ target.pageIndex = pageId;
+ copy(target, ext.srcTarget[0]);
+ return true;
+ }
+
private static void copy(Target src, LauncherTarget dst) {
// fill in
}
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index 3be91d4..6612662 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -1052,6 +1052,7 @@
if (!mOverlayShown) {
mLauncher.getUserEventDispatcher().logActionOnContainer(Action.Touch.SWIPE,
Action.Direction.LEFT, ContainerType.WORKSPACE, 0);
+ mLauncher.getStatsLogManager().logSwipeOnContainer(true, 0);
}
mOverlayShown = true;
// Not announcing the overlay page for accessibility since it announces itself.
@@ -1061,6 +1062,7 @@
if (!ued.isPreviousHomeGesture()) {
mLauncher.getUserEventDispatcher().logActionOnContainer(Action.Touch.SWIPE,
Action.Direction.RIGHT, ContainerType.WORKSPACE, -1);
+ mLauncher.getStatsLogManager().logSwipeOnContainer(false, -1);
}
} else if (Float.compare(mOverlayTranslation, 0f) != 0) {
// When arriving to 0 overscroll from non-zero overscroll, announce page for
diff --git a/src/com/android/launcher3/logging/StatsLogManager.java b/src/com/android/launcher3/logging/StatsLogManager.java
index d11d434..cad95b0 100644
--- a/src/com/android/launcher3/logging/StatsLogManager.java
+++ b/src/com/android/launcher3/logging/StatsLogManager.java
@@ -41,5 +41,6 @@
public void logAppLaunch(View v, Intent intent) { }
public void logTaskLaunch(View v, ComponentKey key) { }
public void logTaskDismiss(View v, ComponentKey key) { }
+ public void logSwipeOnContainer(boolean isSwipingToLeft, int pageId) { }
public void verify() {} // TODO: should move into robo tests
}