Repository navigation
Conversation
The UI tells the engine whether the app is in front with setAppState (active, minimized). Leaving the front raises Mudlet's sysApplicationFocusChangeEvent and saves the profile, as the system may kill a background process without warning; onTrimMemory saves it too, through EngineNative.nativeSave(). A switch or quit asked during a save waits for it, as Mudlet refuses to close then. The engine sends attention (ms) for alert(), the bell and new text while minimized, and moveTypedLine ahead of hiddenInput when the typed line is to move into the masked one. EngineClient keeps that as state for the input line to act on. The stand-in accepts setAppState and ignores it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016ujaeFyaqXXDx8xjoThE6J
…anch A switch asked while the app-state save runs is now checked in the host test: Mudlet refuses to close during a save, so the switch has to wait for it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016ujaeFyaqXXDx8xjoThE6J
Notify on new data while minimized is on by default (Host::mAlertOnNewData), so the save holds mAlertOnNewData="yes" and the rewrite to turn it on did nothing. The typed-line order also caught the hiddenInput (wanted false) every client is sent on attaching; only the one asking for hidden input follows moveTypedLine. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016ujaeFyaqXXDx8xjoThE6J
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.
Brief overview of PR changes/additions
setAppState(active,minimized). libmudlet passes them tosetApplicationActive(), which raisessysApplicationFocusChangeEvent, and tosetWindowMinimized(). Whenactiveturns false, it saves the profile withsaveAsync()and reports statussave.EngineService.onTrimMemory()saves too, through the new JNI callEngineNative.nativeSave(), which is covered by the existing R8 rule.attention(ms), fromattentionRequested:alert(), the bell, and game text that arrives while the app is minimized.moveTypedLine, fromtypedLineMoveRequested. EngineClient holds it asmoveTypedLine, whichtypedLineMoved()clears. It is not wired into InputLine.kt.setAppStateand does nothing with it. The protocol is now version 6.Motivation for adding to Mudlet
Android kills background processes without warning. Saving when the app leaves the front, or when memory is short, keeps the player's changes. U8 sends
setAppStateand acts onattention.Other info (issues closed, discussion etc)
Part of Mudlet/Mudlet#9011
Stacked on #50 (on #43); merge order #43, #50, this. The brief expected "new data while minimized" to send
notify. Upstream sendsattentionRequested(0)for it, so the test checksattention0. Roadmap rows will be added after the rebase onto main.Checked: stand-in test_engine.py, Kotlin protocol tests, ktlint, clang-format, ShellCheck; CI: https://github.com/Mudlet/android/actions/runs/43662532818; bite: https://github.com/Mudlet/android/actions/runs/43662592279; device-only: the onTrimMemory save on a real phone (the emulator smoke test sends
am send-trim-memory).🤖 Generated with Claude Code
https://claude.ai/code/session_016ujaeFyaqXXDx8xjoThE6J