Search in sources :

Example 21 with ContainerType

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

the class AbstractLauncherUiTest method checkLauncherIntegrity.

private static 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();
        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)

Example 22 with ContainerType

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

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 23 with ContainerType

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

the class UserEventDispatcher method logActionBounceTip.

public void logActionBounceTip(int containerType) {
    LauncherEvent event = newLauncherEvent(newAction(Action.Type.TIP), newContainerTarget(containerType));
    event.srcTarget[0].tipType = TipType.BOUNCE;
    dispatchUserEvent(event, null);
}
Also used : LauncherEvent(com.android.launcher3.userevent.nano.LauncherLogProto.LauncherEvent) LoggerUtils.newLauncherEvent(com.android.launcher3.logging.LoggerUtils.newLauncherEvent)

Example 24 with ContainerType

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

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 25 with ContainerType

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

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)

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