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

Commit b812b3ff authored by thiruram's avatar thiruram
Browse files

Log tapping on split screen & free form icons within task menu.

Bug: 157770913

Sample Log: https://docs.google.com/document/d/1FXi_jY1B63aMSjNyomAmoN1nSTtVbvculNGX7TKdRRw/edit#bookmark=id.4hmzxwn1efy

Change-Id: Id98dccb9452af7be20f636410d886dc8aeaa6bd1
parent 9752dedd
Loading
Loading
Loading
Loading
+17 −9
Original line number Diff line number Diff line
@@ -18,6 +18,8 @@ package com.android.quickstep;

import static android.view.Display.DEFAULT_DISPLAY;

import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_SYSTEM_SHORTCUT_FREE_FORM_TAP;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_SYSTEM_SHORTCUT_SPLIT_SCREEN_TAP;
import static com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch.TAP;

import android.app.Activity;
@@ -35,6 +37,7 @@ import android.view.View;
import com.android.launcher3.BaseDraggingActivity;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.R;
import com.android.launcher3.logging.StatsLogManager.LauncherEvent;
import com.android.launcher3.model.WellbeingModel;
import com.android.launcher3.model.data.WorkspaceItemInfo;
import com.android.launcher3.popup.SystemShortcut;
@@ -83,10 +86,12 @@ public interface TaskShortcutFactory {

        private final int mIconRes;
        private final int mTextRes;
        private final LauncherEvent mLauncherEvent;

        MultiWindowFactory(int iconRes, int textRes) {
        MultiWindowFactory(int iconRes, int textRes, LauncherEvent launcherEvent) {
            mIconRes = iconRes;
            mTextRes = textRes;
            mLauncherEvent = launcherEvent;
        }

        protected abstract boolean isAvailable(BaseDraggingActivity activity, int displayId);
@@ -102,7 +107,8 @@ public interface TaskShortcutFactory {
            if (!isAvailable(activity, task.key.displayId)) {
                return null;
            }
            return new MultiWindowSystemShortcut(mIconRes, mTextRes, activity, taskView, this);
            return new MultiWindowSystemShortcut(mIconRes, mTextRes, activity, taskView, this,
                    mLauncherEvent);
        }
    }

@@ -114,11 +120,12 @@ public interface TaskShortcutFactory {
        private final TaskThumbnailView mThumbnailView;
        private final TaskView mTaskView;
        private final MultiWindowFactory mFactory;
        private final LauncherEvent mLauncherEvent;

        public MultiWindowSystemShortcut(int iconRes, int textRes,
                BaseDraggingActivity activity, TaskView taskView, MultiWindowFactory factory) {
        public MultiWindowSystemShortcut(int iconRes, int textRes, BaseDraggingActivity activity,
                TaskView taskView, MultiWindowFactory factory, LauncherEvent launcherEvent) {
            super(iconRes, textRes, activity, dummyInfo(taskView));

            mLauncherEvent = launcherEvent;
            mHandler = new Handler(Looper.getMainLooper());
            mTaskView = taskView;
            mRecentsView = activity.getOverviewPanel();
@@ -203,12 +210,13 @@ public interface TaskShortcutFactory {
                WindowManagerWrapper.getInstance().overridePendingAppTransitionMultiThumbFuture(
                        future, animStartedListener, mHandler, true /* scaleUp */,
                        taskKey.displayId);
                mTarget.getStatsLogManager().log(mLauncherEvent, mTaskView.buildProto());
            }
        }
    }

    TaskShortcutFactory SPLIT_SCREEN = new MultiWindowFactory(
            R.drawable.ic_split_screen, R.string.recent_task_option_split_screen) {
    TaskShortcutFactory SPLIT_SCREEN = new MultiWindowFactory(R.drawable.ic_split_screen,
            R.string.recent_task_option_split_screen, LAUNCHER_SYSTEM_SHORTCUT_SPLIT_SCREEN_TAP) {

        @Override
        protected boolean isAvailable(BaseDraggingActivity activity, int displayId) {
@@ -241,8 +249,8 @@ public interface TaskShortcutFactory {
        }
    };

    TaskShortcutFactory FREE_FORM = new MultiWindowFactory(
            R.drawable.ic_split_screen, R.string.recent_task_option_freeform) {
    TaskShortcutFactory FREE_FORM = new MultiWindowFactory(R.drawable.ic_split_screen,
            R.string.recent_task_option_freeform, LAUNCHER_SYSTEM_SHORTCUT_FREE_FORM_TAP) {

        @Override
        protected boolean isAvailable(BaseDraggingActivity activity, int displayId) {
+2 −2
Original line number Diff line number Diff line
@@ -223,8 +223,8 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
        setOutlineProvider(mOutlineProvider);
    }

    /* Builds proto for logging */
    protected LauncherAtom.ItemInfo buildProto() {
    /** Builds proto for logging */
    public LauncherAtom.ItemInfo buildProto() {
        ComponentKey componentKey = TaskUtils.getLaunchComponentKeyForTask(getTask().key);
        LauncherAtom.ItemInfo.Builder itemBuilder = LauncherAtom.ItemInfo.newBuilder();
        itemBuilder.setIsWork(componentKey.user != Process.myUserHandle());
+9 −3
Original line number Diff line number Diff line
@@ -96,6 +96,10 @@ public class StatsLogManager implements ResourceBasedOverride {
                + "the icon onto 'Uninstall' button in the target bar")
        LAUNCHER_ITEM_UNINSTALL_CANCELLED(470),

        @UiEvent(doc = "User tapped or long pressed on the task icon(aka package icon) "
                + "from overview to open task menu.")
        LAUNCHER_TASK_ICON_TAP_OR_LONGPRESS(517),

        @UiEvent(doc = "User opened package specific widgets list by tapping on widgets system "
                + "shortcut within longpress popup window.")
        LAUNCHER_SYSTEM_SHORTCUT_WIDGETS_TAP(514),
@@ -104,9 +108,11 @@ public class StatsLogManager implements ResourceBasedOverride {
                + "within longpress popup window.")
        LAUNCHER_SYSTEM_SHORTCUT_APP_INFO_TAP(515),

        @UiEvent(doc = "User tapped or long pressed on the task icon(aka package icon) "
                + "from overview to open task menu.")
        LAUNCHER_TASK_ICON_TAP_OR_LONGPRESS(517);
        @UiEvent(doc = "User tapped on split screen icon on a task menu.")
        LAUNCHER_SYSTEM_SHORTCUT_SPLIT_SCREEN_TAP(518),

        @UiEvent(doc = "User tapped on free form icon on a task menu.")
        LAUNCHER_SYSTEM_SHORTCUT_FREE_FORM_TAP(519);
        // ADD MORE

        private final int mId;