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

Commit aafa8a44 authored by thiruram's avatar thiruram
Browse files

[AA+] Add LAUNCHER_ALLAPPS_KEYBOARD_CLOSED event.

Also adds Launcher.allAppsLogger method to simplify AllApps specific user events logging.

Bug: 178562918
Change-Id: I57520fe1504079091f0ff2c4c74268f727ffe14f
parent 9012515f
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -213,8 +213,12 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo
        if (insets == null) return;

        if (insets.isVisible(WindowInsets.Type.ime())) {
            getWindowInsetsController().hide(WindowInsets.Type.ime());
            hideIme();
        }
    }

    protected void hideIme() {
        getWindowInsetsController().hide(WindowInsets.Type.ime());
    }

    /**
+8 −0
Original line number Diff line number Diff line
@@ -15,6 +15,8 @@
 */
package com.android.launcher3.allapps;

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

import android.content.Context;
import android.graphics.Rect;
import android.util.AttributeSet;
@@ -93,4 +95,10 @@ public class LauncherAllAppsContainerView extends AllAppsContainerView {
            }
        }
    }

    @Override
    protected void hideIme() {
        super.hideIme();
        mLauncher.getLiveSearchManager().allAppsLogger().log(LAUNCHER_ALLAPPS_KEYBOARD_CLOSED);
    }
}
+14 −3
Original line number Diff line number Diff line
@@ -153,15 +153,15 @@ public class LiveSearchManager implements StateListener<LauncherState> {
            clearWidgetHost();
        }

        StatsLogger logger = mLauncher.getStatsLogManager().logger();
        if (finalState.equals(ALL_APPS)) {
            // creates new instance ID since new all apps session is started.
            mLogInstanceId = new InstanceIdSequence().newInstanceId();
            logger.withInstanceId(mLogInstanceId).log(LAUNCHER_ALLAPPS_ENTRY);
            allAppsLogger().log(LAUNCHER_ALLAPPS_ENTRY);
        } else if (mPrevLauncherState.equals(ALL_APPS)
                // Check if mLogInstanceId is not null; to avoid NPE when LAUNCHER_ALLAPPS_EXIT is
                // triggered multiple times
                && mLogInstanceId != null) {
            logger.withInstanceId(mLogInstanceId).log(LAUNCHER_ALLAPPS_EXIT);
            allAppsLogger().log(LAUNCHER_ALLAPPS_EXIT);
            mLogInstanceId = null;
        }
    }
@@ -316,4 +316,15 @@ public class LiveSearchManager implements StateListener<LauncherState> {
        @Override
        public void onActivitySaveInstanceState(Activity activity, Bundle bundle) { }
    }

    /**
     * Returns new instance of {@link StatsLogger} pre-populated with details required to log
     * AllApps specific user events.
     */
    public StatsLogger allAppsLogger() {
        return getLogInstanceId()
                .map(instanceId -> mLauncher.getStatsLogManager().logger()
                        .withInstanceId(instanceId))
                .orElse(mLauncher.getStatsLogManager().logger());
    }
}
+3 −0
Original line number Diff line number Diff line
@@ -350,6 +350,9 @@ public class StatsLogManager implements ResourceBasedOverride {

        @UiEvent(doc = "Launcher exited from AllApps state.")
        LAUNCHER_ALLAPPS_EXIT(693),

        @UiEvent(doc = "User closed the AllApps keyboard.")
        LAUNCHER_ALLAPPS_KEYBOARD_CLOSED(694),
        ;

        // ADD MORE