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

Commit f5099749 authored by Schneider Victor-tulias's avatar Schneider Victor-tulias Committed by Android (Google) Code Review
Browse files

Merge changes I26080534,Iede0881b into main

* changes:
  Send ACTION_CANCEL motion event to TIS instead of finishing the recents animation on screen off
  Replace all uses of string concatenation with CompoundString in ActiveGestureLog
parents 10c14c29 44de9caa
Loading
Loading
Loading
Loading
+0 −9
Original line number Diff line number Diff line
@@ -753,15 +753,6 @@ public class QuickstepLauncher extends Launcher {
                () -> ActivityManagerWrapper.getInstance().invalidateHomeTaskSnapshot(this));
    }

    @Override
    protected void onScreenOnChanged(boolean isOn) {
        super.onScreenOnChanged(isOn);
        if (!isOn) {
            RecentsView recentsView = getOverviewPanel();
            recentsView.finishRecentsAnimation(true /* toRecents */, null);
        }
    }

    @Override
    public void onAllAppsTransition(float progress) {
        super.onAllAppsTransition(progress);
+11 −6
Original line number Diff line number Diff line
@@ -1189,7 +1189,8 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
                break;
        }
        ActiveGestureLog.INSTANCE.addLog(
                /* event= */ "onSettledOnEndTarget " + endTarget,
                new ActiveGestureLog.CompoundString("onSettledOnEndTarget ")
                        .append(endTarget.name()),
                /* gestureEvent= */ ON_SETTLED_ON_END_TARGET);
    }

