Merge "Add scroll up and scroll down logging." into tm-qpr-dev am: 821ef94974 am: 0967d53cf5

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/20181861

Change-Id: I476bfd2bf672e4c840e87e1a29aee14bcbdd827c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
TreeHugger Robot
2022-10-19 21:47:35 +00:00
committed by Automerger Merge Worker
2 changed files with 46 additions and 2 deletions
@@ -17,7 +17,11 @@ package com.android.launcher3.allapps;
import static android.view.View.MeasureSpec.UNSPECIFIED;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_SCROLLED;
import static com.android.launcher3.logger.LauncherAtom.ContainerInfo;
import static com.android.launcher3.logger.LauncherAtom.SearchResultContainer;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_SCROLLED_DOWN;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_SCROLLED_UNKNOWN_DIRECTION;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_SCROLLED_UP;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_VERTICAL_SWIPE_BEGIN;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_VERTICAL_SWIPE_END;
import static com.android.launcher3.util.LogConfig.SEARCH_LOGGING;
@@ -31,6 +35,7 @@ import android.util.SparseIntArray;
import androidx.recyclerview.widget.RecyclerView;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.ExtendedEditText;
import com.android.launcher3.FastScrollRecyclerView;
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.R;
@@ -56,6 +61,7 @@ public class AllAppsRecyclerView extends FastScrollRecyclerView {
private final SparseIntArray mViewHeights = new SparseIntArray();
private final SparseIntArray mCachedScrollPositions = new SparseIntArray();
private final AllAppsFastScrollHelper mFastScrollHelper;
private int mCumulativeVerticalScroll;
private final AdapterDataObserver mObserver = new RecyclerView.AdapterDataObserver() {
@@ -157,7 +163,7 @@ public class AllAppsRecyclerView extends FastScrollRecyclerView {
StatsLogManager mgr = ActivityContext.lookupContext(getContext()).getStatsLogManager();
switch (state) {
case SCROLL_STATE_DRAGGING:
mgr.logger().log(LAUNCHER_ALLAPPS_SCROLLED);
mCumulativeVerticalScroll = 0;
requestFocus();
mgr.logger().sendToInteractionJankMonitor(
LAUNCHER_ALLAPPS_VERTICAL_SWIPE_BEGIN, this);
@@ -166,10 +172,17 @@ public class AllAppsRecyclerView extends FastScrollRecyclerView {
case SCROLL_STATE_IDLE:
mgr.logger().sendToInteractionJankMonitor(
LAUNCHER_ALLAPPS_VERTICAL_SWIPE_END, this);
logCumulativeVerticalScroll();
break;
}
}
@Override
public void onScrolled(int dx, int dy) {
super.onScrolled(dx, dy);
mCumulativeVerticalScroll += dy;
}
/**
* Maps the touch (from 0..1) to the adapter position that should be visible.
*/
@@ -349,4 +362,21 @@ public class AllAppsRecyclerView extends FastScrollRecyclerView {
public boolean hasOverlappingRendering() {
return false;
}
private void logCumulativeVerticalScroll() {
ActivityContext context = ActivityContext.lookupContext(getContext());
StatsLogManager mgr = context.getStatsLogManager();
ExtendedEditText editText = context.getAppsView().getSearchUiManager().getEditText();
ContainerInfo containerInfo = ContainerInfo.newBuilder().setSearchResultContainer(
SearchResultContainer
.newBuilder()
.setQueryLength((editText == null) ? -1 : editText.length())).build();
// mCumulativeVerticalScroll == 0 when user comes back to original position, we don't
// know the direction of scrolling.
mgr.logger().withContainerInfo(containerInfo).log(
mCumulativeVerticalScroll == 0 ? LAUNCHER_ALLAPPS_SCROLLED_UNKNOWN_DIRECTION
: (mCumulativeVerticalScroll > 0) ? LAUNCHER_ALLAPPS_SCROLLED_DOWN
: LAUNCHER_ALLAPPS_SCROLLED_UP);
}
}
@@ -555,6 +555,20 @@ public class StatsLogManager implements ResourceBasedOverride {
+ "result page etc.")
LAUNCHER_ALLAPPS_SCROLLED(985),
@UiEvent(doc = "User scrolled up on one of the all apps surfaces such as A-Z list, search "
+ "result page etc.")
LAUNCHER_ALLAPPS_SCROLLED_UP(1229),
@UiEvent(doc =
"User scrolled down on one of the all apps surfaces such as A-Z list, search "
+ "result page etc.")
LAUNCHER_ALLAPPS_SCROLLED_DOWN(1230),
@UiEvent(doc = "User scrolled on one of the all apps surfaces such as A-Z list, search "
+ "result page etc and we don't know the direction since user came back to "
+ "original position from which they scrolled.")
LAUNCHER_ALLAPPS_SCROLLED_UNKNOWN_DIRECTION(1231),
@UiEvent(doc = "User tapped taskbar home button")
LAUNCHER_TASKBAR_HOME_BUTTON_TAP(1003),