Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6098a8c8 authored by vadimt's avatar vadimt
Browse files

Adding events checking for Launcher starting apps

Change-Id: Id651397f643280a9f99a470df029479bd1b41e5c
parent 3c7f820e
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -57,6 +57,7 @@ import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.logging.UserEventDispatcher;
import com.android.launcher3.popup.SystemShortcut;
import com.android.launcher3.testing.TestLogging;
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Direction;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch;
@@ -331,6 +332,9 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
            Consumer<Boolean> resultCallback, Handler resultCallbackHandler) {
        if (mTask != null) {
            final ActivityOptions opts;
            if (Utilities.IS_RUNNING_IN_TEST_HARNESS) {
                TestLogging.recordEvent("startActivityFromRecentsAsync:" + mTask);
            }
            if (animate) {
                opts = mActivity.getActivityLaunchOptions(this);
                if (freezeTaskList) {
+4 −0
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ import com.android.launcher3.logging.StatsLogUtils;
import com.android.launcher3.logging.StatsLogUtils.LogStateProvider;
import com.android.launcher3.logging.UserEventDispatcher;
import com.android.launcher3.logging.UserEventDispatcher.UserEventDelegate;
import com.android.launcher3.testing.TestLogging;
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.launcher3.util.SystemUiController;
import com.android.launcher3.util.ViewCache;
@@ -329,6 +330,9 @@ public abstract class BaseActivity extends Activity
            return;
        }
        try {
            if (Utilities.IS_RUNNING_IN_TEST_HARNESS) {
                TestLogging.recordEvent("start: shortcut: " + packageName);
            }
            getSystemService(LauncherApps.class).startShortcut(packageName, id, sourceBounds,
                    startActivityOptions, user);
        } catch (SecurityException | IllegalStateException e) {
+4 −0
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ import androidx.annotation.Nullable;

import com.android.launcher3.LauncherSettings.Favorites;
import com.android.launcher3.model.AppLaunchTracker;
import com.android.launcher3.testing.TestLogging;
import com.android.launcher3.uioverrides.DisplayRotationListener;
import com.android.launcher3.uioverrides.WallpaperColorInfo;
import com.android.launcher3.util.PackageManagerHelper;
@@ -164,6 +165,9 @@ public abstract class BaseDraggingActivity extends BaseActivity
                startShortcutIntentSafely(intent, optsBundle, item, sourceContainer);
            } else if (user == null || user.equals(Process.myUserHandle())) {
                // Could be launching some bookkeeping activity
                if (Utilities.IS_RUNNING_IN_TEST_HARNESS) {
                    TestLogging.recordEvent("start: activity: " + intent);
                }
                startActivity(intent, optsBundle);
                AppLaunchTracker.INSTANCE.get(this).onStartApp(intent.getComponent(),
                        Process.myUserHandle(), sourceContainer);
+9 −0
Original line number Diff line number Diff line
@@ -22,11 +22,15 @@ import androidx.test.uiautomator.By;
import androidx.test.uiautomator.BySelector;
import androidx.test.uiautomator.UiObject2;

import java.util.regex.Pattern;

/**
 * App icon, whether in all apps or in workspace/
 */
public final class AppIcon extends Launchable {

    private static final Pattern START_EVENT = Pattern.compile("start:");

    AppIcon(LauncherInstrumentation launcher, UiObject2 icon) {
        super(launcher, icon);
    }
@@ -49,4 +53,9 @@ public final class AppIcon extends Launchable {
    protected String getLongPressIndicator() {
        return "deep_shortcuts_container";
    }

    @Override
    protected void expectActivityStartEvents() {
        mLauncher.expectEvent(START_EVENT);
    }
}
+10 −0
Original line number Diff line number Diff line
@@ -18,10 +18,15 @@ package com.android.launcher3.tapl;

import androidx.test.uiautomator.UiObject2;

import java.util.regex.Pattern;

/**
 * Menu item in an app icon menu.
 */
public class AppIconMenuItem extends Launchable {

    private static final Pattern START_SHORTCUT_EVENT = Pattern.compile("start: shortcut:");

    AppIconMenuItem(LauncherInstrumentation launcher, UiObject2 shortcut) {
        super(launcher, shortcut);
    }
@@ -37,4 +42,9 @@ public class AppIconMenuItem extends Launchable {
    protected String getLongPressIndicator() {
        return "drop_target_bar";
    }

    @Override
    protected void expectActivityStartEvents() {
        mLauncher.expectEvent(START_SHORTCUT_EVENT);
    }
}
Loading