@@ -2215,7 +2216,8 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
            TaskView nextTask = mRecentsView == null ? null : mRecentsView.getNextPageTaskView();
            if (nextTask != null) {
                int[] taskIds = nextTask.getTaskIds();
                StringBuilder nextTaskLog = new StringBuilder();
                ActiveGestureLog.CompoundString nextTaskLog = new ActiveGestureLog.CompoundString(
                        "Launching task: ");
                for (TaskIdAttributeContainer c : nextTask.getTaskIdAttributeContainers()) {
                    if (c == null) {
                        continue;
@@ -2234,7 +2236,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
                if (!hasTaskPreviouslyAppeared) {
                    ActiveGestureLog.INSTANCE.trackEvent(EXPECTING_TASK_APPEARED);
                }
                ActiveGestureLog.INSTANCE.addLog("Launching task: " + nextTaskLog);
                ActiveGestureLog.INSTANCE.addLog(nextTaskLog);
                nextTask.launchTask(success -> {
                    resultCallback.accept(success);
                    if (success) {
@@ -2310,9 +2312,12 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
                // previous quickswitch task launch, then cancel the animation back to the app
                RemoteAnimationTarget appearedTaskTarget = appearedTaskTargets[0];
                TaskInfo taskInfo = appearedTaskTarget.taskInfo;
                ActiveGestureLog.INSTANCE.addLog("Unexpected task appeared"
                        + " id=" + taskInfo.taskId
                        + " pkg=" + taskInfo.baseIntent.getComponent().getPackageName());
                ActiveGestureLog.INSTANCE.addLog(
                        new ActiveGestureLog.CompoundString("Unexpected task appeared")
                                .append(" id=")
                                .append(taskInfo.taskId)
                                .append(" pkg=")
                                .append(taskInfo.baseIntent.getComponent().getPackageName()));
                finishRecentsAnimationOnTasksAppeared(null /* onFinishComplete */);
            } else if (handleTaskAppeared(appearedTaskTargets)) {
                Optional<RemoteAnimationTarget> taskTargetOptional =
+2 −1
Original line number Diff line number Diff line
@@ -410,7 +410,8 @@ public class GestureState implements RecentsAnimationCallbacks.RecentsAnimationL
        mEndTarget = target;
        mStateCallback.setState(STATE_END_TARGET_SET);
        ActiveGestureLog.INSTANCE.addLog(
                /* event= */ "setEndTarget " + mEndTarget,
                new ActiveGestureLog.CompoundString("setEndTarget ")
                        .append(mEndTarget.name()),
                /* gestureEvent= */ SET_END_TARGET);
        switch (mEndTarget) {
            case HOME:
+3 −2
Original line number Diff line number Diff line
@@ -201,8 +201,9 @@ public class TaskAnimationManager implements RecentsAnimationCallbacks.RecentsAn
                    RecentsView recentsView =
                            activityInterface.getCreatedActivity().getOverviewPanel();
                    if (recentsView != null) {
                        ActiveGestureLog.INSTANCE.addLog("Launching side task id="
                                + appearedTaskTarget.taskId);
                        ActiveGestureLog.INSTANCE.addLog(
                                new ActiveGestureLog.CompoundString("Launching side task id=")
                                        .append(appearedTaskTarget.taskId));
                        recentsView.launchSideTaskInLiveTileMode(appearedTaskTarget.taskId,
                                appearedTaskTargets,
                                new RemoteAnimationTarget[0] /* wallpaper */,
+44 −13
Original line number Diff line number Diff line
@@ -102,6 +102,7 @@ import com.android.launcher3.util.DisplayController;
import com.android.launcher3.util.LockedUserState;
import com.android.launcher3.util.OnboardingPrefs;
import com.android.launcher3.util.SafeCloseable;
import com.android.launcher3.util.ScreenOnTracker;
import com.android.launcher3.util.TraceHelper;
import com.android.quickstep.inputconsumers.AccessibilityInputConsumer;
import com.android.quickstep.inputconsumers.AssistantInputConsumer;
@@ -451,6 +452,8 @@ public class TouchInteractionService extends Service {
    private final AbsSwipeUpHandler.Factory mFallbackSwipeHandlerFactory =
            this::createFallbackSwipeHandler;

    private final ScreenOnTracker.ScreenOnListener mScreenOnListener = this::onScreenOnChanged;

    private ActivityManagerWrapper mAM;
    private OverviewCommandHelper mOverviewCommandHelper;
    private OverviewComponentObserver mOverviewComponentObserver;
@@ -487,6 +490,8 @@ public class TouchInteractionService extends Service {
        LockedUserState.get(this).runOnUserUnlocked(mTaskbarManager::onUserUnlocked);
        mDeviceState.addNavigationModeChangedCallback(this::onNavigationModeChanged);
        sConnected = true;

        ScreenOnTracker.INSTANCE.get(this).addListener(mScreenOnListener);
    }

    private void disposeEventHandlers(String reason) {
@@ -659,6 +664,8 @@ public class TouchInteractionService extends Service {

        mTaskbarManager.destroy();
        sConnected = false;

        ScreenOnTracker.INSTANCE.get(this).removeListener(mScreenOnListener);
        super.onDestroy();
    }

@@ -668,6 +675,17 @@ public class TouchInteractionService extends Service {
        return mTISBinder;
    }

    protected void onScreenOnChanged(boolean isOn) {
        if (isOn) {
            return;
        }
        long currentTime = SystemClock.uptimeMillis();
        MotionEvent cancelEvent = MotionEvent.obtain(
                currentTime, currentTime, ACTION_CANCEL, 0f, 0f, 0);
        onInputEvent(cancelEvent);
        cancelEvent.recycle();
    }

    private void onInputEvent(InputEvent ev) {
        if (!(ev instanceof MotionEvent)) {
            Log.e(TAG, "Unknown event " + ev);
@@ -731,29 +749,42 @@ public class TouchInteractionService extends Service {
        }

        if (mUncheckedConsumer != InputConsumer.NO_OP) {
            switch (event.getActionMasked()) {
            switch (action) {
                case ACTION_DOWN:
                    // fall through
                case ACTION_UP:
                    ActiveGestureLog.INSTANCE.addLog(
                            /* event= */ "onMotionEvent(" + (int) event.getRawX() + ", "
                                    + (int) event.getRawY() + "): "
                                    + MotionEvent.actionToString(event.getActionMasked()) + ", "
                                    + MotionEvent.classificationToString(event.getClassification()),
                            /* gestureEvent= */ event.getActionMasked() == ACTION_DOWN
                            new CompoundString("onMotionEvent(")
                                    .append((int) event.getRawX())
                                    .append(", ")
                                    .append((int) event.getRawY())
                                    .append("): ")
                                    .append(MotionEvent.actionToString(action))
                                    .append(", ")
                                    .append(MotionEvent.classificationToString(
                                            event.getClassification())),
                            /* gestureEvent= */ action == ACTION_DOWN
                                    ? MOTION_DOWN
                                    : MOTION_UP);
                    break;
                case ACTION_MOVE:
                    ActiveGestureLog.INSTANCE.addLog("onMotionEvent: "
                            + MotionEvent.actionToString(event.getActionMasked()) + ","
                            + MotionEvent.classificationToString(event.getClassification())
                            + ", pointerCount: " + event.getPointerCount(), MOTION_MOVE);
                    ActiveGestureLog.INSTANCE.addLog(
                            new CompoundString("onMotionEvent: ")
                                    .append(MotionEvent.actionToString(action))
                                    .append(",")
                                    .append(MotionEvent.classificationToString(
                                            event.getClassification()))
                                    .append(", pointerCount: ")
                                    .append(event.getPointerCount()),
                            MOTION_MOVE);
                    break;
                default: {
                    ActiveGestureLog.INSTANCE.addLog("onMotionEvent: "
                            + MotionEvent.actionToString(event.getActionMasked()) + ","
                            + MotionEvent.classificationToString(event.getClassification()));
                    ActiveGestureLog.INSTANCE.addLog(
                            new CompoundString("onMotionEvent: ")
                                    .append(MotionEvent.actionToString(action))
                                    .append(",")
                                    .append(MotionEvent.classificationToString(
                                            event.getClassification())));
                }
            }
        }
Loading