Search in sources :

Example 6 with ContainerType

use of com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType in project android_packages_apps_Trebuchet by LineageOS.

the class UserEventDispatcher method logActionOnContainer.

public void logActionOnContainer(int action, int dir, int containerType, int pageIndex) {
    LauncherEvent event = newLauncherEvent(newTouchAction(action), newContainerTarget(containerType));
    event.action.dir = dir;
    event.srcTarget[0].pageIndex = pageIndex;
    dispatchUserEvent(event, null);
}
Also used : LauncherEvent(com.android.launcher3.userevent.nano.LauncherLogProto.LauncherEvent) LoggerUtils.newLauncherEvent(com.android.launcher3.logging.LoggerUtils.newLauncherEvent)

Example 7 with ContainerType

use of com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType in project Neo-Launcher by NeoApplications.

the class OverviewWithoutFocusInputConsumer method finishTouchTracking.

private void finishTouchTracking(MotionEvent ev) {
    mVelocityTracker.computeCurrentVelocity(100);
    float velocityX = mVelocityTracker.getXVelocity();
    float velocityY = mVelocityTracker.getYVelocity();
    float velocity = mNavBarPosition.isRightEdge() ? -velocityX : (mNavBarPosition.isLeftEdge() ? velocityX : -velocityY);
    final boolean triggerQuickstep;
    int touch = Touch.FLING;
    if (Math.abs(velocity) >= ViewConfiguration.get(mContext).getScaledMinimumFlingVelocity()) {
        triggerQuickstep = velocity > 0;
    } else {
        float displacementX = mDisableHorizontalSwipe ? 0 : (ev.getX() - mDownPos.x);
        float displacementY = ev.getY() - mDownPos.y;
        triggerQuickstep = squaredHypot(displacementX, displacementY) >= mSquaredTouchSlop;
        touch = Touch.SWIPE;
    }
    if (triggerQuickstep) {
        mContext.startActivity(new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_HOME).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
        TOUCH_INTERACTION_LOG.addLog("startQuickstep");
        BaseActivity activity = BaseDraggingActivity.fromContext(mContext);
        // This number doesn't reflect workspace page index.
        int pageIndex = -1;
        // It only indicates that launcher client screen was shown.
        int containerType = StatsLogUtils.getContainerTypeFromState(activity.getCurrentState());
        activity.getUserEventDispatcher().logActionOnContainer(touch, Direction.UP, containerType, pageIndex);
        activity.getUserEventDispatcher().setPreviousHomeGesture(true);
    } else {
    // ignore
    }
}
Also used : BaseActivity(com.android.launcher3.BaseActivity) Intent(android.content.Intent)

Example 8 with ContainerType

use of com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType in project Neo-Launcher by NeoApplications.

the class UserEventDispatcher method logActionCommand.

/**
 * TODO: Make this function work when a container view is passed as the 2nd param.
 */
public void logActionCommand(int command, View itemView, int srcContainerType) {
    LauncherEvent event = newLauncherEvent(newCommandAction(command), newItemTarget(itemView, mInstantAppResolver), newTarget(Target.Type.CONTAINER));
    if (fillInLogContainerData(event, itemView)) {
        // TODO: Remove the following two lines once fillInLogContainerData can take in a
        // container view.
        event.srcTarget[0].type = Target.Type.CONTAINER;
        event.srcTarget[0].containerType = srcContainerType;
    }
    dispatchUserEvent(event, null);
}
Also used : LauncherEvent(com.android.launcher3.userevent.nano.LauncherLogProto.LauncherEvent) LoggerUtils.newLauncherEvent(com.android.launcher3.logging.LoggerUtils.newLauncherEvent)

Example 9 with ContainerType

use of com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType in project Neo-Launcher by NeoApplications.

the class LoggerUtils method newContainerTarget.

public static Target newContainerTarget(int containerType) {
    Target t = newTarget(Target.Type.CONTAINER);
    t.containerType = containerType;
    return t;
}
Also used : Target(com.android.launcher3.userevent.nano.LauncherLogProto.Target) ButtonDropTarget(com.android.launcher3.ButtonDropTarget)

Example 10 with ContainerType

use of com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType in project Neo-Launcher by NeoApplications.

the class AbstractLauncherUiTest method checkLauncherIntegrity.

