Search in sources :

Example 1 with LogContainerProvider

use of com.android.launcher3.logging.StatsLogUtils.LogContainerProvider in project Neo-Launcher by NeoApplications.

the class AppLaunchActivity method startUri.

private void startUri(Uri uri) {
    try {
        ComponentKey dl = AppSearchProvider.uriToComponent(uri, this);
        ItemInfo dVar = new AppItemInfoWithIcon(dl);
        if (!getPackageManager().isSafeMode() || Utilities.isSystemApp(this, dVar.getIntent())) {
            if (dl.user.equals(android.os.Process.myUserHandle())) {
                startActivity(dVar.getIntent());
            } else {
                LauncherAppsCompat.getInstance(this).startActivityForProfile(dl.componentName, dl.user, getIntent().getSourceBounds(), null);
            }
            View view = new View(this);
            view.setTag(dVar);
            String predictionRank = uri.getQueryParameter("predictionRank");
            new LogContainerProvider(this, TextUtils.isEmpty(predictionRank) ? -1 : Integer.parseInt(predictionRank)).addView(view);
            return;
        }
        Toast.makeText(this, R.string.safemode_shortcut_error, Toast.LENGTH_SHORT).show();
    } catch (Exception e) {
        Toast.makeText(this, R.string.activity_not_found, Toast.LENGTH_SHORT).show();
    }
}
Also used : ItemInfo(com.android.launcher3.ItemInfo) ComponentKey(com.android.launcher3.util.ComponentKey) View(android.view.View)

Example 2 with LogContainerProvider

use of com.android.launcher3.logging.StatsLogUtils.LogContainerProvider in project Neo-Launcher by NeoApplications.

the class UserEventDispatcher method logDeepShortcutsOpen.

public void logDeepShortcutsOpen(View icon) {
    LogContainerProvider provider = StatsLogUtils.getLaunchProviderRecursive(icon);
    if (icon == null || !(icon.getTag() instanceof ItemInfo || provider == null)) {
        return;
    }
    ItemInfo info = (ItemInfo) icon.getTag();
    LauncherEvent event = newLauncherEvent(newTouchAction(Action.Touch.LONGPRESS), newItemTarget(info, mInstantAppResolver), newTarget(Target.Type.CONTAINER));
    provider.fillInLogContainerData(icon, info, event.srcTarget[0], event.srcTarget[1]);
    dispatchUserEvent(event, null);
    resetElapsedContainerMillis("deep shortcut open");
}
Also used : ItemInfo(com.android.launcher3.ItemInfo) LauncherEvent(com.android.launcher3.userevent.nano.LauncherLogProto.LauncherEvent) LoggerUtils.newLauncherEvent(com.android.launcher3.logging.LoggerUtils.newLauncherEvent) LogContainerProvider(com.android.launcher3.logging.StatsLogUtils.LogContainerProvider)

Example 3 with LogContainerProvider

use of com.android.launcher3.logging.StatsLogUtils.LogContainerProvider in project Neo-Launcher by NeoApplications.

the class UserEventDispatcher method fillInLogContainerData.

/**
 * Fills in the container data on the given event if the given view is not null.
 *
 * @return whether container data was added.
 */
public boolean fillInLogContainerData(LauncherLogProto.LauncherEvent event, @Nullable View v) {
    // Fill in grid(x,y), pageIndex of the child and container type of the parent
    LogContainerProvider provider = StatsLogUtils.getLaunchProviderRecursive(v);
    if (v == null || !(v.getTag() instanceof ItemInfo) || provider == null) {
        return false;
    }
    final ItemInfo itemInfo = (ItemInfo) v.getTag();
    final Target target = event.srcTarget[0];
    final Target targetParent = event.srcTarget[1];
    onFillInLogContainerData(itemInfo, target, targetParent);
    provider.fillInLogContainerData(v, itemInfo, target, targetParent);
    return true;
}
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) ItemInfo(com.android.launcher3.ItemInfo) LogContainerProvider(com.android.launcher3.logging.StatsLogUtils.LogContainerProvider)

Example 4 with LogContainerProvider

use of com.android.launcher3.logging.StatsLogUtils.LogContainerProvider in project Neo-Launcher by NeoApplications.

the class UserEventDispatcher method logDragNDrop.

public void logDragNDrop(DropTarget.DragObject dragObj, View dropTargetAsView) {
    LauncherEvent event = newLauncherEvent(newTouchAction(Action.Touch.DRAGDROP), newItemTarget(dragObj.originalDragInfo, mInstantAppResolver), newTarget(Target.Type.CONTAINER));
    event.destTarget = new Target[] { newItemTarget(dragObj.originalDragInfo, mInstantAppResolver), newDropTarget(dropTargetAsView) };
    dragObj.dragSource.fillInLogContainerData(null, dragObj.originalDragInfo, event.srcTarget[0], event.srcTarget[1]);
    if (dropTargetAsView instanceof LogContainerProvider) {
        ((LogContainerProvider) dropTargetAsView).fillInLogContainerData(null, dragObj.dragInfo, event.destTarget[0], event.destTarget[1]);
    }
    event.actionDurationMillis = SystemClock.uptimeMillis() - mActionDurationMillis;
    dispatchUserEvent(event, null);
}
Also used : LauncherEvent(com.android.launcher3.userevent.nano.LauncherLogProto.LauncherEvent) LoggerUtils.newLauncherEvent(com.android.launcher3.logging.LoggerUtils.newLauncherEvent) LogContainerProvider(com.android.launcher3.logging.StatsLogUtils.LogContainerProvider)

Example 5 with LogContainerProvider

use of com.android.launcher3.logging.StatsLogUtils.LogContainerProvider in project android_packages_apps_Trebuchet by LineageOS.

the class UserEventDispatcher method fillLogContainer.

/**
 * Fills in the container data on the given event if the given view is not null.
 *
 * @return whether container data was added.
 */
public boolean fillLogContainer(@Nullable View v, Target child, @Nullable ArrayList<Target> targets) {
    LogContainerProvider firstParent = StatsLogUtils.getLaunchProviderRecursive(v);
    if (v == null || !(v.getTag() instanceof ItemInfo) || firstParent == null) {
        return false;
    }
    final ItemInfo itemInfo = (ItemInfo) v.getTag();
    firstParent.fillInLogContainerData(itemInfo, child, targets);
    return true;
}
Also used : ItemInfo(com.android.launcher3.model.data.ItemInfo) LogContainerProvider(com.android.launcher3.logging.StatsLogUtils.LogContainerProvider)

Aggregations

LogContainerProvider (com.android.launcher3.logging.StatsLogUtils.LogContainerProvider)5 ItemInfo (com.android.launcher3.ItemInfo)3 LoggerUtils.newLauncherEvent (com.android.launcher3.logging.LoggerUtils.newLauncherEvent)3 LauncherEvent (com.android.launcher3.userevent.nano.LauncherLogProto.LauncherEvent)3 DropTarget (com.android.launcher3.DropTarget)2 LoggerUtils.newContainerTarget (com.android.launcher3.logging.LoggerUtils.newContainerTarget)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.newTarget (com.android.launcher3.logging.LoggerUtils.newTarget)2 Target (com.android.launcher3.userevent.nano.LauncherLogProto.Target)2 View (android.view.View)1 ItemInfo (com.android.launcher3.model.data.ItemInfo)1 ComponentKey (com.android.launcher3.util.ComponentKey)1