Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1bfd24e1 authored by thiruram's avatar thiruram Committed by Thiru Ramasamy
Browse files

[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
parent 21803095
Loading
Loading
Loading
Loading
+14 −2
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@
package com.android.launcher3.allapps;

import static com.android.launcher3.allapps.AllAppsGridAdapter.AdapterItem;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_TAP_ON_PERSONAL_TAB;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_TAP_ON_WORK_TAB;
import static com.android.launcher3.model.BgDataModel.Callbacks.FLAG_HAS_SHORTCUT_PERMISSION;
import static com.android.launcher3.model.BgDataModel.Callbacks.FLAG_QUIET_MODE_CHANGE_PERMISSION;
import static com.android.launcher3.model.BgDataModel.Callbacks.FLAG_QUIET_MODE_ENABLED;
@@ -432,9 +434,19 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo
            mAH[AdapterHolder.WORK].setup(mViewPager.getChildAt(1), mWorkMatcher);
            mViewPager.getPageIndicator().setActiveMarker(AdapterHolder.MAIN);
            findViewById(R.id.tab_personal)
                    .setOnClickListener((View view) -> mViewPager.snapToPage(AdapterHolder.MAIN));
                    .setOnClickListener((View view) -> {
                        if (mViewPager.snapToPage(AdapterHolder.MAIN)) {
                            mLauncher.getStatsLogManager().logger()
                                    .log(LAUNCHER_ALLAPPS_TAP_ON_PERSONAL_TAB);
                        }
                    });
            findViewById(R.id.tab_work)
                    .setOnClickListener((View view) -> mViewPager.snapToPage(AdapterHolder.WORK));
                    .setOnClickListener((View view) -> {
                        if (mViewPager.snapToPage(AdapterHolder.WORK)) {
                            mLauncher.getStatsLogManager().logger()
                                    .log(LAUNCHER_ALLAPPS_TAP_ON_WORK_TAB);
                        }
                    });
            onActivePageChanged(mViewPager.getNextPage());
        } else {
            mAH[AdapterHolder.MAIN].setup(findViewById(R.id.apps_list_view), null);
+16 −0
Original line number Diff line number Diff line
@@ -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;
    }
}
+0 −10
Original line number Diff line number Diff line
@@ -16,8 +16,6 @@
package com.android.launcher3.allapps;

import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_KEYBOARD_CLOSED;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_SWITCHED_TO_MAIN_TAB;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_SWITCHED_TO_WORK_TAB;

import android.content.Context;
import android.graphics.Rect;
@@ -90,14 +88,6 @@ public class LauncherAllAppsContainerView extends AllAppsContainerView {
    public void onActivePageChanged(int currentActivePage) {
        super.onActivePageChanged(currentActivePage);
        if (mUsingTabs) {
            // Log tab switches only when the launcher is in AllApps state
            if (mLauncher.getStateManager().getCurrentStableState() == LauncherState.ALL_APPS) {
                mLauncher.getStatsLogManager().logger()
                        .log(currentActivePage == AdapterHolder.WORK
                                ? LAUNCHER_ALLAPPS_SWITCHED_TO_WORK_TAB
                                : LAUNCHER_ALLAPPS_SWITCHED_TO_MAIN_TAB);
            }

            if (currentActivePage == AdapterHolder.WORK) {
                WorkEduView.showWorkEduIfNeeded(mLauncher);
            } else {
+10 −4
Original line number Diff line number Diff line
@@ -362,11 +362,11 @@ public class StatsLogManager implements ResourceBasedOverride {
        @UiEvent(doc = "User closed the AllApps keyboard.")
        LAUNCHER_ALLAPPS_KEYBOARD_CLOSED(694),

        @UiEvent(doc = "User switched to Main tab in AllApps screen.")
        LAUNCHER_ALLAPPS_SWITCHED_TO_MAIN_TAB(695),
        @UiEvent(doc = "User switched to AllApps Main/Personal tab by swiping left.")
        LAUNCHER_ALLAPPS_SWIPE_TO_PERSONAL_TAB(695),

        @UiEvent(doc = "User switched to Work tab in AllApps screen.")
        LAUNCHER_ALLAPPS_SWITCHED_TO_WORK_TAB(696),
        @UiEvent(doc = "User switched to AllApps Work tab by swiping right.")
        LAUNCHER_ALLAPPS_SWIPE_TO_WORK_TAB(696),

        @UiEvent(doc = "Default event when dedicated UI event is not available for the user action"
                + " on slice .")
@@ -398,6 +398,12 @@ public class StatsLogManager implements ResourceBasedOverride {

        @UiEvent(doc = "Launcher entered into AllApps state with device search enabled.")
        LAUNCHER_ALLAPPS_ENTRY_WITH_DEVICE_SEARCH(720),

        @UiEvent(doc = "User switched to AllApps Main/Personal tab by tapping on it.")
        LAUNCHER_ALLAPPS_TAP_ON_PERSONAL_TAB(721),

        @UiEvent(doc = "User switched to AllApps Work tab by tapping on it.")
        LAUNCHER_ALLAPPS_TAP_ON_WORK_TAB(722),
        ;

        // ADD MORE