WIP: feat(auth): automatic logoff after user inactivity (UI API 1.12.0) #30
Draft
james.maes
wants to merge 1 commits from
feat/session-user-activity into main
pull from: feat/session-user-activity
merge into: QRun-IO:main
QRun-IO:main
QRun-IO:feat/e2e-scan-base64-extra
QRun-IO:fix/slow-link-timeouts
QRun-IO:fix/signout-idp-session
QRun-IO:fix/metadata-load-timeout
QRun-IO:ci/release-gates
QRun-IO:fix/widget-icon-string-main
QRun-IO:fix/restore-main-tree
QRun-IO:fix/widget-icon-string
QRun-IO:release/scanner-1.0.2-notes
QRun-IO:release/scanner-1.0.2
QRun-IO:fix/refresh-device-versions
QRun-IO:fix/company-signout-before-session-end
QRun-IO:test/available-scanner-photo-policy
QRun-IO:feature/gs1-record-photos
QRun-IO:docs/scanner-preview-publication
QRun-IO:feature/mobile-scanner-host
QRun-IO:feature/echo-scanner-presentation
QRun-IO:ci/qrun-android-publisher-main-20261102
QRun-IO:ci-proof/cache-interface-20261102
QRun-IO:ci-proof/android-shared-20261102
QRun-IO:archive/qrun-github-cutover-20261101/c55d3002b0d9/feature/echo-scanner-presentation
QRun-IO:migration/github-cutoff-reconcile-20261101
QRun-IO:archive/qrun-github-cutover-20261101/625a275de334/feature/mobile-scanner-host
QRun-IO:feature/orb-0.8-track
QRun-IO:feature/orb-0.7.17
QRun-IO:feature/orb-0712-stable-gate
QRun-IO:fix/package-token-0710
QRun-IO:fix/shared-publisher-context
QRun-IO:fix/current-registry
QRun-IO:feature/central-ci
No Reviewers
Labels
Clear labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
Something isn't working
Improvements or additions to documentation
This issue or pull request already exists
New feature or request
Good for newcomers
Extra attention is needed
This doesn't seem right
Further information is requested
This will not be worked on
No labels
Milestone
No items
No Milestone
Projects
Clear projects
No projects
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: QRun-IO/qqq-android#30
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Why
Automatic logoff: a session must end after a set time without a user action. The scanner sends a session heartbeat every 15 seconds or less while it is in the foreground, so its requests are not its operator. QQQ core gets a user inactivity timeout in QRun-IO/qqq PR 1361 (UI API 1.12.0); this is the scanner's side of it.
What
scanner-host/.../UserActivity.kt: the time of the operator's last action on a clock that counts device sleep (SystemClock.elapsedRealtime).ScannerActivity.onUserInteractionrecords every touch and key; a hardware scan records one too (ScannerWidget), since no key event reaches the activity for it.X-QQQ-User-Activity-Age: the UI API repository, the mobile-session heartbeat and record files. The device enrollment API does not (it has no user session). Until the first action of a fresh process the age is the device's uptime: nothing is assumed in the operator's favour, and the server decides from what it recorded.InactivityLogoffcomposable: when the server publishesuserInactivityTimeoutSeconds, warns 60 seconds before ("Are you still there?", "Stay signed in") and callsQViewModel.logOut()when the time runs out. The server ends the session at the next request regardless, which the existingonUnauthorizedpath already handles (requestLogout).OAuth2AuthenticationMetaData.Values.userInactivityTimeoutSeconds(optional).A server without the value ignores the header and the scanner shows nothing new.
Not done here
nativeSessionLogin.prompt = login.AGENTS.mdasks for emulator coverage of authentication changes, so this needs:qqqsampleandroidmobileapp:connectedDebugAndroidTestand a scanner E2E case before it leaves draft.Verified
./gradlew :qqq:android:core:testDebugUnitTest :qqq:android:mobileapp:testDebugUnitTest :scanner-host:testDebugUnitTest :scanner-host:lintDebug :scanner-host:assembleDebugond3258bf: exit 0. Unit tests: core 60, mobileapp 65, scanner-host 130, 0 failures (5 new inUserActivityTest, one assertion pair inNativeSessionLoginTest). Debug APK assembled.d3258bf(run 7368: unit tests, lint, APKs and the existing connected tests on an emulator): success. Those connected tests do not exercise the new timer or dialog.Release
After QRun-IO/qqq PR 1361 is released: emulator and TC22 checks, then a signed scanner release (1.0.5) by the usual hand-signed process, then MDM distribution. Scanners that are not updated are signed out one timeout after each sign-in once a server switches the timeout on.
🤖 Generated with Claude Code
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.