Search in sources :

Example 1 with ContainerType

use of com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType in project android_packages_apps_Launcher3 by crdroidandroid.

the class OverviewWithoutFocusInputConsumer method onSwipeUp.

@Override
public void onSwipeUp(boolean wasFling, PointF finalVelocity) {
    try {
        mContext.startActivity(mGestureState.getHomeIntent());
    } catch (NullPointerException | ActivityNotFoundException | SecurityException e) {
        mContext.startActivity(createHomeIntent());
    }
    ActiveGestureLog.INSTANCE.addLog("startQuickstep");
    BaseActivity activity = BaseDraggingActivity.fromContext(mContext);
    int state = (mGestureState != null && mGestureState.getEndTarget() != null) ? mGestureState.getEndTarget().containerType : LAUNCHER_STATE_HOME;
    activity.getStatsLogManager().logger().withSrcState(LAUNCHER_STATE_BACKGROUND).withDstState(state).withContainerInfo(LauncherAtom.ContainerInfo.newBuilder().setWorkspace(LauncherAtom.WorkspaceContainer.newBuilder().setPageIndex(-1)).build()).log(LAUNCHER_HOME_GESTURE);
}
Also used : ActivityNotFoundException(android.content.ActivityNotFoundException) BaseActivity(com.android.launcher3.BaseActivity)

Example 2 with ContainerType

use of com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType in project android_packages_apps_Launcher3 by AOSPA.

the class AbstractLauncherUiTest method checkLauncherIntegrity.

