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

Commit b57c5776 authored by Vinit Nayak's avatar Vinit Nayak Committed by Android (Google) Code Review
Browse files

Merge "Add unique id to trace logs through recents animations" into ub-launcher3-master

parents 5bdbee5e 9b26e63f
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@ public class SwipeSharedState implements SwipeAnimationListener {
    public boolean goingToLauncher;
    public boolean recentsAnimationFinishInterrupted;
    public int nextRunningTaskId = -1;
    private int mLogId;

    public void setOverviewComponentObserver(OverviewComponentObserver observer) {
        mOverviewComponentObserver = observer;
@@ -156,5 +157,10 @@ public class SwipeSharedState implements SwipeAnimationListener {
        pw.println(prefix + "nextRunningTaskId=" + nextRunningTaskId);
        pw.println(prefix + "lastAnimationCancelled=" + mLastAnimationCancelled);
        pw.println(prefix + "lastAnimationRunning=" + mLastAnimationRunning);
        pw.println(prefix + "logTraceId=" + mLogId);
    }

    public void setLogTraceId(int logId) {
        this.mLogId = logId;
    }
}
+19 −8
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@
package com.android.quickstep;

import static android.view.MotionEvent.ACTION_DOWN;

import static com.android.launcher3.config.FeatureFlags.ADAPTIVE_ICON_WINDOW_ANIM;
import static com.android.launcher3.config.FeatureFlags.APPLY_CONFIG_AT_RUNTIME;
import static com.android.launcher3.config.FeatureFlags.ENABLE_HINTS_IN_OVERVIEW;
@@ -68,11 +67,9 @@ import android.view.InputEvent;
import android.view.MotionEvent;
import android.view.Surface;
import android.view.WindowManager;

import androidx.annotation.BinderThread;
import androidx.annotation.UiThread;
import androidx.annotation.WorkerThread;

import com.android.launcher3.BaseDraggingActivity;
import com.android.launcher3.R;
import com.android.launcher3.ResourceUtils;
@@ -137,6 +134,13 @@ class ArgList extends LinkedList<String> {
public class TouchInteractionService extends Service implements
        NavigationModeChangeListener, DisplayListener {

    /**
     * NOTE: This value should be kept same as
     * ActivityTaskManagerService#INTENT_EXTRA_LOG_TRACE_ID in platform
     */
    public static final String INTENT_EXTRA_LOG_TRACE_ID = "INTENT_EXTRA_LOG_TRACE_ID";


    public static final EventLogArray TOUCH_INTERACTION_LOG =
            new EventLogArray("touch_interaction_log", 40);

@@ -239,6 +243,7 @@ public class TouchInteractionService extends Service implements
    private static boolean sConnected = false;
    private static boolean sIsInitialized = false;
    private static final SwipeSharedState sSwipeSharedState = new SwipeSharedState();
    private int mLogId;

    public static boolean isConnected() {
        return sConnected;
@@ -549,9 +554,12 @@ public class TouchInteractionService extends Service implements
            Log.e(TAG, "Unknown event " + ev);
            return;
        }

        MotionEvent event = (MotionEvent) ev;
        TOUCH_INTERACTION_LOG.addLog("onMotionEvent", event.getActionMasked());
        if (event.getAction() == ACTION_DOWN) {
            mLogId = TOUCH_INTERACTION_LOG.generateAndSetLogId();
            sSwipeSharedState.setLogTraceId(mLogId);

            if (mSwipeTouchRegion.contains(event.getX(), event.getY())) {
                boolean useSharedState = mConsumer.useSharedSwipeState();
                mConsumer.onConsumerAboutToBeSwitched();
@@ -571,6 +579,8 @@ public class TouchInteractionService extends Service implements
                mUncheckedConsumer = InputConsumer.NO_OP;
            }
        }

        TOUCH_INTERACTION_LOG.addLog("onMotionEvent", event.getActionMasked());
        mUncheckedConsumer.onMotionEvent(event);
    }

@@ -713,13 +723,13 @@ public class TouchInteractionService extends Service implements
        return new OtherActivityInputConsumer(this, runningTaskInfo,
                shouldDefer, mOverviewCallbacks, this::onConsumerInactive,
                sSwipeSharedState, mInputMonitorCompat, mSwipeTouchRegion,
                disableHorizontalSwipe(event), factory);
                disableHorizontalSwipe(event), factory, mLogId);
    }

    private InputConsumer createDeviceLockedInputConsumer(RunningTaskInfo taskInfo) {
        if (mMode == Mode.NO_BUTTON && taskInfo != null) {
            return new DeviceLockedInputConsumer(this, sSwipeSharedState, mInputMonitorCompat,
                    mSwipeTouchRegion, taskInfo.taskId);
                    mSwipeTouchRegion, taskInfo.taskId, mLogId);
        } else {
            return mResetGestureInputConsumer;
        }
