From f54e016c82aef00661b59ac67ebcdb398f5b63a1 Mon Sep 17 00:00:00 2001 From: Brandon Dayauon Date: Tue, 10 Jan 2023 10:50:55 -0800 Subject: [PATCH] split the scrolling logging into work,personal, and search - moved collapse/extend logging with the other scroll logging bug: 263817965 test: Manual - WW Change-Id: I9cd57b895c0c2edb7fe39ef98dced574d09a0953 --- .../allapps/AllAppsRecyclerView.java | 44 ++++++++++++++----- .../launcher3/allapps/WorkModeSwitch.java | 2 - .../launcher3/logging/StatsLogManager.java | 23 ++++++---- 3 files changed, 48 insertions(+), 21 deletions(-) diff --git a/src/com/android/launcher3/allapps/AllAppsRecyclerView.java b/src/com/android/launcher3/allapps/AllAppsRecyclerView.java index d308fcb3b8..8cb31fa2e1 100644 --- a/src/com/android/launcher3/allapps/AllAppsRecyclerView.java +++ b/src/com/android/launcher3/allapps/AllAppsRecyclerView.java @@ -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); } } diff --git a/src/com/android/launcher3/allapps/WorkModeSwitch.java b/src/com/android/launcher3/allapps/WorkModeSwitch.java index 11ce738208..3f2f21d470 100644 --- a/src/com/android/launcher3/allapps/WorkModeSwitch.java +++ b/src/com/android/launcher3/allapps/WorkModeSwitch.java @@ -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() { diff --git a/src/com/android/launcher3/logging/StatsLogManager.java b/src/com/android/launcher3/logging/StatsLogManager.java index 2159c6b68f..5f6df277f8 100644 --- a/src/com/android/launcher3/logging/StatsLogManager.java +++ b/src/com/android/launcher3/logging/StatsLogManager.java @@ -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