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

Commit 61745e17 authored by Hyunyoung Song's avatar Hyunyoung Song Committed by Android (Google) Code Review
Browse files

Merge "Add logging for Onboarding Bug: 73784423" into ub-launcher3-edmonton

parents 46afdf51 018eec68
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -55,6 +55,7 @@ message Target {
  optional int32 span_y = 14 [default = 1];// Used for ItemType.WIDGET
  optional int32 predictedRank = 15;
  optional TargetExtension extension = 16;
  optional TipType tip_type = 17;
}

// Used to define what type of item a Target would represent.
@@ -88,6 +89,7 @@ enum ContainerType {
  NAVBAR = 11;
  TASKSWITCHER = 12; // Recents UI Container (QuickStep)
  APP = 13; // Foreground activity is another app (QuickStep)
  TIP = 14; // Onboarding texts (QuickStep)
}

// Used to define what type of control a Target would represent.
@@ -109,14 +111,24 @@ enum ControlType {
  CANCEL_TARGET = 14;
}

enum TipType {
  DEFAULT_NONE = 0;
  BOUNCE = 1;
  SWIPE_UP_TEXT = 2;
  QUICK_SCRUB_TEXT = 3;
  PREDICTION_TEXT = 4;
}

// Used to define the action component of the LauncherEvent.
message Action {
  enum Type {
    TOUCH = 0;
    AUTOMATED = 1;
    COMMAND = 2;
    TIP = 3;
    // SOFT_KEYBOARD, HARD_KEYBOARD, ASSIST
  }

  enum Touch {
    TAP = 0;
    LONGPRESS = 1;
@@ -125,6 +137,7 @@ message Action {
    FLING = 4;
    PINCH = 5;
  }

  enum Direction {
    NONE = 0;
    UP = 1;
−154 B (125 KiB)

File changed.

No diff preview for this file type.

+13 −0
Original line number Diff line number Diff line
@@ -48,8 +48,10 @@ import android.view.ViewConfiguration;

import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.BaseDraggingActivity;
import com.android.launcher3.InvariantDeviceProfile;
import com.android.launcher3.MainThreadExecutor;
import com.android.launcher3.anim.AnimationSuccessListener;
import com.android.launcher3.logging.UserEventDispatcher;
import com.android.quickstep.ActivityControlHelper.ActivityInitListener;
import com.android.quickstep.ActivityControlHelper.AnimationFactory;
import com.android.quickstep.ActivityControlHelper.FallbackActivityControllerHelper;
@@ -189,6 +191,17 @@ public class OverviewCommandHelper {
        mMainThreadExecutor.execute(new ShowRecentsCommand());
    }

    public void onTip(int actionType, int viewType) {
        mMainThreadExecutor.execute(new Runnable() {
            @Override
            public void run() {
                UserEventDispatcher.newInstance(mContext,
                        new InvariantDeviceProfile(mContext).getDeviceProfile(mContext))
                        .logActionTip(actionType, viewType);
            }
        });
    }

    public ActivityControlHelper getActivityControlHelper() {
        return mActivityControlHelper;
    }
+5 −0
Original line number Diff line number Diff line
@@ -147,6 +147,11 @@ public class TouchInteractionService extends Service {
            TraceHelper.endSection("SysUiBinder", "onQuickStep");

        }

        @Override
        public void onTip(int actionType, int viewType) {
            mOverviewCommandHelper.onTip(actionType, viewType);
        }
    };

    private final TouchConsumer mNoOpTouchConsumer = (ev) -> {};
+51 −1
Original line number Diff line number Diff line
@@ -15,15 +15,32 @@
 */
package com.android.quickstep.logging;

import android.util.Log;

import static com.android.launcher3.logging.LoggerUtils.newAction;
import static com.android.launcher3.logging.LoggerUtils.newContainerTarget;
import static com.android.launcher3.logging.LoggerUtils.newLauncherEvent;
import static com.android.launcher3.userevent.nano.LauncherLogProto.ControlType.CANCEL_TARGET;
import static com.android.systemui.shared.system.LauncherEventUtil.VISIBLE;
import static com.android.systemui.shared.system.LauncherEventUtil.DISMISS;
import static com.android.systemui.shared.system.LauncherEventUtil.RECENTS_QUICK_SCRUB_ONBOARDING_TIP;
import static com.android.systemui.shared.system.LauncherEventUtil.RECENTS_SWIPE_UP_ONBOARDING_TIP;

import com.android.launcher3.logging.UserEventDispatcher;
import com.android.launcher3.model.nano.LauncherDumpProto;
import com.android.launcher3.userevent.nano.LauncherLogExtensions;
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.systemui.shared.system.LauncherEventUtil;
import com.android.systemui.shared.system.MetricsLoggerCompat;

/**
 * This class handles AOSP MetricsLogger function calls.
 * This class handles AOSP MetricsLogger function calls and logging around
 * quickstep interactions.
 */
public class UserEventDispatcherExtension extends UserEventDispatcher {

    private static final String TAG = "UserEventDispatcher";

    public void logStateChangeAction(int action, int dir, int srcChildTargetType,
                                     int srcParentContainerType, int dstContainerType,
                                     int pageIndex) {
@@ -32,4 +49,37 @@ public class UserEventDispatcherExtension extends UserEventDispatcher {
        super.logStateChangeAction(action, dir, srcChildTargetType, srcParentContainerType,
                dstContainerType, pageIndex);
    }

    public void logActionTip(int actionType, int viewType) {
        LauncherLogProto.Action action = new LauncherLogProto.Action();
        LauncherLogProto.Target target = new LauncherLogProto.Target();
        switch(actionType) {
            case VISIBLE:
                action.type = LauncherLogProto.Action.Type.TIP;
                target.type = LauncherLogProto.Target.Type.CONTAINER;
                target.containerType = LauncherLogProto.ContainerType.TIP;
                break;
            case DISMISS:
                action.type = LauncherLogProto.Action.Type.TOUCH;
                action.touch = LauncherLogProto.Action.Touch.TAP;
                target.type = LauncherLogProto.Target.Type.CONTROL;
                target.controlType = CANCEL_TARGET;
                break;
            default:
                Log.e(TAG, "Unexpected action type = " + actionType);
        }

        switch(viewType) {
            case RECENTS_QUICK_SCRUB_ONBOARDING_TIP:
                target.tipType = LauncherLogProto.TipType.QUICK_SCRUB_TEXT;
                break;
            case RECENTS_SWIPE_UP_ONBOARDING_TIP:
                target.tipType = LauncherLogProto.TipType.SWIPE_UP_TEXT;
                break;
            default:
                Log.e(TAG, "Unexpected viewType = " + viewType);
        }
        LauncherLogProto.LauncherEvent event = newLauncherEvent(action, target);
        dispatchUserEvent(event, null);
    }
}
Loading