private void checkLauncherIntegrity(Launcher launcher, ContainerType expectedContainerType) {
    if (launcher != null) {
        final StateManager<LauncherState> 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();
        final boolean isStarted = launcher.isStarted();
        checkLauncherState(launcher, expectedContainerType, isResumed, isStarted);
        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:
                {
                    checkLauncherStateInOverview(launcher, expectedContainerType, isStarted, 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)

Example 3 with ContainerType

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

the class OverviewWithoutFocusInputConsumer method onSwipeUp.

@Override
public void onSwipeUp(boolean wasFling, PointF finalVelocity) {
    mContext.startActivity(mGestureState.getHomeIntent());
    ActiveGestureLog.INSTANCE.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 = (mGestureState != null && mGestureState.getEndTarget() != null) ? mGestureState.getEndTarget().containerType : LauncherLogProto.ContainerType.WORKSPACE;
    activity.getUserEventDispatcher().logActionOnContainer(wasFling ? Touch.FLING : Touch.SWIPE, Direction.UP, containerType, pageIndex);
    activity.getUserEventDispatcher().setPreviousHomeGesture(true);
    activity.getStatsLogManager().logger().withSrcState(LAUNCHER_STATE_HOME).withDstState(LAUNCHER_STATE_HOME).withContainerInfo(LauncherAtom.ContainerInfo.newBuilder().setWorkspace(LauncherAtom.WorkspaceContainer.newBuilder().setPageIndex(-1)).build()).log(LAUNCHER_HOME_GESTURE);
}
Also used : BaseActivity(com.android.launcher3.BaseActivity)

Example 4 with ContainerType

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

the class Launcher method onNewIntent.

@Override
protected void onNewIntent(Intent intent) {
    if (Utilities.IS_RUNNING_IN_TEST_HARNESS) {
        Log.d(TestProtocol.PERMANENT_DIAG_TAG, "Launcher.onNewIntent: " + intent);
    }
    Object traceToken = TraceHelper.INSTANCE.beginSection(ON_NEW_INTENT_EVT);
    super.onNewIntent(intent);
    boolean alreadyOnHome = hasWindowFocus() && ((intent.getFlags() & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) != Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT);
    // Check this condition before handling isActionMain, as this will get reset.
    boolean shouldMoveToDefaultScreen = alreadyOnHome && isInState(NORMAL) && AbstractFloatingView.getTopOpenView(this) == null;
    boolean isActionMain = Intent.ACTION_MAIN.equals(intent.getAction());
    boolean internalStateHandled = ACTIVITY_TRACKER.handleNewIntent(this, intent);
    if (isActionMain) {
        if (!internalStateHandled) {
            // In all these cases, only animate if we're already on home
            closeOpenViews(isStarted());
            if (!isInState(NORMAL)) {
                // Only change state, if not already the same. This prevents cancelling any
                // animations running as part of resume
                mStateManager.goToState(NORMAL, mStateManager.shouldAnimateStateChange(), this::handlePendingActivityRequest);
            }
            // Reset the apps view
            if (!alreadyOnHome) {
                mAppsView.reset(isStarted());
            }
            if (shouldMoveToDefaultScreen && !mWorkspace.isHandlingTouch()) {
                mWorkspace.post(mWorkspace::moveToDefaultScreen);
            }
        }
        // Handle HOME_INTENT
        UserEventDispatcher ued = getUserEventDispatcher();
        Target target = newContainerTarget(mStateManager.getState().containerType);
        target.pageIndex = mWorkspace.getCurrentPage();
        ued.logActionCommand(Action.Command.HOME_INTENT, target, newContainerTarget(ContainerType.WORKSPACE));
        hideKeyboard();
        if (mLauncherCallbacks != null) {
            mLauncherCallbacks.onHomeIntent(internalStateHandled);
        }
        mOverlayManager.hideOverlay(isStarted() && !isForceInvisible());
        handleGestureContract(intent);
    } else if (Intent.ACTION_ALL_APPS.equals(intent.getAction())) {
        getStateManager().goToState(ALL_APPS, alreadyOnHome);
    }
    TraceHelper.INSTANCE.endSection(traceToken);
}
Also used : UserEventDispatcher(com.android.launcher3.logging.UserEventDispatcher) Target(com.android.launcher3.userevent.nano.LauncherLogProto.Target) LoggerUtils.newContainerTarget(com.android.launcher3.logging.LoggerUtils.newContainerTarget) DragObject(com.android.launcher3.DropTarget.DragObject)

Example 5 with ContainerType

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

the class UserEventDispatcher method logActionBack.

public void logActionBack(boolean completed, int downX, int downY, boolean isButton, boolean gestureSwipeLeft, int containerType) {
    int actionTouch = isButton ? Action.Touch.TAP : Action.Touch.SWIPE;
    Action action = newCommandAction(actionTouch);
    action.command = Action.Command.BACK;
    action.dir = isButton ? Action.Direction.NONE : gestureSwipeLeft ? Action.Direction.LEFT : Action.Direction.RIGHT;
    Target target = newControlTarget(isButton ? ControlType.BACK_BUTTON : ControlType.BACK_GESTURE);
    target.spanX = downX;
    target.spanY = downY;
    target.cardinality = completed ? 1 : 0;
    LauncherEvent event = newLauncherEvent(action, target, newContainerTarget(containerType));
    dispatchUserEvent(event, null);
}
Also used : LoggerUtils.newCommandAction(com.android.launcher3.logging.LoggerUtils.newCommandAction) LoggerUtils.newTouchAction(com.android.launcher3.logging.LoggerUtils.newTouchAction) LoggerUtils.newAction(com.android.launcher3.logging.LoggerUtils.newAction) Action(com.android.launcher3.userevent.nano.LauncherLogProto.Action) LoggerUtils.newTarget(com.android.launcher3.logging.LoggerUtils.newTarget) Target(com.android.launcher3.userevent.nano.LauncherLogProto.Target) LoggerUtils.newControlTarget(com.android.launcher3.logging.LoggerUtils.newControlTarget) LoggerUtils.newItemTarget(com.android.launcher3.logging.LoggerUtils.newItemTarget) DropTarget(com.android.launcher3.DropTarget) LoggerUtils.newContainerTarget(com.android.launcher3.logging.LoggerUtils.newContainerTarget) LoggerUtils.newDropTarget(com.android.launcher3.logging.LoggerUtils.newDropTarget) LauncherEvent(com.android.launcher3.userevent.nano.LauncherLogProto.LauncherEvent) LoggerUtils.newLauncherEvent(com.android.launcher3.logging.LoggerUtils.newLauncherEvent)

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