# Original battery's low capacity density and adapting a GS8+ battery

#### Infy_AsiX

##### Senior Member
I've been researching about batteries out of interest of replacement, better charging maintaining and longevity. Being unable to find a recently manufactured Z3C battery anywhere, I'm setting up a Galaxy S8+ replacement battery with a removed Z3C battery's printed circuit board solder connected. I can't find a good source on lithium-ion shelf life through Google but it's commonly mentioned to be 2-3 years to being considered depleted. I've got the mod working but haven't finished cleaning it up. The leftover space in the device got me curious on the actual capacity limit. I started calculating the differences and ended up writing it all up for comparison. I can follow up with some photos.

Notes
• Measured by eye using a steel ruler and flat tool on an official warranty replacement 16W13 manufacture dated battery. The capacity feels depleted maybe 80% or so, so it's considered depleted. Being depleted the thickness may have swollen up to 10%. See sources below on these points.
• Dimensions in centimeters
• All numbers rounded to two decimal places
• Nom = Nominal Voltage
• Sony's original battery has an energy density of 2008 maximum technology according to this graph http://2.bp.blogspot.com/-NkSg5gn6ePM/VVPBtPLreJI/AAAAAAAAAoI/-KeFe45ky14/s1600/Pix.png found on the source list below.
• Using a case without the back panel easily affords an extra millimeter.
• For an extra 0.9mm in thickness a Z1C 127 x 64.9 x 9.5 case can be used on a Z3C 127.3 x 64.9 x 8.6.

Original Batteries
Sony Z3C = 9 x 5.1 x 0.4 = 18.36ml = Nom 3.8V 2600mAh 141.61mAh/ml 0.54Wh/L = 2008 density
Samsung S8+, 2017 density = 8.3 x 4.55 x 0.5 = 18.88ml = Nom 3.85V 3500mAh 185.38mAh/ml 0.71Wh/L (or estimated Nom 3.8V 3360mAh 177.96mAh/ml 0.68Wh/L)

Hypothetical higher densitys
Sony Z3C, if matched 2014 maximum density = (estimated using 0.66Wh/L = Nom 3.8V 3189mAh 12.12Wh, 173.69mAh/ml)
Sony Z3C, if Samsung S8+ 2017 density = Nom 3.85V 3387mAh 13.04Wh (or estimated Nom 3.8V 3285mAh 12.48Wh)

Sony Z3C, hypothetical 0.1 thicker
9 x 5.1 x 0.5 = 22.95ml
If Original 2008 density = Nom 3.8V 3250mAh 12.35Wh
If 2014 density = (estimated using 0.66Wh/L = Nom 3.8V 3987mAh 15.15Wh, 173.73mAh/ml)
If 2017 density = Nom 3.85V 4231mAh 16.29Wh (or estimated Nom 3.8V 4106mAh 15.6Wh)

Sources
Good basic sources in general is scarce through basic searching on the topic of lithium-ion batteries. I think it's because the industry is highly competitive with low margins leading to secrecy in interest of intellectual property (got the gist of this from a few different Qnovo blog articles). Also it's got heavily ongoing academic focused research and development but would be funded and therefore guarded by the corporations . Funny though that my main sources are from CEO's of battery related companies. I think it's a case there of smaller companies with an interest and belief in sharing knowledge to create public awareness. Thus here we are on XDA with some relevant useful facts.

At 80% retained capacity a battery is considered depleted. Capacity loss is greatly accelerated after 80% as is the risk of safety measure failure
https://qnovo.com/what-happens-after-80-percent/. The industry leader in support and sales by model volume, Apple's warranty policy follows this guideline https://support.apple.com/en-au/ipho.../battery-power.

https://qnovo.blogspot.com.au/2015/08/72_14.html

This article https://qnovo.com/moores-law-and-snails-law/ has a graph for Energy Density Wh/L by year which I used for estimating what Sony's battery could have been if maximum density was used at the time.

I used Table 4 from http://batteryuniversity.com/learn/article/how_to_prolong_lithium_based_batteries to presume the capacity of 4.35V and 4.4V which I used for estimated results. Based like this:
4.30 110-115%
4.35 115-120%
4.4 120-125%

Last edited:

#### Dovydas21

##### New member
Really interesting, I was thinking to do something similiar, but with bigger battery and use z3c without glass back with maybe a moded case, photos would be really interesting, probably now gonna buy s8+ battery to tinker with, considering s8+ battery 7mm is shorter would really help in custom wiring to old z3c battery pcb

Infy_AsiX

#### Infy_AsiX

##### Senior Member
Photos with short descriptions https://imgur.com/a/8Ceha.

There's a lot of stuff to cover. I'll cover the basics. If anyone wants more information, just ask.

I was planning to remove the S8+ PCB and attempt to solder it myself. After Banggood didn't package the soldering iron order twice, I got fed up waiting and decided to quote a cheap phone technician. Given the fee was AUD \$18 I went ahead.

There was some communication issues as the technician didn't speak English, so I had to discuss with the staff. I'd have preferred the S8+ PCB removed and with shorter wires but it has actually has worked out well. Looking at the broken battery I removed the Z3C PCB from, it's difficult removing the PCB from the spot welding while leaving lots of aluminium tab left over. I've read how aluminium is one of the most difficult materials to solder to and having big fresh tabs is easier and safer.

It all fits well and is still removable quick swappable with my other mod. I'll be monitoring its performance. I already use custom charge threshold rates and limits using Tasker rooted for longevity. I already previously monitor battery temperature, usage rates and voltage by overlay so I should be able to notice differences. Plus i've got two working Z3C's to power test :fingers-crossed:

Should probably add that doing any battery modification goes against safety recommendations. You need to know what you're doing for the involved risks. Follow electrostatic discharge safety for installation and use required measures for handling the battery if using it removable.

Last edited:
lokr

#### TheHow7zer

##### Senior Member
Hey, I'm interested in this mod. Can't wait to find out your results. I may be able to help you out a bit, I'm a CNC Machinist and I have my own set of calipers if you wanted a more accurate measurement on the z3c battery sizes. I may (read: may) be able to make a back plate that will hold a slightly different battery.

Infy_AsiX

#### Infy_AsiX

##### Senior Member
Hey, I'm interested in this mod. Can't wait to find out your results. I may be able to help you out a bit, I'm a CNC Machinist and I have my own set of calipers if you wanted a more accurate measurement on the z3c battery sizes. I may (read: may) be able to make a back plate that will hold a slightly different battery.

You're welcome to get more accurate measurements for correction. It shouldn't be much of a difference but can be useful for interests sake.

