[Xperia Z1 Compact Q&A, Help & Troubleshooting] S4RSZ:
So I started having an issues with my battery lately too and started to do some online digging and found lots of people with issues. I'm on the latest stock firmware and have nothing rooted. I did drop my phone on some point which may have caused issues, nevertheless I would like to give my input.

From what I have found from digging around on the chipset used in our phones, the battery mangament is located on the chipset. I'm not talking the software part, but the part giving information from the battery directly. (embedded software I think this if called). So the way I see it is:

--> battery: report voltage or other raw info to battery mangement on chipset

--> Chipset: interpret voltage or other raw info and convert this to charge level and provide info regarding battery

--> Other layers: sony firmware, android, kernel

--> User interface: displays charge levels etc.

From what I've read about modern batteries (Li-Ion etc.) there is a certain threshold at which the battery gets a charge so low it is unable to be charged ever again. So there is a certain charge level at which the phone shuts off to prevent reaching that level. There are a lot of different ways to determine the charge level (see wiki about State of Charge) but from what I understand it mostly comes down to reading a certain raw info and converting this to a charge level bases on Graphs from rawinfo vs charge level.

Additionally I read that the charge level reported to us is not the actual charge level (here). This is caused by the nature of the batteries. Because the actual charge level isn't a good reflection of how long your phone will actually last, and to not give users the idea there battery is bad, this actual charge level is altered.

Now I don't know any of this for sure but I suspect that the Chipset still works with the actual charge level, and that only in a higher layer the conversion to the "user" charge level is made. I don't think that an update to a new android or kernel goes as deep as the embedded software on the chipset, but I do think it can change the calculation of the "user" battery charge.

If this calculation is changed, I can only assume it;s for the better. What I think is happening is the following. When the battery starts to degrade (either by "natural" wear or otherwise) the new calculation of the "user" charge level is more inaccurate then the one on an older build. The actual charge level will be the same as before, but the "user" charge level drops very steep when the software realises that it that actual charge level is is getting low. In other words, the "user" charge level is displayed too high for a long time, and all of a sudden it needs to correct, which makes it look like your losing a lot of charge all of sudden. The actual shutdown signal, for shutting down the phone and preventing the battery to drain too deep, is probably based on the "actual" charge level, since this is critical to have the phone function properly.

What I think is that the actual time the phone lasts is the same time (assuming same usage of phone), independent if you're using Lollipop or pre-lollipop. This time will be shorter because of battery degradation, or because of a bad battery batch. The new software just results in a bad calculation of the "user" battery level for batteries that have degraded too far. Since replacing the battery gives a the new "user" charge level calculation a new battery to work with this solves the issues of the sudden drop. Down grading to a older Sony firmware etc would also have some effect as the old "user" charge level calculation is better for degrading batteries , although at some point this older firmware will also have issues regarding the "user" charge level the more the battery degrades.

I personally think that there certainly is a batch of phones with "bad" batteries in it. I have a phone with batch number 14W44 myself, two other people in this thread have reported no issues with batch 14W11 and 14W15. I'm curious which batches you have/had

Please note that most of this is speculation. While I have done some online digging, I have no experience with any of this and can only rely on my own interpretation and minimal knowledge embedded software (Dad's in embedded software, though in a completely different field of it. I'm a 26 yo University Student with interest in electronics)