Search in sources :

Example 51 with Target

use of com.android.launcher3.userevent.nano.LauncherLogProto.Target 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)

Example 52 with Target

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

the class UserEventDispatcher method logActionOnControl.

/**
 * Logs control action with proper parent hierarchy
 */
public void logActionOnControl(int actionType, int controlType, @Nullable View controlInContainer, int... parentTypes) {
    Target control = newTarget(Target.Type.CONTROL);
    control.controlType = controlType;
    Action action = newAction(actionType);
    ArrayList<Target> targets = makeTargetsList(control);
    if (controlInContainer != null) {
        fillLogContainer(controlInContainer, control, targets);
    }
    for (int parentContainerType : parentTypes) {
        if (parentContainerType < 0)
            continue;
        targets.add(newContainerTarget(parentContainerType));
    }
    LauncherEvent event = newLauncherEvent(action, targets);
    if (actionType == Action.Touch.DRAGDROP) {
        event.actionDurationMillis = SystemClock.uptimeMillis() - mActionDurationMillis;
    }
    dispatchUserEvent(event, null);
}
Also used : 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) 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) LauncherEvent(com.android.launcher3.userevent.nano.LauncherLogProto.LauncherEvent) LoggerUtils.newLauncherEvent(com.android.launcher3.logging.LoggerUtils.newLauncherEvent)

Example 53 with Target

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

the class UserEventDispatcher method logActionCommand.

public void logActionCommand(int command, Target srcTarget, Target dstTarget) {
    LauncherEvent event = newLauncherEvent(newCommandAction(command), srcTarget);
    if (command == Action.Command.STOP) {
        if (mAppOrTaskLaunch || !mSessionStarted) {
            mSessionStarted = false;
            return;
        }
    }
    if (dstTarget != null) {
        event.destTarget = new Target[1];
        event.destTarget[0] = dstTarget;
        event.action.isStateChange = true;
    }
    dispatchUserEvent(event, null);
}
Also used : LauncherEvent(com.android.launcher3.userevent.nano.LauncherLogProto.LauncherEvent) LoggerUtils.newLauncherEvent(com.android.launcher3.logging.LoggerUtils.newLauncherEvent)

Example 54 with Target

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

the class PredictionUiStateManager method fillInPredictedRank.

/**
 * Fill in predicted_rank field based on app prediction.
 * Only applicable when {@link ItemInfo#itemType} is one of the followings:
 * {@link LauncherSettings.Favorites#ITEM_TYPE_APPLICATION},
 * {@link LauncherSettings.Favorites#ITEM_TYPE_SHORTCUT},
 * {@link LauncherSettings.Favorites#ITEM_TYPE_DEEP_SHORTCUT}
 */
public static void fillInPredictedRank(@NonNull ItemInfo itemInfo, @NonNull LauncherLogProto.Target target) {
    final PredictionUiStateManager manager = PredictionUiStateManager.INSTANCE.getNoCreate();
    if (manager == null || itemInfo.getTargetComponent() == null || itemInfo.user == null || (itemInfo.itemType != LauncherSettings.Favorites.ITEM_TYPE_APPLICATION && itemInfo.itemType != LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT && itemInfo.itemType != LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT)) {
        return;
    }
    final ComponentKey k = new ComponentKey(itemInfo.getTargetComponent(), itemInfo.user);
    final List<ComponentKeyMapper> predictedApps = manager.getCurrentState().apps;
    IntStream.range(0, predictedApps.size()).filter((i) -> k.equals(predictedApps.get(i).getComponentKey())).findFirst().ifPresent((rank) -> target.predictedRank = rank);
}
Also used : ComponentKey(com.android.launcher3.util.ComponentKey)

Example 55 with Target

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

the class RecentsView method createTaskLauncherAnimation.

