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);
}
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);
}
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);
}
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);
}
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;
}
Aggregations