That's an interesting offer suggestion. I'm a little curious how much signal loss there is with a metal case. I prefer a TPU for the sides of my case with a small lip to cover the front, also a hard back to adhere 3M VHB for a Garmin interface. So I tracked down a Z1C Ringke fusion to combine all my hardware mods :laugh:

#### Cirra92

##### Senior Member
Wow very nice idea and the mod indeed I am sucker for battery life, so I'm very much interested in actual numbers here, you could provide us some screenshots and further feedback on mod performance.
I've got a question though, since the S8+ battery is 0.1mm thicker, would it be possible to put some double sided tape on the frame + B7000 glue in order to lift the original glass back and still keep it on the phone?

Infy_AsiX

#### Infy_AsiX

##### Senior Member
Wow very nice idea and the mod indeed I am sucker for battery life, so I'm very much interested in actual numbers here, you could provide us some screenshots and further feedback on mod performance.
I've got a question though, since the S8+ battery is 0.1mm thicker, would it be possible to put some double sided tape on the frame + B7000 glue in order to lift the original glass back and still keep it on the phone?

I might try to compare across two devices with the same Nandroid copy and the less old 2016 battery. I'd probably only test up to 80% to maintain cycle life. May be awhile yet though as I broke a motherboard while transporting for an unrelated replacement screen warranty removal.

B7000 hey, you've done some phone repairs already too? It's 0.1cm, 1mm thicker. B7000 applies as liquid so it won't be raised enough when adhering. Using a case isn't a bad compromise as it affords protection, something I've already always used in the past.

Cirra92

#### Cirra92

##### Senior Member
I might try to compare across two devices with the same Nandroid copy and the less old 2016 battery. I'd probably only test up to 80% to maintain cycle life. May be awhile yet though as I broke a motherboard while transporting for an unrelated replacement screen warranty removal.

B7000 hey, you've done some phone repairs already too? It's 0.1cm, 1mm thicker. B7000 applies as liquid so it won't be raised enough when adhering. Using a case isn't a bad compromise as it affords protection, something I've already always used in the past.

I thought some screenshots with the device that has the mod, you don't need to compare with old one Bad luck for the motherboard, had some mishaps too with broken screens while replacing them myself :/