@@ -783,7 +793,8 @@ public class TouchInteractionService extends Service implements
        }

        // Pass null animation handler to indicate this start is preload.
        startRecentsActivityAsync(mOverviewComponentObserver.getOverviewIntentIgnoreSysUiState(), null);
        startRecentsActivityAsync(mOverviewComponentObserver.getOverviewIntentIgnoreSysUiState(),
                null);
    }

    @Override
+8 −5
Original line number Diff line number Diff line
@@ -18,12 +18,12 @@ package com.android.quickstep.inputconsumers;
import static android.view.MotionEvent.ACTION_CANCEL;
import static android.view.MotionEvent.ACTION_POINTER_DOWN;
import static android.view.MotionEvent.ACTION_UP;

import static com.android.launcher3.Utilities.squaredHypot;
import static com.android.launcher3.Utilities.squaredTouchSlop;
import static com.android.quickstep.MultiStateCallback.DEBUG_STATES;
import static com.android.quickstep.WindowTransformSwipeHandler.MIN_PROGRESS_FOR_OVERVIEW;
import static com.android.quickstep.TouchInteractionService.INTENT_EXTRA_LOG_TRACE_ID;
import static com.android.quickstep.TouchInteractionService.startRecentsActivityAsync;
import static com.android.quickstep.WindowTransformSwipeHandler.MIN_PROGRESS_FOR_OVERVIEW;

import android.content.ComponentName;
import android.content.Context;
@@ -36,7 +36,6 @@ import android.view.MotionEvent;
import android.view.VelocityTracker;
import android.view.ViewConfiguration;
import android.view.WindowManager;

import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.quickstep.LockScreenRecentsActivity;
@@ -76,6 +75,7 @@ public class DeviceLockedInputConsumer implements InputConsumer,

    private final PointF mTouchDown = new PointF();
    private final ClipAnimationHelper mClipAnimationHelper;
    private int mLogId;
    private final ClipAnimationHelper.TransformParams mTransformParams;
    private final Point mDisplaySize;
    private final MultiStateCallback mStateCallback;
@@ -90,11 +90,13 @@ public class DeviceLockedInputConsumer implements InputConsumer,
    private SwipeAnimationTargetSet mTargetSet;

    public DeviceLockedInputConsumer(Context context, SwipeSharedState swipeSharedState,
            InputMonitorCompat inputMonitorCompat, RectF swipeTouchRegion, int runningTaskId) {
            InputMonitorCompat inputMonitorCompat, RectF swipeTouchRegion, int runningTaskId,
            int logId) {
        mContext = context;
        mTouchSlopSquared = squaredTouchSlop(context);
        mSwipeSharedState = swipeSharedState;
        mClipAnimationHelper = new ClipAnimationHelper(context);
        mLogId = logId;
        mTransformParams = new ClipAnimationHelper.TransformParams();
        mInputMonitorCompat = inputMonitorCompat;
        mSwipeTouchRegion = swipeTouchRegion;
@@ -205,7 +207,8 @@ public class DeviceLockedInputConsumer implements InputConsumer,
        Intent intent = new Intent(Intent.ACTION_MAIN)
                .addCategory(Intent.CATEGORY_DEFAULT)
                .setComponent(new ComponentName(mContext, LockScreenRecentsActivity.class))
                .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
                .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK)
                .putExtra(INTENT_EXTRA_LOG_TRACE_ID, mLogId);

        mInputMonitorCompat.pilferPointers();
        startRecentsActivityAsync(intent, newListenerSet);
