Skip to content

OEM battery-killer mitigation: per-manufacturer guidance + exemption flow (P3) #227

Description

@adsamcik

Context

Follow-up to the tracking-architecture review (P3). For a continuous tracker, OEM background killers (Xiaomi/MIUI, Samsung OneUI "sleeping apps", Huawei PowerGenie) are a primary cause of dropped tracking, and they sit outside AOSP Doze/App-Standby APIs.

The app currently uses only Settings.ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS via BatteryOptimizationHelper (and deliberately avoids the REQUEST_IGNORE_BATTERY_OPTIMIZATIONS permission for Play caution).

Work items

  1. Per-manufacturer guidance UI. Detect Build.MANUFACTURER and deep-link to the correct OEM screen (MIUI autostart, Samsung battery, Huawei protected apps) with concise instructions, following the dontkillmyapp.com patterns. Surface contextually from the tracking screen when a user-initiated session starts.
  2. Battery-optimization exemption flow (decision). Evaluate offering ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS with a rationale on first user-initiated tracking. Google Play permits the REQUEST_IGNORE_BATTERY_OPTIMIZATIONS permission for apps whose core function requires continuous background work (continuous location tracking qualifies). This is a deliberate Play-policy trade-off — needs a decision, not just code.
  3. Detect & nudge. Use PowerManager.isIgnoringBatteryOptimizations() (already wired) plus the ApplicationExitInfo reason added in PR feat(tracker): resilient user-session restart + previous-exit classification #222 to detect repeated OEM/SIGKILL exits and prompt the user with OEM guidance.

Notes

minSdk 26 means several legacy OEM tricks (e.g. the Huawei EMUI-4 LocationManagerService wakelock-tag hack) do not apply.

References

Reference: report section P3 (§4); https://dontkillmyapp.com ; Doze battery-optimization exemption policy.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions