fix(logs): say in a recovered session folder whether the device restarted (#2752)

This commit is contained in:
Kurt Himebauch authored and GitHub committed 2026-11-17 13:35:04 -05:00
1 parent 28cf995d7b
commit 7909af74d6
2 files changed
+47

No files matched your search

@@ -0,0 +1,30 @@
package com.droiddeck.launcher.session
import org.junit.Assert.assertNotNull
import org.junit.Assert.assertNull
import org.junit.Assert.assertTrue
import org.junit.Test
class SessionRestartNoteTest {
private val started = 1_731_100_000_000L
@Test fun aBootAfterTheSessionBeganIsReportedAsARestart() {
val note = SessionArtifacts.restartNote(started, started + 20 * 60_000L)
assertNotNull(note)
assertTrue(note!!.startsWith("The device itself probably restarted"))
}
@Test fun aBootBeforeTheSessionBeganMeansOnlyTheAppEnded() {
val note = SessionArtifacts.restartNote(started, started - 3 * 3_600_000L)
assertTrue(note!!.startsWith("The device does not appear to have restarted"))
}
@Test fun clockCorrectionsWithinAMinuteAreNotARestart() {
val note = SessionArtifacts.restartNote(started, started + 30_000L)
assertTrue(note!!.startsWith("The device does not appear to have restarted"))
}
@Test fun aFolderWithoutAStartTimeSaysNothing() {
assertNull(SessionArtifacts.restartNote(0L, started))
}
}