public PendingAnimation createTaskLauncherAnimation(TaskView tv, long duration) {
    if (FeatureFlags.IS_DOGFOOD_BUILD && mPendingAnimation != null) {
        throw new IllegalStateException("Another pending animation is still running");
    }
    int count = getTaskViewCount();
    if (count == 0) {
        return new PendingAnimation(new AnimatorSet());
    }
    int targetSysUiFlags = tv.getThumbnail().getSysUiStatusNavFlags();
    final boolean[] passedOverviewThreshold = new boolean[] { false };
    ValueAnimator progressAnim = ValueAnimator.ofFloat(0, 1);
    progressAnim.setInterpolator(LINEAR);
    progressAnim.addUpdateListener(animator -> {
        // Once we pass a certain threshold, update the sysui flags to match the target
        // tasks' flags
        mActivity.getSystemUiController().updateUiState(UI_STATE_OVERVIEW, animator.getAnimatedFraction() > UPDATE_SYSUI_FLAGS_THRESHOLD ? targetSysUiFlags : 0);
        onTaskLaunchAnimationUpdate(animator.getAnimatedFraction(), tv);
        // Passing the threshold from taskview to fullscreen app will vibrate
        final boolean passed = animator.getAnimatedFraction() >= SUCCESS_TRANSITION_PROGRESS;
        if (passed != passedOverviewThreshold[0]) {
            passedOverviewThreshold[0] = passed;
            performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY, HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
        }
    });
    ClipAnimationHelper clipAnimationHelper = new ClipAnimationHelper(mActivity);
    clipAnimationHelper.fromTaskThumbnailView(tv.getThumbnail(), this);
    clipAnimationHelper.prepareAnimation(mActivity.getDeviceProfile(), true);
    AnimatorSet anim = createAdjacentPageAnimForTaskLaunch(tv, clipAnimationHelper);
    anim.play(progressAnim);
    anim.setDuration(duration);
    Consumer<Boolean> onTaskLaunchFinish = this::onTaskLaunched;
    mPendingAnimation = new PendingAnimation(anim);
    mPendingAnimation.addEndListener((onEndListener) -> {
        if (onEndListener.isSuccess) {
            Consumer<Boolean> onLaunchResult = (result) -> {
                onTaskLaunchFinish.accept(result);
                if (!result) {
                    tv.notifyTaskLaunchFailed(TAG);
                }
            };
            tv.launchTask(false, onLaunchResult, getHandler());
            Task task = tv.getTask();
            if (task != null) {
                mActivity.getUserEventDispatcher().logTaskLaunchOrDismiss(onEndListener.logAction, Direction.DOWN, indexOfChild(tv), TaskUtils.getLaunchComponentKeyForTask(task.key));
            }
        } else {
            onTaskLaunchFinish.accept(false);
        }
        mPendingAnimation = null;
    });
    return mPendingAnimation;
}
Also used : SyncRtSurfaceTransactionApplierCompat(com.android.systemui.shared.system.SyncRtSurfaceTransactionApplierCompat) Drawable(android.graphics.drawable.Drawable) LayoutTransition(android.animation.LayoutTransition) Handler(android.os.Handler) TAP(com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch.TAP) Canvas(android.graphics.Canvas) AccessibilityEvent(android.view.accessibility.AccessibilityEvent) PendingAnimation(com.android.launcher3.util.PendingAnimation) SCALE_PROPERTY(com.android.launcher3.LauncherAnimUtils.SCALE_PROPERTY) RotationMode(com.android.launcher3.graphics.RotationMode) TargetApi(android.annotation.TargetApi) CLEAR_ALL_BUTTON(com.android.launcher3.userevent.nano.LauncherLogProto.ControlType.CLEAR_ALL_BUTTON) RecentsAnimationWrapper(com.android.quickstep.RecentsAnimationWrapper) DeviceProfile(com.android.launcher3.DeviceProfile) HapticFeedbackConstants(android.view.HapticFeedbackConstants) Nullable(androidx.annotation.Nullable) Layout(android.text.Layout) TextPaint(android.text.TextPaint) LauncherLogProto(com.android.launcher3.userevent.nano.LauncherLogProto) TimeInterpolator(android.animation.TimeInterpolator) Insettable(com.android.launcher3.Insettable) Utilities.squaredTouchSlop(com.android.launcher3.Utilities.squaredTouchSlop) ArrayList(java.util.ArrayList) TaskUtils.checkCurrentOrManagedUserId(com.android.quickstep.TaskUtils.checkCurrentOrManagedUserId) ComponentName(android.content.ComponentName) ViewPool(com.android.launcher3.util.ViewPool) ViewDebug(android.view.ViewDebug) FeatureFlags(com.android.launcher3.config.FeatureFlags) Direction(com.android.launcher3.userevent.nano.LauncherLogProto.Action.Direction) LINEAR(com.android.launcher3.anim.Interpolators.LINEAR) SparseBooleanArray(android.util.SparseBooleanArray) R(com.android.launcher3.R) ComponentKey(com.android.launcher3.util.ComponentKey) MIN_VISIBLE_CHANGE_PIXELS(androidx.dynamicanimation.animation.DynamicAnimation.MIN_VISIBLE_CHANGE_PIXELS) ValueAnimator(android.animation.ValueAnimator) ACCEL(com.android.launcher3.anim.Interpolators.ACCEL) UI_STATE_OVERVIEW(com.android.launcher3.util.SystemUiController.UI_STATE_OVERVIEW) Rect(android.graphics.Rect) PackageManagerWrapper(com.android.systemui.shared.system.PackageManagerWrapper) Task(com.android.systemui.shared.recents.model.Task) Animator(android.animation.Animator) FloatProperty(android.util.FloatProperty) QUICKSTEP_SPRINGS(com.android.launcher3.config.FeatureFlags.QUICKSTEP_SPRINGS) AttributeSet(android.util.AttributeSet) ActivityManagerWrapper(com.android.systemui.shared.system.ActivityManagerWrapper) View(android.view.View) Matrix(android.graphics.Matrix) LauncherEventUtil(com.android.systemui.shared.system.LauncherEventUtil) RectF(android.graphics.RectF) Utilities(com.android.launcher3.Utilities) SpringForce(androidx.dynamicanimation.animation.SpringForce) TransitionListener(android.animation.LayoutTransition.TransitionListener) UI_HELPER_EXECUTOR(com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR) ObjectAnimator(android.animation.ObjectAnimator) EDGE_NAV_BAR(com.android.launcher3.Utilities.EDGE_NAV_BAR) TaskUtils(com.android.quickstep.TaskUtils) TaskStackChangeListener(com.android.systemui.shared.system.TaskStackChangeListener) ViewGroup(android.view.ViewGroup) WindowInsets(android.view.WindowInsets) ThumbnailData(com.android.systemui.shared.recents.model.ThumbnailData) TaskThumbnailChangeListener(com.android.quickstep.RecentsModel.TaskThumbnailChangeListener) ListView(android.widget.ListView) Themes(com.android.launcher3.util.Themes) SUCCESS_TRANSITION_PROGRESS(com.android.launcher3.uioverrides.touchcontrollers.TaskViewTouchController.SUCCESS_TRANSITION_PROGRESS) Typeface(android.graphics.Typeface) ActivityManager(android.app.ActivityManager) Context(android.content.Context) StaticLayout(android.text.StaticLayout) AccessibilityNodeInfo(android.view.accessibility.AccessibilityNodeInfo) TaskThumbnailCache(com.android.quickstep.TaskThumbnailCache) CHANGE_FLAG_ICON_PARAMS(com.android.launcher3.InvariantDeviceProfile.CHANGE_FLAG_ICON_PARAMS) KeyEvent(android.view.KeyEvent) Touch(com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch) STATE_HANDLER_INVISIBILITY_FLAGS(com.android.launcher3.BaseActivity.STATE_HANDLER_INVISIBILITY_FLAGS) Intent(android.content.Intent) AnimatorPlaybackController(com.android.launcher3.anim.AnimatorPlaybackController) SpringObjectAnimator(com.android.launcher3.anim.SpringObjectAnimator) FAST_OUT_SLOW_IN(com.android.launcher3.anim.Interpolators.FAST_OUT_SLOW_IN) Utilities.squaredHypot(com.android.launcher3.Utilities.squaredHypot) MotionEvent(android.view.MotionEvent) BaseActivity(com.android.launcher3.BaseActivity) ENABLE_QUICKSTEP_LIVE_TILE(com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE) AnimatorSet(android.animation.AnimatorSet) Build(android.os.Build) OverScroller(com.android.launcher3.util.OverScroller) LayoutInflater(android.view.LayoutInflater) VIEW_TRANSLATE_Y(com.android.launcher3.LauncherAnimUtils.VIEW_TRANSLATE_Y) VIEW_TRANSLATE_X(com.android.launcher3.LauncherAnimUtils.VIEW_TRANSLATE_X) ClipAnimationHelper(com.android.quickstep.util.ClipAnimationHelper) Point(android.graphics.Point) ACCEL_2(com.android.launcher3.anim.Interpolators.ACCEL_2) LauncherState(com.android.launcher3.LauncherState) Consumer(java.util.function.Consumer) InvariantDeviceProfile(com.android.launcher3.InvariantDeviceProfile) PropertyListBuilder(com.android.launcher3.anim.PropertyListBuilder) RecentsModel(com.android.quickstep.RecentsModel) PagedView(com.android.launcher3.PagedView) PendingAnimation(com.android.launcher3.util.PendingAnimation) ClipAnimationHelper(com.android.quickstep.util.ClipAnimationHelper) Task(com.android.systemui.shared.recents.model.Task) AnimatorSet(android.animation.AnimatorSet) ValueAnimator(android.animation.ValueAnimator) TextPaint(android.text.TextPaint) Point(android.graphics.Point)

