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

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

Merge "Reorganize ActiveGestureLogs for ease-of-use" into tm-qpr-dev

parents 90d00194 0a184a99
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@ import static com.android.quickstep.GestureState.STATE_RECENTS_SCROLLING_FINISHE
import static com.android.quickstep.MultiStateCallback.DEBUG_STATES;
import static com.android.quickstep.util.ActiveGestureErrorDetector.GestureEvent.CANCEL_RECENTS_ANIMATION;
import static com.android.quickstep.util.ActiveGestureErrorDetector.GestureEvent.EXPECTING_TASK_APPEARED;
import static com.android.quickstep.util.ActiveGestureErrorDetector.GestureEvent.LAUNCHER_DESTROYED;
import static com.android.quickstep.util.ActiveGestureErrorDetector.GestureEvent.ON_SETTLED_ON_END_TARGET;
import static com.android.quickstep.views.RecentsView.UPDATE_SYSUI_FLAGS_THRESHOLD;
import static com.android.systemui.shared.system.ActivityManagerWrapper.CLOSE_SYSTEM_WINDOWS_REASON_RECENTS;
@@ -181,6 +182,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
                    if (mActivity != activity) {
                        return;
                    }
                    ActiveGestureLog.INSTANCE.addLog("Launcher destroyed", LAUNCHER_DESTROYED);
                    mRecentsView = null;
                    mActivity = null;
                }
+271 −271
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ import android.util.ArraySet;
import androidx.annotation.NonNull;

import java.io.PrintWriter;
import java.util.List;
import java.util.Set;

/**
@@ -37,7 +36,7 @@ public class ActiveGestureErrorDetector {
        ON_SETTLED_ON_END_TARGET, START_RECENTS_ANIMATION, FINISH_RECENTS_ANIMATION,
        CANCEL_RECENTS_ANIMATION, SET_ON_PAGE_TRANSITION_END_CALLBACK, CANCEL_CURRENT_ANIMATION,
        CLEANUP_SCREENSHOT, SCROLLER_ANIMATION_ABORTED, TASK_APPEARED, EXPECTING_TASK_APPEARED,
        FLAG_USING_OTHER_ACTIVITY_INPUT_CONSUMER,
        FLAG_USING_OTHER_ACTIVITY_INPUT_CONSUMER, LAUNCHER_DESTROYED,

        /**
         * These GestureEvents are specifically associated to state flags that get set in
@@ -68,15 +67,8 @@ public class ActiveGestureErrorDetector {
    protected static void analyseAndDump(
            @NonNull String prefix,
            @NonNull PrintWriter writer,
            List<ActiveGestureLog.EventLog> eventLogs) {
        writer.println(prefix + "ActiveGestureErrorDetector:");
        for (int i = 0; i < eventLogs.size(); i++) {
            ActiveGestureLog.EventLog eventLog = eventLogs.get(i);
            if (eventLog == null) {
                continue;
            }
            int gestureId = eventLog.logId;
            writer.println(prefix + "\tError messages for gesture ID: " + gestureId);
            @NonNull ActiveGestureLog.EventLog eventLog) {
        writer.println(prefix + "Error messages for gesture ID: " + eventLog.logId);

        boolean errorDetected = false;
        // Use a Set since the order is inherently checked in the loop.
@@ -88,6 +80,7 @@ public class ActiveGestureErrorDetector {
                continue;
            }
            encounteredEvents.add(gestureEvent);

            switch (gestureEvent) {
                case MOTION_UP:
                    errorDetected |= printErrorIfTrue(
@@ -162,6 +155,13 @@ public class ActiveGestureErrorDetector {
                                    + "before/without setting end target to new task",
                            writer);
                    break;
                case LAUNCHER_DESTROYED:
                    errorDetected |= printErrorIfTrue(
                            true,
                            prefix,
                            /* errorMessage= */ "Launcher destroyed mid-gesture",
                            writer);
                    break;
                case STATE_GESTURE_COMPLETED:
                    errorDetected |= printErrorIfTrue(
                            !encounteredEvents.contains(GestureEvent.MOTION_UP),
@@ -348,8 +348,7 @@ public class ActiveGestureErrorDetector {
                writer);

        if (!errorDetected) {
                writer.println(prefix + "\t\tNo errors detected.");
            }
            writer.println(prefix + "\tNo errors detected.");
        }
    }

@@ -358,7 +357,8 @@ public class ActiveGestureErrorDetector {
        if (!condition) {
            return false;
        }
        writer.println(prefix + "\t\t- " + errorMessage);
        writer.println(prefix + "\t- " + errorMessage);

        return true;
    }
}
+12 −8
Original line number Diff line number Diff line
@@ -155,19 +155,27 @@ public class ActiveGestureLog {
    }

    public void dump(String prefix, PrintWriter writer) {
        if (FeatureFlags.ENABLE_GESTURE_ERROR_DETECTION.get()) {
            writer.println(prefix + "ActiveGestureErrorDetector:");
            for (int i = 0; i < logs.length; i++) {
                EventLog eventLog = logs[(nextIndex + i) % logs.length];
                if (eventLog == null) {
                    continue;
                }
                ActiveGestureErrorDetector.analyseAndDump(prefix + '\t', writer, eventLog);
            }
        }

        writer.println(prefix + "ActiveGestureLog history:");
        SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss.SSSZ  ", Locale.US);
        Date date = new Date();
        ArrayList<EventLog> eventLogs = new ArrayList<>();

        for (int i = 0; i < logs.length; i++) {
            EventLog eventLog = logs[(nextIndex + i) % logs.length];
            if (eventLog == null) {
                continue;
            }
            eventLogs.add(eventLog);
            writer.println(prefix + "\tLogs for logId: " + eventLog.logId);

            writer.println(prefix + "\tLogs for logId: " + eventLog.logId);
            for (EventEntry eventEntry : eventLog.eventEntries) {
                date.setTime(eventEntry.time);

@@ -199,10 +207,6 @@ public class ActiveGestureLog {
                writer.println(msg);
            }
        }

        if (FeatureFlags.ENABLE_GESTURE_ERROR_DETECTION.get()) {
            ActiveGestureErrorDetector.analyseAndDump(prefix + '\t', writer, eventLogs);
        }
    }

    /**