Skip to content

Develop - Dynamic font size and marquee, button remap fix for call vol, custom refresh rate#379

Merged
sameerasw merged 19 commits intomainfrom
develop
Apr 30, 2026
Merged

Develop - Dynamic font size and marquee, button remap fix for call vol, custom refresh rate#379
sameerasw merged 19 commits intomainfrom
develop

Conversation

@sameerasw
Copy link
Copy Markdown
Owner

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:

  • Added a new "Screen refresh rate" feature to the FeatureRegistry, including metadata, search settings, and required permissions. This feature is now recognized as part of the app's interface category. [1] [2]
  • Registered the "Screen refresh rate" feature with the SHIZUKU permission in the PermissionRegistry.
  • Integrated the new feature into the FeatureSettingsActivity, including UI presentation (RefreshRateSettingsUI), permission checks, and feature enablement logic. [1] [2] [3] [4] [5] [6]

Quick Settings Tile for Refresh Rate:

  • Added a new RefreshRateTileService for toggling screen refresh rate presets from the quick settings panel, with proper permission handling and UI updates. [1] [2]
  • Updated QSPreferencesActivity to recognize the new refresh rate tile and map it to the correct feature.

Settings Repository Enhancements:

  • Introduced new keys and methods to manage refresh rate mode, fixed/min/peak values, and reset behavior in SettingsRepository. Also, implemented logic to apply or reset refresh rate settings as needed. [1] [2] [3]

Volume Adjustment Improvements:

  • Updated volume adjustment logic in InputEventListenerService and ButtonRemapHandler to use adjustSuggestedStreamVolume with USE_DEFAULT_STREAM_TYPE, ensuring more consistent behavior across devices. [1] [2] [3]

Minor UI/UX Improvements:

  • Minor Compose UI improvements, such as importing basicMarquee, dimensionResource, and sp in HapticFeedbackPicker.kt [1] [2]

rahulsharma860 and others added 19 commits April 20, 2026 23:41
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.
@sameerasw sameerasw self-assigned this Apr 30, 2026
@sameerasw sameerasw added bug Something isn't working enhancement New feature or request labels Apr 30, 2026
@sameerasw sameerasw merged commit 1d97809 into main Apr 30, 2026
1 check passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in Essentials Progress Apr 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants