Onboarding flow should deep link directly to the Background activity page for the app, the screen with the "Optimized" and "Unrestricted" options #150

Closed
opened 2026-07-02 20:02:37 +00:00 by JMR-dev · 0 comments
JMR-dev commented 2026-07-02 20:02:37 +00:00 (Migrated from github.com)

Context

BatteryOptimizationManager.settingsIntent() (push/BatteryOptimizationManager.kt, ~lines
44-52) currently deep-links to Settings.ACTION_APPLICATION_DETAILS_SETTINGS — the app's general
info page — which requires the user to then manually navigate into "Battery" (naming and depth
vary by OEM) and choose "Unrestricted"/"Optimized" themselves. BatteryOptimizationScreen.kt's
"Take me there" button launches this intent as the final onboarding step. The ticket asks for the
deep link to land directly on the sub-screen with those radio options, skipping the extra taps.

Note the existing KDoc on BatteryOptimizationManager already explains a deliberate constraint
here: the code avoids the restricted REQUEST_IGNORE_BATTERY_OPTIMIZATIONS permission/dialog
because Google Play limits it to an approved set of use cases (rejection risk, see #17) — any fix
here must stay within that same constraint (no restricted permissions, Play/F-Droid-safe).

Scope

  • Spike: determine whether a documented Android intent action exists that lands directly on
    the per-app battery/background-activity sub-screen (the one with
    "Optimized"/"Unrestricted"/"Restricted") rather than the app-info page. There is no single
    universal public Settings.ACTION_* constant guaranteed to land there across all OEMs —
    confirm what's reliably available on stock/AOSP (and note where Samsung/other OEM skins
    diverge).
  • Where a more direct intent is available and doesn't require a restricted permission, update
    settingsIntent() to target it, with a fallback to today's app-details intent when it can't
    be resolved (resolveActivity check) or on OEMs where it doesn't apply.
  • Update the KDoc rationale in BatteryOptimizationManager to reflect the new approach and
    its OEM caveats.

Acceptance criteria

  • On stock Android (and any other OEMs the spike confirms support it), tapping "Take me there" on
    the battery-optimization onboarding screen lands directly on the
    "Optimized"/"Unrestricted"/"Restricted" screen, not the general app-info page.
  • On devices/OEMs without a better deep link, falls back to today's app-details behavior rather
    than failing.
  • No restricted permissions introduced (stays consistent with the existing Play-safety rationale).

Relevant files

  • push/BatteryOptimizationManager.kt, ui/onboarding/BatteryOptimizationScreen.kt.

Notes

Spike first, like #125 — confirm feasibility across OEMs/API levels before committing to an
implementation; the payoff (saving the user 1-2 taps) is real but modest, so this shouldn't turn
into an open-ended per-OEM intent registry.

## Context `BatteryOptimizationManager.settingsIntent()` (`push/BatteryOptimizationManager.kt`, ~lines 44-52) currently deep-links to `Settings.ACTION_APPLICATION_DETAILS_SETTINGS` — the app's general info page — which requires the user to then manually navigate into "Battery" (naming and depth vary by OEM) and choose "Unrestricted"/"Optimized" themselves. `BatteryOptimizationScreen.kt`'s "Take me there" button launches this intent as the final onboarding step. The ticket asks for the deep link to land directly on the sub-screen with those radio options, skipping the extra taps. Note the existing KDoc on `BatteryOptimizationManager` already explains a deliberate constraint here: the code avoids the restricted `REQUEST_IGNORE_BATTERY_OPTIMIZATIONS` permission/dialog because Google Play limits it to an approved set of use cases (rejection risk, see #17) — any fix here must stay within that same constraint (no restricted permissions, Play/F-Droid-safe). ## Scope - [ ] Spike: determine whether a documented Android intent action exists that lands directly on the per-app battery/background-activity sub-screen (the one with "Optimized"/"Unrestricted"/"Restricted") rather than the app-info page. There is no single universal public `Settings.ACTION_*` constant guaranteed to land there across all OEMs — confirm what's reliably available on stock/AOSP (and note where Samsung/other OEM skins diverge). - [ ] Where a more direct intent is available and doesn't require a restricted permission, update `settingsIntent()` to target it, with a fallback to today's app-details intent when it can't be resolved (`resolveActivity` check) or on OEMs where it doesn't apply. - [ ] Update the KDoc rationale in `BatteryOptimizationManager` to reflect the new approach and its OEM caveats. ## Acceptance criteria - On stock Android (and any other OEMs the spike confirms support it), tapping "Take me there" on the battery-optimization onboarding screen lands directly on the "Optimized"/"Unrestricted"/"Restricted" screen, not the general app-info page. - On devices/OEMs without a better deep link, falls back to today's app-details behavior rather than failing. - No restricted permissions introduced (stays consistent with the existing Play-safety rationale). ## Relevant files - `push/BatteryOptimizationManager.kt`, `ui/onboarding/BatteryOptimizationScreen.kt`. ## Notes Spike first, like #125 — confirm feasibility across OEMs/API levels before committing to an implementation; the payoff (saving the user 1-2 taps) is real but modest, so this shouldn't turn into an open-ended per-OEM intent registry.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: JMR-dev/LibreMail#150