Develop - Dynamic font size and marquee, button remap fix for call vol, custom refresh rate#379
Conversation
Added the dimens.xml file, and added the resizeable font size which prevented the overflow or the text.
2. Added the Marquee in Search bar.
When Button Remap consumes the volume DOWN event via FLAG_REQUEST_FILTER_KEY_EVENTS and re-simulates short-press behaviour on UP, three call sites passed STREAM_MUSIC explicitly, which overrode Android's default stream routing during calls, ringing, and other active-stream contexts. Switch each site to adjustSuggestedStreamVolume with USE_DEFAULT_STREAM_TYPE — the documented API for "do what hardware volume keys would normally do". The system then routes to STREAM_VOICE_CALL during calls, STREAM_RING while ringing, STREAM_MUSIC while music plays, and falls back to the suggested type when nothing is active. Sites changed: - ButtonRemapHandler.kt:153 accessibility-service path - InputEventListenerService.kt:171 Shizuku /dev/input, torch on - InputEventListenerService.kt:199 Shizuku /dev/input, torch off The toggleMediaVolume() helper at ButtonRemapHandler.kt:244,251 stays on STREAM_MUSIC by design — it backs the user-selected "Toggle media volume" mapping action. The ~500ms perceived latency that comes from the consume-then-replay design is structural to short-press handling and is not addressed here.
## Problem With Button Remap enabled and a mapping on Vol+ / Vol-, a single short press always changed media volume — even during a phone call. This overrode Android's default stream routing (STREAM_VOICE_CALL during calls, STREAM_RING while ringing, etc.). ## Cause The accessibility service path consumes the volume DOWN event via `FLAG_REQUEST_FILTER_KEY_EVENTS` and re-simulates default volume behaviour on UP if no long-press fired. Three call sites in that re-simulation hardcoded `STREAM_MUSIC`, so every short press always adjusted media volume regardless of what stream Android would have picked. ## Fix Replace the hardcoded `adjustStreamVolume(STREAM_MUSIC, …)` with `adjustSuggestedStreamVolume(direction, USE_DEFAULT_STREAM_TYPE, FLAG_SHOW_UI)` at the three sites. This is the documented Android API for *"do exactly what hardware volume keys would normally do"* — the system itself picks `STREAM_VOICE_CALL` during calls, `STREAM_RING` while ringing, `STREAM_MUSIC` while music plays, and falls back to the suggestion when nothing is active. Ref: [`AudioManager.adjustSuggestedStreamVolume`](https://developer.android.com/reference/android/media/AudioManager#adjustSuggestedStreamVolume(int,%20int,%20int)). ## Sites changed - `app/src/main/java/com/sameerasw/essentials/services/handlers/ButtonRemapHandler.kt:153` — accessibility-service path, screen-on - `app/src/main/java/com/sameerasw/essentials/services/InputEventListenerService.kt:171` — Shizuku `/dev/input` path, torch-on branch - `app/src/main/java/com/sameerasw/essentials/services/InputEventListenerService.kt:199` — Shizuku `/dev/input` path, torch-off branch ## Intentionally untouched `toggleMediaVolume()` at `ButtonRemapHandler.kt:244,251` keeps `STREAM_MUSIC`. That helper backs the user-selected **Toggle media volume** mapping action, which by design must act on media volume regardless of active stream. ## Out of scope The ~500 ms perceived latency on short-press is structural to the consume-then-replay design (DOWN is consumed, only UP-before-timeout re-simulates) and is not what this PR addresses. Worth a separate UX pass. ## Verification - `./gradlew assembleDebug` — green; no new warnings on the edited lines. - Grep sweep: zero `adjustStreamVolume` calls remain in the re-simulation paths; three `adjustSuggestedStreamVolume` calls at the edited lines. - On-device matrix to exercise after merge: idle → ringtone slider; music playing → music slider; cellular call (screen on / proximity off) → in-call slider; VoIP (Signal, Meet) → communication slider; long-press → mapped action still fires, slider stays put. Diff: 6 changed lines across two files.
closes #355 This implementation is Vibe-coded, but i did testing and everything worked on my pixel 9a. The implementation is similar to other features.
Added the dimens.xml file, and added the resizeable font size which prevented the overflow or the text.
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.
This pull request introduces a new "Screen refresh rate" feature, including its integration into the app's settings, quick settings tile, and permission management. It also improves volume adjustment logic and adds new keys and methods for managing refresh rate settings in the repository.
Screen Refresh Rate Feature Integration:
FeatureRegistry, including metadata, search settings, and required permissions. This feature is now recognized as part of the app's interface category. [1] [2]PermissionRegistry.FeatureSettingsActivity, including UI presentation (RefreshRateSettingsUI), permission checks, and feature enablement logic. [1] [2] [3] [4] [5] [6]Quick Settings Tile for Refresh Rate:
RefreshRateTileServicefor toggling screen refresh rate presets from the quick settings panel, with proper permission handling and UI updates. [1] [2]QSPreferencesActivityto recognize the new refresh rate tile and map it to the correct feature.Settings Repository Enhancements:
SettingsRepository. Also, implemented logic to apply or reset refresh rate settings as needed. [1] [2] [3]Volume Adjustment Improvements:
InputEventListenerServiceandButtonRemapHandlerto useadjustSuggestedStreamVolumewithUSE_DEFAULT_STREAM_TYPE, ensuring more consistent behavior across devices. [1] [2] [3]Minor UI/UX Improvements:
basicMarquee,dimensionResource, andspinHapticFeedbackPicker.kt[1] [2]