[AA+] Fixes duplicate LAUNCHER_ALLAPPS_SWITCHED_TO_MAIN_TAB logs.

LAUNCHER_ALLAPPS_SWITCHED_TO_MAIN_TAB is logged when transistioning from AllApps search results view to all apps view.

Bug: 178562918
Test: Manual
Change-Id: Ie02e23ae9eaabad719ad2a1fc8f08a9e4c36936f
This commit is contained in:
thiruram
2021-02-12 20:09:12 -08:00
committed by Thiru Ramasamy
parent 21803095ee
commit 1bfd24e13f
4 changed files with 40 additions and 16 deletions

View File

@@ -15,9 +15,13 @@
*/
package com.android.launcher3.allapps;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_SWIPE_TO_PERSONAL_TAB;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_SWIPE_TO_WORK_TAB;
import android.content.Context;
import android.util.AttributeSet;
import com.android.launcher3.Launcher;
import com.android.launcher3.PagedView;
import com.android.launcher3.R;
import com.android.launcher3.config.FeatureFlags;
@@ -44,4 +48,16 @@ public class AllAppsPagedView extends PersonalWorkPagedView {
R.dimen.all_apps_header_top_padding);
setPadding(0, topPadding, 0, 0);
}
@Override
protected boolean snapToPageWithVelocity(int whichPage, int velocity) {
boolean resp = super.snapToPageWithVelocity(whichPage, velocity);
if (resp && whichPage != mCurrentPage) {
Launcher.getLauncher(getContext()).getStatsLogManager().logger()
.log(mCurrentPage < whichPage
? LAUNCHER_ALLAPPS_SWIPE_TO_WORK_TAB
: LAUNCHER_ALLAPPS_SWIPE_TO_PERSONAL_TAB);
}
return resp;
}
}