Skip to content

Battery: passive location + geofence wake-from-stationary + tier-aware priority (P2) #226

Description

@adsamcik

Context

Follow-up to the tracking-architecture review (P2) and PR #223 (which added setMaxUpdateDelayMillis batching to the fused trigger).

These are larger battery/accuracy features that change the collection model and warrant on-device measurement (Battery Historian) rather than a small trigger tweak.

Work items

  1. Passive location for AMBIENT/STATIONARY. AMBIENT tier currently uses the non-GPS AmbientCollectionTrigger. Add an opportunistic passive consumer (Priority.PRIORITY_PASSIVE / PRIORITY_NO_POWER) so stationary/low-motion periods still capture fixes computed by other apps at ~zero battery cost.
  2. Geofence wake-from-stationary. When the activity-recognition state goes STILL, register a 50–200 m exit geofence (setNotificationResponsiveness ≈ 5 min) and drop continuous GPS; on GEOFENCE_TRANSITION_EXIT, escalate the tier and re-enable location updates. Pattern: transistorsoft background-geolocation motion model.
  3. Tier-aware priority. Thread the policy tier into DynamicIntervalCollectionTrigger.updateInterval(...) so selectPriority() can return LOW_POWER/BALANCED/HIGH_ACCURACY per tier (currently only permission-based).
  4. Mid-session BatteryAwarePolicy re-evaluation. BatteryAwarePolicy.adjustForBattery() is applied only at session start; re-evaluate as the battery drains so a long session caps the tier dynamically.

Validation

  • Battery Historian before/after for a multi-hour walking + stationary session.
  • Confirm route fidelity is acceptable with passive + geofence (timestamps preserved).

References

Reference: report section P2 (§4.3, §4.4); Android location battery-optimization docs; transistorsoft background-geolocation.

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