Aggregations

View (android.view.View)85 WorkspaceItemInfo (com.android.launcher3.model.data.WorkspaceItemInfo)59 Point (android.graphics.Point)42 Rect (android.graphics.Rect)41 AppWidgetHostView (android.appwidget.AppWidgetHostView)40 AbstractFloatingView (com.android.launcher3.AbstractFloatingView)38 ItemInfo (com.android.launcher3.model.data.ItemInfo)37 Animator (android.animation.Animator)35 ValueAnimator (android.animation.ValueAnimator)35 Target (com.android.launcher3.userevent.nano.LauncherLogProto.Target)35 BubbleTextView (com.android.launcher3.BubbleTextView)34 DropTarget (com.android.launcher3.DropTarget)32 DragView (com.android.launcher3.dragndrop.DragView)30 LauncherAppWidgetHostView (com.android.launcher3.widget.LauncherAppWidgetHostView)30 AnimatorSet (android.animation.AnimatorSet)29 RemoteAnimationTargetCompat (com.android.systemui.shared.system.RemoteAnimationTargetCompat)29 ComponentName (android.content.ComponentName)28 ObjectAnimator (android.animation.ObjectAnimator)27 DraggableView (com.android.launcher3.dragndrop.DraggableView)26 AppInfo (com.android.launcher3.model.data.AppInfo)26