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

Commit 883ea7c7 authored by Jagrut Desai's avatar Jagrut Desai
Browse files

Gesture Error Detection - Improvements Part 2

- Adding gesture error detection for ON_START_RECENTS_ANIMATION for to be getting callabck within time limit.

Bug: 293379641
Bug: 290266108
Test: Presubmit
Flag: not needed
Change-Id: I7d0f70c55dc44749218ff8d8427e71cd512d083c
parent c65b902c
Loading
Loading
Loading
Loading
+16 −1
Original line number Diff line number Diff line
@@ -66,6 +66,8 @@ public class ActiveGestureErrorDetector {

    private ActiveGestureErrorDetector() {}

    private static final long ON_START_RECENT_ANIMATION_TIME_LIMIT = 500;

    protected static void analyseAndDump(
            @NonNull String prefix,
            @NonNull PrintWriter writer,
@@ -76,6 +78,7 @@ public class ActiveGestureErrorDetector {
        // Use a Set since the order is inherently checked in the loop.
        final Set<GestureEvent> encounteredEvents = new ArraySet<>();
        // Set flags and check order of operations.
        long lastStartRecentAnimationEventEntryTime = 0;
        for (ActiveGestureLog.EventEntry eventEntry : eventLog.eventEntries) {
            GestureEvent gestureEvent = eventEntry.getGestureEvent();
            if (gestureEvent == null) {
@@ -234,6 +237,16 @@ public class ActiveGestureErrorDetector {
                            /* errorMessage= */ "ON_START_RECENTS_ANIMATION "
                                    + "onAnimationStart callback ran before startRecentsAnimation",
                            writer);
                    errorDetected |= printErrorIfTrue(
                            eventEntry.getTime() - lastStartRecentAnimationEventEntryTime
                                    > ON_START_RECENT_ANIMATION_TIME_LIMIT,
                            prefix,
                            /* errorMessage= */"ON_START_RECENTS_ANIMATION "
                                    + "startRecentsAnimation was never called or onAnimationStart "
                                    + "callback was called more than 500 ms after "
                                    + "startRecentsAnimation.",
                            writer);
                    lastStartRecentAnimationEventEntryTime = 0;
                    break;
                case ON_CANCEL_RECENTS_ANIMATION:
                    errorDetected |= printErrorIfTrue(
@@ -253,12 +266,14 @@ public class ActiveGestureErrorDetector {
                                    + "callback",
                            writer);
                    break;
                case START_RECENTS_ANIMATION:
                    lastStartRecentAnimationEventEntryTime = eventEntry.getTime();
                    break;
                case MOTION_DOWN:
                case SET_END_TARGET:
                case SET_END_TARGET_HOME:
                case SET_END_TARGET_ALL_APPS:
                case SET_END_TARGET_NEW_TASK:
                case START_RECENTS_ANIMATION:
                case SET_ON_PAGE_TRANSITION_END_CALLBACK:
                case CANCEL_CURRENT_ANIMATION:
                case FLAG_USING_OTHER_ACTIVITY_INPUT_CONSUMER:
+4 −0
Original line number Diff line number Diff line
@@ -266,6 +266,10 @@ public class ActiveGestureLog {
            time = System.currentTimeMillis();
            duplicateCount = 0;
        }

        public long getTime() {
            return time;
        }
    }

    /** An entire log of entries associated with a single log ID */