private static void checkLauncherIntegrity(Launcher launcher, ContainerType expectedContainerType) {
    if (launcher != null) {
        final LauncherStateManager stateManager = launcher.getStateManager();
        final LauncherState stableState = stateManager.getCurrentStableState();
        assertTrue("Stable state != state: " + stableState.getClass().getSimpleName() + ", " + stateManager.getState().getClass().getSimpleName(), stableState == stateManager.getState());
        final boolean isResumed = launcher.hasBeenResumed();
        assertTrue("hasBeenResumed() != isStarted(), hasBeenResumed(): " + isResumed, isResumed == launcher.isStarted());
        assertTrue("hasBeenResumed() != isUserActive(), hasBeenResumed(): " + isResumed, isResumed == launcher.isUserActive());
        final int ordinal = stableState.ordinal;
        switch(expectedContainerType) {
            case WORKSPACE:
            case WIDGETS:
                {
                    assertTrue("Launcher is not resumed in state: " + expectedContainerType, isResumed);
                    assertTrue(TestProtocol.stateOrdinalToString(ordinal), ordinal == TestProtocol.NORMAL_STATE_ORDINAL);
                    break;
                }
            case ALL_APPS:
                {
                    assertTrue("Launcher is not resumed in state: " + expectedContainerType, isResumed);
                    assertTrue(TestProtocol.stateOrdinalToString(ordinal), ordinal == TestProtocol.ALL_APPS_STATE_ORDINAL);
                    break;
                }
            case OVERVIEW:
                {
                    assertTrue("Launcher is not resumed in state: " + expectedContainerType, isResumed);
                    assertTrue(TestProtocol.stateOrdinalToString(ordinal), ordinal == TestProtocol.OVERVIEW_STATE_ORDINAL);
                    break;
                }
            case BACKGROUND:
                {
                    assertTrue("Launcher is resumed in state: " + expectedContainerType, !isResumed);
                    assertTrue(TestProtocol.stateOrdinalToString(ordinal), ordinal == TestProtocol.NORMAL_STATE_ORDINAL);
                    break;
                }
            default:
                throw new IllegalArgumentException("Illegal container: " + expectedContainerType);
        }
    } else {
        assertTrue("Container type is not BACKGROUND or FALLBACK_OVERVIEW: " + expectedContainerType, expectedContainerType == ContainerType.BACKGROUND || expectedContainerType == ContainerType.FALLBACK_OVERVIEW);
    }
}
Also used : LauncherState(com.android.launcher3.LauncherState) LauncherStateManager(com.android.launcher3.LauncherStateManager)

Aggregations

LoggerUtils.newLauncherEvent (com.android.launcher3.logging.LoggerUtils.newLauncherEvent)8 LauncherEvent (com.android.launcher3.userevent.nano.LauncherLogProto.LauncherEvent)8 BaseActivity (com.android.launcher3.BaseActivity)7 LauncherState (com.android.launcher3.LauncherState)7 Target (com.android.launcher3.userevent.nano.LauncherLogProto.Target)6 ActivityNotFoundException (android.content.ActivityNotFoundException)5 LoggerUtils.newContainerTarget (com.android.launcher3.logging.LoggerUtils.newContainerTarget)4 LoggerUtils.newTarget (com.android.launcher3.logging.LoggerUtils.newTarget)3 ButtonDropTarget (com.android.launcher3.ButtonDropTarget)2 DropTarget (com.android.launcher3.DropTarget)2 LoggerUtils.newAction (com.android.launcher3.logging.LoggerUtils.newAction)2 LoggerUtils.newCommandAction (com.android.launcher3.logging.LoggerUtils.newCommandAction)2 LoggerUtils.newControlTarget (com.android.launcher3.logging.LoggerUtils.newControlTarget)2 LoggerUtils.newDropTarget (com.android.launcher3.logging.LoggerUtils.newDropTarget)2 LoggerUtils.newItemTarget (com.android.launcher3.logging.LoggerUtils.newItemTarget)2 LoggerUtils.newTouchAction (com.android.launcher3.logging.LoggerUtils.newTouchAction)2 UserEventDispatcher (com.android.launcher3.logging.UserEventDispatcher)2 Action (com.android.launcher3.userevent.nano.LauncherLogProto.Action)2 AppWidgetHostView (android.appwidget.AppWidgetHostView)1 Intent (android.content.Intent)1