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

Commit 16e87859 authored by Lucas Dupin's avatar Lucas Dupin Committed by Android (Google) Code Review
Browse files

Merge "Fix whenToCheck returned by AttentionDetector"

parents c20de154 1761fce0
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -145,7 +145,7 @@ public class AttentionDetector {
            if (DEBUG) {
                Slog.d(TAG, "Do not check for attention yet, wait " + (whenToCheck - now));
            }
            return nextScreenDimming;
            return whenToCheck;
        } else if (whenToStopExtending < whenToCheck) {
            if (DEBUG) {
                Slog.d(TAG, "Let device sleep to avoid false results and improve security "
+9 −0
Original line number Diff line number Diff line
@@ -97,6 +97,15 @@ public class AttentionDetectorTest extends AndroidTestCase {
        verify(mAttentionManagerInternal, never()).checkAttention(anyInt(), anyLong(), any());
    }

    @Test
    public void testUpdateUserActivity_schedulesTheNextCheck() {
        long now = SystemClock.uptimeMillis();
        mNextDimming = now;
        mAttentionDetector.onUserActivity(now, PowerManager.USER_ACTIVITY_EVENT_TOUCH);
        long nextTimeout = mAttentionDetector.updateUserActivity(mNextDimming + 5000L);
        assertThat(nextTimeout).isEqualTo(mNextDimming + 5000L);
    }

    @Test
    public void testOnUserActivity_ignoresAfterMaximumExtension() {
        long now = SystemClock.uptimeMillis();