Skip to content

Charging: time-to-full as a details-table row (rescoped — no standalone feature) #124

Description

@almothafar

Part of the charger-notification redesign. All dependencies merged (#122, #108/#120).

Rescoped 2026-07-12 (session discussion) — decision documented so a fresh session can build without re-planning.

Decision

Not a standalone feature or notification. Stock Android and OEMs already show time-to-full (Samsung's lock screen "Full charge in X", Settings → Battery) using the fuel gauge's learned charge curve — strictly better than our linear estimate, which would be most wrong exactly where people look (the taper above 80%).

What survives is the nearly-free version: one row in the details table, since #108's merged charge rate makes it a two-line computation.

Agreed scope

A single row in the battery details table, shown only while charging and only when computable (independent gating like the #108 rows; hidden otherwise — never "0 min" or garbage):

Time to full · ~1h 20m

Computation (capacity-free — works on Kirin too)

Use #108's smoothed charge rate directly, not mAh/current:

hours_to_full = (100 − level%) / chargeRatePercentPerHour
  • Rate comes from the BatteryRateTracker.BatteryRate already computed in BatteryDetailsFragment.addRateRows (it calls record()); reuse that same object — do not re-read.
  • Hide when: not charging, !rate.hasRate(), or level ≥ 99%.
  • Pure, unit-testable helper for the math + duration formatting (e.g. ~1h 20m, ~45m), Western digits per Battery details table: fix RTL alignment + use Western digits for numbers #96.

Placement

BatteryDetailsFragment.addRateRows — a row below "Charge rate", same pattern as the existing rate/current rows.

Honest caveat (document in the row's Javadoc, not the UI)

Linear estimate, no taper modeling; it will overshoot near full. Acceptable for a glanceable rough figure — precision is explicitly a non-goal (the OS owns the accurate number).

Affected code

  • ui/fragment/BatteryDetailsFragment.java — one row in addRateRows
  • service/BatteryRateTracker.java (or a small util) — pure estimateMinutesToFull(level, ratePph) + duration formatter
  • res/values/strings.xml + values-ar — "Time to full" label + value format
  • tests — the estimate + formatter (boundaries: level 99/100, rate 0/1, rounding)

Acceptance criteria

Non-goals

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