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

Commit a1a5e087 authored by Schneider Victor-tulias's avatar Schneider Victor-tulias
Browse files

Replace all uses of string concatenation with CompoundString in ActiveGestureLog

Flag: not needed
Fixes: 300926831
Test: ran launcher, tested gestures and checked logs
Change-Id: Iede0881be315cb1ef0a30eaf2a9e17e020828586
parent 3554656c
Loading
Loading
Loading
Loading
+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 */,
+24 −11
Original line number Diff line number Diff line
@@ -734,24 +734,37 @@ public class TouchInteractionService extends Service {
                    // fall through
                case ACTION_UP:
                    ActiveGestureLog.INSTANCE.addLog(
                            /* event= */ "onMotionEvent(" + (int) event.getRawX() + ", "
                                    + (int) event.getRawY() + "): "
                                    + MotionEvent.actionToString(event.getActionMasked()) + ", "
                                    + MotionEvent.classificationToString(event.getClassification()),
                            new CompoundString("onMotionEvent(")
                                    .append((int) event.getRawX())
                                    .append(", ")
                                    .append((int) event.getRawY())
                                    .append("): ")
                                    .append(MotionEvent.actionToString(event.getActionMasked()))
                                    .append(", ")
                                    .append(MotionEvent.classificationToString(
                                            event.getClassification())),
                            /* gestureEvent= */ event.getActionMasked() == 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(event.getActionMasked()))
                                    .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(event.getActionMasked()))
                                    .append(",")
                                    .append(MotionEvent.classificationToString(
                                            event.getClassification())));
                }
            }
        }
+18 −3
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@ public class ActiveGestureLog {
    private static final int TYPE_INTEGER = 2;
    private static final int TYPE_BOOL_TRUE = 3;
    private static final int TYPE_BOOL_FALSE = 4;
    private static final int TYPE_INPUT_CONSUMER = 5;
    private static final int TYPE_COMPOUND_STRING = 5;
    private static final int TYPE_GESTURE_EVENT = 6;

    private final EventLog[] logs;
@@ -81,7 +81,13 @@ public class ActiveGestureLog {
    }

    public void addLog(CompoundString compoundString) {
        addLog(TYPE_INPUT_CONSUMER, "", 0, compoundString, null);
        addLog(TYPE_COMPOUND_STRING, "", 0, compoundString, null);
    }

    public void addLog(
            CompoundString compoundString,
            @Nullable ActiveGestureErrorDetector.GestureEvent gestureEvent) {
        addLog(TYPE_COMPOUND_STRING, "", 0, compoundString, gestureEvent);
    }

    /**
@@ -185,7 +191,7 @@ public class ActiveGestureLog {
                    case TYPE_INTEGER:
                        msg.append(": ").append((int) eventEntry.extras);
                        break;
                    case TYPE_INPUT_CONSUMER:
                    case TYPE_COMPOUND_STRING:
                        msg.append(eventEntry.mCompoundString);
                        break;
                    case TYPE_GESTURE_EVENT:
@@ -314,6 +320,15 @@ public class ActiveGestureLog {
            return this;
        }

        public CompoundString append(int num) {
            if (mIsNoOp) {
                return this;
            }
            mSubstrings.add(Integer.toString(num));

            return this;
        }

        @Override
        public String toString() {
            if (mIsNoOp) {
Loading