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

Commit 45639f84 authored by Android Build Merger (Role)'s avatar Android Build Merger (Role)
Browse files

[automerger] Log the parent of the PREDICTION container type (ALLAPPS OR...

[automerger] Log the parent of the PREDICTION container type (ALLAPPS OR TASKSWITCHER) Bug: 79423536 am: 46d07f7c

Change-Id: Idb8aa7f3bc23045ca99e097e64842fabbf94b8a9
parents 3c6a4c48 46d07f7c
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -30,7 +30,9 @@ import android.view.View.AccessibilityDelegate;

import com.android.launcher3.DeviceProfile.OnDeviceProfileChangeListener;
import com.android.launcher3.logging.UserEventDispatcher;
import com.android.launcher3.logging.UserEventDispatcher.UserEventDelegate;
import com.android.launcher3.uioverrides.UiFactory;
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.launcher3.util.SystemUiController;

import java.io.FileDescriptor;
@@ -38,7 +40,7 @@ import java.io.PrintWriter;
import java.lang.annotation.Retention;
import java.util.ArrayList;

public abstract class BaseActivity extends Activity {
public abstract class BaseActivity extends Activity implements UserEventDelegate{

    public static final int INVISIBLE_BY_STATE_HANDLER = 1 << 0;
    public static final int INVISIBLE_BY_APP_TRANSITIONS = 1 << 1;
@@ -89,9 +91,11 @@ public abstract class BaseActivity extends Activity {
        return null;
    }

    public void modifyUserEvent(LauncherLogProto.LauncherEvent event) {}

    public final UserEventDispatcher getUserEventDispatcher() {
        if (mUserEventDispatcher == null) {
            mUserEventDispatcher = UserEventDispatcher.newInstance(this, mDeviceProfile);
            mUserEventDispatcher = UserEventDispatcher.newInstance(this, mDeviceProfile, this);
        }
        return mUserEventDispatcher;
    }
+23 −2
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import static com.android.launcher3.LauncherState.ALL_APPS;
import static com.android.launcher3.LauncherState.NORMAL;
import static com.android.launcher3.dragndrop.DragLayer.ALPHA_INDEX_LAUNCHER_LOAD;
import static com.android.launcher3.logging.LoggerUtils.newContainerTarget;
import static com.android.launcher3.logging.LoggerUtils.newTarget;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
@@ -91,6 +92,7 @@ import com.android.launcher3.keyboard.CustomActionsPopup;
import com.android.launcher3.keyboard.ViewGroupFocusHelper;
import com.android.launcher3.logging.FileLog;
import com.android.launcher3.logging.UserEventDispatcher;
import com.android.launcher3.logging.UserEventDispatcher.UserEventDelegate;
import com.android.launcher3.model.ModelWriter;
import com.android.launcher3.notification.NotificationListener;
import com.android.launcher3.popup.PopupContainerWithArrow;
@@ -100,6 +102,7 @@ import com.android.launcher3.states.InternalStateHandler;
import com.android.launcher3.states.RotationHelper;
import com.android.launcher3.touch.ItemClickHandler;
import com.android.launcher3.uioverrides.UiFactory;
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action;
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
import com.android.launcher3.userevent.nano.LauncherLogProto.Target;
@@ -140,8 +143,8 @@ import java.util.Set;
/**
 * Default launcher application.
 */
public class Launcher extends BaseDraggingActivity
        implements LauncherExterns, LauncherModel.Callbacks, LauncherProviderChangeListener {
public class Launcher extends BaseDraggingActivity implements LauncherExterns,
        LauncherModel.Callbacks, LauncherProviderChangeListener, UserEventDelegate{
    public static final String TAG = "Launcher";
    static final boolean LOGD = false;

@@ -1643,6 +1646,24 @@ public class Launcher extends BaseDraggingActivity
        }
    }

    @Override
    public void modifyUserEvent(LauncherLogProto.LauncherEvent event) {
        if (event.srcTarget != null && event.srcTarget.length > 0 &&
                event.srcTarget[1].containerType == ContainerType.PREDICTION) {
            Target[] targets = new Target[3];
            targets[0] = event.srcTarget[0];
            targets[1] = event.srcTarget[1];
            targets[2] = newTarget(Target.Type.CONTAINER);
            event.srcTarget = targets;
            LauncherState state = mStateManager.getState();
            if (state == LauncherState.ALL_APPS) {
                event.srcTarget[2].containerType = ContainerType.ALLAPPS;
            } else if (state == LauncherState.OVERVIEW) {
                event.srcTarget[2].containerType = ContainerType.TASKSWITCHER;
            }
        }
    }

    public boolean startActivitySafely(View v, Intent intent, ItemInfo item) {
        boolean success = super.startActivitySafely(v, intent, item);
        if (success && v instanceof BubbleTextView) {
+15 −1
Original line number Diff line number Diff line
@@ -70,7 +70,8 @@ public class UserEventDispatcher {
            FeatureFlags.IS_DOGFOOD_BUILD && Utilities.isPropertyEnabled(LogConfig.USEREVENT);
    private static final String UUID_STORAGE = "uuid";

    public static UserEventDispatcher newInstance(Context context, DeviceProfile dp) {
    public static UserEventDispatcher newInstance(Context context, DeviceProfile dp,
            UserEventDelegate delegate) {
        SharedPreferences sharedPrefs = Utilities.getDevicePrefs(context);
        String uuidStr = sharedPrefs.getString(UUID_STORAGE, null);
        if (uuidStr == null) {
@@ -79,6 +80,7 @@ public class UserEventDispatcher {
        }
        UserEventDispatcher ued = Utilities.getOverrideObject(UserEventDispatcher.class,
                context.getApplicationContext(), R.string.user_event_dispatcher_class);
        ued.mDelegate = delegate;
        ued.mIsInLandscapeMode = dp.isVerticalBarLayout();
        ued.mIsInMultiWindowMode = dp.isMultiWindowMode;
        ued.mUuidStr = uuidStr;
@@ -86,6 +88,14 @@ public class UserEventDispatcher {
        return ued;
    }

    public static UserEventDispatcher newInstance(Context context, DeviceProfile dp) {
        return newInstance(context, dp, null);
    }

    public interface UserEventDelegate {
        void modifyUserEvent(LauncherEvent event);
    }

    /**
     * Implemented by containers to provide a container source for a given child.
     */
@@ -134,6 +144,7 @@ public class UserEventDispatcher {
    private String mUuidStr;
    protected InstantAppResolver mInstantAppResolver;
    private boolean mAppOrTaskLaunch;
    private UserEventDelegate mDelegate;

    //                      APP_ICON    SHORTCUT    WIDGET
    // --------------------------------------------------------------
@@ -162,6 +173,9 @@ public class UserEventDispatcher {
                newItemTarget(v, mInstantAppResolver), newTarget(Target.Type.CONTAINER));

        if (fillInLogContainerData(event, v)) {
            if (mDelegate != null) {
                mDelegate.modifyUserEvent(event);
            }
            fillIntentInfo(event.srcTarget[0], intent);
        }
        dispatchUserEvent(event, intent);