Merge "split the scrolling logging into work,personal, and search" into tm-qpr-dev

This commit is contained in:
Brandon Dayauon
2023-01-14 00:32:54 +00:00
committed by Android (Google) Code Review
3 changed files with 48 additions and 21 deletions

View File

@@ -17,11 +17,15 @@ package com.android.launcher3.allapps;
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_PERSONAL_SCROLLED_DOWN;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_PERSONAL_SCROLLED_UP;
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_SEARCH_SCROLLED_DOWN;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_SEARCH_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.logging.StatsLogManager.LauncherEvent.LAUNCHER_WORK_FAB_BUTTON_COLLAPSE;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_WORK_FAB_BUTTON_EXTEND;
import static com.android.launcher3.util.LogConfig.SEARCH_LOGGING;
import android.content.Context;
@@ -275,17 +279,37 @@ public class AllAppsRecyclerView extends FastScrollRecyclerView {
private void logCumulativeVerticalScroll() {
ActivityContext context = ActivityContext.lookupContext(getContext());
StatsLogManager mgr = context.getStatsLogManager();
ExtendedEditText editText = context.getAppsView().getSearchUiManager().getEditText();
ActivityAllAppsContainerView<?> appsView = context.getAppsView();
ExtendedEditText editText = appsView.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);
if (mCumulativeVerticalScroll == 0) {
// mCumulativeVerticalScroll == 0 when user comes back to original position, we
// don't know the direction of scrolling.
mgr.logger().withContainerInfo(containerInfo).log(
LAUNCHER_ALLAPPS_SCROLLED_UNKNOWN_DIRECTION);
return;
} else if (appsView.isSearching()) {
// In search results page
mgr.logger().withContainerInfo(containerInfo).log((mCumulativeVerticalScroll > 0)
? LAUNCHER_ALLAPPS_SEARCH_SCROLLED_DOWN
: LAUNCHER_ALLAPPS_SEARCH_SCROLLED_UP);
return;
} else if (appsView.mViewPager != null) {
int currentPage = appsView.mViewPager.getCurrentPage();
if (currentPage == BaseAllAppsContainerView.AdapterHolder.WORK) {
// In work A-Z list
mgr.logger().withContainerInfo(containerInfo).log((mCumulativeVerticalScroll > 0)
? LAUNCHER_WORK_FAB_BUTTON_COLLAPSE
: LAUNCHER_WORK_FAB_BUTTON_EXTEND);
return;
}
}
// In personal A-Z list
mgr.logger().withContainerInfo(containerInfo).log((mCumulativeVerticalScroll > 0)
? LAUNCHER_ALLAPPS_PERSONAL_SCROLLED_DOWN
: LAUNCHER_ALLAPPS_PERSONAL_SCROLLED_UP);
}
}

View File

@@ -203,12 +203,10 @@ public class WorkModeSwitch extends LinearLayout implements Insettable,
public void extend() {
mTextView.setVisibility(VISIBLE);
mStatsLogManager.logger().log(LAUNCHER_WORK_FAB_BUTTON_EXTEND);
}
public void shrink(){
mTextView.setVisibility(GONE);
mStatsLogManager.logger().log(LAUNCHER_WORK_FAB_BUTTON_COLLAPSE);
}
public int getScrollThreshold() {

View File

@@ -558,14 +558,11 @@ 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 up on the all apps personal A-Z list.")
LAUNCHER_ALLAPPS_PERSONAL_SCROLLED_UP(1287),
@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 down on the all apps personal A-Z list.")
LAUNCHER_ALLAPPS_PERSONAL_SCROLLED_DOWN(1288),
@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 "
@@ -626,11 +623,19 @@ public class StatsLogManager implements ResourceBasedOverride {
@UiEvent(doc = "User has invoked split to left half with a keyboard shortcut.")
LAUNCHER_KEYBOARD_SHORTCUT_SPLIT_LEFT_TOP(1233),
@UiEvent(doc = "User has collapsed the work FAB button by swiping down")
@UiEvent(doc = "User has collapsed the work FAB button by scrolling down in the all apps"
+ " work A-Z list.")
LAUNCHER_WORK_FAB_BUTTON_COLLAPSE(1276),
@UiEvent(doc = "User has collapsed the work FAB button by swiping up")
@UiEvent(doc = "User has collapsed the work FAB button by scrolling up in the all apps"
+ " work A-Z list.")
LAUNCHER_WORK_FAB_BUTTON_EXTEND(1277),
@UiEvent(doc = "User scrolled down on the search result page.")
LAUNCHER_ALLAPPS_SEARCH_SCROLLED_DOWN(1285),
@UiEvent(doc = "User scrolled up on the search result page.")
LAUNCHER_ALLAPPS_SEARCH_SCROLLED_UP(1286),
;
// ADD MORE