Loading services/core/java/com/android/server/power/AttentionDetector.java +1 −1 Original line number Diff line number Diff line Loading @@ -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 " Loading services/tests/servicestests/src/com/android/server/power/AttentionDetectorTest.java +9 −0 Original line number Diff line number Diff line Loading @@ -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(); Loading Loading
services/core/java/com/android/server/power/AttentionDetector.java +1 −1 Original line number Diff line number Diff line Loading @@ -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 " Loading
services/tests/servicestests/src/com/android/server/power/AttentionDetectorTest.java +9 −0 Original line number Diff line number Diff line Loading @@ -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(); Loading