+0 −1
Original line number Diff line number Diff line
@@ -50,7 +50,6 @@ import com.android.quickstep.fallback.FallbackRecentsView;
import com.android.quickstep.util.ObjectWrapper;
import com.android.quickstep.util.RectFSpringAnim;
import com.android.quickstep.util.SwipeAnimationTargetSet;
import com.android.quickstep.views.RecentsView;
import com.android.quickstep.views.TaskView;
import com.android.systemui.shared.recents.model.ThumbnailData;
import com.android.systemui.shared.system.ActivityManagerWrapper;
+10 −7
Original line number Diff line number Diff line
@@ -22,11 +22,11 @@ import static android.view.MotionEvent.ACTION_POINTER_DOWN;
import static android.view.MotionEvent.ACTION_POINTER_UP;
import static android.view.MotionEvent.ACTION_UP;
import static android.view.MotionEvent.INVALID_POINTER_ID;

import static com.android.launcher3.Utilities.EDGE_NAV_BAR;
import static com.android.launcher3.Utilities.squaredHypot;
import static com.android.launcher3.util.RaceConditionTracker.ENTER;
import static com.android.launcher3.util.RaceConditionTracker.EXIT;
import static com.android.quickstep.TouchInteractionService.INTENT_EXTRA_LOG_TRACE_ID;
import static com.android.quickstep.TouchInteractionService.TOUCH_INTERACTION_LOG;
import static com.android.quickstep.TouchInteractionService.startRecentsActivityAsync;
import static com.android.systemui.shared.system.ActivityManagerWrapper.CLOSE_SYSTEM_WINDOWS_REASON_RECENTS;
@@ -35,6 +35,7 @@ import android.annotation.TargetApi;
import android.app.ActivityManager.RunningTaskInfo;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.Intent;
import android.graphics.PointF;
import android.graphics.RectF;
import android.os.Build;
@@ -43,12 +44,13 @@ import android.os.Looper;
import android.view.MotionEvent;
import android.view.VelocityTracker;
import android.view.ViewConfiguration;

import androidx.annotation.UiThread;
import com.android.launcher3.R;
import com.android.launcher3.util.Preconditions;
import com.android.launcher3.util.RaceConditionTracker;
import com.android.launcher3.util.TraceHelper;
import com.android.quickstep.BaseSwipeUpHandler;
import com.android.quickstep.BaseSwipeUpHandler.Factory;
import com.android.quickstep.OverviewCallbacks;
import com.android.quickstep.SwipeSharedState;
import com.android.quickstep.SysUINavigationMode;
@@ -59,11 +61,8 @@ import com.android.quickstep.util.NavBarPosition;
import com.android.quickstep.util.RecentsAnimationListenerSet;
import com.android.systemui.shared.system.ActivityManagerWrapper;
import com.android.systemui.shared.system.InputMonitorCompat;

import java.util.function.Consumer;

import androidx.annotation.UiThread;

/**
 * Input consumer for handling events originating from an activity other than Launcher
 */
@@ -119,14 +118,16 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC
        ActivityManagerWrapper.getInstance().cancelRecentsAnimation(
                true /* restoreHomeStackPosition */);
    };
    private int mLogId;

    public OtherActivityInputConsumer(Context base, RunningTaskInfo runningTaskInfo,
            boolean isDeferredDownTarget, OverviewCallbacks overviewCallbacks,
            Consumer<OtherActivityInputConsumer> onCompleteCallback,
            SwipeSharedState swipeSharedState, InputMonitorCompat inputMonitorCompat,
            RectF swipeTouchRegion, boolean disableHorizontalSwipe,
            BaseSwipeUpHandler.Factory handlerFactory) {
            Factory handlerFactory, int logId) {
        super(base);
        mLogId = logId;

        mMainThreadHandler = new Handler(Looper.getMainLooper());
        mRunningTask = runningTaskInfo;
@@ -341,7 +342,9 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC
            RecentsAnimationListenerSet newListenerSet =
                    mSwipeSharedState.newRecentsAnimationListenerSet();
            newListenerSet.addListener(handler);
            startRecentsActivityAsync(handler.getLaunchIntent(), newListenerSet);
            Intent intent = handler.getLaunchIntent();
            intent.putExtra(INTENT_EXTRA_LOG_TRACE_ID, mLogId);
            startRecentsActivityAsync(intent, newListenerSet);
        }
    }

Loading