Yeah I took the phone apart 3 times already (though it was to replace the screen only, didn't remove the motherboard) so I'm familiar enough with Z3C disassembly Right, 0.1cm, I meant that but made a stupid mistake, sorry. I've mentioned B7000 since I used that to avoid notorious issues of screen and back glass separating from frame, but didn't use the double sided tape as I don't know how good is it gonna stick, so thought in this case of using maybe a double layer of the tape and glue on top of it. I have a silicone case on it, but would like to keep the original look
Anyway I hope to see what benefit this gives you, as my battery is 2y old now (still going strong though), so it will likely start to give up on me, and I'm interested in this mod
Thanks, and good job once again :victory:

Infy_AsiX

#### Infy_AsiX

##### Senior Member
I thought some screenshots with the device that has the mod, you don't need to compare with old one Bad luck for the motherboard, had some mishaps too with broken screens while replacing them myself :/

Yeah I took the phone apart 3 times already (though it was to replace the screen only, didn't remove the motherboard) so I'm familiar enough with Z3C disassembly Right, 0.1cm, I meant that but made a stupid mistake, sorry. I've mentioned B7000 since I used that to avoid notorious issues of screen and back glass separating from frame, but didn't use the double sided tape as I don't know how good is it gonna stick, so thought in this case of using maybe a double layer of the tape and glue on top of it. I have a silicone case on it, but would like to keep the original look
Anyway I hope to see what benefit this gives you, as my battery is 2y old now (still going strong though), so it will likely start to give up on me, and I'm interested in this mod
Thanks, and good job once again :victory:

I think it's hard to demonstrate battery performance based on how different smartphone power usage can be. On a fresh ROM even an old battery lasts a long time. I'd estimate my basic usage averages around 650mA/h based on the system current draw when the screen is on and being used generally. That's with debloated stock and various power saving mods like kernel tweaks, low brightness and Greenify. Though on the other hand I do have a lot of mods and Xposed going on. I prefer to leave mobile data, wifi and sync always on so that's no help either. Though also my old stock rom does seem faulty, running out of ZRAM even with it greatly increased.

Anyway at ~650mA/h that's still only 5 hours SOT with 3325mAh. 4 hours SOT using a max limit of 80%, around the same as a new stock 2600mAh battery. 3 hours SOT for a degraded battery with 80% capacity left or a new stock set to 80% max limit. 2.5 hours SOT for a degraded 80% remaining with a set 80% max limit. If feels like those last scenarios describe my old batteries. With a theoretical 4000mAh an extra hour again would certainly be welcome. Technically you can get close to that with a S8 Active battery that's 4000mAh 4.4V, judging by phone dimensions between the S8, S8 Active, S8+ it will be smaller and thicker again.

It kind of shows why I don't like comparing battery performance with between user setups. There's too many variables to power consumption on a smartphone. I don't know how people get 8 hours screen time in screenshots but physics dictates the limit. To get 8 hours SOT with 3325mAh, current draw would have to average 415mA, something I can't reach on my setup. Not to mention performing a full deep discharge cycle harming longevity. However it's definitely possible on a fresh ROM with only a few apps, noting that's how reviewer benchmarks operate (untrue to real usage). It kind of brings back the fact that a removable battery is still the only solution to extending run time beyond an insufficient limited capacity without complicating charging and requiring tethering.

I'll try to get a screenshot that indicates what I've mentioned here as confirmation. You could try watching your system current draw using an app too, I see Ampere and AccuBattery often mentioned, I prefer DevCheck or Cool Tool. Then estimate your own capacity health, potential run times and screenshot for interest and knowledge sharing's sake .

Last edited:
Cirra92

#### Cirra92

##### Senior Member
I think it's hard to demonstrate battery performance based on how different smartphone power usage can be. On a fresh ROM even an old battery lasts a long time. I'd estimate my basic usage averages around 650mA/h based on the system current draw when the screen is on and being used generally. That's with debloated stock and various power saving mods like kernel tweaks, low brightness and Greenify. Though on the other hand I do have a lot of mods and Xposed going on. I prefer to leave mobile data, wifi and sync always on so that's no help either. Though also my old stock rom does seem faulty, running out of ZRAM even with it greatly increased.

Anyway at ~650mA/h that's still only 5 hours SOT with 3325mAh. 4 hours SOT using a max limit of 80%, around the same as a new stock 2600mAh battery. 3 hours SOT for a degraded battery with 80% capacity left or a new stock set to 80% max limit. 2.5 hours SOT for a degraded 80% remaining with a set 80% max limit. If feels like those last scenarios describe my old batteries. With a theoretical 4000mAh an extra hour again would certainly be welcome. Technically you can get close to that with a S8 Active battery that's 4000mAh 4.4V, judging by phone dimensions between the S8, S8 Active, S8+ it will be smaller and thicker again.

It kind of shows why I don't like comparing battery performance with between user setups. There's too many variables to power consumption on a smartphone. I don't know how people get 8 hours screen time in screenshots but physics dictates the limit. To get 8 hours SOT with 3325mAh, current draw would have to average 415mA, something I can't reach on my setup. Not to mention performing a full deep discharge cycle harming longevity. However it's definitely possible on a fresh ROM with only a few apps, noting that's how reviewer benchmarks operate (untrue to real usage). It kind of brings back the fact that a removable battery is still the only solution to extending run time beyond an insufficient limited capacity without complicating charging and requiring tethering.

I'll try to get a screenshot that indicates what I've mentioned here as confirmation. You could try watching your system current draw using an app too, I see Ampere and AccuBattery often mentioned, I prefer DevCheck or Cool Tool. Then estimate your own capacity health, potential run times and screenshot for interest and knowledge sharing's sake .

Well yeah I agree on that, it's hard to do it precisely, however I asked because you know your typical usage and maybe could make a rough conclusion on the benefit that this mod gives you, if your current usage does not differ much from the one with original battery. I do not rely much on those app calculations no matter how precise the might be, as I don't rely on reviewer's tests as well, because my usage is specific. I can tell I'm one of those who was reaching 8h of SOT, even 9h on 5.1.1 with specific settings (microG instead of Gapps, global UV, interactive governor tweaks, intelliplug, different LMK values and Amplify, though the last one didn't make much difference) and that battery life was pretty consistent until MM came on board. Now I'm on Carbon 7.1.1 (with same settings) and can average 7h of SOT and always 24-36h of total usage with 2y old battery, which is damn good if you consider that and the fact that I had a lot of full discharge cycles, 100% -> 1%.

Based on your calculations even with your current draw you can get extra 1h of SOT, if I understood right what you wrote, not that SOT is sole indicator of how your battery performs, but it does show a lot in same usage scenario

I have AccuBattery installed from last night, will monitor in upcoming days and share here, just for general info as you said, and to see how much is the % of degradation

Infy_AsiX and okij

#### Infy_AsiX

##### Senior Member
I can tell I'm one of those who was reaching 8h of SOT, even 9h on 5.1.1 with specific settings (microG instead of Gapps, global UV, interactive governor tweaks, intelliplug, different LMK values and Amplify, though the last one didn't make much difference) and that battery life was pretty consistent until MM came on board. Now I'm on Carbon 7.1.1 (with same settings) and can average 7h of SOT and always 24-36h of total usage with 2y old battery, which is damn good if you consider that and the fact that I had a lot of full discharge cycles, 100% -> 1%.

Based on your calculations even with your current draw you can get extra 1h of SOT, if I understood right what you wrote, not that SOT is sole indicator of how your battery performs, but it does show a lot in same usage scenario

I have AccuBattery installed from last night, will monitor in upcoming days and share here, just for general info as you said, and to see how much is the % of degradation

That's certainly some impressive power consumption. Was that on stock before N? I've always been stock ROM until now that I'm migrating transitioning to LOS N across two Z3Cs.

I also started trying AccuBattery a few days ago and found it quite useful in a few ways. How it records charging/discharging sessions with mA and mAh data, provides a way to track energy consumption. It's Process CPU usage overlay helped me realise the live wallpaper I had was using 50% of my CPU generally and that DevCheck's overlay is resource intensive. Though AccuB's CPU usage overlay doesn't work on N properly anymore due to SELinux. I found however capacity health estimates are incorrect on my stock ROM, doing some digging and have come up with a basic understanding.

It gets a little complicated so it's confusing and some more testing or other's checking is needed to confirm some specific things. I only had one phone this week so I tested it on my stock ROM with the S8+ battery. The screenshots confirm AccuB recorded close to the expected capacity of the S8+. Note the device was not used in a way to represent a constant drain, the timing is just to demonstrate separation. The screenshots are scattered in content as I was just grabbing the stats not expecting the below 1% occurrence. To understand just look for what's described above each for explanation.
Showing percentage output "50%" at ~3.8V when it should be 70%, 3:35 (pm ).
https://i.imgur.com/qZwnCDy
At ~3.65V it hit "1%" 4:48pm.
https://i.imgur.com/JQrqwAG
~3.6V below "1%" 6:26pm. Around this voltage holds the most energy, why 0.05V lasted so long from the last screenshot.
https://i.imgur.com/ZQTZU29
~3.45V below "1%" 6:59pm
https://i.imgur.com/8kZaWSm
Last screenshot ~3.25V before cutoff at 3.2V 7:07pm.
https://i.imgur.com/16PysRL

Post session stats screenshots. Note the session started at 99% because I forgot to restore AccuBattery's Titanium data until after booting, meaning some mAh is missing from 100% but as seen AccuB tracked close to the expected capacity of the S8+. In regards to SOT in my last post, there's confirmation my old stock ROM averages 600mA with screen on. Note the screen off mA is high because of playing Google Music on phone speakers the entire cycle. Obviously the %/h is false here due to the missing ~1100mAh below 0%.

AccuB's charging health estimates are constantly incorrect at ~2000mAh. I think this is caused by system battery aging calibration that is set on my old stock ROM. Doesn't matter which whether stock 2014, stock '15 or S8+ '17 battery is used. Dividing a discharge session mAh by percent used gives the same approximate low mAh per percentage. This is why the S8+ battery keeps running at 1% remaining for over another 1000mAh. Doing some searching of the symptom takes me back to the days where third party extended batteries were used, meeting the issue. The main issue is the kernel controls the calibrating capacity percentage fuel gauge chip. For example the Note 4 has a kernel mod fuel gauge chip fix for extended batteries. Another example is the Galaxy S2 could reset it's fuel gauge using root. Here's some old Xperia Arc/Pro fuel chip kernel insight.

I've tried deleting /data/system/batterystats-checkin.bin, batterystats-daily.xml, and batterystats.bin. Removing the battery resets the percentage accordingly but charging and discharging is still incorrect.

Looking at /sys/class/power_supply/bms/batt_aging is "1". With /sys/class/power_supply/bms/device/fcc_new_mah "2313". Or fcc_samples "2380/2156/2268/2268/2366". FCC meaning full charge capacity. This could well be evidence.

I just received a replacement Z3C yesterday to load up LOS N again. I haven't opened it up yet, it's device manufacture tag is 15W04. My nandroid restore has batt_aging "0", fcc_new_mah "0", fcc_samples "0/0/0/0/0/". AccuBattery estimates health near 2600 and dividing mAh by percent usage is approximate. I guess a full cycle is in order to confirm some things. If on AOSP, drivers aren't configured to lower the capacity range, that's less the issue of variability. However the range seems to be hard set to 2600, so the S8+ battery will be running for an extra ~700mAh after 0%.

I found the app CaliBattery is a useful basic way to estimate percentage by voltage. This helps with overcoming stock's aging estimator, though it's notification doesn't update for me on LOS14.1. For example if you received a new official replacement battery but restored a Nandroid backup, you'd have the same battery issues mentioned until enough full cycles are run, recorded and used by the system. On the counter side an old battery on AOSP if it's hard set to 2600 (need test confirmation of this) will turn off before 1%.

One possible workaround is to take voltage readings and calculate percentage using Tasker and write that to system percentage with root. The problem there is efficiency and not updating while screen's off in interest of power. A proper fix requires modifying the relevant fuel gauge configuration in the kernel. I'm not a developer nor have any kernel building experience to do that.
Edit: I stumbled across /sys/module/qpnp_bms/parameters/bms_reset which seems to be a generic kernel setting allowing to reset the percentage. This with Tasker helps with getting the level correct before and after charging. If something like CaliBattery can show approximate level when draining, things seem ok as a workaround. Still needs further testing, and to try on AOSP (the file does exist at least). To be continued...

Last edited:
Cirra92

#### Cirra92

##### Senior Member
That's certainly some impressive power consumption. Was that on stock before N? I've always been stock ROM until now that I'm migrating transitioning to LOS N across two Z3Cs.

I also started trying AccuBattery a few days ago and found it quite useful in a few ways. How it records charging/discharging sessions with mA and mAh data, provides a way to track energy consumption. It's Process CPU usage overlay helped me realise the live wallpaper I had was using 50% of my CPU generally and that DevCheck's overlay is resource intensive. Though AccuB's CPU usage overlay doesn't work on N properly anymore due to SELinux. I found however capacity health estimates are incorrect on my stock ROM, doing some digging and have come up with a basic understanding.

It gets a little complicated so it's confusing and some more testing or other's checking is needed to confirm some specific things. I only had one phone this week so I tested it on my stock ROM with the S8+ battery. The screenshots confirm AccuB recorded close to the expected capacity of the S8+. Note the device was not used in a way to represent a constant drain, the timing is just to demonstrate separation. The screenshots are scattered in content as I was just grabbing the stats not expecting the below 1% occurrence. To understand just look for what's described above each for explanation.
Showing percentage output "50%" at ~3.8V when it should be 70%, 3:35 (pm ).
https://i.imgur.com/qZwnCDy
At ~3.65V it hit "1%" 4:48pm.
https://i.imgur.com/JQrqwAG
~3.6V below "1%" 6:26pm. Around this voltage holds the most energy, why 0.05V lasted so long from the last screenshot.
https://i.imgur.com/ZQTZU29
~3.45V below "1%" 6:59pm
https://i.imgur.com/8kZaWSm
Last screenshot ~3.25V before cutoff at 3.2V 7:07pm.
https://i.imgur.com/16PysRL

Post session stats screenshots. Note the session started at 99% because I forgot to restore AccuBattery's Titanium data until after booting, meaning some mAh is missing from 100% but as seen AccuB tracked close to the expected capacity of the S8+. In regards to SOT in my last post, there's confirmation my old stock ROM averages 600mA with screen on. Note the screen off mA is high because of playing Google Music on phone speakers the entire cycle. Obviously the %/h is false here due to the missing ~1100mAh below 0%.

AccuB's charging health estimates are constantly incorrect at ~2000mAh. I think this is caused by system battery aging calibration that is set on my old stock ROM. Doesn't matter which whether stock 2014, stock '15 or S8+ '17 battery is used. Dividing a discharge session mAh by percent used gives the same approximate low mAh per percentage. This is why the S8+ battery keeps running at 1% remaining for over another 1000mAh. Doing some searching of the symptom takes me back to the days where third party extended batteries were used, meeting the issue. The main issue is the kernel controls the calibrating capacity percentage fuel gauge chip. For example the Note 4 has a kernel mod fuel gauge chip fix for extended batteries. Another example is the Galaxy S2 could reset it's fuel gauge using root. Here's some old Xperia Arc/Pro fuel chip kernel insight.

I've tried deleting /data/system/batterystats-checkin.bin, batterystats-daily.xml, and batterystats.bin. Removing the battery resets the percentage accordingly but charging and discharging is still incorrect.

Looking at /sys/class/power_supply/bms/batt_aging is "1". With /sys/class/power_supply/bms/device/fcc_new_mah "2313". Or fcc_samples "2380/2156/2268/2268/2366". FCC meaning full charge capacity. This could well be evidence.

I just received a replacement Z3C yesterday to load up LOS N again. I haven't opened it up yet, it's device manufacture tag is 15W04. My nandroid restore has batt_aging "0", fcc_new_mah "0", fcc_samples "0/0/0/0/0/". AccuBattery estimates health near 2600 and dividing mAh by percent usage is approximate. I guess a full cycle is in order to confirm some things. If on AOSP, drivers aren't configured to lower the capacity range, that's less the issue of variability. However the range seems to be hard set to 2600, so the S8+ battery will be running for an extra ~700mAh after 0%.

I found the app CaliBattery is a useful basic way to estimate percentage by voltage. This helps with overcoming stock's aging estimator, though it's notification doesn't update for me on LOS14.1. For example if you received a new official replacement battery but restored a Nandroid backup, you'd have the same battery issues mentioned until enough full cycles are run, recorded and used by the system. On the counter side an old battery on AOSP if it's hard set to 2600 (need test confirmation of this) will turn off before 1%.

One possible workaround is to take voltage readings and calculate percentage using Tasker and write that to system percentage with root. The problem there is efficiency and not updating while screen's off in interest of power. A proper fix requires modifying the relevant fuel gauge configuration in the kernel. I'm not a developer nor have any kernel building experience to do that.
Edit: I stumbled across /sys/module/qpnp_bms/parameters/bms_reset which seems to be a Sony kernel setting allowing to reset the percentage. This with Tasker helps with getting the level correct before and after charging. If something like CaliBattery can show approximate level when draining, things seem ok as a workaround. Still needs further testing, and to try on AOSP (the file does exist at least). To be continued...

That was on stock, the most efficient one was LP, the last 5.1.1, I got constantly 8+ hours of SOT, and even 9+ in half of those charges probably, but as soon as I flashed the first stable official MM build and then went back to LP (in the same month even) the battery life dropped significantly, and the only thing I remember that could have changed was the bootloader, literally nothing else, but I doubt it has anything to do with battery life.
You can see the screenshots here just after flashing the 5.1.1 back then. -> https://forum.xda-developers.com/showpost.php?p=68155846&postcount=16

And also I have observed the battery stats through AccuB, you can check some on attachment shots, and if measurements are valid my screen power draw is 350-400 mA and the battery health is reported to be at ~2400ma or ~92% which is actually more than I expected And as you can see, the standby drain is unusually high, been that way since I flashed the rom, and I'm sure it has to be lower, but will tackle that when O gets more bugs fixed. All of this is on Carbon N rom by Myself5.

I can see that you've done your homework extensively, which is impressive Now, for the battery capacity coding part, I'm not sure if its hard coded as I've used my phone just a month ago until 1% and it didn't die where it should because the battery capacity is lower. Don't know about the way to reset the battery chip (or gauge) since it has been said that its self regulated, unlike the Galaxy S2 as you've mentioned and I owned it as well and done that. It might level out through a number of successive charging cycles, try to load it with clean rom and give it a go, why would they hard code the capacity, that's weird, but that's beyond my knowledge anyway.

#### Attachments

• Screenshot_20171120-193452.png
96 KB · Views: 251
• Screenshot_20171120-193608.png
90.7 KB · Views: 255
• Screenshot_20171120-202440.png
120.9 KB · Views: 253
Infy_AsiX

#### Infy_AsiX

##### Senior Member
And also I have observed the battery stats through AccuB, you can check some on attachment shots, and if measurements are valid my screen power draw is 350-400 mA and the battery health is reported to be at ~2400ma or ~92% which is actually more than I expected And as you can see, the standby drain is unusually high, been that way since I flashed the rom, and I'm sure it has to be lower, but will tackle that when O gets more bugs fixed. All of this is on Carbon N rom by Myself5.

I can see that you've done your homework extensively, which is impressive Now, for the battery capacity coding part, I'm not sure if its hard coded as I've used my phone just a month ago until 1% and it didn't die where it should because the battery capacity is lower. Don't know about the way to reset the battery chip (or gauge) since it has been said that its self regulated, unlike the Galaxy S2 as you've mentioned and I owned it as well and done that. It might level out through a number of successive charging cycles, try to load it with clean rom and give it a go, why would they hard code the capacity, that's weird, but that's beyond my knowledge anyway.
I think AccuBattery's health estimate is unreliable after noticing how it seems to report by the ROM's provided mAh/% rather than usage. It's discharging mA rate and history total discharge however are useful as they seem to track mAh usage current. So I think doing a full cycle noting the history's total mAh thus avoiding any kernel/ROM BMS configuration interference may be the only way to check.

I'll get around to testing the S8+ battery on AOSP soon. I ran this replacement Z3C on LOS almost flat but aging stats in /battery haven't changed. I guess the BMS aging stats are hidden by not linking to output like Sony's stock. I made up my own CaliBattery style notification through Tasker and have BMS reset on every % change when charging. So far it looks to be a workable workaround.

If some close to three year old batteries do still have 90% health, the batteries are actually good after all. My first two Z3C batteries were swollen under a year, but I lacked knowledge on maintaining them back then. Well that and the design problem of overheating during gaming and charging at 100% to keep topped up due to too slow charging without a swappable battery. The reasons why I've ended up learning all this, modding a removable feature with a custom charging profile on Tasker.

Last edited:

#### Cirra92

##### Senior Member
@Infy_AsiX Hey man how is your battery mod doing? Is it still in life?

Did you manage to track where is that battery capacity coded, if it is anyway?

#### Infy_AsiX

##### Senior Member
@Infy_AsiX Hey man how is your battery mod doing? Is it still in life?

Did you manage to track where is that battery capacity coded, if it is anyway?
Hehe are you checking if I experienced a lithium-ion battery fire?

I didn't delve further than previously discussed as by workaround the charging and estimation is functioning well enough. To change the charger and battery functions is kernel code and would require some understanding to work.

The Z1C Ringke Rearth Fusion case fits like a glove with the extra mm for the plastic spacers I install too. Looks nice and cool while working well. The Z3C is still my preferred phone size form factor and I need it as a bike computer with smartphone extras. For multimedia and gaming consumption I picked up a ZTE Axon 7 to complement.

Sent from my ZTE Axon 7 using XDA Labs

#### Cirra92

##### Senior Member
Hehe are you checking if I experienced a lithium-ion battery fire?

I didn't delve further than previously discussed as by workaround the charging and estimation is functioning well enough. To change the charger and battery functions is kernel code and would require some understanding to work.

The Z1C Ringke Rearth Fusion case fits like a glove with the extra mm for the plastic spacers I install too. Looks nice and cool while working well. The Z3C is still my preferred phone size form factor and I need it as a bike computer with smartphone extras. For multimedia and gaming consumption I picked up a ZTE Axon 7 to complement.

Sent from my ZTE Axon 7 using XDA Labs

Haha no, I thought maybe you had any kind of issue with it and just gave it a good swing through the window
So the battery level reading did not level out with certain number of cycles, at least to a certain amount? I thought maybe that it would get recorded by system and the kernel would adapt that accordingly, since my best guess is that it's a dynamic reading, rather than pre-set capacity, as you've mentioned yourself.
Anyway, if I go that road, and I'm considering that seriously as of late, I would like to explore the ways to attach the back panel and keeping a stock look. Where did you put those plastic spacers?

Good choice on that Axon 7

#### Infy_AsiX

##### Senior Member
Haha no, I thought maybe you had any kind of issue with it and just gave it a good swing through the window
So the battery level reading did not level out with certain number of cycles, at least to a certain amount? I thought maybe that it would get recorded by system and the kernel would adapt that accordingly, since my best guess is that it's a dynamic reading, rather than pre-set capacity, as you've mentioned yourself.
Anyway, if I go that road, and I'm considering that seriously as of late, I would like to explore the ways to attach the back panel and keeping a stock look. Where did you put those plastic spacers?

Good choice on that Axon 7
It may have adjusted the Full Charge Capacity back to what the Z3C considers a full new stock 2600Mah. The purpose of that is just to recalibrate the fuel gauge percentage outputs for accuracy throughout the range to account for degradation I think. I recall something like a couple bits of code mentioning 2600 in the kernel battery somewhere back when I did some peeking. The kernel defines the battery size and the related BMS functions and calculates on that premise.

Anyway it's stock feature. I moved onto AOSP so can't say how stock would've exactly responded except as I speculate above. AOSP doesn't implement the feature, I can assume without it, earlier shutdowns or rapid unsmooth drops in percentages can occur on degraded batteries. Think of Apple's degraded battery CPU throttling controversy, it's a new issue because of greater peak power demand of modern performance and combine that with how battery voltage can spike low due to this. I've learnt more about this by investigating how Axon 7 users with degraded batteries are experiencing throttling too under a Qualcomm BCL enabled feature. I made a thread about it here: https://forum.xda-developers.com/axon-7/how-to/degraded-battery-bcl-device-lag-t3752545

The plastic spacers are in the last photo in the album. I'm talking about the ones to allow an air gap for lowering heat stress without these a normal Z3C case will fit well. I could probably update a photo, I do use a couple plastic spacers to hold the battery alignment too. The battery itself is obviously thicker than stock so straight installing the back panel won't work well. A case is easiest as no back panel is required, if you prefer the look, you could use a clear back case and just place the back panel before it.

To recap the battery itself functions fully and charges fine. Without kernel fixes the percentage will be 0% when there's the extra energy left. Using an alternative app to provide a custom estimated percentage based on voltage is a way to see remaining power. I made my own Tasker profiles to custom calculate displaying a notification that also considers plug state.

Sent from my ZTE Axon 7 using XDA Labs

Last edited:

#### Cirra92

##### Senior Member
It may have adjusted the Full Charge Capacity back to what the Z3C considers a full new stock 2600Mah. The purpose of that is just to recalibrate the fuel gauge percentage outputs for accuracy throughout the range to account for degradation I think. I recall something like a couple bits of code mentioning 2600 in the kernel battery somewhere back when I did some peeking. The kernel defines the battery size and the related BMS functions and calculates on that premise.

Anyway it's stock feature. I moved onto AOSP so can't say how stock would've exactly responded except as I speculate above. AOSP doesn't implement the feature, I can assume without it, earlier shutdowns or rapid unsmooth drops in percentages can occur on degraded batteries. Think of Apple's degraded battery CPU throttling controversy, it's a new issue because of greater peak power demand of modern performance and combine that with how battery voltage can spike low due to this. I've learnt more about this by investigating how Axon 7 users with degraded batteries are experiencing throttling too under a Qualcomm BCL enabled feature. I made a thread about it here: https://forum.xda-developers.com/axon-7/how-to/degraded-battery-bcl-device-lag-t3752545

The plastic spacers are in the last photo in the album. I'm talking about the ones to allow an air gap for lowering heat stress without these a normal Z3C case will fit well. I could probably update a photo, I do use a couple plastic spacers to hold the battery alignment too. The battery itself is obviously thicker than stock so straight installing the back panel won't work well. A case is easiest as no back panel is required, if you prefer the look, you could use a clear back case and just place the back panel before it.

To recap the battery itself functions fully and charges fine. Without kernel fixes the percentage will be 0% when there's the extra energy left. Using an alternative app to provide a custom estimated percentage based on voltage is a way to see remaining power. I made my own Tasker profiles to custom calculate displaying a notification that also considers plug state.

Sent from my ZTE Axon 7 using XDA Labs

Thanks for the always extensive and in-depth reply
Well that does make sense to have it embedded in kernel code somewhere.

I am on AOSP as well, almost a year already, but I haven't noticed any lags or slowdowns on low battery levels (low voltage levels) even down to 1%, and my battery will be 3 years old in June. Either the system has adapted to degradation or my battery didn't degrade much, which I really doubt since I had a lot of 100% -> 0% cycles and the battery was under high CPU and temperature stress in a lot of occasions.

As for the spacers, yes I forgot the pictures, I've seen them again. Now, I want to try and fit the original back panel, I know the GS8+ battery is 1mm thicker, however right now when I glue my back panel so that it has tight fit on the frame, it is actually "intruding" in the back of the phone, and it's not level with edges of the side frame, it's rather inside. The idea is to use let's say two layers of a double sided tape directly on the frame to compensate for that 1mm, apply the B7000 on top of that and on side walls of the frame as much as possible and place the back panel. I hope you understood since my english might not be up to that level

Since it's my only phone atm I would like to keep it decent looking as much as possible
My normal usage of the phone does not involve heavy tasks at all so temperature is not my concern, that's why I want to use the original back panel to close it down.
And yes I remember you are using Tasker to read the actual voltage level, although it would "hurt" my eyes to look at that non-linear stock battery indicator, I would have to do it as well

#### Falcos

##### New member
Please, could somebody share his voltage/percentage curve for tasker? And which system interface did you use to update the battery percentage? And did somebody of you test how effecient tasker does handle events? It would be not so usefull if it is taking additional 200mA during 10h runtime for event handling and system updates.

Did anybody find out how to change the charging overvoltage cutoff and the shutdown voltage? I would like to stress my battery a little bit more to get every thing out of my 44g for the first 50 to 100 cycles until it gets replaced.
A custom charging cutoff voltage and shutdown trigger voltage would be the best solution for a lightweight outdoor navigation device with 30-50 cycles per year. My device is so highly specialized that I did even remove the cameras and exchange the glass backpannel with a 0.25mm thin carbon pannel.

Kind Regards
Falco

Last edited:

### Top Liked Posts

• There are no posts matching your filters.
• 8
I've been researching about batteries out of interest of replacement, better charging maintaining and longevity. Being unable to find a recently manufactured Z3C battery anywhere, I'm setting up a Galaxy S8+ replacement battery with a removed Z3C battery's printed circuit board solder connected. I can't find a good source on lithium-ion shelf life through Google but it's commonly mentioned to be 2-3 years to being considered depleted. I've got the mod working but haven't finished cleaning it up. The leftover space in the device got me curious on the actual capacity limit. I started calculating the differences and ended up writing it all up for comparison. I can follow up with some photos.

Notes
• Measured by eye using a steel ruler and flat tool on an official warranty replacement 16W13 manufacture dated battery. The capacity feels depleted maybe 80% or so, so it's considered depleted. Being depleted the thickness may have swollen up to 10%. See sources below on these points.
• Dimensions in centimeters
• All numbers rounded to two decimal places
• Nom = Nominal Voltage
• Sony's original battery has an energy density of 2008 maximum technology according to this graph http://2.bp.blogspot.com/-NkSg5gn6ePM/VVPBtPLreJI/AAAAAAAAAoI/-KeFe45ky14/s1600/Pix.png found on the source list below.
• Using a case without the back panel easily affords an extra millimeter.
• For an extra 0.9mm in thickness a Z1C 127 x 64.9 x 9.5 case can be used on a Z3C 127.3 x 64.9 x 8.6.

Original Batteries
Sony Z3C = 9 x 5.1 x 0.4 = 18.36ml = Nom 3.8V 2600mAh 141.61mAh/ml 0.54Wh/L = 2008 density
Samsung S8+, 2017 density = 8.3 x 4.55 x 0.5 = 18.88ml = Nom 3.85V 3500mAh 185.38mAh/ml 0.71Wh/L (or estimated Nom 3.8V 3360mAh 177.96mAh/ml 0.68Wh/L)

Hypothetical higher densitys
Sony Z3C, if matched 2014 maximum density = (estimated using 0.66Wh/L = Nom 3.8V 3189mAh 12.12Wh, 173.69mAh/ml)
Sony Z3C, if Samsung S8+ 2017 density = Nom 3.85V 3387mAh 13.04Wh (or estimated Nom 3.8V 3285mAh 12.48Wh)

Sony Z3C, hypothetical 0.1 thicker
9 x 5.1 x 0.5 = 22.95ml
If Original 2008 density = Nom 3.8V 3250mAh 12.35Wh
If 2014 density = (estimated using 0.66Wh/L = Nom 3.8V 3987mAh 15.15Wh, 173.73mAh/ml)
If 2017 density = Nom 3.85V 4231mAh 16.29Wh (or estimated Nom 3.8V 4106mAh 15.6Wh)

Sources
Good basic sources in general is scarce through basic searching on the topic of lithium-ion batteries. I think it's because the industry is highly competitive with low margins leading to secrecy in interest of intellectual property (got the gist of this from a few different Qnovo blog articles). Also it's got heavily ongoing academic focused research and development but would be funded and therefore guarded by the corporations . Funny though that my main sources are from CEO's of battery related companies. I think it's a case there of smaller companies with an interest and belief in sharing knowledge to create public awareness. Thus here we are on XDA with some relevant useful facts.

At 80% retained capacity a battery is considered depleted. Capacity loss is greatly accelerated after 80% as is the risk of safety measure failure
https://qnovo.com/what-happens-after-80-percent/. The industry leader in support and sales by model volume, Apple's warranty policy follows this guideline https://support.apple.com/en-au/ipho.../battery-power.

https://qnovo.blogspot.com.au/2015/08/72_14.html

This article https://qnovo.com/moores-law-and-snails-law/ has a graph for Energy Density Wh/L by year which I used for estimating what Sony's battery could have been if maximum density was used at the time.

I used Table 4 from http://batteryuniversity.com/learn/article/how_to_prolong_lithium_based_batteries to presume the capacity of 4.35V and 4.4V which I used for estimated results. Based like this:
4.30 110-115%
4.35 115-120%
4.4 120-125%
2
I think it's hard to demonstrate battery performance based on how different smartphone power usage can be. On a fresh ROM even an old battery lasts a long time. I'd estimate my basic usage averages around 650mA/h based on the system current draw when the screen is on and being used generally. That's with debloated stock and various power saving mods like kernel tweaks, low brightness and Greenify. Though on the other hand I do have a lot of mods and Xposed going on. I prefer to leave mobile data, wifi and sync always on so that's no help either. Though also my old stock rom does seem faulty, running out of ZRAM even with it greatly increased.

Anyway at ~650mA/h that's still only 5 hours SOT with 3325mAh. 4 hours SOT using a max limit of 80%, around the same as a new stock 2600mAh battery. 3 hours SOT for a degraded battery with 80% capacity left or a new stock set to 80% max limit. 2.5 hours SOT for a degraded 80% remaining with a set 80% max limit. If feels like those last scenarios describe my old batteries. With a theoretical 4000mAh an extra hour again would certainly be welcome. Technically you can get close to that with a S8 Active battery that's 4000mAh 4.4V, judging by phone dimensions between the S8, S8 Active, S8+ it will be smaller and thicker again.

It kind of shows why I don't like comparing battery performance with between user setups. There's too many variables to power consumption on a smartphone. I don't know how people get 8 hours screen time in screenshots but physics dictates the limit. To get 8 hours SOT with 3325mAh, current draw would have to average 415mA, something I can't reach on my setup. Not to mention performing a full deep discharge cycle harming longevity. However it's definitely possible on a fresh ROM with only a few apps, noting that's how reviewer benchmarks operate (untrue to real usage). It kind of brings back the fact that a removable battery is still the only solution to extending run time beyond an insufficient limited capacity without complicating charging and requiring tethering.

I'll try to get a screenshot that indicates what I've mentioned here as confirmation. You could try watching your system current draw using an app too, I see Ampere and AccuBattery often mentioned, I prefer DevCheck or Cool Tool. Then estimate your own capacity health, potential run times and screenshot for interest and knowledge sharing's sake .

Well yeah I agree on that, it's hard to do it precisely, however I asked because you know your typical usage and maybe could make a rough conclusion on the benefit that this mod gives you, if your current usage does not differ much from the one with original battery. I do not rely much on those app calculations no matter how precise the might be, as I don't rely on reviewer's tests as well, because my usage is specific. I can tell I'm one of those who was reaching 8h of SOT, even 9h on 5.1.1 with specific settings (microG instead of Gapps, global UV, interactive governor tweaks, intelliplug, different LMK values and Amplify, though the last one didn't make much difference) and that battery life was pretty consistent until MM came on board. Now I'm on Carbon 7.1.1 (with same settings) and can average 7h of SOT and always 24-36h of total usage with 2y old battery, which is damn good if you consider that and the fact that I had a lot of full discharge cycles, 100% -> 1%.

Based on your calculations even with your current draw you can get extra 1h of SOT, if I understood right what you wrote, not that SOT is sole indicator of how your battery performs, but it does show a lot in same usage scenario

I have AccuBattery installed from last night, will monitor in upcoming days and share here, just for general info as you said, and to see how much is the % of degradation
1
Really interesting, I was thinking to do something similiar, but with bigger battery and use z3c without glass back with maybe a moded case, photos would be really interesting, probably now gonna buy s8+ battery to tinker with, considering s8+ battery 7mm is shorter would really help in custom wiring to old z3c battery pcb
1
Photos with short descriptions https://imgur.com/a/8Ceha.

There's a lot of stuff to cover. I'll cover the basics. If anyone wants more information, just ask.

I was planning to remove the S8+ PCB and attempt to solder it myself. After Banggood didn't package the soldering iron order twice, I got fed up waiting and decided to quote a cheap phone technician. Given the fee was AUD \$18 I went ahead.

There was some communication issues as the technician didn't speak English, so I had to discuss with the staff. I'd have preferred the S8+ PCB removed and with shorter wires but it has actually has worked out well. Looking at the broken battery I removed the Z3C PCB from, it's difficult removing the PCB from the spot welding while leaving lots of aluminium tab left over. I've read how aluminium is one of the most difficult materials to solder to and having big fresh tabs is easier and safer.

It all fits well and is still removable quick swappable with my other mod. I'll be monitoring its performance. I already use custom charge threshold rates and limits using Tasker rooted for longevity. I already previously monitor battery temperature, usage rates and voltage by overlay so I should be able to notice differences. Plus i've got two working Z3C's to power test :fingers-crossed:

Should probably add that doing any battery modification goes against safety recommendations. You need to know what you're doing for the involved risks. Follow electrostatic discharge safety for installation and use required measures for handling the battery if using it removable.
1
That's certainly some impressive power consumption. Was that on stock before N? I've always been stock ROM until now that I'm migrating transitioning to LOS N across two Z3Cs.

I also started trying AccuBattery a few days ago and found it quite useful in a few ways. How it records charging/discharging sessions with mA and mAh data, provides a way to track energy consumption. It's Process CPU usage overlay helped me realise the live wallpaper I had was using 50% of my CPU generally and that DevCheck's overlay is resource intensive. Though AccuB's CPU usage overlay doesn't work on N properly anymore due to SELinux. I found however capacity health estimates are incorrect on my stock ROM, doing some digging and have come up with a basic understanding.

It gets a little complicated so it's confusing and some more testing or other's checking is needed to confirm some specific things. I only had one phone this week so I tested it on my stock ROM with the S8+ battery. The screenshots confirm AccuB recorded close to the expected capacity of the S8+. Note the device was not used in a way to represent a constant drain, the timing is just to demonstrate separation. The screenshots are scattered in content as I was just grabbing the stats not expecting the below 1% occurrence. To understand just look for what's described above each for explanation.
Showing percentage output "50%" at ~3.8V when it should be 70%, 3:35 (pm ).
https://i.imgur.com/qZwnCDy
At ~3.65V it hit "1%" 4:48pm.
https://i.imgur.com/JQrqwAG
~3.6V below "1%" 6:26pm. Around this voltage holds the most energy, why 0.05V lasted so long from the last screenshot.
https://i.imgur.com/ZQTZU29
~3.45V below "1%" 6:59pm
https://i.imgur.com/8kZaWSm
Last screenshot ~3.25V before cutoff at 3.2V 7:07pm.
https://i.imgur.com/16PysRL

Post session stats screenshots. Note the session started at 99% because I forgot to restore AccuBattery's Titanium data until after booting, meaning some mAh is missing from 100% but as seen AccuB tracked close to the expected capacity of the S8+. In regards to SOT in my last post, there's confirmation my old stock ROM averages 600mA with screen on. Note the screen off mA is high because of playing Google Music on phone speakers the entire cycle. Obviously the %/h is false here due to the missing ~1100mAh below 0%.

AccuB's charging health estimates are constantly incorrect at ~2000mAh. I think this is caused by system battery aging calibration that is set on my old stock ROM. Doesn't matter which whether stock 2014, stock '15 or S8+ '17 battery is used. Dividing a discharge session mAh by percent used gives the same approximate low mAh per percentage. This is why the S8+ battery keeps running at 1% remaining for over another 1000mAh. Doing some searching of the symptom takes me back to the days where third party extended batteries were used, meeting the issue. The main issue is the kernel controls the calibrating capacity percentage fuel gauge chip. For example the Note 4 has a kernel mod fuel gauge chip fix for extended batteries. Another example is the Galaxy S2 could reset it's fuel gauge using root. Here's some old Xperia Arc/Pro fuel chip kernel insight.

I've tried deleting /data/system/batterystats-checkin.bin, batterystats-daily.xml, and batterystats.bin. Removing the battery resets the percentage accordingly but charging and discharging is still incorrect.

Looking at /sys/class/power_supply/bms/batt_aging is "1". With /sys/class/power_supply/bms/device/fcc_new_mah "2313". Or fcc_samples "2380/2156/2268/2268/2366". FCC meaning full charge capacity. This could well be evidence.

I just received a replacement Z3C yesterday to load up LOS N again. I haven't opened it up yet, it's device manufacture tag is 15W04. My nandroid restore has batt_aging "0", fcc_new_mah "0", fcc_samples "0/0/0/0/0/". AccuBattery estimates health near 2600 and dividing mAh by percent usage is approximate. I guess a full cycle is in order to confirm some things. If on AOSP, drivers aren't configured to lower the capacity range, that's less the issue of variability. However the range seems to be hard set to 2600, so the S8+ battery will be running for an extra ~700mAh after 0%.

I found the app CaliBattery is a useful basic way to estimate percentage by voltage. This helps with overcoming stock's aging estimator, though it's notification doesn't update for me on LOS14.1. For example if you received a new official replacement battery but restored a Nandroid backup, you'd have the same battery issues mentioned until enough full cycles are run, recorded and used by the system. On the counter side an old battery on AOSP if it's hard set to 2600 (need test confirmation of this) will turn off before 1%.

One possible workaround is to take voltage readings and calculate percentage using Tasker and write that to system percentage with root. The problem there is efficiency and not updating while screen's off in interest of power. A proper fix requires modifying the relevant fuel gauge configuration in the kernel. I'm not a developer nor have any kernel building experience to do that.
Edit: I stumbled across /sys/module/qpnp_bms/parameters/bms_reset which seems to be a Sony kernel setting allowing to reset the percentage. This with Tasker helps with getting the level correct before and after charging. If something like CaliBattery can show approximate level when draining, things seem ok as a workaround. Still needs further testing, and to try on AOSP (the file does exist at least). To be continued...

That was on stock, the most efficient one was LP, the last 5.1.1, I got constantly 8+ hours of SOT, and even 9+ in half of those charges probably, but as soon as I flashed the first stable official MM build and then went back to LP (in the same month even) the battery life dropped significantly, and the only thing I remember that could have changed was the bootloader, literally nothing else, but I doubt it has anything to do with battery life.
You can see the screenshots here just after flashing the 5.1.1 back then. -> https://forum.xda-developers.com/showpost.php?p=68155846&postcount=16

And also I have observed the battery stats through AccuB, you can check some on attachment shots, and if measurements are valid my screen power draw is 350-400 mA and the battery health is reported to be at ~2400ma or ~92% which is actually more than I expected And as you can see, the standby drain is unusually high, been that way since I flashed the rom, and I'm sure it has to be lower, but will tackle that when O gets more bugs fixed. All of this is on Carbon N rom by Myself5.

I can see that you've done your homework extensively, which is impressive Now, for the battery capacity coding part, I'm not sure if its hard coded as I've used my phone just a month ago until 1% and it didn't die where it should because the battery capacity is lower. Don't know about the way to reset the battery chip (or gauge) since it has been said that its self regulated, unlike the Galaxy S2 as you've mentioned and I owned it as well and done that. It might level out through a number of successive charging cycles, try to load it with clean rom and give it a go, why would they hard code the capacity, that's weird, but that's beyond my knowledge anyway.