Fix Direct Boot accessibility startup#2153
Open
smh786 wants to merge 3 commits into
Open
Conversation
Author
|
Update: I was able to build and test this on the affected Zinwa Q25. The original service-only guard was not enough. The confirmed root cause was With the latest branch:
This was tested without the external Q25 boot-fix workaround app installed. |
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.
Summary
Fix Direct Boot startup so KeyMapper does not initialize credential-encrypted database-backed components before the user has unlocked the device.
The root cause found during Q25 testing was that
LOCKED_BOOT_COMPLETEDstarted the app process and then calledBaseKeyMapperApp.onBootUnlocked(), which initialized normal app components while user 0 was stillRUNNING_LOCKED. That path could open/data/user/0/.../databases/key_map_databasebefore credential-encrypted storage was available, causing repeatedSQLiteCantOpenDatabaseExceptioncrashes.This PR now:
UserManager.isUserUnlockedonBootUnlocked()fromLOCKED_BOOT_COMPLETEDonBootUnlocked()from normalBOOT_COMPLETED, which is delivered after unlockReproduction
Tested on a Zinwa Q25 running BenOS Uma.1.
Installed KeyMapper
4.2.0-fossover the ROM-provided3.2.1-fosssystem app, with KeyMapper Accessibility enabled and no external workaround app installed.After reboot, before first unlock:
Logcat shows KeyMapper trying to open CE storage before unlock:
On this device, the repeated Direct Boot crash/restart state appears to corrupt lockscreen physical-keyboard handling until the first unlock. Examples observed before first unlock:
adb shell getevent -ltshowed only one hardware key down/up event, so duplication occurred above the Linux input layer.Device verification
Built and tested locally on the same Q25 using a debug build installed as
io.github.sds100.keymapper.debug.Before first unlock, after this fix:
BaseKeyMapperApplogsDelay init because lockedkey_map_databaseopen attempt or SQLite fatal occurs before unlockAfter first unlock:
onBootUnlockedthenInitWhy
This keeps KeyMapper available after the first unlock while preventing the broken Direct Boot/locked-user startup window from touching credential-encrypted app storage.