App Preferences & Config
Relevant source files
The following files were used as context for generating this wiki page:
- app/src/main/kotlin/dev/patrickgold/florisboard/app/AppPrefs.kt
- lib/android/src/main/kotlin/org/florisboard/lib/android/AndroidSettings.kt
- app/src/main/res/values/strings.xml
- app/src/main/kotlin/dev/patrickgold/florisboard/lib/devtools/Devtools.kt
- app/src/main/kotlin/dev/patrickgold/florisboard/app/devtools/DevtoolsScreen.kt
- README.md
The App Preferences & Config system in Ownkey Keyboard manages the extensive customization options available to users, ranging from keyboard layouts and themes to advanced AI integration settings. Built upon a structured preference model, it provides a centralized way to handle user choices, secure storage for sensitive data like API keys, and debugging tools for developers.
This system ensures that the keyboard remains responsive by separating high-level configuration from core input logic. It also supports cross-device synchronization (e.g., Phone to Wear OS) for AI-specific configurations, ensuring a consistent user experience across the ecosystem.
Sources: README.md, AGENTS.md
Preference Architecture
The project utilizes a structured model to categorize preferences into logical domains. These categories are defined in the application's resource files and managed through the FlorisPreferenceModel.
Core Preference Domains
Preferences are grouped into the following primary domains:
| Domain | Description | Key Configuration Elements |
|---|---|---|
| Localization | Language and layout settings. | Subtypes, layout IDs, language packs. |
| Theme | Visual appearance and styling. | Day/Night modes, key borders, corner radius. |
| Keyboard | Physical behavior and layout tweaks. | Number row, long-press delay, window mode. |
| Typing | Correction and suggestion engine. | Autocorrect, capitalization, predictive text. |
| Clipboard | History and sync behavior. | Internal clipboard, history size, sync to system. |
| AI (Voxtral) | Dictation and LLM rewrite config. | API keys, endpoint URLs, model versions. |
Sources: app/src/main/res/values/strings.xml:49-434, app/src/main/kotlin/dev/patrickgold/florisboard/lib/devtools/Devtools.kt:105-113
Secure Storage & BYOK
Ownkey Keyboard implements a "Bring Your Own Key" (BYOK) model for AI features. Sensitive preferences, specifically API keys for Voxtral and LLM providers, are stored encrypted using the Android Keystore-backed system. This prevents sensitive credentials from being stored in plaintext or included in non-sanitized backups.
Sources: README.md, app/src/main/res/values/strings.xml:451-460
AI Configuration (Voxtral & LLM)
The AI configuration is a specialized subset of preferences that manages how the keyboard interacts with external inference endpoints for dictation (ASR) and text rewriting.
The diagram shows the relationship between local encrypted preference storage and external AI providers.
Sources: app/src/main/res/values/strings.xml:451-507, README.md
AI Preference Details
- Dictation (Voxtral): Configures the ASR endpoint (defaulting to Mistral), model ID (e.g.,
voxtral-mini-latest), and ISO language hints to improve recognition. - LLM Rewrite: Manages prompts and instructions for text transformation. It includes "Rewrite Voices," which are preset prompt instructions (e.g., "Professional," "Casual").
Sources: app/src/main/res/values/strings.xml:461-507, README.md
Developer Tools & Debugging
The Devtools module provides preferences and actions used during development to inspect the application state and troubleshoot configuration issues.
Debug Overlays and Flags
Developers can toggle several debugging overlays that visualize internal states:
- Input State Overlay: Overlays the current state of the input cache.
- Spelling Overlay: Visualizes spellchecker results.
- Key Touch Boundaries: Outlines the hitboxes of individual keys in red.
- Primary Clip Overlay: Displays the current content of the primary clipboard.
Sources: app/src/main/kotlin/dev/patrickgold/florisboard/app/devtools/DevtoolsScreen.kt:60-95, app/src/main/res/values/strings.xml:655-680
Android System Settings Access
Ownkey includes a utility to inspect Android system-level settings that affect keyboard behavior (Global, Secure, and System tables). This is managed via the AndroidSettings class.
| Setting Table | ID | Usage in App |
|---|---|---|
| Global | global | System-wide flags and performance metrics. |
| Secure | secure | Accessibility and input method list permissions. |
| System | system | UI preferences like font scale and locales. |
Sources: lib/android/src/main/kotlin/org/florisboard/lib/android/AndroidSettings.kt:22-68, app/src/main/kotlin/dev/patrickgold/florisboard/app/devtools/DevtoolsScreen.kt:133-155
Data Flow: Debug Log Generation
The Devtools object is responsible for aggregating various configuration states into a single debug log for issue reporting.
The sequence shows how the Devtools object pulls data from multiple configuration managers to generate a comprehensive report.
Sources: app/src/main/kotlin/dev/patrickgold/florisboard/lib/devtools/Devtools.kt:38-60, app/src/main/kotlin/dev/patrickgold/florisboard/lib/devtools/Devtools.kt:105-125
Summary
The App Preferences & Config system is the backbone of Ownkey Keyboard's extensibility. It securely handles user credentials for AI features, organizes hundreds of UI and behavior options into manageable domains, and provides developers with the necessary tools to inspect the keyboard's internal state. By leveraging Android's secure storage and a modular preference model, the system balances user customization with data security and maintainability.
Sources: README.md, app/src/main/res/values/strings.xml