Repository navigation
diag: log what turned the screen off and how long it stayed off - #26
Open
thiagosoeiro wants to merge 3 commits into
Open
thiagosoeiro wants to merge 3 commits into
thiagosoeiro wants to merge 3 commits into
Conversation
The screen has been going dark sooner than expected and coming straight back on. Nothing here can turn a display on, and our own log export only sees this app's own pid, so the log could not say which of the two was happening. Screen off now records how long the screen had been on and the screen timeout in force, which "Screen timeout by network" writes, so a screen that ran out its own countdown is told from one something turned off. Screen on records how long it was off, flagging a screen that came straight back rather than being woken by hand. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The flicker is the dim before the screen goes off, repeating - dark, bright, dark - not the screen going on and off, so the screen off and on lines land at the wrong moment to catch it. Two causes look the same to the eye and different in the log. Auto brightness rewrites the brightness setting, so a run of changes in the last seconds is the light sensor hunting; a ContentObserver on it now logs each change with how long the screen has been on. Android's own dim never touches that setting, so a dim repeating while the observer stays quiet is the dim countdown being restarted - which writing the screen timeout does, and that write now says when it landed while the screen was on. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
# Conflicts: # app/src/main/java/dev/pranav/applock/services/AppLockAccessibilityService.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
From the 2026-09-17 logs, the screen went off and came back on within 0.1–0.7 s three times (20:18:57.951 → .065, 20:42:51.118 → .856, 20:43:10.386 → .780 UTC), two of them confirmed by the display itself (
onDisplayChanged 2 → 1 → 2).Two different things are happening there, and the log could not tell them apart:
ScreenTimeoutByNetworkwroteset to 15 s, was 30 sat 20:42:34 on leaving the trusted Wi-Fi, and the screen died 17 s later.FLAG_TURN_SCREEN_ONinPasswordOverlayScreen) belongs toPasswordOverlayActivity, which only the Shizuku and Usage backends launch.Our own export runs
logcat -d, which only returns this app's pid, so the waking party never appears in the file.What this adds
Android does not hand an ordinary app a wake reason, so this records the timing shape instead, on the screen-state receiver that already exists:
straight back oninside 2 s, plus whether the phone locked meanwhile."After it came on" is the idle time only if the screen was left alone — a touch restarts Android's countdown and is invisible here — so a short reading is the telling one. That caveat is in the KDoc.
Diagnostics only: no behaviour changes, and the lines go through
LogUtils, so they follow the logging switch.🤖 Generated with Claude Code