Currently, battery stats are saved in upower per battery. For swappable batteries, this means that we lose useful information whenever the user swaps out a battery. Proposed solution is to cache battery stats so we can display these regardless of batteries having been swapped out, and do so per battery bay.
Does it make sense though? The information shown about the battery really is specific to that battery. Are you saying you want to continue to be able to see the stats of a battery that was seen in the past but isn't currently in use?
Yes, essentially that. I think it does, since it can be quite interesting how the system drained the battery when the older one was still inserted. Since there can only ever be one battery inserted into the bay, we won't override data by definition. That said, this issue is somewhat lower on my list currently. I don't think it would be too hard to do this without getting in the way of what's normal on current hardware (namely just one battery which isn't even replaceable). For systems that hardly ever get connected to mains, but which have 2 bays to be able to swap out batteries in the field, this is more useful (and actually where we observed said behavior). Upstream upower doesn't seem very interested, but it seems a simple cache (track energy consumption, write it to disk once in a while) can nicely solve this problem. Anyway, low priority for now. We can discuss details once it bubbles up on my to-do list.
All right, go for it!